mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:38:05 +11:00
pcat: properly handle IMMED flag in _find
This commit is contained in:
parent
1b5333d0b4
commit
c2c32bbed8
16
blk/758
16
blk/758
@ -1,10 +1,6 @@
|
|||||||
: MOVri, SWAP 0xb0 OR A, A, ;
|
: OPi CREATE C, DOES> C@ A, A, ;
|
||||||
: MOVxI, SWAP 0xb8 OR A, A,, ;
|
0x04 OPi ADDALi, 0x24 OPi ANDALi,
|
||||||
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;
|
0xcd OPi INT,
|
||||||
: MOVxm, 0x8b A, SWAP 3 LSHIFT 0x6 OR A, A,, ;
|
: OPI CREATE C, DOES> C@ A, A,, ;
|
||||||
: INT, 0xcd A, A, ;
|
0x05 OPI ADDAXI, 0x25 OPI ANDAXI,
|
||||||
: ADDAXI, 0x05 A, A,, ; : ADDALi, 0x04 A, A, ;
|
|
||||||
: SUBxi, 0x83 A, SWAP 0xe8 OR A, A, ;
|
|
||||||
: ADDxi, 0x83 A, SWAP 0xc0 OR A, A, ;
|
|
||||||
: JMPr, 0xff A, 7 AND 0xe0 OR A, ;
|
|
||||||
: JMPf, ( seg off ) 0xea A, SPLITB A, A, A,, ;
|
|
||||||
|
16
blk/759
16
blk/759
@ -1,16 +0,0 @@
|
|||||||
( 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, JNZ, FJR, ;
|
|
||||||
: IFNZ, JZ, FJR, ;
|
|
||||||
: IFC, JNC, FJR, ;
|
|
||||||
: IFNC, JC, 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! ;
|
|
19
blk/760
19
blk/760
@ -1,11 +1,8 @@
|
|||||||
: FWRs BSET 0 A, ;
|
: MOVri, SWAP 0xb0 OR A, A, ;
|
||||||
: FSET @ THEN, ;
|
: MOVxI, SWAP 0xb8 OR A, A,, ;
|
||||||
( : BREAK, FJR, 0x8000 OR ;
|
: MOVsx, 0x8e A, SWAP 3 LSHIFT OR 0xc0 OR A, ;
|
||||||
: BREAK?, DUP 0x8000 AND IF
|
: MOVxm, 0x8b A, SWAP 3 LSHIFT 0x6 OR A, A,, ;
|
||||||
0x7fff AND 1 ALLOT THEN, -1 ALLOT
|
: SUBxi, 0x83 A, SWAP 0xe8 OR A, A, ;
|
||||||
THEN ; )
|
: ADDxi, 0x83 A, SWAP 0xc0 OR A, A, ;
|
||||||
: RPCs, PC - 1- DUP 128 + 0xff > IF ABORT" PC ovfl" THEN A, ;
|
: JMPr, 0xff A, 7 AND 0xe0 OR A, ;
|
||||||
: RPCn, PC - 2- A,, ;
|
: JMPf, ( seg off ) 0xea A, SPLITB A, A, A,, ;
|
||||||
: AGAIN, ( BREAK?, ) RPCs, ;
|
|
||||||
( Use RPCx with appropriate JMP/CALL op. Example:
|
|
||||||
JMPs, 0x42 RPCs, or CALLn, 0x1234 RPCn, )
|
|
||||||
|
20
blk/761
20
blk/761
@ -1,4 +1,16 @@
|
|||||||
: PUSHZ, CX 0 MOVxI, IFZ, CX INCx, THEN, CX PUSHx, ;
|
( Place BEGIN, where you want to jump back and AGAIN after
|
||||||
: CODE ( same as CREATE, but with native word )
|
a relative jump operator. Just like BSET and BWR. )
|
||||||
(entry) 0 ( native ) C, ;
|
: BEGIN, PC ;
|
||||||
: ;CODE JMPn, 0x1a ( next ) RPCn, ;
|
: BSET PC SWAP ! ;
|
||||||
|
( same as BSET, but we need to write a placeholder )
|
||||||
|
: FJR, PC 0 A, ;
|
||||||
|
: IFZ, JNZ, FJR, ;
|
||||||
|
: IFNZ, JZ, FJR, ;
|
||||||
|
: IFC, JNC, FJR, ;
|
||||||
|
: IFNC, JC, 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! ;
|
||||||
|
11
blk/762
Normal file
11
blk/762
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
: 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- DUP 128 + 0xff > IF ABORT" PC ovfl" THEN 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/763
Normal file
4
blk/763
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
: PUSHZ, CX 0 MOVxI, IFZ, CX INCx, THEN, CX PUSHx, ;
|
||||||
|
: CODE ( same as CREATE, but with native word )
|
||||||
|
(entry) 0 ( native ) C, ;
|
||||||
|
: ;CODE JMPn, 0x1a ( next ) RPCn, ;
|
2
blk/828
2
blk/828
@ -4,7 +4,7 @@ CODE _find ( cur w -- a f )
|
|||||||
SI INCx, ( first char ) AX AX XORxx, ( initial prev )
|
SI INCx, ( first char ) AX AX XORxx, ( initial prev )
|
||||||
BEGIN, ( loop )
|
BEGIN, ( loop )
|
||||||
DI AX SUBxx, ( jump to prev wordref )
|
DI AX SUBxx, ( jump to prev wordref )
|
||||||
AL [DI] -1 MOVr[]+, ( strlen )
|
AL [DI] -1 MOVr[]+, 0x7f ANDALi, ( strlen )
|
||||||
CL AL CMPrr, IFZ, ( same len )
|
CL AL CMPrr, IFZ, ( same len )
|
||||||
SI PUSHx, DI PUSHx, CX PUSHx, ( --> lvl 3 )
|
SI PUSHx, DI PUSHx, CX PUSHx, ( --> lvl 3 )
|
||||||
3 ADDALi, ( header ) AH AH XORrr, DI AX SUBxx,
|
3 ADDALi, ( header ) AH AH XORrr, DI AX SUBxx,
|
||||||
|
Loading…
Reference in New Issue
Block a user