diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-21 16:39:22 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-21 16:39:46 -0700 |
commit | 9ce8fd1cc1770d7e41d214421237ecea7b1efb4e (patch) | |
tree | 42a1f0dbe0e02587538154774f9324e3fee957c1 | |
parent | ddeed58f8524849315286de8ff825c43e5b82f9d (diff) | |
download | mu-9ce8fd1cc1770d7e41d214421237ecea7b1efb4e.tar.gz |
4580
Since we're cuddling jump/call args next to the opcode, we can have longer labels without messing up the layout!
-rw-r--r-- | subx/examples/ex8.subx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/subx/examples/ex8.subx b/subx/examples/ex8.subx index 688d7f1f..de0fa188 100644 --- a/subx/examples/ex8.subx +++ b/subx/examples/ex8.subx @@ -44,18 +44,18 @@ ascii_length: # (s) 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 2/r32/EDX 4/disp8 # copy *(ESP+4) to EDX # var result = 0 (EAX) b8/copy . . . . . . . 0/imm32 # copy 0 to EAX -$al_loop: +$ascii_length_loop: # var c = *s (ECX) 8a/copy 0/mod/* 2/rm32/EDX . . . 1/r32/ECX . . # copy byte at *EDX to lower byte of ECX # if c == '\0' break 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0/imm32 # compare ECX with 0 - 74/jump-if-equal $al_ret/disp8 + 74/jump-if-equal $ascii_length_ret/disp8 # ++s 81 0/subop/add 3/mod/direct 2/rm32/EDX . . . . . 1/imm32 # add 1 to EDX # ++result 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 1/imm32 # add 1 to EAX # loop - eb/jump $al_loop/disp8 -$al_ret: + eb/jump $ascii_length_loop/disp8 +$ascii_length_ret: # return (result in EAX) c3/return |