From c1ece9ad718a23e0ca5283aa78afc1e10b1f60c9 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 18 Sep 2017 17:17:30 -0700 Subject: [PATCH] Standardize on sizeof_ hack --- desk.acc/calculator.s | 8 ++++---- desk.acc/show_image_file.s | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/desk.acc/calculator.s b/desk.acc/calculator.s index 8a745fc..28769bf 100644 --- a/desk.acc/calculator.s +++ b/desk.acc/calculator.s @@ -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? diff --git a/desk.acc/show_image_file.s b/desk.acc/show_image_file.s index 9ba0bf5..f95bcec 100644 --- a/desk.acc/show_image_file.s +++ b/desk.acc/show_image_file.s @@ -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