Browse Source

Introduce the notion of Extra words

pull/102/head
Virgil Dupras 4 years ago
parent
commit
f38de1c151
16 changed files with 41 additions and 19 deletions
  1. +1
    -0
      blk/001
  2. +2
    -1
      blk/030
  3. +2
    -2
      blk/037
  4. +1
    -1
      blk/102
  5. +14
    -0
      blk/150
  6. +3
    -0
      blk/152
  7. +1
    -0
      blk/153
  8. +0
    -0
      blk/154
  9. +6
    -0
      blk/155
  10. +4
    -0
      blk/156
  11. +5
    -0
      blk/157
  12. +2
    -2
      blk/422
  13. +0
    -5
      blk/434
  14. +0
    -3
      blk/435
  15. +0
    -5
      blk/470
  16. BIN
      emul/forth.bin

+ 1
- 0
blk/001 View File

@@ -3,6 +3,7 @@ MASTER INDEX
3 Usage 30 Dictionary 3 Usage 30 Dictionary
70 Implementation notes 100 Block editor 70 Implementation notes 100 Block editor
120 Linker 140 Addressed devices 120 Linker 140 Addressed devices
150 Extra words
200 Z80 assembler 260 Cross compilation 200 Z80 assembler 260 Cross compilation
280 Z80 boot code 350 ACIA driver 280 Z80 boot code 350 ACIA driver
370 SD Card driver 390 Inner core 370 SD Card driver 390 Inner core


+ 2
- 1
blk/030 View File

@@ -1,6 +1,7 @@
Dictionary Dictionary


Be sure to read usage guide (B3) first.
List of words defined in Inner core (B390), Core words (B420)
and Extra words (B150).


31 Glossary 34 Symbols 31 Glossary 34 Symbols
37 Entry management 40 Defining words 37 Entry management 40 Defining words


+ 2
- 2
blk/037 View File

@@ -1,7 +1,7 @@
Entry management Entry management


(find) a -- a f Read at a and find it in dict. If found,
f=1 and a = wordref. If not found, f=0 and
'? x -- a f Find x it in dict. If found, f=1 and
a = wordref. If not found, f=0 and
a = string addr. a = string addr.
' x -- a Push addr of word x to a. If not found, ' x -- a Push addr of word x to a. If not found,
aborts. aborts.


+ 1
- 1
blk/102 View File

@@ -1,3 +1,4 @@
152 LOAD ( extras )
103 105 LOADR 103 105 LOADR


: BROWSE : BROWSE
@@ -13,4 +14,3 @@
; ;






+ 14
- 0
blk/150 View File

@@ -0,0 +1,14 @@
Extra words

The Core words (B420) section contains the absolute minimum
needed to get a usable Forth interpreter with input buffer and
disk blocks access running. The goal here is to minimize the
binary size of a minimum Collapse OS install.

Extra words are words you will most likely want because they
are generally useful. They are so useful that they are part
of the Dictionary (B30).

Some programs need them, so they will automatically LOAD them.
To that end, the loader is conditional: it aborts if extra
words are already present. Load with "152 LOAD".

+ 3
- 0
blk/152 View File

@@ -0,0 +1,3 @@
'? CASE NOT [IF]
153 157 LOADR
[THEN] DROP ( from '? )

blk/427 → blk/153 View File

@@ -8,3 +8,4 @@
; IMMEDIATE ; IMMEDIATE
: ENDOF [COMPILE] ELSE ; IMMEDIATE : ENDOF [COMPILE] ELSE ; IMMEDIATE




blk/428 → blk/154 View File


+ 6
- 0
blk/155 View File

@@ -0,0 +1,6 @@
: FILL ( a n b -- )
SWAP 2 PICK + ( a b a+n ) ROT ( b a+n a ) DO ( b )
DUP I C!
LOOP
;


+ 4
- 0
blk/156 View File

@@ -0,0 +1,4 @@
: EMPTY
LIT< _sys (find) NOT IF ABORT THEN
DUP HERE ! CURRENT ! ;


+ 5
- 0
blk/157 View File

@@ -0,0 +1,5 @@
: WIPE BLK( 1024 0 FILL BLK!! ;

( src dst -- )
: COPY SWAP BLK@ BLK> ! BLK! ;


+ 2
- 2
blk/422 View File

@@ -8,9 +8,9 @@
: LITS 34 , SCPY ; : LITS 34 , SCPY ;
: LIT< WORD LITS ; IMMEDIATE : LIT< WORD LITS ; IMMEDIATE
: LITA 36 , , ; : LITA 36 , , ;
: '? WORD (find) ;
: ' : '
WORD (find) (?br) [ 4 , ] EXIT
'? (?br) [ 4 , ] EXIT
LIT< (wnf) (find) DROP EXECUTE LIT< (wnf) (find) DROP EXECUTE
; ;
: ['] ' LITA ; IMMEDIATE : ['] ' LITA ; IMMEDIATE


+ 0
- 5
blk/434 View File

@@ -6,10 +6,5 @@
LOOP LOOP
2DROP 2DROP
; ;
: FILL ( a n b -- )
SWAP 2 PICK + ( a b a+n ) ROT ( b a+n a ) DO ( b )
DUP I C!
LOOP
;
: DELW 1- 0 SWAP C! ; : DELW 1- 0 SWAP C! ;
: PREV 3 - DUP @ - ; : PREV 3 - DUP @ - ;

+ 0
- 3
blk/435 View File

@@ -11,6 +11,3 @@
WORD( HERE ! ( w ) WORD( HERE ! ( w )
PREV CURRENT ! PREV CURRENT !
; ;
: EMPTY
LIT< _sys (find) NOT IF ABORT THEN
DUP HERE ! CURRENT ! ;

+ 0
- 5
blk/470 View File

@@ -1,7 +1,2 @@
( b1 b2 -- ) ( b1 b2 -- )
: LOADR 1+ SWAP DO I DUP . CRLF LOAD LOOP ; : LOADR 1+ SWAP DO I DUP . CRLF LOAD LOOP ;

: WIPE BLK( 1024 0 FILL BLK!! ;

( src dst -- )
: COPY SWAP BLK@ BLK> ! BLK! ;

BIN
emul/forth.bin View File


Loading…
Cancel
Save