From 5db9af7b0d1d027b9325b45917ab46beaa52d5a0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sat, 8 May 2021 12:48:50 -0400 Subject: Rewrite `clr_arr` to use the ortho extension. This makes the code much smaller than the previous version. --- programs/sub-suite/subeditor.s | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s index 1053790..aa9482a 100644 --- a/programs/sub-suite/subeditor.s +++ b/programs/sub-suite/subeditor.s @@ -68,19 +68,16 @@ init_tables: clr_arr: - pha.q ; Preserve A. - and #0 ; Reset A. + pha.q ; Preserve A. + and #0 ; Reset A. @loop: - mov.q (d), a ; Clear 16 bytes. - mov.q (d+8), a ; - add d, #$10 ; Increment the pointer by 16. - sub s, #$10 ; Subtract 16 from the size. - bcc @end ; We've reached the end of the array, so we're done. - beq @end ; - bra @loop ; Keep looping. + mov.q (d+s), a ; Clear 16 bytes. + mov.q (d+s+8), a ; + sub s, #16 ; Subtract 16 from the size. + bcs @loop ; We haven't reached the end, so keep looping. @end: - pla.q ; Restore A. - rts ; End of clr_arr. + pla.q ; Restore A. + rts ; End of clr_arr. pnt_strt: -- cgit v1.2.3-13-gbd6f