diff options
-rw-r--r-- | 069allocate.subx | 28 | ||||
-rw-r--r-- | 075array-equal.subx | 26 | ||||
-rwxr-xr-x | apps/assort | bin | 40175 -> 40175 bytes | |||
-rwxr-xr-x | apps/braces | bin | 39569 -> 39569 bytes | |||
-rwxr-xr-x | apps/calls | bin | 44930 -> 44930 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 33919 -> 33919 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 34478 -> 34478 bytes | |||
-rwxr-xr-x | apps/dquotes | bin | 45364 -> 45364 bytes | |||
-rwxr-xr-x | apps/factorial | bin | 32931 -> 32931 bytes | |||
-rwxr-xr-x | apps/handle | bin | 33785 -> 33785 bytes | |||
-rwxr-xr-x | apps/hex | bin | 42573 -> 42573 bytes | |||
-rwxr-xr-x | apps/pack | bin | 52846 -> 52846 bytes | |||
-rwxr-xr-x | apps/sigils | bin | 52868 -> 52868 bytes | |||
-rwxr-xr-x | apps/survey | bin | 49448 -> 49448 bytes | |||
-rwxr-xr-x | apps/tests | bin | 38992 -> 38992 bytes |
15 files changed, 28 insertions, 26 deletions
diff --git a/069allocate.subx b/069allocate.subx index 8845c8c3..f7063d2e 100644 --- a/069allocate.subx +++ b/069allocate.subx @@ -16,11 +16,39 @@ # very same 'allocate' helper. They just need a new allocation descriptor for # their book-keeping. +# A default allocation descriptor for programs to use. +== data +Heap: + # curr + 0/imm32 + # limit + 0/imm32 + == 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 +# Let's start initializing the default allocation descriptor. + +Entry: + # initialize heap + # . Heap = new-segment(64KB) + # . . push args + 68/push Heap/imm32 + 68/push 0x10000/imm32/64KB + # . . call + e8/call new-segment/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + + e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. +$array-equal-main:end: + # syscall(exit, Num-test-failures) + 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx + b8/copy-to-eax 1/imm32/exit + cd/syscall 0x80/imm8 + # Claim the next 'n' bytes of memory starting at ad->curr and update ad->curr. # Abort if there isn't enough memory in 'ad'. allocate: # ad : (address allocation-descriptor), n : int -> address-or-null/eax diff --git a/075array-equal.subx b/075array-equal.subx index 7f5109f9..d6dec878 100644 --- a/075array-equal.subx +++ b/075array-equal.subx @@ -5,24 +5,6 @@ # . 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 -Entry: - # initialize heap - # . Heap = new-segment(64KB) - # . . push args - 68/push Heap/imm32 - 68/push 0x10000/imm32/64KB - # . . call - e8/call new-segment/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - - e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. -$array-equal-main:end: - # syscall(exit, Num-test-failures) - 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx - b8/copy-to-eax 1/imm32/exit - cd/syscall 0x80/imm8 - array-equal?: # a : (address array int), b : (address array int) -> eax : boolean # pseudocode: # lena = a->length @@ -618,12 +600,4 @@ test-check-array-equal: 5d/pop-to-ebp c3/return -== data - -Heap: - # curr - 0/imm32 - # limit - 0/imm32 - # . . vim:nowrap:textwidth=0 diff --git a/apps/assort b/apps/assort index 69d3436b..d04fab27 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/braces b/apps/braces index 67c0f75a..187567e5 100755 --- a/apps/braces +++ b/apps/braces Binary files differdiff --git a/apps/calls b/apps/calls index 2ec41b22..863bd993 100755 --- a/apps/calls +++ b/apps/calls Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index e8992622..fd28bf3a 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index cddb2555..8c96482d 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/dquotes b/apps/dquotes index ede07c89..108a74bb 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/factorial b/apps/factorial index 19f57d7a..0fa9ab2b 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/handle b/apps/handle index 1ac9ea30..1ebf8f81 100755 --- a/apps/handle +++ b/apps/handle Binary files differdiff --git a/apps/hex b/apps/hex index f0828df4..c9241871 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/pack b/apps/pack index 56826bf4..95a306bd 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/sigils b/apps/sigils index 4a4bebf1..f4f1834d 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/survey b/apps/survey index ec7e318f..6097c5df 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/tests b/apps/tests index 36ba05ea..8def31f9 100755 --- a/apps/tests +++ b/apps/tests Binary files differ |