summaryrefslogtreecommitdiff
path: root/programs/sub-suite/subasm.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-02-25 12:43:11 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2021-02-25 12:43:11 -0500
commit35a18609864470b3dc49f3a9a6cb6ec93e57300d (patch)
treec52364211b25723b2cf4595ed6c4bc2d45195062 /programs/sub-suite/subasm.s
parent8d7f27d9a0b61d3694a62f3e54be885d8073f02b (diff)
- Implemented the multiply expression into the assembler.
- Implemented support for the SIB addressing mode into the assembler. SIB is short for "Scale Index, and Base", and works much like x86's version of SIB (scale*index+base), although my version supports any scale value between 1, and 256. - Redid the line shifting routine in SuBEditor. It now uses memcpy, and memset to do that, and also supports shifting the line left, or right by any number of characters.
Diffstat (limited to 'programs/sub-suite/subasm.s')
-rw-r--r--programs/sub-suite/subasm.s12
1 files changed, 8 insertions, 4 deletions
diff --git a/programs/sub-suite/subasm.s b/programs/sub-suite/subasm.s
index f22ee60..56d13c2 100644
--- a/programs/sub-suite/subasm.s
+++ b/programs/sub-suite/subasm.s
@@ -118,7 +118,6 @@
subasm:
pha.q ; Preserve A.
- phe.q ; Preserve E.
des ; Make room for the command id.
and #0 ; Reset A.
lea d, (cmd_buf) ; Get the command buffer.
@@ -128,23 +127,28 @@ subasm:
jsr chk_cmd ; No, but did we get a full command?
bne @cmd ; Yes, so skip everything else.
mov.q ptr, d ;
+ psh d ; Preserve D.
+ psh s ; Preserve S.
+ psh f ; Preserve F.
jsr lex ; No, so start lexing this line.
+ pul d ; Restore D.
+ pul s ; Restore S.
+ pul f ; Restore F.
bra @end ; We are done.
@cmd:
mov s, (s) ; Get the command ID.
cmp s, #7 ; Is the command ID greater than the command count?
bcs @end ; Yes, so we're done.
lsl s, #1 ; No, so multiply the command ID by two.
- lea.w e, (cmd_srt+s) ; Get the pointer, from the command subroutine table.
+ lea.w s, (cmd_srt+s) ; Get the pointer, from the command subroutine table.
and #0 ; Reset A.
tab ; Reset B.
- jsr (e) ; Run the command's subroutine.
+ jsr s ; Run the command's subroutine.
@end:
and #0 ; Reset A.
jsr update_ptr ; Get the screen buffer index.
tay ; Save it in Y.
ins ; Cleanup the stack frame.
- ple.q ; Restore E.
pla.q ; Restore A.
rts ; End of subasm.