mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-11 08:28:06 +11:00
z80/8086: extract 2>R code from stable ABI zone
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.
This commit is contained in:
parent
94cb76520a
commit
650481f849
4
blk/091
4
blk/091
@ -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
|
33 2>R wordref 42 EXIT wordref 53 (br) wordref
|
||||||
80 (loop) wordref a9 2>R wordref bf (n) 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
|
||||||
|
2
blk/283
2
blk/283
@ -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 )
|
||||||
|
5
blk/286
5
blk/286
@ -1,7 +1,4 @@
|
|||||||
CODE 2>R ( 0xa9 )
|
ORG @ 0xb9 + HERE !
|
||||||
DE POP, HL POP,
|
|
||||||
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL,
|
|
||||||
;CODE NOP, NOP, NOP,
|
|
||||||
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.
|
||||||
|
11
blk/288
11
blk/288
@ -1,11 +1,14 @@
|
|||||||
CODE >R
|
CODE >R
|
||||||
HL POP,
|
HL POP, 17 BCALL, ( 17 == pushRS )
|
||||||
17 BCALL, ( 17 == pushRS )
|
|
||||||
;CODE
|
;CODE
|
||||||
CODE R>
|
CODE R>
|
||||||
20 BCALL, ( 20 == popRS )
|
20 BCALL, ( 20 == popRS ) HL PUSH,
|
||||||
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,
|
||||||
|
2
blk/397
2
blk/397
@ -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 ) , , ;
|
||||||
|
2
blk/805
2
blk/805
@ -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 )
|
||||||
|
7
blk/807
7
blk/807
@ -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 !
|
ORG @ 0xb9 + HERE !
|
||||||
CODE 2>R ( 0xa9 )
|
|
||||||
[BP] 4 POP[w]+, [BP] 2 POP[w]+, BP 4 ADDxi,
|
|
||||||
;CODE NOP, NOP, NOP, NOP, NOP,
|
|
||||||
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,
|
||||||
|
2
blk/810
2
blk/810
@ -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 )
|
||||||
|
8
blk/813
8
blk/813
@ -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
|
|
||||||
|
4
blk/814
4
blk/814
@ -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
|
||||||
|
BIN
cvm/forth.bin
BIN
cvm/forth.bin
Binary file not shown.
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user