Compare commits

...

4 Commits

Author SHA1 Message Date
Virgil Dupras 99c05fff3c pcat: it works!
Forth intepreter now works! There's still DOES> and overflow checks
to implement, but otherwise, we have it!
2020-06-20 20:06:42 -04:00
Virgil Dupras ae719508d9 pcat: make /MOD division 16-bit
Was required for the many "256 /MOD" in the code.
2020-06-20 19:14:51 -04:00
Virgil Dupras 60ecab314e pcat: we have PROMPT!
Not working, but we do get that sweet "CollapseOS".
2020-06-20 16:58:48 -04:00
Virgil Dupras 397ee3e3e6 Simplify word ' 2020-06-20 14:13:41 -04:00
7 changed files with 15 additions and 15 deletions

View File

@ -1,8 +1,5 @@
: '? WORD FIND ;
: '
'? (?br) [ 4 , ] EXIT
LIT< (wnf) FIND DROP EXECUTE
;
: ' '? NOT IF LIT< (wnf) FIND DROP EXECUTE THEN ;
: ROLL
?DUP NOT IF EXIT THEN
1+ DUP PICK ( n val )

View File

@ -4,7 +4,9 @@ ORG @ 0x25 + HERE ! ( bypass BPB )
L1 FSET ( start )
CLI, CLD, AX 0x800 MOVxI, DS AX MOVsx, ES AX MOVsx,
SS AX MOVsx, STI,
AH 2 MOVri, DX 0 MOVxI, CH 0 MOVri, CL 2 MOVri, AL 7 MOVri,
BX 0 MOVxI, 0x13 INT, ( read sectors 2-9 of boot floppy )
AH 2 MOVri, DX 0 MOVxI, CH 0 MOVri, CL 2 MOVri, AL 12 MOVri,
BX 0 MOVxI, 0x13 INT, ( read sectors 2-14 of boot floppy )
( TODO: reading 12 sectors like this probably doesn't work
on real vintage PC/AT with floppy. Make this more robust. )
0x800 0 JMPf,
ORG @ 0x1fe + HERE ! 0x55 A, 0xaa A,

View File

@ -9,7 +9,7 @@ H@ XCURRENT ! ( set current tip of dict, 0x42 )
CODE (br) ( 0x53 ) L2 BSET ( used in br? )
DI DX MOVxx, DI [DI] MOVx[], DX DI ADDxx,
;CODE NOP, NOP,
CODE (br?) ( 0x67 )
CODE (?br) ( 0x67 )
AX POPx, AX AX ORxx, JZ, L2 @ RPCs, ( False, branch )
( True, skip next 2 bytes and don't branch )
L1 BSET ( loop will jump here ) DX INCx, DX INCx,

View File

@ -2,4 +2,4 @@
DI 3 SUBxi, AX [DI] MOVx[], ( prev )
AX AX ORxx,
JNZ, AGAIN, ( loop )
AX INCx, ( NZ ) RETn,
SI DECx, ( start of string, and NZ ) RETn,

View File

@ -6,8 +6,8 @@ CODE *
AX PUSHx,
;CODE
CODE /MOD
BX POPx, AX POPx,
BL DIVr, ( TODO: use DIVx, risk of 8086 error )
BH BH XORrr, BL AH MOVrr, BX PUSHx, ( modulo )
BL AL MOVrr, BX PUSHx, ( division )
BX POPx, AX POPx, DX PUSHx, ( protect )
DX DX XORxx, BX DIVx,
BX DX MOVxx, DX POPx, ( unprotect )
BX PUSHx, ( modulo ) AX PUSHx, ( division )
;CODE

Binary file not shown.

View File

@ -9,11 +9,12 @@ RS_ADDR 0x80 - CONSTANT RAMSTART
CODE (emit)
AX POPx, AH 0x0e MOVri, ( print char ) 0x10 INT,
;CODE
CODE (key) AH AH XORrr, 0x16 INT, AX PUSHx, ;CODE
: FOO (key) (emit) ;
: BOOT 0x08 @ LIT< FOO _find DROP EXECUTE BYE ;
CODE (key)
AH AH XORrr, 0x16 INT, AH AH XORrr, AX PUSHx, ;CODE
380 LOAD ( xcomp core high )
(entry) _
( Update LATEST )
PC ORG @ 8 + !
EOT,
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!