Pārlūkot izejas kodu

Make word routine refs 1b instead of 2

Saves quite a bit of binary space. More than 300 bytes in forth1.bin
pull/102/head
Virgil Dupras pirms 4 gadiem
vecāks
revīzija
d8de8a058a
9 mainītis faili ar 13 papildinājumiem un 12 dzēšanām
  1. +1
    -1
      blk/077
  2. +3
    -1
      blk/078
  3. Binārs
      emul/forth/z80c.bin
  4. +1
    -2
      forth/boot.fs
  5. +3
    -3
      forth/core.fs
  6. +1
    -1
      forth/icore.fs
  7. +2
    -2
      forth/link.fs
  8. +1
    -1
      forth/xcomp.fs
  9. +1
    -1
      forth/z80a.fs

+ 1
- 1
blk/077 Parādīt failu

@@ -6,7 +6,7 @@ A dictionary entry has this structure:
bigger than input buffer, of course). not null-terminated
- 2b prev offset
- 1b size + IMMEDIATE flag
- 2b code pointer
- 1b code pointer (always jumps in the <0x100 range)
- Parameter field (PF)

The prev offset is the number of bytes between the prev field


+ 3
- 1
blk/078 Parādīt failu

@@ -1,7 +1,9 @@
(cont.) The code pointer point to "word routines". These
routines expect to be called with IY pointing to the PF. They
themselves are expected to end by jumping to the address at
(IP). They will usually do so with "jp next".
(IP). They will usually do so with "jp next". They are 1b
because all those routines live in the first 0x100 bytes of
the boot binary. The 0 MSB is assumed.

That's for "regular" words (words that are part of the dict
chain). There are also "special words", for example NUMBER,


Binārs
emul/forth/z80c.bin Parādīt failu


+ 1
- 2
forth/boot.fs Parādīt failu

@@ -315,7 +315,6 @@ PC ORG @ 0x34 + ! ( execute )
H 0 LDrn,
( HL points to code pointer )
IY INCss,
IY INCss,
( IY points to PFA )
JP(HL),

@@ -338,7 +337,7 @@ PC ORG @ 0x0f + ! ( compiledWord )
0x33 JPnn, ( 33 == execute )

PC ORG @ 0x0c + ! ( cellWord )
( Pushes the PFA directly )
( Pushes PFA directly )
IY PUSHqq,
JPNEXT,



+ 3
- 3
forth/core.fs Parādīt failu

@@ -58,7 +58,7 @@
: CREATE
(entry) ( empty header with name )
11 ( 11 == cellWord )
, ( write it )
C, ( write it )
;

( We run this when we're in an entry creation context. Many
@@ -71,11 +71,11 @@
: DOES>
( Overwrite cellWord in CURRENT )
( 43 == doesWord )
43 CURRENT @ !
43 CURRENT @ C!
( When we have a DOES>, we forcefully place HERE to 4
bytes after CURRENT. This allows a DOES word to use ","
and "C," without messing everything up. )
CURRENT @ 4 + HERE !
CURRENT @ 3 + HERE !
( HERE points to where we should write R> )
R> ,
( We're done. Because we've popped RS, we'll exit parent


+ 1
- 1
forth/icore.fs Parādīt failu

@@ -237,7 +237,7 @@ XCURRENT @ ( to PSP )
( We cannot use LITN as IMMEDIATE because of bootstrapping
issues. Same thing for ",".
32 == NUMBER 14 == compiledWord )
[ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] ,
[ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C,
BEGIN
WORD
(find)


+ 2
- 2
forth/link.fs Parādīt failu

@@ -82,7 +82,7 @@
)
( ol o a1 a2 -- )
: RLWORD
SWAP DUP @ ( ol o a2 a1 n )
SWAP DUP C@ ( ol o a2 a1 n )
( 0e == compiledWord, 2b == doesWord )
DUP <>{ 0x0e &= 0x2b |= <>} NOT IF
( unwind all args )
@@ -95,7 +95,7 @@
( ol o a2 a1 n )
0x2b = IF 2 + THEN
( ol o a2 a1 )
2 + ( ol o a2 a1+2 )
1 + ( ol o a2 a1+1 )
BEGIN ( ol o a2 a1 )
2OVER ( ol o a2 a1 ol o )
SWAP ( ol o a2 a1 o ol )


+ 1
- 1
forth/xcomp.fs Parādīt failu

@@ -34,7 +34,7 @@ VARIABLE XOFF
: X:
(xentry)
( 0e == compiledWord )
[ 0x0e LITN ] ,
[ 0x0e LITN ] C,
BEGIN
WORD
( cross compile CURRENT )


+ 1
- 1
forth/z80a.fs Parādīt failu

@@ -324,7 +324,7 @@
( same as CREATE, but with native word )
(entry)
( 23 == nativeWord )
23 ,
23 C,
;

: ;CODE JPNEXT, ;


Notiek ielāde…
Atcelt
Saglabāt