diff options
Diffstat (limited to 'subx/apps/crenshaw2-1.subx')
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index c0bdc768..dec4023a 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -25,10 +25,10 @@ # call e8/call abort/disp32 # discard arg - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # exit(0) - bb/copy . . . . . . . 0/imm32 # copy 0 to EBX - b8/copy . . . . . . . 1/imm32/exit # copy 1 to EAX + bb/copy . . . . . . . 0/imm32 # copy to EBX + b8/copy . . . . . . . 1/imm32/exit # copy to EAX cd/syscall 0x80/imm8 ## helpers @@ -42,10 +42,10 @@ abort: # s : (address array byte) -> <void> # call e8/call error/disp32 # discard arg - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # exit(1) - bb/copy . . . . . . . 1/imm32 # copy 1 to EBX - b8/copy . . . . . . . 1/imm32/exit # copy 1 to EAX + bb/copy . . . . . . . 1/imm32 # copy to EBX + b8/copy . . . . . . . 1/imm32/exit # copy to EAX cd/syscall 0x80/imm8 # print out "Error: #{s} expected\n" to stderr @@ -56,28 +56,28 @@ error: # s : (address array byte) -> <void> # call e8/call write_stderr/disp32 # discard arg - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write_stderr(s) # push args ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . . 4/disp8 . # push *(ESP+4) # call e8/call write_stderr/disp32 # discard arg - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write_stderr(" expected") # push args 68/push " expected"/imm32 # call e8/call write_stderr/disp32 # discard arg - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write_stderr("\n") # push args 68/push Newline/imm32 # call e8/call write_stderr/disp32 # discard arg - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # end c3/return @@ -92,15 +92,15 @@ write_stdout: # s : (address array byte) -> <void> 53/push-EBX # write(1/stdout, (data) s+4, (size) *s) # fd = 1 (stdout) - bb/copy . . . . . . . 1/imm32 # copy 1 to EBX + bb/copy . . . . . . . 1/imm32 # copy to EBX # x = s+4 8b/copy 1/mod/*+disp8 4/rm32/SIB 5/base/EBP 4/index/none . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX - 81 0/subop/add 3/mod/direct 1/rm32/ECX . . . . . 4/imm32 # add 4 to ECX + 81 0/subop/add 3/mod/direct 1/rm32/ECX . . . . . 4/imm32 # add to ECX # size = *s 8b/copy 1/mod/*+disp8 4/rm32/SIB 5/base/EBP 4/index/none . 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 # call write() - b8/copy . . . . . . . 4/imm32/write # copy 1 to EAX + b8/copy . . . . . . . 4/imm32/write # copy to EAX cd/syscall 0x80/imm8 # restore registers 5b/pop-to-EBX |