diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-21 16:55:46 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-21 16:56:37 -0700 |
commit | 9372c16c00f032fe72e921723c2dc9ab88486ff6 (patch) | |
tree | 74f1f3074675e90a2f53f2799c55bd5a9d9618af /subx/apps | |
parent | 9ce8fd1cc1770d7e41d214421237ecea7b1efb4e (diff) | |
download | mu-9372c16c00f032fe72e921723c2dc9ab88486ff6.tar.gz |
4581
Even more cuddling. We want to keep lines short where the opcode and operands are self-explanatory. If there are any implicit registers, etc., we'll continue to do the table layout. The first two columns look messy now; let's see how this goes. Maybe I'll give up on the tabular layout altogether, just string args with a single space.
Diffstat (limited to 'subx/apps')
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 16 | ||||
-rw-r--r-- | subx/apps/factorial.subx | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index 97ef55ec..48a6c16e 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -21,7 +21,7 @@ # main: # abort(Error_integer) # push args - 68/push . . . . . . . Error_integer/imm32 + 68/push Error_integer/imm32 # call e8/call abort/disp32 # discard arg @@ -29,7 +29,7 @@ # exit(0) bb/copy . . . . . . . 0/imm32 # copy 0 to EBX b8/copy . . . . . . . 1/imm32/exit # copy 1 to EAX - cd/syscall . . . . . . . 0x80/imm8 # int 80h + cd/syscall 0x80/imm8 # print error message and exit # really maps to the 'Expected' function in Crenshaw @@ -44,13 +44,13 @@ abort: # s : (address array byte) -> <void> # exit(1) bb/copy . . . . . . . 1/imm32 # copy 1 to EBX b8/copy . . . . . . . 1/imm32/exit # copy 1 to EAX - cd/syscall . . . . . . . 0x80/imm8 # int 80h + cd/syscall 0x80/imm8 # print out "Error: #{s} expected\n" to stderr error: # s : (address array byte) -> <void> # write_stderr("Error: ") # push args - 68/push . . . . . . . Error/imm32 + 68/push Error/imm32 # call e8/call write_stderr/disp32 # discard arg @@ -64,14 +64,14 @@ error: # s : (address array byte) -> <void> 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP # write_stderr(" expected") # push args - 68/push . . . . . . . Expected_suffix/imm32 + 68/push Expected_suffix/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 # write_stderr("\n") # push args - 68/push . . . . . . . Newline/imm32 + 68/push Newline/imm32 # call e8/call write_stderr/disp32 # discard arg @@ -91,7 +91,7 @@ write_stderr: # s : (address array byte) -> <void> 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 - cd/syscall . . . . . . . 0x80/imm8 # int 80h + cd/syscall 0x80/imm8 # end c3/return @@ -107,7 +107,7 @@ write_stdout: # s : (address array byte) -> <void> 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 - cd/syscall . . . . . . . 0x80/imm8 # int 80h + cd/syscall 0x80/imm8 # end c3/return diff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx index d71ea455..f1cce6a4 100644 --- a/subx/apps/factorial.subx +++ b/subx/apps/factorial.subx @@ -29,7 +29,7 @@ # exit(EAX) 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX b8/copy . . . . . . . 1/imm32 # copy 1 to EAX - cd/syscall . . . . . . . 0x80/imm8 # int 80h + cd/syscall 0x80/imm8 # factorial(n) factorial: @@ -106,7 +106,7 @@ write_stderr: # s : (address array byte) -> <void> 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 - cd/syscall . . . . . . . 0x80/imm8 # int 80h + cd/syscall 0x80/imm8 # end c3/return |