This commit is contained in:
Kartik Agaram 2018-12-28 08:56:21 -08:00
parent e0610e396f
commit 5a9795bb66
19 changed files with 20 additions and 20 deletions

View File

@ -8,7 +8,7 @@
# main:
# syscall(exit, 0) -- can't test _write just yet
bb/copy-to-EBX 0/imm32
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
_write: # fd : int, s : (address array byte) -> <void>

View File

@ -23,7 +23,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# compare a null-terminated ascii string with a more idiomatic length-prefixed byte array

View File

@ -10,7 +10,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
string-equal: # s : string, benchmark : string -> EAX : boolean

View File

@ -47,7 +47,7 @@ _test-trace-stream:
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# Allocate a new segment for the trace stream, initialize its length, and save its address to Trace-stream.

View File

@ -24,7 +24,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# TODO: come up with a way to signal when a write to disk fails

View File

@ -42,7 +42,7 @@
#? e8/call test-stop-skips-returns-on-exit/disp32
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# Configure an exit-descriptor for a call pushing 'nbytes' bytes of args to
@ -105,7 +105,7 @@ stop: # ed : (address exit-descriptor), value : int
75/jump-if-not-equal $stop:fake/disp8
# syscall(exit, value)
8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 3/r32/EBX 8/disp8 . # copy *(ESP+8) to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
$stop:fake:
# ed->value = value+1

View File

@ -49,7 +49,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
read: # f : fd or (address stream), s : (address stream) -> num-bytes-read/EAX

View File

@ -37,7 +37,7 @@ Stdin:
#? e8/call test-read-byte-refills-buffer/disp32
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# return next byte value in EAX, with top 3 bytes cleared.

View File

@ -16,7 +16,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
write-stream: # f : fd or (address stream), s : (address stream) -> <void>

View File

@ -9,7 +9,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# write(out, "Error: "+msg+"\n") then stop(ed, 1)

View File

@ -31,7 +31,7 @@ Stdout:
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# Write lower byte of 'n' to 'f'.

View File

@ -9,7 +9,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
print-byte: # f : (address buffered-file), n : num -> <void>

View File

@ -11,7 +11,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
write-buffered: # f : (address buffered-file), msg : (address array byte) -> <void>

View File

@ -23,7 +23,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# . syscall(exit, Num-test-failures)
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# write(out, "Error: "+msg+": "+byte) then stop(ed, 1)

View File

@ -52,7 +52,7 @@ $run-main:
$main:end:
# syscall(exit, EAX)
89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
factorial: # n : int -> int/EAX

View File

@ -29,7 +29,7 @@
e8/call argv-equal/disp32
# syscall(exit, EAX)
89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# compare two null-terminated ascii strings

View File

@ -23,7 +23,7 @@
e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
# syscall(exit, EAX)
89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# compare a null-terminated ascii string with a more idiomatic length-prefixed byte array

View File

@ -14,7 +14,7 @@ bb/copy-to-EBX 1/imm32
# increment EBX
43/inc-EBX
# syscall(exit, EBX)
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# . . vim:nowrap:textwidth=0

View File

@ -30,7 +30,7 @@ $loop:
$exit:
# syscall(exit, EBX)
b8/copy-to-EAX 1/imm32
b8/copy-to-EAX 1/imm32/exit
cd/syscall 0x80/imm8
# . . vim:nowrap:textwidth=0