Explorar el Código

Add word "LOAD"

pull/102/head
Virgil Dupras hace 4 años
padre
commit
aec19e5c87
Se han modificado 7 ficheros con 44 adiciones y 5 borrados
  1. +1
    -1
      blk/001
  2. +1
    -0
      blk/064
  3. +10
    -0
      blk/100
  4. +2
    -0
      blk/102
  5. BIN
      emul/forth/z80c.bin
  6. +28
    -2
      forth/blk.fs
  7. +2
    -2
      forth/icore.fs

+ 1
- 1
blk/001 Ver fichero

@@ -1,4 +1,4 @@
MASTER INDEX

3 Usage 30 Dictionary
70 Implementation notes
70 Implementation notes 100 Block explorer

+ 1
- 0
blk/064 Ver fichero

@@ -3,3 +3,4 @@ Disk
BLK> -- a Address of the current block variable.
LIST n -- Prints the contents of the block n on screen in the
form of 16 lines of 64 columns.
LOAD n -- Interprets Forth code from block n

+ 10
- 0
blk/100 Ver fichero

@@ -0,0 +1,10 @@
Block explorer

This is an application to conveniently browse the contents of
the disk blocks. You can launch it with "102 LOAD".

USAGE: When loaded, the Forth interpreter is replaced by the
explorer interpreter. Typing "Q" quits the program.

Typing a decimal number followed by space or return lists the
contents of that block.

+ 2
- 0
blk/102 Ver fichero

@@ -0,0 +1,2 @@
: foo ." Hello world! " 42 . ;
foo

BIN
emul/forth/z80c.bin Ver fichero


+ 28
- 2
forth/blk.fs Ver fichero

@@ -7,11 +7,17 @@
: BLK!* 2 BLKMEM+ ;
( Current blk pointer in ( )
: BLK> 4 BLKMEM+ ;
: BLK( 6 BLKMEM+ ;
( backup for CINPTR when LOADing )
: BLKC<* 6 BLKMEM+ ;
: BLK( 8 BLKMEM+ ;

: BLK$
H@ 0x57 RAM+ !
1030 ALLOT
( 1024 for the block, 8 for variables )
1032 ALLOT
( LOAD detects end of block with ASCII EOT. This is why
we write it there. EOT == 0x04 )
4 C,
-1 BLK> !
;

@@ -30,3 +36,23 @@
CRLF
LOOP
;

: _
(boot<)
DUP 4 = IF
DROP
( We're finished interpreting )
BLKC<* @ 0x0c RAM+ !
C<
THEN
;

: LOAD
BLK@
( 2e == BOOT C< PTR )
BLK( 0x2e RAM+ !
( Save current C< ptr )
0x0c RAM+ @ BLKC<* !
( 0c == CINPTR )
['] _ 0x0c RAM+ !
;

+ 2
- 2
forth/icore.fs Ver fichero

@@ -178,7 +178,7 @@

( system c< simply reads source from binary, starting at
LATEST. Convenient way to bootstrap a new system. )
: (c<)
: (boot<)
( 2e == BOOT C< PTR )
0x2e RAM+ @ ( a )
DUP C@ ( a c )
@@ -192,7 +192,7 @@
( 2e == SYSTEM SCRATCHPAD )
CURRENT @ 0x2e RAM+ !
( 0c == CINPTR )
LIT< (c<) (find) DROP 0x0c RAM+ !
LIT< (boot<) (find) DROP 0x0c RAM+ !
LIT< INIT (find)
IF EXECUTE
ELSE DROP INTERPRET THEN


Cargando…
Cancelar
Guardar