mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 17:48:05 +11:00
Compare commits
3 Commits
85a0b87da3
...
3be30e24bb
Author | SHA1 | Date | |
---|---|---|---|
|
3be30e24bb | ||
|
bf0e999f8e | ||
|
a72322df31 |
2
blk/751
2
blk/751
@ -6,3 +6,5 @@ VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4
|
|||||||
: AX 0 ; : CX 1 ; : DX 2 ; : BX 3 ;
|
: AX 0 ; : CX 1 ; : DX 2 ; : BX 3 ;
|
||||||
: SP 4 ; : BP 5 ; : SI 6 ; : DI 7 ;
|
: SP 4 ; : BP 5 ; : SI 6 ; : DI 7 ;
|
||||||
: ES 0 ; : CS 1 ; : SS 2 ; : DS 3 ;
|
: 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
10
blk/753
@ -3,11 +3,7 @@
|
|||||||
0xf4 OP1 HLT, 0xfc OP1 CLD, 0xfd OP1 STD,
|
0xf4 OP1 HLT, 0xfc OP1 CLD, 0xfd OP1 STD,
|
||||||
( no argument, jumps with relative addrs are special )
|
( no argument, jumps with relative addrs are special )
|
||||||
0xeb OP1 JMPs, 0xe9 OP1 JMPn, 0x74 OP1 JZ,
|
0xeb OP1 JMPs, 0xe9 OP1 JMPn, 0x74 OP1 JZ,
|
||||||
: MOVri, SWAP 0xb0 OR A, A, ;
|
0xe8 OP1 CALLn,
|
||||||
: 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, ;
|
: OPrr CREATE C, DOES> C@ A, 3 LSHIFT OR 0xc0 OR A, ;
|
||||||
0x31 OPrr XORxx, 0x08 OPrr ORrr,
|
0x31 OPrr XORxx, 0x30 OPrr XORrr, 0x08 OPrr ORrr,
|
||||||
|
25
blk/754
25
blk/754
@ -1,16 +1,9 @@
|
|||||||
( Place BEGIN, where you want to jump back and AGAIN after
|
: MOVri, SWAP 0xb0 OR A, A, ;
|
||||||
a relative jump operator. Just like BSET and BWR. )
|
: MOVxi, SWAP 0xb8 OR A, A,, ;
|
||||||
: BEGIN, PC ;
|
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;
|
||||||
: BSET PC SWAP ! ;
|
: MOVxm, 0x8b A, SWAP 3 LSHIFT 0x6 OR A, A,, ;
|
||||||
( same as BSET, but we need to write a placeholder )
|
: MOVr[], 0x8a A, SWAP 3 LSHIFT OR A, ;
|
||||||
( : FJR, PC 0 A, ;
|
: INCx, 0x40 OR A, ;
|
||||||
: IFZ, JRNZ, FJR, ;
|
: INT, 0xcd A, A, ;
|
||||||
: IFNZ, JRZ, FJR, ;
|
: JMPr, 0xff A, 7 AND 0xe0 OR A, ;
|
||||||
: IFC, JRNC, FJR, ;
|
: JMPf, ( seg off ) 0xea A, SPLITB A, A, A,, ;
|
||||||
: 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
25
blk/755
@ -1,9 +1,16 @@
|
|||||||
: FWRs BSET 0 A, ;
|
( Place BEGIN, where you want to jump back and AGAIN after
|
||||||
: FSET @ THEN, ;
|
a relative jump operator. Just like BSET and BWR. )
|
||||||
( : BREAK, FJR, 0x8000 OR ;
|
: BEGIN, PC ;
|
||||||
: BREAK?, DUP 0x8000 AND IF
|
: BSET PC SWAP ! ;
|
||||||
0x7fff AND 1 ALLOT THEN, -1 ALLOT
|
( same as BSET, but we need to write a placeholder )
|
||||||
THEN ; )
|
( : FJR, PC 0 A, ;
|
||||||
: AGAIN, ( BREAK?, ) PC - 1- A, ;
|
: IFZ, JRNZ, FJR, ;
|
||||||
: BWR @ AGAIN, ;
|
: 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! ;
|
||||||
|
10
blk/756
Normal file
10
blk/756
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
: 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, )
|
4
blk/757
Normal file
4
blk/757
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
: CODE ( same as CREATE, but with native word )
|
||||||
|
(entry)
|
||||||
|
23 C, ( 23 == nativeWord ) ;
|
||||||
|
: ;CODE ;
|
4
blk/812
4
blk/812
@ -5,8 +5,8 @@ JMPn, 0 A,, ( 00, main ) JMPn, 0 A,, ( 03, find )
|
|||||||
0 A, ( 0a, unused ) JMPn, 0 A,, ( 0b, cellWord )
|
0 A, ( 0a, unused ) JMPn, 0 A,, ( 0b, cellWord )
|
||||||
JMPn, 0 A,, ( 0e compiledWord ) JMPn, 0 A,, ( 11, pushRS )
|
JMPn, 0 A,, ( 0e compiledWord ) JMPn, 0 A,, ( 11, pushRS )
|
||||||
JMPn, 0 A,, ( 14, popRS )
|
JMPn, 0 A,, ( 14, popRS )
|
||||||
JMPn, 0 A,, ( 17, nativeWord )
|
BX JMPr, ( 17, nativeWord ) 0 A,
|
||||||
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, ( 20, numberWord ) 0 A, 0 A, ( 22, litWord )
|
||||||
0 A, 0 A, ( 24, addrWord ) 0 A, 0 A, ( 26, unused )
|
0 A, 0 A, ( 24, addrWord ) 0 A, 0 A, ( 26, unused )
|
||||||
0 A, 0 A,, ( unused )
|
0 A, 0 A,, ( unused )
|
||||||
|
16
blk/813
16
blk/813
@ -1,3 +1,15 @@
|
|||||||
PC 3 - ORG @ 1+ ! ( main )
|
( 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 + !
|
||||||
AH 0x0e MOVri, ( print char ) AL 'X' MOVri, 0x10 INT,
|
AH 0x0e MOVri, ( print char ) AL 'X' MOVri, 0x10 INT,
|
||||||
HLT,
|
L2 BSET JMPs, L2 @ RPCs,
|
||||||
|
;CODE
|
||||||
|
8
blk/814
Normal file
8
blk/814
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
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 )
|
@ -1,4 +1,6 @@
|
|||||||
750 LOAD
|
750 LOAD ( 8086 asm )
|
||||||
812 813 LOADR
|
262 LOAD ( xcomp )
|
||||||
|
270 LOAD ( xcomp overrides )
|
||||||
|
812 814 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!
|
||||||
|
Loading…
Reference in New Issue
Block a user