rea5245 wrote:
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.
That first branch is jumping into the middle of the instruction, but that's correct. The operand byte is $EA, which is a NOP instruction. By branching to this, they get an extra two cycles per iteration without making the code any longer. That sort of trickery was a lot more common in the early days, when memory was small and expensive.
The second branch just looks correct to me. In "*+4", the * refers to the address of this instruction, which is $0551. So *+4 is $0555, which is the STX instruction. It's loading X with a value, then jumping over the instruction that loads X with a different value.
They've missed an opportunity to save another byte here: if you replace BNE *+4 with .byte $2C, then the following LDX #$CC becomes the operand of a BIT instruction, and won't be executed as an LDX. That was also a common trick in the old days.
Quote:
LDA #TARGET
STA VECTORLOCATION
LDA #TARGET>>8
STA VECTORLOCATION+1
I don't know the SYM-1's assembler, but the usual syntax for this is
Code:
LDA #>TARGET
STA VECTORLOCATION
LDA #<TARGET
STA VECTORLOCATION+1
The < and > operators give the high and low bytes of their argument respectively.