Date : Tue, 26 Feb 2008 16:18:04 +0100
From : eelco@... (Eelco Huininga)
Subject: BBC FPGA Boots to BASIC... almost...
Mark McDougall wrote:
> Jonathan Graham Harston wrote:
>
>> You could temporarily replace the VDU code with something like:
>>
>> PHA:TAY:PHA:TXA:PHA
>> TSX:LDA &103,A
>> CMP #32:BCS P%+4:LDA #42
>> LDY #0:STA (&D8),Y
>> INC &D8:BNE P%+4:INC &D9
>> PLA:TAX:PLA:TAY:PLA:RTS
>
> I'm having trouble following your code...
>
> 1st of all, I believe the 1st TAY should be TYA?
Correct!
>
> 2nd, IIUC, on entry A contains the character to be printed. I'm not sure
> exactly what the "LDA &103,A" instruction is, and how it restores the
> character???
The 6502's stack runs from &0100 to &01FF. The PHA effectively does this:
STA &0100,S
DEC S
So the LDA &0103,X reads back the byte pushed to the stack by the first PHA.
Cheers,
Eelco