This is an obscure programming trick. Its
effect is to Branch forward to the JSR, as if you had coded this:
Code:
sta INPUTBUFFER,x
inx
jmp THEJSR ; <-------------------- was: .BYTE $2C
L244C:
lda #$07 ; BEL character.
THEJSR:
jsr OUTDO
bne INLIN2
It works because $2C is the opcode for BIT abs, an instruction that has two operand bytes following the opcode. But in this case the programmer's goal is not to do a BIT. Instead, the goal is to swallow (skip over) the two operand bytes but otherwise accomplish nothing. The two bytes swallowed are the
lda #$07 instruction; that instruction does not get executed. Instead those two bytes -- $A9 $07 -- get interpreted as the operand of the BIT instruction.
This is weird to wrap your brain around. But the CPU doesn't find it difficult at all! From its POV, (and with the $2C restored) it just sees...
Code:
sta INPUTBUFFER,x
inx
bit $07A9 ; (bogus operand - not really an address; this is actually the lda $#07 instruction)
jsr OUTDO
bne INLIN2
Certain factors make this trick undesirable. Yes, it saves a byte or two (compared with an actual BRA or JMP). But -- besides any
human confusion it may cause! -- there will also be an access to location $07A9, and that can disrupt operation of certain I/O chips should they happen to be mapped there.
-- Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html