Re: M65C02A Core
Posted: Wed Aug 06, 2014 8:40 am
The best way to find out is to throw some code out there and see what happens, doc!
The '816 will have a clear advantage over Michael's 'C02A for a traditional 16-bit cell Forth, because the '816 has 16-bit registers. For example:
For a simple but popular word like @ (fetch), the psp in x looks like a good choice for the '816.
How about Michael's core?
I am not familiar with Michael's core yet, and I may have missed an optimization, but it looks like a slight win for psp in s.
I realize that this is a very isolated example, but I think that it suggests that any difference in efficiency from the choice of psp register is dwarfed by the difference resulting from registers that can hold an entire cell and ones that can't.
Mike
The '816 will have a clear advantage over Michael's 'C02A for a traditional 16-bit cell Forth, because the '816 has 16-bit registers. For example:
Code: Select all
; 65c816 in 16-bit accumulator mode
fetch: ; psp in x
PRIMITIVE
lda (0,x)
sta 0,x
NEXT
fetch: ; psp in s
PRIMITIVE
ldy #0
lda (1,s),y
sta 1,s
NEXT
How about Michael's core?
Code: Select all
; m65c02a has an 8-bit accumulator
fetch: ; psp in x
PRIMITIVE
lda (0,x)
pha
inc 0,x
bne *+2
inc 1,x
lda (0,x)
sta 1,x
pla
sta 0,x
NEXT
fetch: ; psp in s
PRIMITIVE
ldy #0
lda (1,s),y
pha
iny
lda (2,s),y
sta 3,s
pla
sta 1,s
NEXT
I realize that this is a very isolated example, but I think that it suggests that any difference in efficiency from the choice of psp register is dwarfed by the difference resulting from registers that can hold an entire cell and ones that can't.
Mike