6502 Looping using CMP BNE via TXA & TAX

350 views Asked by At

Just learning the whole process of storing data, I am a complete newbie to low-level programming so please be gentle. But why is this simple code not working, so far it is only populating the 00 byte at $1000 address with my simple preset test digit of #08, I thought by looping like this I would see the first 8 bytes containing 08 each in the debugger at the $1000 address, but noooo. I thought using TXA (transfer x to the accumulator) and TAX (transfer accumulator to X) would do it as CMP and BNE only work off of the accumulator, but noooooo. Very frustrating. Any help will be met with massive gratitude and smiles...

        ldx #00
loader  lda #$08
        sta $1000,x
        inx
        txa
        cmp #08
        bne exit
        tax
        jmp loader

exit    jsr*
1

There are 1 answers

1
Smokeyparkin On

Solved! I simply had to change BNE to BEQ!