Quellcode durchsuchen

Add CURRENT* and simplify xcomp

pull/102/head
Virgil Dupras vor 4 Jahren
Ursprung
Commit
e6d3638f4f
7 geänderte Dateien mit 25 neuen und 28 gelöschten Zeilen
  1. +2
    -0
      dictionary.txt
  2. +5
    -0
      emul/forth/xcomp.fs
  3. BIN
      emul/forth/z80c.bin
  4. +3
    -1
      forth/icore.fs
  5. +8
    -22
      forth/xcomp.fs
  6. +0
    -4
      forth/z80c.fs
  7. +7
    -1
      notes.txt

+ 2
- 0
dictionary.txt Datei anzeigen

@@ -98,6 +98,8 @@ J -- n Copy RS third item to PS
C@ a -- c Set c to byte at address a
C! c a -- Store byte c in address a
CURRENT -- a Set a to wordref of last added entry.
CURRENT* -- a A pointer to active CURRENT*. Useful when we have
multiple active dicts.
HERE -- a Push HERE's address
H@ -- a HERE @
MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting with a1, going


+ 5
- 0
emul/forth/xcomp.fs Datei anzeigen

@@ -4,3 +4,8 @@

CURRENT @ XCURRENT !
H@ ' _bend - 4 + XOFF !

( dummy entry for dict hook )
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!


BIN
emul/forth/z80c.bin Datei anzeigen


+ 3
- 1
forth/icore.fs Datei anzeigen

@@ -35,7 +35,8 @@
: FLAGS 0x08 RAM+ ;
: (parse*) 0x0a RAM+ ;
: HERE 0x04 RAM+ ;
: CURRENT 0x02 RAM+ ;
: CURRENT* 0x51 RAM+ ;
: CURRENT CURRENT* @ ;

( w -- a f )
: (find) CURRENT @ SWAP _find ;
@@ -185,6 +186,7 @@
;

: BOOT
0x02 RAM+ CURRENT* !
LIT< (parse) (find) DROP (parse*) !
( 60 == SYSTEM SCRATCHPAD )
CURRENT @ 0x60 RAM+ !


+ 8
- 22
forth/xcomp.fs Datei anzeigen

@@ -24,40 +24,26 @@
VARIABLE XCURRENT
VARIABLE XOFF

: (xentry)
H@ ( h )
WORD ( h s )
SCPY ( h )
( Adjust HERE -1 because SCPY copies the null )
H@ 1 - ( h h' )
DUP HERE ! ( h h' )
-^ ( sz )
( write prev value )
H@ XCURRENT @ - ,
( write size )
C,
H@ XCURRENT !
;
: XCON XCURRENT CURRENT* ! ;
: XCOFF CURRENT CURRENT* ! ;

: (xentry) XCON (entry) XCOFF ;

( Finds in *both* CURRENT and XCURRENT )
( w -- a f xa xf )
: (xfind)
DUP ( w w )
CURRENT @ SWAP ( w cur w )
( hardcoded system CURRENT )
0x02 RAM+ @ SWAP ( w cur w )
_find ( w a f )
ROT ( a f w )
XCURRENT @ SWAP ( a f xcur w )
_find ( a f xa xf )
;

: XCODE
(xentry) 23 ,
;
: XCODE XCON CODE XCOFF ;

: XIMM
XCURRENT @ 1 -
DUP C@ 128 OR SWAP C!
;
: XIMM XCON IMMEDIATE XCOFF ;

: X:
(xentry)


+ 0
- 4
forth/z80c.fs Datei anzeigen

@@ -22,10 +22,6 @@
This unit expects the same conf as boot.fs.
)

( dummy entry for dict hook )
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!

( a b c -- b c a )
CODE ROT
HL POPqq, ( C )


+ 7
- 1
notes.txt Datei anzeigen

@@ -88,7 +88,8 @@ RAMSTART INITIAL_SP
+0e WORDBUF
+2e SYSVNXT
+4e INTJUMP
+51 RESERVED
+51 CURRENTPTR
+53 RESERVED
+60 SYSTEM SCRATCHPAD
+80 RAMEND

@@ -116,6 +117,11 @@ those slots...) in boot binaries are made to jump to this address. If you use
one of those slots for an interrupt, write a jump to the appropriate offset in
that RAM location.

CURRENTPTR points to current CURRENT. The Forth CURRENT word doesn't return
RAM+2 directly, but rather the value at this address. Most of the time, it
points to RAM+2, but sometimes, when maintaining alternative dicts (during
cross compilation for example), it can point elsewhere.

SYSTEM SCRATCHPAD is reserved for temporary system storage or can be reserved
by low-level drivers. These are the current usages of this space throughout the
project:


Laden…
Abbrechen
Speichern