From ba3ffa27f20b697a8bc1de49a582efdef2182231 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 28 Apr 2025 08:13:55 -0400 Subject: reloc.s: remove redundant code, handle code_run correctly. --- reloc.s | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/reloc.s b/reloc.s index 58f2989..c073f30 100644 --- a/reloc.s +++ b/reloc.s @@ -70,9 +70,7 @@ exitwait: sta COLOR2 rts .else - lda #$40 ; turn the screen red... - sta COLOR2 -freeze: bne freeze ; wait for the user to press Reset. +freeze: bcc freeze ; wait for the user to press Reset. .endif relocate_code: @@ -114,8 +112,6 @@ relocate_code: ; KISS principle. ldy #0 move_loop: - lda (code_ptr),y - pha cpx #8 bne shiftit @@ -131,8 +127,9 @@ tpok: sta shfreg shiftit: + ; get next bit from bitmap byte inx - pla + lda (code_ptr),y asl shfreg bcc dontadj sbc offset_pages @@ -162,15 +159,16 @@ dontadj: adc MEMLO+1 sta MEMLO+1 ; MEMLO now MEMLO + code length + 1 byte - ; is RUNAD in our code space? If not, it points somewhere - ; within DOS, and shouldn't be altered. - lda RUNAD+1 - cmp code_start+1 - bcc do_init + ; do we have a run address? + lda code_run+1 + beq do_init ; no: $00xx not valid. - ; fix up RUNAD - sbc offset_pages ; carry already set by the cmp above + ; point RUNAD at adjusted run address. + sec + sbc offset_pages sta RUNAD+1 + lda code_run + sta RUNAD do_init: ; if there's an init address, call it (just like DOS would). -- cgit v1.2.3