Standardize on sizeof_ hack

This commit is contained in:
Joshua Bell 2017-09-18 17:17:30 -07:00
parent 4227be7825
commit c1ece9ad71
2 changed files with 8 additions and 8 deletions

View File

@ -87,7 +87,7 @@ call_init:
lda LCBANK1
lda LCBANK1
ldx #(routine_end - routine)
ldx #sizeof_routine
: lda routine,x
sta zp_stash,x
dex
@ -125,7 +125,7 @@ skip: lda #0
sta RAMWRTON
rts
.endproc
routine_end := *
sizeof_routine := * - routine
.endproc
;;; ==================================================
@ -901,7 +901,7 @@ exit: lda LCBANK1
;; Copy following routine to ZP and invoke it
zp_stash := $20
ldx #(routine_end - routine)
ldx #sizeof_routine
loop: lda routine,x
sta zp_stash,x
dex
@ -913,7 +913,7 @@ loop: lda routine,x
sta RAMWRTOFF
jmp exit_da
.endproc
routine_end := * ; Can't use .sizeof before the .proc definition
sizeof_routine := * - routine ; Can't use .sizeof before the .proc definition
.endproc
: cmp #A2D_ELEM_TITLE ; Title bar?

View File

@ -40,15 +40,15 @@ call_main_addr := call_main_trampoline+7 ; address patched in her
.scope
sta RAMWRTON
sta RAMRDON
ldx #(call_main_template_end - call_main_template)
loop: lda call_main_template,x
ldx #sizeof_routine
loop: lda routine,x
sta call_main_trampoline,x
dex
bpl loop
jmp call_init
.endscope
.proc call_main_template
.proc routine
sta RAMRDOFF
sta RAMWRTOFF
jsr $1000 ; overwritten (in zp version)
@ -56,7 +56,7 @@ loop: lda call_main_template,x
sta RAMWRTON
rts
.endproc
call_main_template_end: ; can't .sizeof(proc) before declaration
sizeof_routine := * - routine ; can't .sizeof(proc) before declaration
;; https://github.com/cc65/cc65/issues/478
.proc call_init