summaryrefslogtreecommitdiff
path: root/programs/sub-suite/lexer.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-10-04 18:22:00 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-10-04 18:22:00 -0400
commitca8e2f93acc794b00464c5513956bd84de258913 (patch)
tree83153822fdea777bd11a8254c0e4bd87fe1d8350 /programs/sub-suite/lexer.s
parent784ff59108b887e246b0f33ff696dfd981659ab2 (diff)
- Added support for reading, and writing outside the
emulator's memory. All reads outside of the emulator's memory give back $/0xFF bytes, while all writes outside of the emulator's memory are ignored. - Implemented malloc(), and free() in the SuB Suite. In order to do this, I had to add support for a heap, which I did by reserving the first 3 banks of the address space (the first 192K), and by adding a routine that finds the end of the RAM. In this case, I set the starting address for the routine at bank 3 (bank 4 with one indexing), but, the routine's starting address isn't hardcoded, and thus, any starting address can be passed as an argument. The routine uses the fact that we can now read/write outside the emulator's memory, and also uses the fact that writing outside the emulator's memory will be ignored, and that reading outside the emulator's memory will always read $/0xFF bytes, and uses that to signal that it's reached the end of the RAM. - Added a test program for getting the size of RAM starting at address $/0x20000.
Diffstat (limited to 'programs/sub-suite/lexer.s')
-rw-r--r--programs/sub-suite/lexer.s22
1 files changed, 11 insertions, 11 deletions
diff --git a/programs/sub-suite/lexer.s b/programs/sub-suite/lexer.s
index 50bf21e..fc47f10 100644
--- a/programs/sub-suite/lexer.s
+++ b/programs/sub-suite/lexer.s
@@ -17,16 +17,16 @@ lex:
; pha ; Preserve the character.
; jsr isdigit ; Is this character a digit?
; pla ; Get the character back.
-@getline:
- ldb #1 ; Set the second pointer
- lda.q lline ; to the last line.
- jsr set_ptr ;
- ldy #ln.next ; Set the index to the next line pointer.
- lda.q (ptr2), y ; Get the next line.
- jsr set_ptr ; Set the second pointer to the next line.
- sta.q cline ; Make it the current line.
- and #0 ; Reset A.
- tay ; Reset Y.
+;@getline:
+; ldb #1 ; Set the second pointer
+; lda.q lline ; to the last line.
+; jsr set_ptr ;
+; ldy #ln.next ; Set the index to the next line pointer.
+; lda.q (ptr2), y ; Get the next line.
+; jsr set_ptr ; Set the second pointer to the next line.
+; sta.q cline ; Make it the current line.
+; and #0 ; Reset A.
+; tay ; Reset Y.
@loop:
ldy.w idx0 ; Get the string index.
lda (ptr), y ; Get a character from the line.
@@ -396,7 +396,7 @@ set_lexptr:
set_cmdbuf:
and #0 ; Reset A.
tab ; Reset B.
- lda.d #cmd_buf ; to the command buffer.
+ lda.q cmd_buf ; Set the first pointer to the command buffer.
jsr set_ptr ;
and #0 ; Reset A.
tab ; Reset B.