Only its jump at 0x33 remains. I've also fixed a strange offset oddity in 8086's (n) placement. It was off by 2, but strangely, it ran properly. Anyway, now it's fixed.master
@@ -5,8 +5,8 @@ sets that don't change (well, not without some binary manipu- | |||||
lation). Here's the complete list of these references: | lation). Here's the complete list of these references: | ||||
04 BOOT addr 06 (uflw) addr 08 LATEST | 04 BOOT addr 06 (uflw) addr 08 LATEST | ||||
42 EXIT wordref 53 (br) wordref 67 (?br) wordref | |||||
80 (loop) wordref a9 2>R wordref bf (n) wordref | |||||
33 2>R wordref 42 EXIT wordref 53 (br) wordref | |||||
67 (?br) wordref 80 (loop) wordref bf (n) wordref | |||||
d4 (s) wordref | d4 (s) wordref | ||||
BOOT and (uflw) exist because they are referred to before those | BOOT and (uflw) exist because they are referred to before those | ||||
@@ -10,5 +10,5 @@ NOP, NOP, NOP, NOP, ( unused ) | |||||
0 JP, ( RST 28 ) | 0 JP, ( RST 28 ) | ||||
NOP, NOP, NOP, NOP, NOP, ( unused ) | NOP, NOP, NOP, NOP, NOP, ( unused ) | ||||
0 JP, ( RST 30 ) | 0 JP, ( RST 30 ) | ||||
NOP, NOP, NOP, NOP, NOP, ( unused ) | |||||
0 A, 0 JP, ( 33, 2>R ) NOP, ( unused ) | |||||
0 JP, ( RST 38 ) | 0 JP, ( RST 38 ) |
@@ -1,7 +1,4 @@ | |||||
CODE 2>R ( 0xa9 ) | |||||
DE POP, HL POP, | |||||
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL, | |||||
;CODE NOP, NOP, NOP, | |||||
ORG @ 0xb9 + HERE ! | |||||
CODE (n) ( 0xbf, number literal ) | CODE (n) ( 0xbf, number literal ) | ||||
( Literal value to push to stack is next to (n) reference | ( Literal value to push to stack is next to (n) reference | ||||
in the atom list. That is where IP is currently pointing. | in the atom list. That is where IP is currently pointing. | ||||
@@ -1,11 +1,14 @@ | |||||
CODE >R | CODE >R | ||||
HL POP, | |||||
17 BCALL, ( 17 == pushRS ) | |||||
HL POP, 17 BCALL, ( 17 == pushRS ) | |||||
;CODE | ;CODE | ||||
CODE R> | CODE R> | ||||
20 BCALL, ( 20 == popRS ) | |||||
HL PUSH, | |||||
20 BCALL, ( 20 == popRS ) HL PUSH, | |||||
;CODE | ;CODE | ||||
CODE 2>R ( 0xa9 ) | |||||
PC ORG @ 0x35 + ! ( stable ABI JP ) | |||||
DE POP, HL POP, | |||||
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL, | |||||
;CODE NOP, NOP, NOP, | |||||
CODE 2R> | CODE 2R> | ||||
20 BCALL, ( 20 == popRS ) EXDEHL, 20 BCALL, | 20 BCALL, ( 20 == popRS ) EXDEHL, 20 BCALL, | ||||
HL PUSH, DE PUSH, | HL PUSH, DE PUSH, | ||||
@@ -1,6 +1,6 @@ | |||||
( Now we have "as late as possible" stuff. See B70 and B270. ) | ( Now we have "as late as possible" stuff. See B70 and B270. ) | ||||
: _bchk DUP 0x7f + 0xff > IF LIT< br-ovfl (print) ABORT THEN ; | : _bchk DUP 0x7f + 0xff > IF LIT< br-ovfl (print) ABORT THEN ; | ||||
: DO 0xa9 ( 2>R ) , H@ ; IMMEDIATE | |||||
: DO 0x33 ( 2>R ) , H@ ; IMMEDIATE | |||||
: LOOP 0x80 ( loop ) , H@ - _bchk , ; IMMEDIATE | : LOOP 0x80 ( loop ) , H@ - _bchk , ; IMMEDIATE | ||||
( LEAVE is implemented in low xcomp ) | ( LEAVE is implemented in low xcomp ) | ||||
: LITN 0xbf ( n ) , , ; | : LITN 0xbf ( n ) , , ; | ||||
@@ -12,4 +12,4 @@ JMPn, 0 A,, ( 1a, next ) 0 A, 0 A,, ( unused ) | |||||
0 A, 0 A,, ( unused ) | 0 A, 0 A,, ( unused ) | ||||
0 A, 0 A,, 0 A, 0 A, ( unused ) | 0 A, 0 A,, 0 A, 0 A, ( unused ) | ||||
0 A, 0 A,, ( unused ) | 0 A, 0 A,, ( unused ) | ||||
JMPn, 0 A,, ( 33, execute ) 0 A, 0 A, 0 A, 0 A,, ( unused ) | |||||
0 A, JMPn, 0 A,, ( 33, 2>R ) 0 A, 0 A, 0 A,, ( unused ) |
@@ -5,11 +5,8 @@ CODE (loop) ( 0x80 ) | |||||
JNZ, L2 @ RPCs, ( branch ) | JNZ, L2 @ RPCs, ( branch ) | ||||
( don't branch ) | ( don't branch ) | ||||
BP 4 SUBxi, JMPs, L1 @ RPCs, | BP 4 SUBxi, JMPs, L1 @ RPCs, | ||||
ORG @ 0xa3 + HERE ! | |||||
CODE 2>R ( 0xa9 ) | |||||
[BP] 4 POP[w]+, [BP] 2 POP[w]+, BP 4 ADDxi, | |||||
;CODE NOP, NOP, NOP, NOP, NOP, | |||||
ORG @ 0xb9 + HERE ! | |||||
CODE (n) ( 0xbf, number literal ) | CODE (n) ( 0xbf, number literal ) | ||||
DI DX MOVxx, DI [DI] MOVx[], DI PUSHx, | DI DX MOVxx, DI [DI] MOVx[], DI PUSHx, | ||||
DX INCx, DX INCx, | DX INCx, DX INCx, | ||||
;CODE NOP, NOP, | |||||
;CODE NOP, NOP, NOP, NOP, |
@@ -1,4 +1,4 @@ | |||||
lblexec BSET PC 0x36 - ORG @ 0x34 + ! ( DI -> wordref ) | |||||
lblexec BSET ( DI -> wordref ) | |||||
AL [DI] MOVr[], DI INCx, ( PFA ) | AL [DI] MOVr[], DI INCx, ( PFA ) | ||||
AL AL ORrr, IFZ, DI JMPr, THEN, ( native ) | AL AL ORrr, IFZ, DI JMPr, THEN, ( native ) | ||||
AL DECr, IFNZ, ( cell or does ) | AL DECr, IFNZ, ( cell or does ) | ||||
@@ -7,10 +7,10 @@ CODE >R 1 chkPS, | |||||
CODE R> | CODE R> | ||||
[BP] 0 PUSH[w]+, BP DECx, BP DECx, | [BP] 0 PUSH[w]+, BP DECx, BP DECx, | ||||
;CODE | ;CODE | ||||
CODE 2>R | |||||
PC 0x37 - ORG @ 0x35 + ! ( stable abi ) | |||||
[BP] 4 POP[w]+, [BP] 2 POP[w]+, BP 4 ADDxi, | |||||
;CODE | |||||
CODE 2R> 2 chkPS, | CODE 2R> 2 chkPS, | ||||
[BP] -2 PUSH[w]+, [BP] 0 PUSH[w]+, BP 4 SUBxi, | [BP] -2 PUSH[w]+, [BP] 0 PUSH[w]+, BP 4 SUBxi, | ||||
;CODE | ;CODE | ||||
CODE ROT ( a b c -- b c a ) 3 chkPS, | |||||
CX POPx, BX POPx, AX POPx, | |||||
BX PUSHx, CX PUSHx, AX PUSHx, | |||||
;CODE |
@@ -1,3 +1,7 @@ | |||||
CODE ROT ( a b c -- b c a ) 3 chkPS, | |||||
CX POPx, BX POPx, AX POPx, | |||||
BX PUSHx, CX PUSHx, AX PUSHx, | |||||
;CODE | |||||
CODE DUP 1 chkPS, AX POPx, AX PUSHx, AX PUSHx, ;CODE | CODE DUP 1 chkPS, AX POPx, AX PUSHx, AX PUSHx, ;CODE | ||||
CODE ?DUP 1 chkPS, AX POPx, AX AX ORxx, AX PUSHx, | CODE ?DUP 1 chkPS, AX POPx, AX AX ORxx, AX PUSHx, | ||||
IFNZ, AX PUSHx, THEN, ;CODE | IFNZ, AX PUSHx, THEN, ;CODE | ||||
@@ -10,6 +10,8 @@ CREATE BIN( 0 , | |||||
270 LOAD ( xcomp overrides ) | 270 LOAD ( xcomp overrides ) | ||||
H@ ORG ! | H@ ORG ! | ||||
ORG @ 0x33 + HERE ! | |||||
0 C, 0x04 C, ( 2>R ) | |||||
ORG @ 0x3b + HERE ! | ORG @ 0x3b + HERE ! | ||||
," EXIT" | ," EXIT" | ||||
0 , ( prev ) 4 C, | 0 , ( prev ) 4 C, | ||||
@@ -21,13 +23,12 @@ ORG @ 0x5f + HERE ! | |||||
0x02 CODE (?br) ( 0x67 ) | 0x02 CODE (?br) ( 0x67 ) | ||||
ORG @ 0x77 + HERE ! | ORG @ 0x77 + HERE ! | ||||
0x03 CODE (loop) ( 0x80 ) | 0x03 CODE (loop) ( 0x80 ) | ||||
ORG @ 0xa3 + HERE ! | |||||
0x04 CODE 2>R ( 0xa9 ) | |||||
ORG @ 0xb9 + HERE ! | ORG @ 0xb9 + HERE ! | ||||
0x05 CODE (n) ( 0xbf ) | 0x05 CODE (n) ( 0xbf ) | ||||
ORG @ 0xce + HERE ! | ORG @ 0xce + HERE ! | ||||
0x06 CODE (s) ( 0xd4 ) | 0x06 CODE (s) ( 0xd4 ) | ||||
( END OF STABLE ABI ) | ( END OF STABLE ABI ) | ||||
0x04 CODE 2>R | |||||
0x07 CODE >R | 0x07 CODE >R | ||||
0x08 CODE R> | 0x08 CODE R> | ||||
0x09 CODE 2R> | 0x09 CODE 2R> | ||||
@@ -7,7 +7,7 @@ BLKFS = $(CDIR)/blkfs | |||||
.PHONY: all | .PHONY: all | ||||
all: $(TARGETS) | all: $(TARGETS) | ||||
forth: forth.c $(OBJS) $(CDIR)/blkfs | |||||
forth: forth.c $(OBJS) $(BLKFS) | |||||
$(CC) forth.c $(OBJS) -lncurses -o $@ | $(CC) forth.c $(OBJS) -lncurses -o $@ | ||||
libz80/libz80.o: libz80/z80.c | libz80/libz80.o: libz80/z80.c | ||||
@@ -17,7 +17,7 @@ libz80/libz80.o: libz80/z80.c | |||||
emul.o: emul.c forth.bin $(BLKFS) | emul.o: emul.c forth.bin $(BLKFS) | ||||
$(CC) -DFBIN_PATH=\"`pwd`/forth.bin\" -DBLKFS_PATH=\"`pwd`/$(BLKFS)\" -c -o emul.o emul.c | $(CC) -DFBIN_PATH=\"`pwd`/forth.bin\" -DBLKFS_PATH=\"`pwd`/$(BLKFS)\" -c -o emul.o emul.c | ||||
forth.bin: xcomp.fs $(STAGE) | |||||
forth.bin: xcomp.fs $(STAGE) $(BLKFS) | |||||
$(CDIR)/stage < xcomp.fs > $@ | $(CDIR)/stage < xcomp.fs > $@ | ||||
$(BLKFS): $(STAGE) | $(BLKFS): $(STAGE) | ||||