Sfoglia il codice sorgente

Extract (s) code from stable ABI zone

Only its jump addr remains.
master
Virgil Dupras 3 anni fa
parent
commit
4a91ee5c9c
17 ha cambiato i file con 74 aggiunte e 77 eliminazioni
  1. +3
    -3
      blk/091
  2. +1
    -1
      blk/283
  3. +1
    -0
      blk/286
  4. +0
    -11
      blk/287
  5. +11
    -9
      blk/306
  6. +4
    -2
      blk/307
  7. +1
    -1
      blk/399
  8. +1
    -1
      blk/805
  9. +2
    -1
      blk/807
  10. +9
    -6
      blk/808
  11. +14
    -9
      blk/809
  12. +5
    -14
      blk/810
  13. +9
    -5
      blk/811
  14. +10
    -9
      blk/812
  15. +0
    -3
      blk/813
  16. BIN
      cvm/forth.bin
  17. +3
    -2
      cvm/xcomp.fs

+ 3
- 3
blk/091 Vedi File

@@ -5,9 +5,9 @@ sets that don't change (well, not without some binary manipu-
lation). Here's the complete list of these references:

04 BOOT addr 06 (uflw) addr 08 LATEST
33 2>R wordref 42 EXIT wordref 53 (br) wordref
67 (?br) wordref 80 (loop) wordref bf (n) wordref
d4 (s) wordref
2b (s) wordref 33 2>R wordref 42 EXIT wordref
53 (br) wordref 67 (?br) wordref 80 (loop) wordref
bf (n) wordref

BOOT and (uflw) exist because they are referred to before those
words are defined (in core words). LATEST is a critical part


+ 1
- 1
blk/283 Vedi File

@@ -8,7 +8,7 @@ NOP, NOP, NOP, ( unused )
NOP, NOP, NOP, NOP, ( unused )
NOP, NOP, NOP, NOP, ( unused )
0 JP, ( RST 28 )
NOP, NOP, NOP, NOP, NOP, ( unused )
0 A, 0 JP, ( 2b, (s) ) NOP, ( unused )
0 JP, ( RST 30 )
0 A, 0 JP, ( 33, 2>R ) NOP, ( unused )
0 JP, ( RST 38 )

+ 1
- 0
blk/286 Vedi File

@@ -8,3 +8,4 @@ CODE (n) ( 0xbf, number literal )
IY INCd, IY INCd,
DE PUSH,
;CODE
( END OF STABLE ABI )

+ 0
- 11
blk/287 Vedi File

@@ -1,11 +0,0 @@
CODE (s) ( 0xd4, string literal )
( Like (n) but instead of being followed by a 2 bytes
number, it's followed by a string. When called, puts the
string's address on PS )
IY PUSH, HL POP, ( <-- IP )
E (HL) LDrr, D 0 LDri,
DE INCd,
DE ADDIYd,
HL PUSH,
;CODE
( END OF STABLE ABI )

+ 11
- 9
blk/306 Vedi File

@@ -1,14 +1,16 @@
( Core words )
( KEY and EMIT are not defined here. There're
expected to be defined in platform-specific code. )

( Native words )
CODE EXECUTE
DE POP,
chkPS,
JR, lblexec BWR ( execute-B301 )

CODE ROT ( a b c -- b c a )
HL POP, ( C ) DE POP, ( B ) BC POP, ( A )
chkPS,
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A )
CODE (s) ( string literal )
PC ORG @ 0x2d + ! ( stable ABI JP )
( Like (n) but instead of being followed by a 2 bytes
number, it's followed by a string. When called, puts the
string's address on PS )
IY PUSH, HL POP, ( <-- IP )
E (HL) LDrr, D 0 LDri,
DE INCd,
DE ADDIYd,
HL PUSH,
;CODE

+ 4
- 2
blk/307 Vedi File

@@ -1,14 +1,16 @@
CODE ROT ( a b c -- b c a )
HL POP, ( C ) DE POP, ( B ) BC POP, ( A ) chkPS,
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A )
;CODE
CODE DUP ( a -- a a )
HL POP, chkPS,
HL PUSH, HL PUSH,
;CODE

CODE ?DUP
HL POP, chkPS,
HL PUSH,
HLZ, IFNZ, HL PUSH, THEN,
;CODE

CODE DROP ( a -- )
HL POP,
;CODE

+ 1
- 1
blk/399 Vedi File

@@ -1,4 +1,4 @@
: LIT< 0xd4 ( s ) , WORD DUP C@ 1+ MOVE, ; IMMEDIATE
: LIT< 0x2b ( s ) , WORD DUP C@ 1+ MOVE, ; IMMEDIATE
: BEGIN H@ ; IMMEDIATE
: AGAIN 0x53 ( br ) , H@ - _bchk , ; IMMEDIATE
: UNTIL 0x67 ( ?br ) , H@ - _bchk , ; IMMEDIATE


+ 1
- 1
blk/805 Vedi File

@@ -10,6 +10,6 @@ JMPn, 0 A,, ( 1a, next ) 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,, 0 A, 0 A, ( unused )
0 A, JMPn, 0 A,, ( 2b, (s) ) 0 A, ( unused )
0 A, 0 A,, ( unused )
0 A, JMPn, 0 A,, ( 33, 2>R ) 0 A, 0 A, 0 A,, ( unused )

+ 2
- 1
blk/807 Vedi File

@@ -9,4 +9,5 @@ ORG @ 0xb9 + HERE !
CODE (n) ( 0xbf, number literal )
DI DX MOVxx, DI [DI] MOVx[], DI PUSHx,
DX INCx, DX INCx,
;CODE NOP, NOP, NOP, NOP,
;CODE
( END OF STABLE ABI )

+ 9
- 6
blk/808 Vedi File

@@ -1,6 +1,9 @@
CODE (s) ( 0xd4, string literal, see B287 )
DI DX MOVxx, ( IP )
AH AH XORrr, AL [DI] MOVr[], ( slen )
DX PUSHx, DX INCx, DX AX ADDxx,
;CODE
( END OF STABLE ABI )
lblnext BSET PC 0x1d - ORG @ 0x1b + ! ( next )
( RSP check )
AX RS_ADDR MOVxI, BP AX CMPxx,
IFC, ( BP < RS_ADDR )
DI 0x06 MOVxm, JMPs, L1 FWRs ( execute )
THEN,
DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx,
DI [DI] MOVx[], ( wordref )
( continue to execute ) L1 FSET

+ 14
- 9
blk/809 Vedi File

@@ -1,9 +1,14 @@
lblnext BSET PC 0x1d - ORG @ 0x1b + ! ( next )
( RSP check )
AX RS_ADDR MOVxI, BP AX CMPxx,
IFC, ( BP < RS_ADDR )
DI 0x06 MOVxm, JMPs, L1 FWRs ( execute )
THEN,
DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx,
DI [DI] MOVx[], ( wordref )
( continue to execute ) L1 FSET
lblexec BSET ( DI -> wordref )
AL [DI] MOVr[], DI INCx, ( PFA )
AL AL ORrr, IFZ, DI JMPr, THEN, ( native )
AL DECr, IFNZ, ( cell or does )
DI PUSHx, ( push PFA )
AL DECr, IFZ, ( cell ) JMPs, lblnext @ RPCs, THEN,
( does, see B302 )
DI INCx, DI INCx, DI [DI] MOVx[],
THEN, ( continue to compiled )
( compiled )
BP INCx, BP INCx, [BP] 0 DX MOV[]+x, ( pushRS )
DX DI MOVxx, DX INCx, DX INCx, ( --> IP )
DI [DI] MOVx[],
JMPs, lblexec @ RPCs,

+ 5
- 14
blk/810 Vedi File

@@ -1,14 +1,5 @@
lblexec BSET ( DI -> wordref )
AL [DI] MOVr[], DI INCx, ( PFA )
AL AL ORrr, IFZ, DI JMPr, THEN, ( native )
AL DECr, IFNZ, ( cell or does )
DI PUSHx, ( push PFA )
AL DECr, IFZ, ( cell ) JMPs, lblnext @ RPCs, THEN,
( does, see B302 )
DI INCx, DI INCx, DI [DI] MOVx[],
THEN, ( continue to compiled )
( compiled )
BP INCx, BP INCx, [BP] 0 DX MOV[]+x, ( pushRS )
DX DI MOVxx, DX INCx, DX INCx, ( --> IP )
DI [DI] MOVx[],
JMPs, lblexec @ RPCs,
lblchkPS BSET ( CX -> expected size )
AX PS_ADDR MOVxI, AX SP SUBxx, 2 SUBAXI, ( CALL adjust )
AX CX CMPxx,
IFNC, ( we're good ) RETn, THEN,
( underflow ) DI 0x06 MOVxm, JMPs, lblexec @ RPCs,

+ 9
- 5
blk/811 Vedi File

@@ -1,5 +1,9 @@
lblchkPS BSET ( CX -> expected size )
AX PS_ADDR MOVxI, AX SP SUBxx, 2 SUBAXI, ( CALL adjust )
AX CX CMPxx,
IFNC, ( we're good ) RETn, THEN,
( underflow ) DI 0x06 MOVxm, JMPs, lblexec @ RPCs,
PC 3 - ORG @ 1+ ! ( main )
DX POPx, ( boot drive no ) 0x03 DL MOVmr,
SP PS_ADDR MOVxI, BP RS_ADDR MOVxI,
DI 0x08 MOVxm, ( LATEST )
( HERE begins at CURRENT )
SYSVARS 0x4 ( HERE ) + DI MOVmx,
SYSVARS 0x2 ( CURRENT ) + DI MOVmx,
DI 0x04 ( BOOT ) MOVxm,
JMPn, lblexec @ RPCn, ( execute )

+ 10
- 9
blk/812 Vedi File

@@ -1,9 +1,10 @@
PC 3 - ORG @ 1+ ! ( main )
DX POPx, ( boot drive no ) 0x03 DL MOVmr,
SP PS_ADDR MOVxI, BP RS_ADDR MOVxI,
DI 0x08 MOVxm, ( LATEST )
( HERE begins at CURRENT )
SYSVARS 0x4 ( HERE ) + DI MOVmx,
SYSVARS 0x2 ( CURRENT ) + DI MOVmx,
DI 0x04 ( BOOT ) MOVxm,
JMPn, lblexec @ RPCn, ( execute )
( native words )
CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn,

CODE (s) ( string literal, see B287 )
PC 0x2f - ORG @ 0x2d + ! ( stable abi )
DI DX MOVxx, ( IP )
AH AH XORrr, AL [DI] MOVr[], ( slen )
DX PUSHx, DX INCx, DX AX ADDxx,
;CODE

+ 0
- 3
blk/813 Vedi File

@@ -1,6 +1,3 @@
( native words )
CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn,
CODE >R 1 chkPS,
BP INCx, BP INCx, [BP] 0 POP[w]+,
;CODE NOP, NOP, NOP,


BIN
cvm/forth.bin Vedi File


+ 3
- 2
cvm/xcomp.fs Vedi File

@@ -10,6 +10,8 @@ CREATE BIN( 0 ,
270 LOAD ( xcomp overrides )

H@ ORG !
ORG @ 0x2b + HERE !
0 C, 0x06 C, ( (s) )
ORG @ 0x33 + HERE !
0 C, 0x04 C, ( 2>R )
ORG @ 0x3b + HERE !
@@ -25,9 +27,8 @@ ORG @ 0x77 + HERE !
0x03 CODE (loop) ( 0x80 )
ORG @ 0xb9 + HERE !
0x05 CODE (n) ( 0xbf )
ORG @ 0xce + HERE !
0x06 CODE (s) ( 0xd4 )
( END OF STABLE ABI )
0x06 CODE (s)
0x04 CODE 2>R
0x07 CODE >R
0x08 CODE R>


Loading…
Annulla
Salva