I just began learning 6510 programming, and I'm still having problems using the "zeropage indirect indexed adressing" (or however it's called) correctly. I have a very simple program which just prints a string to the screen. The problem is reading the data from the string. When I use it with absolute indexed addressing like
lda line,x
(where "line" is the address-marker of the text data) it works. When I try the same with the above mentioned variation, I get garbagge. Here are the two code examples, complete (for Kick Assembler):
Works (absolute indexed addressing)
:BasicUpstart2(start) start: sei jsr $E544 jsr print_text rts print_text: ldx #$00 loop_text: lda line,x // works sta $0590,x lda #WHITE sta $d990,x inx cpx #17 // process 17 columns bne loop_text rts line: .text "this is some text"Fails (zeropage indirect indexed addressing)
:BasicUpstart2(start) start: sei jsr $E544 jsr print_text rts print_text: ldx #$00 lda #<line // lo-byte in $FB sta $fb lda #>line // hi-byte in $FC sta $fc loop_text: lda ($fb),x // does not work sta $0590,x lda #WHITE sta $d990,x inx cpx #17 // process 17 columns bne loop_text rts line: .text "this is some text"Thanks in advance for any help.