pcat: begin porting forth

I'm not sure yet where I'm going, but I'm not going to build the
8086 port from the ground up like I did with the z80, that is,
making is sustain itself and eventually merge its forth code with
core words. That would be too much work which would then be thrown
out (all those words I'll initially have to implement in asm which
are already implemented in Forth).

What I *think* I can do is build a mirror version of z80 boot code
and cross-compile it from the z80. This means it has to follow z80
stable ABI.

Nope, I'm not sure where I'm going...
This commit is contained in:
Virgil Dupras 2020-06-13 21:37:54 -04:00
parent 1a467efae1
commit 2b7abf802f
4 changed files with 20 additions and 10 deletions

View File

@ -4,3 +4,4 @@
; ;
: PC H@ ORG @ - BIN( @ + ; : PC H@ ORG @ - BIN( @ + ;
: A, C, ; : A, C, ;
: A,, SPLITB A, A, ;

24
blk/812
View File

@ -1,10 +1,16 @@
( Registers. SP -> PSP DX -> RSP CX -> IP )
H@ ORG ! H@ ORG !
JMPs, L1 FWRs ( start ) JMPn, 0 A,, ( 00, main ) JMPn, 0 A,, ( 03, find )
L2 ( msg ) BSET ," Hello World!" 0 A, 0 A,, ( 06, unused ) 0 A,, ( 08, LATEST )
L1 FSET ( start ) 0 A, ( 0a, unused ) JMPn, 0 A,, ( 0b, cellWord )
SI L2 @ ( msg ) MOVxi, AH 0x0e MOVri, ( print char ) JMPn, 0 A,, ( 0e compiledWord ) JMPn, 0 A,, ( 11, pushRS )
L1 BSET ( loop ) LODSB, AL AL ORrr, ( end of str? ) JMPn, 0 A,, ( 14, popRS )
JZ, L2 FWRs ( next ) 0x10 INT, ( print char ) JMPn, 0 A,, ( 17, nativeWord )
JMPs, L1 ( loop ) BWR JMPn, 0 A,, ( 1a, next ) JMPn, 0 A,, ( 1d, chkPS )
L2 FSET ( next ) AH 0 MOVri, 0x16 INT, ( read kbd ) 0 A, 0 A, ( 20, numberWord ) 0 A, 0 A, ( 22, litWord )
AH 0x0e MOVri, 0x10 INT, ( spit read char ) HLT, ( done ) 0 A, 0 A, ( 24, addrWord ) 0 A, 0 A, ( 26, unused )
0 A, 0 A,, ( unused )
JMPn, 0 A,, ( 2b, doesWord ) 0 A, 0 A, ( 2e, unused )
0 A, 0 A,, ( unused )
JMPn, 0 A,, ( 33, execute ) 0 A, 0 A, ( unused )
0 A, 0 A,, ( unused )

3
blk/813 Normal file
View File

@ -0,0 +1,3 @@
PC 3 - ORG @ 1+ ! ( main )
AH 0x0e MOVri, ( print char ) AL 'X' MOVri, 0x10 INT,
HLT,

View File

@ -1,4 +1,4 @@
750 LOAD 750 LOAD
812 LOAD 812 813 LOADR
ORG @ 256 /MOD 2 PC! 2 PC! ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!