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

pcat: begin organizing native words properly

This port is taking shape!
This commit is contained in:
Virgil Dupras 2020-06-18 15:28:30 -04:00
parent 6bc1738bfd
commit bd508daad9
7 changed files with 28 additions and 24 deletions

24
blk/812
View File

@ -1,15 +1,15 @@
VARIABLE lblexec VARIABLE lblfind
H@ ORG !
JMPn, 0 A,, ( 00, main ) JMPn, 0 A,, ( 03, find )
0 A,, ( 06, unused ) 0 A,, ( 08, LATEST )
0 A, ( 0a, unused ) 0 A, 0 A,, ( 0b, unused )
0 A, 0 A,, ( 0e, unused ) JMPn, 0 A,, ( 11, pushRS )
JMPn, 0 A,, ( 00, main ) 0 A, 0 A,, ( unused )
0 A,, ( unused ) 0 A,, ( 08, LATEST )
0 A, 0 A, 0 A,, ( unused )
0 A, 0 A,, ( unused ) JMPn, 0 A,, ( 11, pushRS )
JMPn, 0 A,, ( 14, popRS )
0 A, 0 A,, ( 17, unused )
JMPn, 0 A,, ( 1a, next ) 0 A, 0 A,, ( 1d, unused )
0 A, 0 A, ( 20, unused ) 0 A, 0 A, ( 22, unused )
0 A, 0 A, ( 24, unused ) 0 A, 0 A, ( 26, unused )
0 A, 0 A,, ( unused )
0 A, 0 A,, ( 2b, unused ) 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 )
JMPn, 0 A,, ( 1a, next ) 0 A, 0 A,, ( unused )
0 A, 0 A, 0 A, 0 A, ( unused )
0 A, 0 A, 0 A, 0 A, ( unused )
0 A, 0 A,, ( unused )
0 A, 0 A,, 0 A, 0 A, ( unused )
0 A, 0 A,, ( unused )
JMPn, 0 A,, ( 33, execute ) 0 A, 0 A, 0 A, 0 A,, ( unused )

View File

@ -2,7 +2,7 @@ PC 0x1d - ORG @ 0x1b + ! ( next )
DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx,
DI [DI] MOVx[], ( wordref )
( continue to execute )
L1 BSET PC 0x36 - ORG @ 0x34 + ! ( execute -- DI -> wordref )
lblexec BSET PC 0x36 - ORG @ 0x34 + ! ( DI -> wordref )
AL [DI] MOVr[], DI INCx, ( PFA )
AL AL ORrr, IFZ, DI JMPr, THEN, ( native )
( continue to compiled )
@ -11,4 +11,4 @@ PC 0x11 - ORG @ 0x0f + ! ( compiled -- DI -> PFA )
BP INCx, BP INCx, [BP] 0 DX MOV[]+x, ( pushRS )
DX DI MOVxx, DX INCx, DX INCx, ( --> IP )
DI [DI] MOVx[],
JMPs, L1 @ RPCs,
JMPs, lblexec @ RPCs,

View File

@ -1,4 +1,4 @@
L4 BSET PC 3 - ORG @ 4 + ! ( find )
lblfind BSET
( find word the same name as str in SI starting from tip in
DI. Returns wordref in DI. Z if found, NZ if not. )
CH CH XORrr, CL [SI] MOVr[], ( CX -> strlen )

11
blk/819
View File

@ -1,15 +1,10 @@
CODE BYE BEGIN, JMPs, AGAIN, ;CODE
CODE EMIT
AX POPx, AH 0x0e MOVri, ( print char ) 0x10 INT,
;CODE CODE 0 AX AX XORxx, AX PUSHx, ;CODE
: BAR '[' 'A' DO I EMIT LOOP BYE ;
L3 BSET 3 A, 'B' A, 'A' A, 'R' A,
L3 BSET 4 A, 'B' A, 'O' A, 'O' A, 'T' A,
PC 3 - ORG @ 1+ ! ( main )
SP PS_ADDR MOVxI,
BP RS_ADDR MOVxI,
DI 0x08 MOVxm, ( LATEST )
SI L3 @ MOVxI,
CALLn, L4 @ RPCn, ( find )
IFZ, JMPn, L1 @ RPCn, ( execute ) THEN,
CALLn, lblfind @ RPCn, ( find )
IFZ, JMPn, lblexec @ RPCn, ( execute ) THEN,
AH 0x0e MOVri, ( print char ) AL '!' MOVri, 0x10 INT,
BEGIN, JMPs, AGAIN,

View File

@ -1,3 +1,4 @@
( native words )
CODE >R
BP INCx, BP INCx, [BP] 0 POP[w]+,
;CODE NOP, NOP, NOP,
@ -8,3 +9,5 @@ CODE 2R>
[BP] -2 PUSH[w]+, [BP] 0 PUSH[w]+, BP 4 SUBxi,
;CODE
CODE I [BP] 0 PUSH[w]+, ;CODE
CODE 1+ DI SP MOVxx, [DI] INC[w], ;CODE
CODE 1- DI SP MOVxx, [DI] DEC[w], ;CODE

6
blk/821 Normal file
View File

@ -0,0 +1,6 @@
CODE BYE BEGIN, JMPs, AGAIN, ;CODE
CODE EMIT
AX POPx, AH 0x0e MOVri, ( print char ) 0x10 INT,
;CODE CODE 0 AX AX XORxx, AX PUSHx, ;CODE
: BOOT 'Z' 1+ 'A' DO I EMIT LOOP BYE ;

View File

@ -3,7 +3,7 @@
750 LOAD ( 8086 asm )
262 LOAD ( xcomp )
270 LOAD ( xcomp overrides )
812 819 LOADR
812 821 LOADR
(entry) _
( Update LATEST )
PC ORG @ 8 + !