From 5ebdf84e7857f659e1a3525e6868e25b7e9e5ee2 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 19 Jun 2020 07:26:33 -0400 Subject: [PATCH] pcat: more native words almost there! --- blk/753 | 3 ++- blk/757 | 1 + blk/759 | 4 ++-- blk/761 | 1 + blk/824 | 18 +++++++++--------- blk/825 | 15 +++++++++++++++ blk/826 | 8 ++++++++ recipes/pcat/xcomp.fs | 2 +- 8 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 blk/825 create mode 100644 blk/826 diff --git a/blk/753 b/blk/753 index 535c12b..efe3268 100644 --- a/blk/753 +++ b/blk/753 @@ -8,7 +8,8 @@ 0xaf OP1 SCASW, 0xaa OP1 STOSB, 0xab OP1 STOSW, ( no argument, jumps with relative addrs are special ) 0xeb OP1 JMPs, 0xe9 OP1 JMPn, 0x74 OP1 JZ, -0x75 OP1 JNZ, 0xe8 OP1 CALLn, +0x75 OP1 JNZ, 0x72 OP1 JC, 0x73 OP1 JNC, +0xe8 OP1 CALLn, : OP1r CREATE C, DOES> C@ + A, ; 0x40 OP1r INCx, 0x48 OP1r DECx, diff --git a/blk/757 b/blk/757 index 19337f7..63f1800 100644 --- a/blk/757 +++ b/blk/757 @@ -1,5 +1,6 @@ : OPrm CREATE C, DOES> C@ A, SWAP 3 LSHIFT OR A, ; 0x8a OPrm MOVr[], 0x8b OPrm MOVx[], +0x3a OPrm CMPr[], 0x3b OPrm CMPx[], : OPmr CREATE C, DOES> C@ A, 3 LSHIFT OR A, ; 0x88 OPmr MOV[]r, 0x89 OPmr MOV[]x, diff --git a/blk/759 b/blk/759 index 3ff2e8b..5625538 100644 --- a/blk/759 +++ b/blk/759 @@ -6,8 +6,8 @@ : FJR, PC 0 A, ; : IFZ, JNZ, FJR, ; : IFNZ, JZ, FJR, ; -( : IFC, JRNC, FJR, ; -: IFNC, JRC, FJR, ; ) +: IFC, JNC, FJR, ; +: IFNC, JC, FJR, ; : THEN, DUP PC ( l l pc ) -^ 1- ( l off ) diff --git a/blk/761 b/blk/761 index 7c8c317..bedee06 100644 --- a/blk/761 +++ b/blk/761 @@ -1,3 +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, ; diff --git a/blk/824 b/blk/824 index 56ebf50..f20a463 100644 --- a/blk/824 +++ b/blk/824 @@ -1,11 +1,11 @@ -CODE 0 AX AX XORxx, AX PUSHx, ;CODE -CODE 1 AX 1 MOVxI, AX PUSHx, ;CODE +CODE ! DI POPx, AX POPx, [DI] AX MOV[]x, ;CODE +CODE @ DI POPx, AX [DI] MOVx[], AX PUSHx, ;CODE +CODE C! DI POPx, AX POPx, [DI] AX MOV[]r, ;CODE +CODE C@ + DI POPx, AH AH XORrr, AL [DI] MOVr[], AX PUSHx, ;CODE CODE I [BP] 0 PUSH[w]+, ;CODE -CODE 1+ DI SP MOVxx, [DI] INC[w], ;CODE -CODE 1- DI SP MOVxx, [DI] DEC[w], ;CODE +CODE I' [BP] -2 PUSH[w]+, ;CODE +CODE J [BP] -4 PUSH[w]+, ;CODE +CODE (resSP) SP PS_ADDR MOVxI, ;CODE +CODE (resRS) BP RS_ADDR MOVxI, ;CODE CODE BYE BEGIN, JMPs, AGAIN, ;CODE -CODE EMIT - AX POPx, AH 0x0e MOVri, ( print char ) 0x10 INT, -;CODE -: FOO 42 10 /MOD '0' + EMIT '0' + EMIT ; -: BOOT ['] FOO EXECUTE BYE ; diff --git a/blk/825 b/blk/825 new file mode 100644 index 0000000..d08a9cb --- /dev/null +++ b/blk/825 @@ -0,0 +1,15 @@ +CODE S= + SI POPx, DI POPx, CH CH XORrr, CL [SI] MOVr[], + CL [DI] CMPr[], + IFZ, ( same size? ) + SI INCx, DI INCx, CLD, REPZ, CMPSB, + THEN, + PUSHZ, +;CODE +CODE CMP + BX POPx, AX POPx, CX CX XORxx, AX BX CMPxx, + IFNZ, ( < or > ) + CX INCx, IFNC, ( < ) CX DECx, CX DECx, THEN, + THEN, + CX PUSHx, +;CODE diff --git a/blk/826 b/blk/826 new file mode 100644 index 0000000..0377038 --- /dev/null +++ b/blk/826 @@ -0,0 +1,8 @@ +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 +: BOOT 4 5 CMP '=' + EMIT ; diff --git a/recipes/pcat/xcomp.fs b/recipes/pcat/xcomp.fs index e9cc40e..c89f527 100644 --- a/recipes/pcat/xcomp.fs +++ b/recipes/pcat/xcomp.fs @@ -3,7 +3,7 @@ 750 LOAD ( 8086 asm ) 262 LOAD ( xcomp ) 270 LOAD ( xcomp overrides ) -812 824 LOADR +812 826 LOADR (entry) _ ( Update LATEST ) PC ORG @ 8 + !