diff options
Diffstat (limited to 'subx/examples/ex9.subx')
-rw-r--r-- | subx/examples/ex9.subx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/subx/examples/ex9.subx b/subx/examples/ex9.subx index 964151a2..ed4e6761 100644 --- a/subx/examples/ex9.subx +++ b/subx/examples/ex9.subx @@ -1,4 +1,5 @@ -## Example showing arg order on the stack. +# Example showing arg order on the stack. +# # Show difference between ascii codes of first letter of first arg and first # letter of second arg. # @@ -23,16 +24,16 @@ # . prolog 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # . . call ascii-difference(argv[1], argv[2]) - # push argv[2] + # ascii-difference(argv[1], argv[2]) + # . . push argv[2] ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # push argv[1] + # . . push argv[1] ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 . # push *(EBP+8) # . . call e8/call ascii-difference/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # exit(EAX) + # syscall(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 |