diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-09-11 19:04:49 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-09-11 19:53:23 -0700 |
commit | ecfbbfb5b58aaba9f9265cb13b9fb4a914bdcf37 (patch) | |
tree | 486cd5f4ee75323b5c733912c7a58501d65b0325 /examples/ex11.subx | |
parent | 4d53de8afa0d44e29d3caeb01ccdd02bc2e4cd70 (diff) | |
download | mu-ecfbbfb5b58aaba9f9265cb13b9fb4a914bdcf37.tar.gz |
5647 - experimental support for swapping OS
Diffstat (limited to 'examples/ex11.subx')
-rw-r--r-- | examples/ex11.subx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/ex11.subx b/examples/ex11.subx index ff0977df..a6a24cfc 100644 --- a/examples/ex11.subx +++ b/examples/ex11.subx @@ -14,17 +14,16 @@ # because checking for it would require the function being tested! Breakage # would cause tests to not run, rather than to fail as we'd like.) -== code 0x09000000 +== code # instruction effective address register displacement immediate # . op subop mod rm32 base index scale r32 # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes Entry: # run all tests 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) + # exit(eax) 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx - b8/copy-to-eax 1/imm32/exit - cd/syscall 0x80/imm8 + e8/call syscall_exit/disp32 # compare a null-terminated ascii string with a more idiomatic length-prefixed byte array # reason for the name: the only place we should have null-terminated ascii strings is from commandline args @@ -327,8 +326,7 @@ write-stderr: # s : (address array byte) -> <void> 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 8/disp8 . # copy *(ebp+8) to edx 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx # . . syscall - b8/copy-to-eax 4/imm32/write - cd/syscall 0x80/imm8 + e8/call syscall_write/disp32 # . restore registers 5b/pop-to-ebx 5a/pop-to-edx @@ -339,7 +337,7 @@ write-stderr: # s : (address array byte) -> <void> 5d/pop-to-ebp c3/return -== data 0x0a000000 +== data Newline: # size |