Austin
New member
We noticed an oversight in the SubtractValue Macro in v. 4.0.11. If you're trying to subtract and having problems, there are two things you need to change.
First, the SubtractValue Macro in the Macros.asm file should change to this:
And secondly, in the ValueCounters.asm file, the valueSubLoop subroutine should look like like this:
First, the SubtractValue Macro in the Macros.asm file should change to this:
Code:
MACRO SubtractValue arg0, arg1, arg2, arg3
TXA
PHA
;arg0 = how many places this value has.
;arg1 = home variable
;arg2 = amount to subtract ... places?
;arg3 = to what place?
LDX arg0
--:
LDA arg1,x ;; the variable that you want to push
STA value,x
dex
BPL --
LDX arg3 ; sets the place to push.
LDA arg2
STA temp
JSR valueSubLoop
;;; now value nees to be unpacked back into the variable.
LDX arg0
-:
LDA value,x ;; the variable that you want to push
STA arg1,x
dex
BPL -
PLA
TAX
ENDM
And secondly, in the ValueCounters.asm file, the valueSubLoop subroutine should look like like this:
Code:
valueSubLoop:
;; temp holds the value to subtract.
lda value,x
sec
sbc temp
cmp #$00
bpl skipCarryDecValue2
clc
adc #$0A
sta value,x
inx
cpx #$08 ;; how many 'places' the value has
bcs underflowThisNumber
lda #$01
STA temp
jmp valueSubLoop
skipCarryDecValue2:
sta value,x
underflowThisNumber:
rts