diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-10-05 19:49:47 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-10-05 19:49:47 -0700 |
commit | 03d50cc83c7c2bebb2b019667b80c1c51f4a8def (patch) | |
tree | 9c0447e91ac0da2aa0fe983f41c4d95d1787f512 /subx/apps | |
parent | 7163541bf2ced701d00b16b1cf1eac6a7d019a15 (diff) | |
download | mu-03d50cc83c7c2bebb2b019667b80c1c51f4a8def.tar.gz |
4667
Standardize on hyphens in all names. And we'll use colons for namespacing labels in functions.
Diffstat (limited to 'subx/apps')
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 1923 -> 1923 bytes | |||
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 18 | ||||
-rwxr-xr-x | subx/apps/factorial | bin | 1921 -> 1921 bytes | |||
-rw-r--r-- | subx/apps/factorial.subx | 22 |
4 files changed, 20 insertions, 20 deletions
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 82b37e65..ac62c8b2 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 1f64964d..400a0bfe 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -50,38 +50,38 @@ abort: # s : (address array byte) -> <void> # print out "Error: #{s} expected\n" to stderr error: # s : (address array byte) -> <void> - # write_stderr("Error: ") + # write-stderr("Error: ") # push args 68/push "Error: "/imm32 # call - e8/call write_stderr/disp32 + e8/call write-stderr/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # write_stderr(s) + # 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 + e8/call write-stderr/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # write_stderr(" expected") + # write-stderr(" expected") # push args 68/push " expected"/imm32 # call - e8/call write_stderr/disp32 + e8/call write-stderr/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # write_stderr("\n") + # write-stderr("\n") # push args 68/push Newline/imm32 # call - e8/call write_stderr/disp32 + e8/call write-stderr/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # end c3/return -write_stdout: # s : (address array byte) -> <void> +write-stdout: # s : (address array byte) -> <void> # prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP diff --git a/subx/apps/factorial b/subx/apps/factorial index ea130f06..2ca65df6 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differdiff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx index 99cc751e..c3b63209 100644 --- a/subx/apps/factorial.subx +++ b/subx/apps/factorial.subx @@ -24,30 +24,30 @@ 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # if (argc > 1) 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0/disp8 1/imm32 # compare *EBP - 7e/jump-if-lesser-or-equal $run_main/disp8 + 7e/jump-if-lesser-or-equal $run-main/disp8 # and if (argv[1] == "test") # push args 68/push "test"/imm32 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 . # push *(EBP+8) # call - e8/call kernel_string_equal/disp32 + e8/call kernel-string-equal/disp32 # discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check result 3d/compare-EAX 1/imm32 - 75/jump-if-not-equal $run_main/disp8 + 75/jump-if-not-equal $run-main/disp8 # then - e8/call run_tests/disp32 - eb/jump $main_exit/disp8 + e8/call run-tests/disp32 + eb/jump $main-exit/disp8 # else EAX = factorial(5) -$run_main: +$run-main: # push arg 68/push 5/imm32 # call e8/call factorial/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -$main_exit: +$main-exit: # exit(EAX) 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX b8/copy . . . . . . . 1/imm32 # copy to EAX @@ -84,7 +84,7 @@ $factorial:exit: 5d/pop-to-EBP c3/return -test_factorial: +test-factorial: # factorial(5) # push arg 68/push 5/imm32 @@ -92,13 +92,13 @@ test_factorial: e8/call factorial/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # check_ints_equal(EAX, 120, failure message) + # check-ints-equal(EAX, 120, failure message) # push args - 68/push "F - test_factorial"/imm32 + 68/push "F - test-factorial"/imm32 68/push 0x78/imm32/expected-120 50/push-EAX # call - e8/call check_ints_equal/disp32 + e8/call check-ints-equal/disp32 # discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # end |