<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 26 Feb 2008 15:12:22 +0000
From   : fragula@... (Fragula)
Subject: BBC FPGA Boots to BASIC... almost...

I'm making assumptions.. Usually a bad thing.. Thought Police over here
please!!!

Should be
; preserve A,Y,X in stack - in that order.
PHA
TYA
PHA
TXA
PHA
; get stack pointer
TSX
;and use it to non-destructively recover A from the stack.
LDA &103,X
;Ok is it lower than 32 (I would have written #&20, but then I'm a sad
; git who should get out more..)
CMP #32
;If it is, skip a few bytes cos we 'aint gonna process it d00d.
; I prefer to flaunt the labels, but another mans meat and all that.
BCC P%+4
LDA #42 ; some sort of symbol..
LDY #&00
STA (&D8),Y
INC &D8
; next line needs a tadge of reality checking. >;{>
BNE P%+4
INC &D9
; recover X, Y, A from stack, in that order.
PLA
TAX
PLA
TAY
PLA
RTS

Sorry.. Have to write vertical and all that.. habit.

> I'm having trouble following your code...
1) JGH is a Guru.
or
2) He maeks tyeps lkie me al doo.


> 
> 1st of all, I believe the 1st TAY should be TYA?
Yep.

> 
> 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???
See above notated. Its recovering stuff from the stack.
> 
> If I run the code as I interpreted it (LDA &103 - absolute),
No.,. Its &
LDA &103,X
stackbase=&100, plus 3 to compensate for the X,X and Y we just pushed,
then indexed by the stack pointer (transferred to X.)

> like '*istake'...
I think there were some *istakes.. However I aint coded since the days
we had to hook the computer up to a treadmill and write code with a
knitting needle in recycled parade tapes.. so there are probably a few
mistakes left in this. :-}

> FWIW I've never written a program in 6502...
I have.. it /used/ to be easy. LOL.

Good luck!

M.


-- 
I have the body of a god!

Bhudda, that is.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>