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

View File

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