Jump to content

Assembler help for my X16-HELP.

Recommended Posts

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
        lda #13
        jmp loop
        .asciiz "abs(n)"
        .asciiz "and; boolean or bitwise"
        .asciiz "asc(c$); petscii value"
        .asciiz "*** end of file ***"
Edited by rje

Share this post

Link to post
Share on other sites

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
bne loop
inc $31
jmp loop

eof: rts

Edited by Stefan

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Please review our Terms of Use