- Debugging...
- 09 Jan 2010 03:15:52 pm
- Last edited by lindenk on 10 Jan 2010 10:54:09 am; edited 2 times in total
I'm sorry for asking for more help but I have a bug in my program that I just can't figure out. So far I've narrowed it down and relized that for some reason Brass is compiling these two differently -
Code:
Code:
The first one seems to work how it should(mostly) but the second calls damagecalculator with a garbage number in de (which I've found out is always $D990) then crashes. Damagecalculator doesn't use the stack at all and attackreceiver only uses it in a small section which I've looked over a few times. Does anyone know what happened?
Code:
bcall(_targetselect)
push hl
strbox(straxecleave1,41)
strbox(straxecleave2,47)
strbox(straxecleave3,53)
strbox(straxecleave4,59)
waitclr()
ld a,(ix+4)
add a,5
ld (ix+4),a
resdata(attackdata+2,7)
ld hl,49152
ld (attackdata+3),hl
ld a,45
bcall(_random2)
add a,75
ld e,a \ ld d,0
bcall(_damagecalculator)
pop ix
bcall(_attackreciever)
Code:
.deflong DamageFull(accu,inter,base)
ld hl,((accu-((accu/256)*256))*256)+(accu/256)
ld (attackdata+3),hl
ld a,inter
bcall(_random2)
add a,base
ld e,a \ ld d,0
bcall(_damagecalculator)
pop ix
bcall(_attackreciever)
.enddeflong
bcall(_targetselect)
push hl
strbox(straxecleave1,41)
strbox(straxecleave2,47)
strbox(straxecleave3,53)
strbox(straxecleave4,59)
waitclr()
ld a,(ix+4)
add a,5
ld (ix+4),a
resdata(attackdata+2,7)
damagefull(192,45,75)
The first one seems to work how it should(mostly) but the second calls damagecalculator with a garbage number in de (which I've found out is always $D990) then crashes. Damagecalculator doesn't use the stack at all and attackreceiver only uses it in a small section which I've looked over a few times. Does anyone know what happened?