PARAM_BLOCK macro: Save/Restore org manually

The `.feature org_per_seg` approach worked, but listing files had
incorrect addresses following the end of the segment. Manually
stash and restore the org at the end of the block.

Also, add in a dec16.
This commit is contained in:
Joshua Bell 2018-04-21 22:41:02 -07:00
parent 8e5504f6bc
commit a285a7413b

View File

@ -441,6 +441,15 @@
skip:
.endmacro
;;; Decrement 16-bit value
.macro dec16 arg
.local skip
lda arg
bne skip
dec arg+1
skip: dec arg
.endmacro
;;; Helper macros to set up a scoped block of parameters at a pre-determined
;;; address.
;;;
@ -462,15 +471,16 @@ skip:
.macro PARAM_BLOCK name, addr
name := addr
.scope name
saved_org := *
.pushseg
.bss
.feature org_per_seg
.org addr
start:
start := *
.endmacro
.macro END_PARAM_BLOCK
size := * - start
.popseg
.org saved_org
.endscope
.endmacro