Hi all, I am sending strings to the serial terminal (I am using an 8251 driven by the 6502) and I want to make my display routine a bit more compact by using a particular address to be loaded
with the start address of the string which is to be displayed when the routine is called, so that I can do something like:
Use particular address: "msgbase" to point to the start of the string
call the print routine which reads from msgbase which now points to the string start address
I am using vasm assembler.
At the moment I am doing the code below, but this loads string1 and would mean some repetition of the code for displaying string2 .
(I haven't shown the wait routine for the 8251 status check)
Code:
jsr printmsg ; print message
end: jmp end ; loops forever after printing
printmsg:
ldx #0
more: lda string1,x ;loads the start of string1, but I want to point to the fixed message address msgbase
beq end
sta data8251
inx
jsr wait ; check 8251 status
jmp more
rts
msgbase: word msgbase ; want this to point to start of the string to be displayed
What I need to do is
something similar to the principle of the lcd routine at:
http://www.6502.org/mini-projects/optrexlcd/lcd.htmbut I can't get this to assemble:
Code:
LDA #LDA #string1 ; I get the error 'operand doesn't fit into 8-bits' edit: my code starts at $FE00
STA MSGBASE ;store high byte of message address at the message base address used by the subroutine