diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2020-10-05 08:47:08 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2020-10-05 08:47:08 -0400 |
commit | 96ae48f8a79f33cff0a89fac211b6862866e1a44 (patch) | |
tree | 885ba3a75da7b3f711cabce8c7590e8430104075 | |
parent | ca8e2f93acc794b00464c5513956bd84de258913 (diff) |
- Added a routine for testing the SuB Suite's
implementation of free(), although it's commented
out.
- Removed the sbc() function from the emulator, since
sbc can be done by just inverting the second operand
of adc.
-rw-r--r-- | programs/sub-suite/subeditor.s | 26 | ||||
-rw-r--r-- | sux.c | 2 | ||||
-rw-r--r-- | sux.h | 8 |
3 files changed, 27 insertions, 9 deletions
diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index 7e124a2..d98d068 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -12,6 +12,7 @@ reset: tyx ; Reset X. jsr init_heap ; Initialize the heap. jsr init_tables ; Initialize the main tables. +; jsr test_free ; jsr clr_scr ; Clear the screen. jsr pnt_strt ; Print the starting message. bra start ; Goto the start of the main program. @@ -48,6 +49,30 @@ init_tables: rts ; End of init_tables. +;test_free: +; inc step ; +; lda.q bitabl ; +; jsr free ; +; lda.q buffer ; +; jsr free ; +; and #0 ; Reset A. +; lda.w #LWSIZE ; Allocate LWSIZE bytes of RAM for the linewrap table. +; jsr malloc ; +; sta.q bitabl ; +; lda.q cmd_buf ; +; jsr free ; +; and #0 ; Reset A. +; lda.w #SCRSIZE ; Allocate SCRSIZE bytes of RAM for the screen buffer. +; jsr malloc ; +; sta.q buffer ; +; and #0 ; Reset A. +; lda.w #CMDSIZE ; Allocate CMDSIZE bytes of RAM for the command buffer. +; jsr malloc ; +; sta.q cmd_buf ; +; and #0 ; Reset A. +; rts ; End of test_free. + + clr_arr: phb ; Preserve whatever was in B. ldb #0 ; Clear B. @@ -78,6 +103,7 @@ clr_arr: plb ; Get whatever was in the B register, back. rts ; End of clr_arr. + pnt_strt: lda.w #ed_name ; Print the name of the editor. jsr print_str ; @@ -286,7 +286,7 @@ void *run(void *args) { case SBC_IMM: /* SBC Immediate. */ case SBC_AB: /* SBC Absolute. */ case SBC_Z: /* SBC Zero Matrix. */ - cpu->a = sbc(cpu, cpu->a, value.u64, thread); + cpu->a = adc(cpu, cpu->a, ~value.u64, thread); break; case PLP_IMP: cpu->ps.u8[thread] = pull(cpu, 0, thread); break; /* PuLl Processor status from stack. */ case PLA_IMP: cpu->a = pull(cpu, size, thread); break; /* PuLl Accumulator from stack. */ @@ -277,14 +277,6 @@ static inline uint64_t adc(struct sux *cpu, uint64_t reg, uint64_t value, uint8_ setflag((sum < value), C); return sum; } -static inline uint64_t sbc(struct sux *cpu, uint64_t reg, uint64_t value, uint8_t thread) { - uint64_t sum = reg-value-!getflag(C); - setflag(sum == 0, Z); - setflag(sum >> 63, N); - setflag(((reg^value) >> 63) && ((reg^sum) >> 63), V); - setflag((sum < value), C); - return sum; -} static inline uint64_t transfer(struct sux *cpu, uint64_t src, uint64_t value, uint8_t opcode, uint8_t prefix, uint8_t thread) { switch (opcode) { |