diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-02 20:43:39 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-02 22:41:28 -0800 |
commit | 0eb0f69616bb928359aed5ec137c973b14b03788 (patch) | |
tree | 30590486138c2611e9cf33e64f0c1952f528e0e6 /subx | |
parent | ef31035a9f41ec38bb4e11a18770c3cf2d8eba09 (diff) | |
download | mu-0eb0f69616bb928359aed5ec137c973b14b03788.tar.gz |
4821
Diffstat (limited to 'subx')
-rw-r--r-- | subx/061error.subx | 47 | ||||
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 6462 -> 6462 bytes | |||
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 41 | ||||
-rwxr-xr-x | subx/apps/crenshaw2-1b | bin | 7023 -> 7023 bytes | |||
-rw-r--r-- | subx/apps/crenshaw2-1b.subx | 41 | ||||
-rwxr-xr-x | subx/apps/factorial | bin | 5262 -> 5353 bytes |
6 files changed, 47 insertions, 82 deletions
diff --git a/subx/061error.subx b/subx/061error.subx new file mode 100644 index 00000000..b03cfde2 --- /dev/null +++ b/subx/061error.subx @@ -0,0 +1,47 @@ +# Print an error message and exit. + +== 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 + +# write(out, "Error: "+msg+"\n") then stop(ed, 1) +error: # ed : (address exit-descriptor), out : fd or (address stream), msg : (address array byte) -> <void> + # . prolog + 55/push-EBP + 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + # write(out, "Error: ") + # . . push args + 68/push "Error: "/imm32 + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # write(out, msg) + # . . push args + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # write(out, Newline) + # . . push args + 68/push Newline/imm32 + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # stop(ed, 1) + # . . push args + 68/push 1/imm32 + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) + # . . call + e8/call stop/disp32 + # should never get past this point + # . epilog + 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 5d/pop-to-EBP + c3/return diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 962c6d53..a02751f0 100755 --- a/subx/apps/crenshaw2-1 +++ b/subx/apps/crenshaw2-1 Binary files differdiff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index a246a594..ccad452d 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -526,47 +526,6 @@ expected: # ed : (address exit-descriptor), f : fd or (address stream), s : (ad 5d/pop-to-EBP c3/return -# write(f, "Error: "+s+"\n") then stop(ed, 1) -error: # ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void> - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # write(f, "Error: ") - # . . push args - 68/push "Error: "/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, s) - # . . push args - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, Newline) - # . . push args - 68/push Newline/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # stop(ed, 1) - # . . push args - 68/push 1/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call stop/disp32 - # should never get past this point - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - # read a byte from 'f', and save it in 'Look' get-char: # f : (address buffered-file) -> <void> # . prolog diff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b index 7faa0d83..2c7d0d0d 100755 --- a/subx/apps/crenshaw2-1b +++ b/subx/apps/crenshaw2-1b Binary files differdiff --git a/subx/apps/crenshaw2-1b.subx b/subx/apps/crenshaw2-1b.subx index 08786b90..0c17e3f9 100644 --- a/subx/apps/crenshaw2-1b.subx +++ b/subx/apps/crenshaw2-1b.subx @@ -725,47 +725,6 @@ expected: # ed : (address exit-descriptor), f : fd or (address stream), s : (ad 5d/pop-to-EBP c3/return -# write(f, "Error: "+s+"\n") then stop(ed, 1) -error: # ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void> - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # write(f, "Error: ") - # . . push args - 68/push "Error: "/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, s) - # . . push args - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, Newline) - # . . push args - 68/push Newline/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # stop(ed, 1) - # . . push args - 68/push 1/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call stop/disp32 - # should never get past this point - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - # read a byte from 'f', and save it in 'Look' get-char: # f : (address buffered-file) -> <void> # . prolog diff --git a/subx/apps/factorial b/subx/apps/factorial index d767ff59..5fb3daf7 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differ |