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

Compare commits

..

No commits in common. "3be30e24bb64c835f54d3aa1ecfb98c20109f164" and "85a0b87da36a7aa0fe17a40f8261339e75a45d7d" have entirely different histories.

11 changed files with 39 additions and 73 deletions

View File

@ -1 +1 @@
1 7 LOADR+
1 5 LOADR+

View File

@ -6,5 +6,3 @@ VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4
: AX 0 ; : CX 1 ; : DX 2 ; : BX 3 ;
: SP 4 ; : BP 5 ; : SI 6 ; : DI 7 ;
: ES 0 ; : CS 1 ; : SS 2 ; : DS 3 ;
: [BX+SI] 0 ; : [BX+DI] 1 ; : [BP+SI] 2 ; : [BP+DI] 3 ;
: [SI] 4 ; : [DI] 5 ; : [BP] 6 ; : [BX] 7 ;

10
blk/753
View File

@ -3,7 +3,11 @@
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, ;
: INT, 0xcd A, A, ;
: JMPr, 0xff A, 7 AND 0xe0 OR A, ;
: JMPf, ( seg off ) 0xea A, SPLITB A, A, SPLITB A, A, ;
: OPrr CREATE C, DOES> C@ A, 3 LSHIFT OR 0xc0 OR A, ;
0x31 OPrr XORxx, 0x30 OPrr XORrr, 0x08 OPrr ORrr,
0x31 OPrr XORxx, 0x08 OPrr ORrr,

25
blk/754
View File

@ -1,9 +1,16 @@
: MOVri, SWAP 0xb0 OR A, A, ;
: MOVxi, SWAP 0xb8 OR A, A,, ;
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;
: MOVxm, 0x8b A, SWAP 3 LSHIFT 0x6 OR A, A,, ;
: MOVr[], 0x8a A, SWAP 3 LSHIFT OR A, ;
: INCx, 0x40 OR A, ;
: INT, 0xcd A, A, ;
: JMPr, 0xff A, 7 AND 0xe0 OR A, ;
: JMPf, ( seg off ) 0xea A, SPLITB A, A, A,, ;
( Place BEGIN, where you want to jump back and AGAIN after
a relative jump operator. Just like BSET and BWR. )
: BEGIN, PC ;
: BSET PC SWAP ! ;
( same as BSET, but we need to write a placeholder )
( : FJR, PC 0 A, ;
: IFZ, JRNZ, FJR, ;
: IFNZ, JRZ, FJR, ;
: IFC, JRNC, FJR, ;
: IFNC, JRC, FJR, ; )
: THEN,
DUP PC ( l l pc )
-^ 1- ( l off )
( warning: l is a PC offset, not a mem addr! )
SWAP ORG @ + BIN( @ - ( off addr )
C! ;

25
blk/755
View File

@ -1,16 +1,9 @@
( Place BEGIN, where you want to jump back and AGAIN after
a relative jump operator. Just like BSET and BWR. )
: BEGIN, PC ;
: BSET PC SWAP ! ;
( same as BSET, but we need to write a placeholder )
( : FJR, PC 0 A, ;
: IFZ, JRNZ, FJR, ;
: IFNZ, JRZ, FJR, ;
: IFC, JRNC, FJR, ;
: IFNC, JRC, FJR, ; )
: THEN,
DUP PC ( l l pc )
-^ 1- ( l off )
( warning: l is a PC offset, not a mem addr! )
SWAP ORG @ + BIN( @ - ( off addr )
C! ;
: FWRs BSET 0 A, ;
: FSET @ THEN, ;
( : BREAK, FJR, 0x8000 OR ;
: BREAK?, DUP 0x8000 AND IF
0x7fff AND 1 ALLOT THEN, -1 ALLOT
THEN ; )
: AGAIN, ( BREAK?, ) PC - 1- A, ;
: BWR @ AGAIN, ;

10
blk/756
View File

@ -1,10 +0,0 @@
: FWRs BSET 0 A, ;
: FSET @ THEN, ;
( : BREAK, FJR, 0x8000 OR ;
: BREAK?, DUP 0x8000 AND IF
0x7fff AND 1 ALLOT THEN, -1 ALLOT
THEN ; )
: 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, )

View File

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

View File

@ -5,8 +5,8 @@ JMPn, 0 A,, ( 00, main ) JMPn, 0 A,, ( 03, find )
0 A, ( 0a, unused ) JMPn, 0 A,, ( 0b, cellWord )
JMPn, 0 A,, ( 0e compiledWord ) JMPn, 0 A,, ( 11, pushRS )
JMPn, 0 A,, ( 14, popRS )
BX JMPr, ( 17, nativeWord ) 0 A,
JMPn, 0 A,, ( 1a, next ) JMPn, 0 A,, ( 1d, unused )
JMPn, 0 A,, ( 17, nativeWord )
JMPn, 0 A,, ( 1a, next ) JMPn, 0 A,, ( 1d, chkPS )
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 )

16
blk/813
View File

@ -1,15 +1,3 @@
( 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 )
;CODE
CODE FOO
( Update LATEST, temporarily hackish )
PC 1- ORG @ 8 + !
PC 3 - ORG @ 1+ ! ( main )
AH 0x0e MOVri, ( print char ) AL 'X' MOVri, 0x10 INT,
L2 BSET JMPs, L2 @ RPCs,
;CODE
HLT,

View File

@ -1,8 +0,0 @@
L1 BSET PC 3 - ORG @ 0x34 + ! ( execute -- BX -> wordref )
AH AH XORrr,
AL [BX] MOVr[],
BX INCx, ( PFA )
AX JMPr,
PC 3 - ORG @ 1+ ! ( main )
BX 0x08 MOVxm, ( LATEST ) JMPs, L1 @ RPCs, ( execute )

View File

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