summaryrefslogtreecommitdiff
path: root/programs/c-ports/annotated-dabbed.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-03-17 15:07:20 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-03-17 15:36:07 -0400
commit071edf621a6722f94027f37720a5a5f73d9696c0 (patch)
tree87761e6dca9e7cf47bf0b6f2d52e8e31623ac01a /programs/c-ports/annotated-dabbed.s
parent917f864a6d1304d9f0c650c107a5fd6576690cb7 (diff)
Revamped the opcode table, made the emulator more
efficient, and ported SuBEditor to C. I revamped the opcode table to add another prefix bit for the addressing mode, finally giving access to all addresses, without wasting any bytes. I made the stack based operations more efficient, by sort of applying Duff's device to it. And I ported SuBEditor to C, to make it easier for me to figure out how to implement SuBAsm.
Diffstat (limited to 'programs/c-ports/annotated-dabbed.s')
-rw-r--r--programs/c-ports/annotated-dabbed.s38
1 files changed, 38 insertions, 0 deletions
diff --git a/programs/c-ports/annotated-dabbed.s b/programs/c-ports/annotated-dabbed.s
new file mode 100644
index 0000000..fca6e81
--- /dev/null
+++ b/programs/c-ports/annotated-dabbed.s
@@ -0,0 +1,38 @@
+dabbed: ; 472: uint8_t dabbed() {
+ ldb #0 ;
+ lda.w #tok ;
+ sta.q ptr2 ;
+ tba ;
+dab_st: ;
+ phy #2 ;
+ txy ; 475: while (!done) {
+ lda (ptr6), y ; 476: if (!cmd_buf[i]) {
+ beq dab_pend ; 477: done = 1;
+ cmp (ptr2), y ; 478: } else if (cmd_buf[i] == tok[i]) {
+ beq chk_str ; 479:
+ jmp dab_pend ; 484: } else {
+ ; 485: done = 1;
+ ; 486: }
+chk_str: ;
+ ply #2 ;
+ inx ; 479: i++;
+ cpx #3 ;
+ bne dab_st ;
+ ldx #0 ; 480: if (i == 3) {
+pnt_msg: ;
+ lda.w #msg ;
+ ldx #0 ;
+ stx.q ptr ;
+ jsl print_str ; 481: print_str(msg);
+ jmp dab_peqnd ; 482: break;
+ ; 483: }
+dab_pend: ;
+ ply #2 ;
+ lda #1 ; 477/485: done = 1;
+ jmp dab_end ;
+dab_peqnd: ;
+ lda #0 ; done = 0;
+ jmp dab_end ;
+dab_end: ; 487: }
+ rtl ; 488: return done;
+ ; 489: }