summaryrefslogtreecommitdiff
path: root/programs/subeditor.s
diff options
context:
space:
mode:
Diffstat (limited to 'programs/subeditor.s')
-rw-r--r--programs/subeditor.s24
1 files changed, 20 insertions, 4 deletions
diff --git a/programs/subeditor.s b/programs/subeditor.s
index d16915d..bdd3a11 100644
--- a/programs/subeditor.s
+++ b/programs/subeditor.s
@@ -13,6 +13,9 @@ step = $C010 ; Enables clock stepping, when set.
maxrow = 23 ; Screen's row count.
maxcol = 79 ; Screen's column count.
+; Include SuBAsm.
+.include "subasm-2.s"
+
.org $A000
; String Literals/Constants.
tok:
@@ -35,6 +38,8 @@ bits:
.byte $02
.byte $01
+; This label is for any included files.
+incl:
; Linewrap table.
.org $1000
@@ -127,6 +132,7 @@ reset:
lda.w #buffer ; Set the array to be cleared to the screen buffer.
jsl clr_arr ; Clear the screen buffer.
jmp start ; Goto the start of the main program.
+
clr_arr:
phb #1 ; Preserve whatever was in B.
ldb #0 ; Clear B.
@@ -371,7 +377,9 @@ cmd_cpy_lp1:
sta (ptr2), y ; Copy one byte from the screen buffer, to the command buffer.
inx ; Increment the command buffer index.
ply #2 ; Get back the screen index.
- iny ; Increment the screen index.
+ cpx.w #$3FF ; Are we at the end of the command buffer?
+ bcs cmd_cpy_nd0 ; Yes, so we're done.
+ iny ; No, so increment the screen index.
inb ; Increment the byte count.
lsr #8 ; Shift in the next byte.
stb g ; Save the byte count.
@@ -383,13 +391,17 @@ cmd_cpy_lp1:
cpb #7 ; Did we shift in eight bytes?
beq cmd_cpy_lp ; Yes, so get eight more bytes.
jmp cmd_cpy_lp1 ; No, so keep shifting in more bytes.
+cmd_cpy_nd0:
+ ldb #0 ; Reset B.
+ phy #2 ; Save the screen index.
+ txy ; Get the command buffer index.
+ stb (ptr2), y ; Terminate the command buffer.
+ ply #2 ; Get back the screen index.
cmd_cpy_nd:
tab ; The B register is zero, so clear the Accumulator.
rtl ; End of cmd_cpy.
-
-
findst:
lda #0 ;
findst_lp:
@@ -406,6 +418,7 @@ findst_done:
cmp #0 ;
rtl ;
+
fndend:
phb #1 ; Save the contents of the B register.
ldb #0 ; Make sure that set_ptr sets the first pointer.
@@ -1194,7 +1207,7 @@ print_buf:
jsl print_str ;
lsr #$10 ; Clear the Accumulator.
cmd_clr:
- lda #10 ;
+ lda #'\n' ;
jsl print_char ;
jmp start ;
@@ -1243,6 +1256,9 @@ set_ptr3:
setptr_end:
rtl ; End of set_ptr.
+; Entry point for SuBAsm.
+parser:
+
.org $FFC0
.qword reset
a