rje 163 Posted November 9, 2020 (edited) So I wrote a proof-of-concept "help" program, and at some point things just get confused. It just cats text to the screen... what could possibly go wrong?? I figure I'm too close to the code, PLUS there's something subtle about assembly language that trips up my newbie asm mind. I've abbreviated the data section, because, you know. ; ; cl65 -o help.prg -t cx16 -C cx16-asm.cfg help.s ; chrout = $ffd2 ; .segment "STARTUP" ; .segment "INIT" ; .segment "ONCE" ; .segment "CODE" .org $8000 .export LOADADDR = * Main: ldx #0 lda curpos loop: jsr $ffd2 inc curpos lda curpos cmp #0 beq newline cmp #42 ; '*' = EOF bne loop ; no rts newline: lda #13 jmp loop curpos: text: .asciiz "abs(n)" .asciiz "and; boolean or bitwise" .asciiz "asc(c$); petscii value" .asciiz "*** end of file ***" Edited November 9, 2020 by rje Quote Share this post Link to post Share on other sites
JimmyDansbo 75 Posted November 9, 2020 (edited) curpos is a label, can you increment a label? Edited November 9, 2020 by JimmyDansbo Quote Share this post Link to post Share on other sites
Stefan 63 Posted November 9, 2020 (edited) You can increase a label. Without testing the code, I think it in this case will increase the value of the first char in the first string. Not what rje intended. You need to use an index. Assuming that the strings do not fit within 256 bytes you could use indirect indexed addressing mode, for example: lda #<text sta $30 lda #>text sta $31 ldy #0 loop: lda ($30),y cmp #'*' beq eof jsr $ffd2 iny bne loop inc $31 jmp loop eof: rts Edited November 9, 2020 by Stefan Quote Share this post Link to post Share on other sites
rje 163 Posted November 9, 2020 Yes, I should be indexing! Thank you Stefan. Quote Share this post Link to post Share on other sites