BigEd wrote:
I completely don't understand! The bad byte is at location &10, right near one end of zp, and not much of zp is being used for the forth stack. Why even consider the need to skip over a bad byte, when it's so easy to place your data elsewhere?
Edit: elsewhere in zp, of course.
chitselb wrote:
That last JMP $B7C6 is an absolute disaster. From what I can tell just by examining the ROM code, it will plop me out of Forth to a BASIC prompt if the user hits STOP during tape i/o, but the zero page will be totally unprepared to operate in BASIC. I never want this to happen. The only workaround I can see at this point is to use what subroutines I can, but I still will have to clone a whole bunch of tape ROM code into precious RAM. Any other suggestions or pointers to prior art will be greatly appreciated.
He's looking for a robust environment, without having to clone any routines that dump to BASIC as part of their natural operation, because BASIC would be quite ill-prepared to operate with zero-page in 'Forth'-mode. We're not talking about one address, but more like dozens.
My idea to put the data stack in page one would cause a performance hit, but then only the user area would need a few contiguous zp addresses for indirection, and the BASIC GETBYT routine could be wedged to return him to Forth before much (in any) damage could be done from the READY prompt, should he find himself dropped there.
Code:
drop:
inx
jmp next
dup: ;25% larger and 19% slower (probably typical)
dex
lda $101,x
sta $100,x
lda $141,x
sta $140,x
jmp next
fetch:
lda $100,x
sta N
lda $140,x
sta N+1
ldy #1
lda (N),y
sta $140,x
dey
lda (N),y
sta $100,x
jmp next
tor:
lda $140,x
pha
lda $100,x
pha
inx
jmp next
Mike
Edit: I missed the part about TOS in zp. That would lessen the burden somewhat:
Code:
drop:
lda $100,x
sta TOS
lda $140,x
sta TOS+1
inx
jmp next
dup: ;17% larger and 17% slower (probably typical)
dex
lda TOS
sta $100,x
lda TOS+1
sta $140,x
jmp next
fetch:
ldy #1
lda (TOS),y
pha
dey
lda (TOS),y
sta TOS
pla
sta TOS+1
jmp next
tor:
lda TOS+1
pha
lda TOS
pha
jmp drop