BigDumbDinosaur wrote:
Code:
lda #A
cmp #B
bcc A_less_than_B
beq A_same_as_B
bne A_greater_than_B
That’s all there is to it.That’s what I always understood, which is why I’m confused about why it’s not working. But I think that misplaced INX is the problem. Without the error checking, this routine actually works. Or maybe that should be ‘works’.
Haven’t had the opportunity to check it yet, but what I think is happening is that the original routine is ignoring the null terminator and instead triggering when X rolls over. By this time, all kinds of random garbage has been copied into the STR_BUF buffer, with the final char unlikely to be in the range A-Z. Which is why the sanity check barfs.
This would also explain why a later check, on the size of Y (the length of the provided filename) is also failing to work as expected. And maybe another new problem with an entirely unrelated buffer getting corrupted. All from that one mistake (and a lack of bounds checking). I’ll give the fix a whirl later today.
[UPDATE] Yep, moving that INX solved all three problems!
_________________
I like it when things smoke.
Blog –
Zolatron 64 project