Closed svallee-dev closed 4 years ago
Turns out there a few more issues with negative numbers (incl most significant byte not getting the $ff for negative numbers). So in case others have this issue and it doesn't get fixed in 6502.net, here is my work around, two functions that I'll now use instead of the < and > operators:
LEAST .function val
.if val < 0
.return 255 & (256 - ((-val) % 256))
.else
.return <val
.endif
.endfunction
MOST .function val
.return val >> 8
.endfunction
Thanks again for the feedback. A very subtle bug in how we're handling the LSB and MSBs, I should have a fix posted soon.
This is a very specific issue I have encountered when using this format:
lda #<NUM
Where NUM can be any number between 0 and 65535. With these positives numbers it works fine. It also seems to work fine with negative numbers... with the exception of numbers between -128 and -255 (inclusive).
For instance, these works:
But these doesn't:
For any numbers between these two, assembly stops on this error:
Mode not supporter for "lda" in selected CPU.