1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 03:18:05 +11:00

pcat: begin structuring around words

This commit is contained in:
Virgil Dupras 2020-06-14 14:15:44 -04:00
parent 85a0b87da3
commit a72322df31
8 changed files with 30 additions and 9 deletions

View File

@ -1 +1 @@
1 5 LOADR+
1 6 LOADR+

View File

@ -3,6 +3,7 @@
0xf4 OP1 HLT, 0xfc OP1 CLD, 0xfd OP1 STD,
( no argument, jumps with relative addrs are special )
0xeb OP1 JMPs, 0xe9 OP1 JMPn, 0x74 OP1 JZ,
0xe8 OP1 CALLn,
: MOVri, SWAP 0xb0 OR A, A, ;
: MOVxi, SWAP 0xb8 OR A, SPLITB A, A, ;
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;

View File

@ -4,6 +4,7 @@
: BREAK?, DUP 0x8000 AND IF
0x7fff AND 1 ALLOT THEN, -1 ALLOT
THEN ; )
: AGAIN, ( BREAK?, ) PC - 1- A, ;
: BWR @ AGAIN, ;
: RPCs, PC - 1- A, ; : RPCn, PC - 2- A,, ;
: AGAIN, ( BREAK?, ) RPCs, ;
( Use RPCx with appropriate JMP/CALL op. Example:
JMPs, 0x42 RPCs, or CALLn, 0x1234 RPCn, )

4
blk/756 Normal file
View File

@ -0,0 +1,4 @@
: CODE ( same as CREATE, but with native word )
(entry)
23 C, ( 23 == nativeWord ) ;
: ;CODE ;

View File

@ -6,7 +6,7 @@ JMPn, 0 A,, ( 00, main ) JMPn, 0 A,, ( 03, find )
JMPn, 0 A,, ( 0e compiledWord ) JMPn, 0 A,, ( 11, pushRS )
JMPn, 0 A,, ( 14, popRS )
JMPn, 0 A,, ( 17, nativeWord )
JMPn, 0 A,, ( 1a, next ) JMPn, 0 A,, ( 1d, chkPS )
JMPn, 0 A,, ( 1a, next ) JMPn, 0 A,, ( 1d, unused )
0 A, 0 A, ( 20, numberWord ) 0 A, 0 A, ( 22, litWord )
0 A, 0 A, ( 24, addrWord ) 0 A, 0 A, ( 26, unused )
0 A, 0 A,, ( unused )

15
blk/813
View File

@ -1,3 +1,14 @@
PC 3 - ORG @ 1+ ! ( main )
AH 0x0e MOVri, ( print char ) AL 'X' MOVri, 0x10 INT,
( BOOT DICT: There are only 3 words in the boot dict, but
these words' offset need to be stable, so they're part of
the "stable ABI" )
'E' A, 'X' A, 'I' A, 'T' A,
0 A,, ( prev )
4 A,
H@ XCURRENT ! ( set current tip of dict, 0x42 )
0x17 A, ( nativeWord )
HLT,
CODE FOO
L1 BSET
AH 0x0e MOVri, ( print char ) AL 'X' MOVri, 0x10 INT,
L2 BSET JMPs, L2 @ RPCs,
;CODE

2
blk/814 Normal file
View File

@ -0,0 +1,2 @@
PC 3 - ORG @ 1+ ! ( main )
JMPs, L1 @ RPCs,

View File

@ -1,4 +1,6 @@
750 LOAD
812 813 LOADR
750 LOAD ( 8086 asm )
262 LOAD ( xcomp )
270 LOAD ( xcomp overrides )
812 814 LOADR
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!