I get a range error (not within 255) whenever the lowbyte of an address is 0 and causes an underflow. I am sure there is a simple way around this, I can't find it though.
I get a range error (not within 255) whenever the lowbyte of an address is 0 and causes an underflow. I am sure there is a simple way around this, I can't find it though.
I'm guessing the -1 NEEDS to be on both the High and Low address. I have been hunting down a bug for the past few days and I think its because, after reading your advice, I only but it on the low byte side.
I'm guessing the -1 NEEDS to be on both the High and Low address. I have been hunting down a bug for the past few days and I think its because, after reading your advice, I only but it on the low byte side.
Indeed - so say for example, the target address is $8000, then >$8000 is $80 and <$8000 is $00, but by just taking 1 from the low byte you get: >$8000 = $80 and <$7FFF = $FF, so the resulting address is $80FF which isn't what you want, so >$7FFF = $7F and <$7FFF is $FF which is what you want.
So you have an address that lands on a page boundary $xx00 and it crashes. This is a tricky thing to fix as simply adding in debug code can change the target address which may then cause it to work! it's only when address00 is $xx00 that you'll have issues.
Indeed - so say for example, the target address is $8000, then >$8000 is $80 and <$8000 is $00, but by just taking 1 from the low byte you get: >$8000 = $80 and <$7FFF = $FF, so the resulting address is $80FF which isn't what you want, so >$7FFF = $7F and <$7FFF is $FF which is what you want.
So you have an address that lands on a page boundary $xx00 and it crashes. This is a tricky thing to fix as simply adding in debug code can change the target address which may then cause it to work! it's only when address00 is $xx00 that you'll have issues.
-Gordon
Yes I found this out the hard way. My program was hanging at "random" intervals. Took me quite some time to realize it was unrelated to what I was working on at the moment. Thank you for all your help