diff --git a/subx/050_write.subx b/subx/050_write.subx index 5b8b4d4f..1f146a5d 100644 --- a/subx/050_write.subx +++ b/subx/050_write.subx @@ -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) -> diff --git a/subx/052kernel_string_equal.subx b/subx/052kernel_string_equal.subx index 7eb7c7af..02284c20 100644 --- a/subx/052kernel_string_equal.subx +++ b/subx/052kernel_string_equal.subx @@ -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 diff --git a/subx/054string_equal.subx b/subx/054string_equal.subx index 8c531e6b..2ac7cb72 100644 --- a/subx/054string_equal.subx +++ b/subx/054string_equal.subx @@ -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 diff --git a/subx/055trace.subx b/subx/055trace.subx index 5e0dda3b..c19392ad 100644 --- a/subx/055trace.subx +++ b/subx/055trace.subx @@ -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. diff --git a/subx/056write.subx b/subx/056write.subx index 64856f97..be20387b 100644 --- a/subx/056write.subx +++ b/subx/056write.subx @@ -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 diff --git a/subx/057stop.subx b/subx/057stop.subx index 92938d53..3f165920 100644 --- a/subx/057stop.subx +++ b/subx/057stop.subx @@ -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 diff --git a/subx/058read.subx b/subx/058read.subx index 5bf83aa6..16b50f07 100644 --- a/subx/058read.subx +++ b/subx/058read.subx @@ -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 diff --git a/subx/059read-byte.subx b/subx/059read-byte.subx index 2ec73f70..b280a3b1 100644 --- a/subx/059read-byte.subx +++ b/subx/059read-byte.subx @@ -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. diff --git a/subx/060write-stream.subx b/subx/060write-stream.subx index ab669fd9..66e15c7b 100644 --- a/subx/060write-stream.subx +++ b/subx/060write-stream.subx @@ -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) -> diff --git a/subx/061error.subx b/subx/061error.subx index a65c8a73..ef244162 100644 --- a/subx/061error.subx +++ b/subx/061error.subx @@ -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) diff --git a/subx/062write-byte.subx b/subx/062write-byte.subx index e4c71681..b73aba62 100644 --- a/subx/062write-byte.subx +++ b/subx/062write-byte.subx @@ -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'. diff --git a/subx/063print-byte.subx b/subx/063print-byte.subx index 1268e800..b7514e9f 100644 --- a/subx/063print-byte.subx +++ b/subx/063print-byte.subx @@ -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 -> diff --git a/subx/064write-buffered.subx b/subx/064write-buffered.subx index 7889e255..55d703c2 100644 --- a/subx/064write-buffered.subx +++ b/subx/064write-buffered.subx @@ -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) -> diff --git a/subx/065error-byte.subx b/subx/065error-byte.subx index 13a828be..d945e5a5 100644 --- a/subx/065error-byte.subx +++ b/subx/065error-byte.subx @@ -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) diff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx index bd73d72b..adc772db 100644 --- a/subx/apps/factorial.subx +++ b/subx/apps/factorial.subx @@ -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 diff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx index 86d7cb54..9ac6d6cb 100644 --- a/subx/examples/ex10.subx +++ b/subx/examples/ex10.subx @@ -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 diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index a03c08d3..5acd5bf0 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -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 diff --git a/subx/examples/ex2.subx b/subx/examples/ex2.subx index 80833894..34dcdf75 100644 --- a/subx/examples/ex2.subx +++ b/subx/examples/ex2.subx @@ -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 diff --git a/subx/examples/ex3.subx b/subx/examples/ex3.subx index a89ec99c..e12f87a2 100644 --- a/subx/examples/ex3.subx +++ b/subx/examples/ex3.subx @@ -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