pcat: add native _find

This commit is contained in:
Virgil Dupras 2020-06-19 07:56:54 -04:00
parent 5ebdf84e78
commit 8cc8df0446
6 changed files with 23 additions and 12 deletions

View File

@ -4,7 +4,7 @@ ORG @ 0x25 + HERE ! ( bypass BPB )
L1 FSET ( start ) L1 FSET ( start )
CLI, CLD, AX 0x800 MOVxI, DS AX MOVsx, ES AX MOVsx, CLI, CLD, AX 0x800 MOVxI, DS AX MOVsx, ES AX MOVsx,
SS AX MOVsx, STI, SS AX MOVsx, STI,
AH 2 MOVri, DX 0 MOVxI, CH 0 MOVri, CL 2 MOVri, AL 2 MOVri, AH 2 MOVri, DX 0 MOVxI, CH 0 MOVri, CL 2 MOVri, AL 3 MOVri,
BX 0 MOVxI, 0x13 INT, ( read sectors 2-3 of boot floppy ) BX 0 MOVxI, 0x13 INT, ( read sectors 2-4 of boot floppy )
0x800 0 JMPf, 0x800 0 JMPf,
ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A, ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A,

View File

@ -1,4 +1,4 @@
VARIABLE lblexec VARIABLE lblfind VARIABLE lblexec VARIABLE lblfind VARIABLE lblnext
H@ ORG ! H@ ORG !
JMPn, 0 A,, ( 00, main ) 0 A, 0 A,, ( unused ) JMPn, 0 A,, ( 00, main ) 0 A, 0 A,, ( unused )
0 A,, ( unused ) 0 A,, ( 08, LATEST ) 0 A,, ( unused ) 0 A,, ( 08, LATEST )

View File

@ -1,4 +1,4 @@
PC 0x1d - ORG @ 0x1b + ! ( next ) lblnext BSET PC 0x1d - ORG @ 0x1b + ! ( next )
DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx, DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx,
DI [DI] MOVx[], ( wordref ) DI [DI] MOVx[], ( wordref )
( continue to execute ) ( continue to execute )

15
blk/826
View File

@ -1,8 +1,9 @@
CODE 0 AX AX XORxx, AX PUSHx, ;CODE CODE _find ( cur w -- a f )
CODE 1 AX 1 MOVxI, AX PUSHx, ;CODE SI POPx, ( w ) DI POPx, ( cur )
CODE 1+ DI SP MOVxx, [DI] INC[w], ;CODE CALLn, lblfind @ RPCn,
CODE 1- DI SP MOVxx, [DI] DEC[w], ;CODE IFNZ, ( not found )
CODE EMIT SI PUSHx, AX AX XORxx, AX PUSHx,
AX POPx, AH 0x0e MOVri, ( print char ) 0x10 INT, JMPn, lblnext @ RPCn,
THEN, ( found )
DI PUSHx, AX 1 MOVxI, AX PUSHx,
;CODE ;CODE
: BOOT 4 5 CMP '=' + EMIT ;

10
blk/828 Normal file
View File

@ -0,0 +1,10 @@
CODE 0 AX AX XORxx, AX PUSHx, ;CODE
CODE 1 AX 1 MOVxI, AX PUSHx, ;CODE
CODE 1+ DI SP MOVxx, [DI] INC[w], ;CODE
CODE 1- DI SP MOVxx, [DI] DEC[w], ;CODE
CODE EMIT
AX POPx, AH 0x0e MOVri, ( print char ) 0x10 INT,
;CODE
: FOO 'X' EMIT ;
L1 BSET 3 A, 'F' A, 'O' A, 'O' A,
: BOOT 0x08 @ [ L1 @ LITN ] _find DROP EXECUTE BYE ;

View File

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