Is this buggy code?
Posted: Tue Jul 12, 2022 5:21 pm
I have a SYM-1. It has a feature where it can draw text on an oscilloscope, and I'm trying to get it to work. I'm using the sample code from the manual, and I think it's buggy. But since I'm not experienced in 6502 programming, I was hoping someone could double check me.
I've attached a snapshot of the code below.
I think that the relative branch at line 0032 is wrong - it's going to jump into the middle of the instruction on line 0030. Likewise, the branch at line 0064 is wrong: it should probably be BNE *+5.
Am I right about this?
And a follow up question... in order to use this code, I need to alter some vectors that the SYM-1 monitor uses to display text. The manual explains how to do that manually from the keyboard. But if I wanted to do it programmatically, how would I? On a 16 bit processor, I'd load a register with the address of the code, then store that address in the vector location. E.g.:
LD D0,#TARGET
ST D0,VECTORLOCATION
On the 6502, I imagine I need to load the low byte of the target address, save it in the low byte of the vector, then repeat with the high byte. I'd like to do something like:
LDA #TARGET
STA VECTORLOCATION
LDA #TARGET>>8
STA VECTORLOCATION+1
But the SYM-1's assembler doesn't support shifting in expressions. It only allows addition and subtraction. Is there an elegant way to do this, or do I just need to load hexadecimal numbers, instead of using labels?
Thank you.
I've attached a snapshot of the code below.
I think that the relative branch at line 0032 is wrong - it's going to jump into the middle of the instruction on line 0030. Likewise, the branch at line 0064 is wrong: it should probably be BNE *+5.
Am I right about this?
And a follow up question... in order to use this code, I need to alter some vectors that the SYM-1 monitor uses to display text. The manual explains how to do that manually from the keyboard. But if I wanted to do it programmatically, how would I? On a 16 bit processor, I'd load a register with the address of the code, then store that address in the vector location. E.g.:
LD D0,#TARGET
ST D0,VECTORLOCATION
On the 6502, I imagine I need to load the low byte of the target address, save it in the low byte of the vector, then repeat with the high byte. I'd like to do something like:
LDA #TARGET
STA VECTORLOCATION
LDA #TARGET>>8
STA VECTORLOCATION+1
But the SYM-1's assembler doesn't support shifting in expressions. It only allows addition and subtraction. Is there an elegant way to do this, or do I just need to load hexadecimal numbers, instead of using labels?
Thank you.