1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 10:20:55 +11:00

Compare commits

..

No commits in common. "f38de1c151b7453e53085b8bc260c6b0dc00564f" and "b046aba7f9d5452b1873f91b069e7d48b5f5beb5" have entirely different histories.

29 changed files with 42 additions and 69 deletions

View File

@ -3,12 +3,12 @@ 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 150 AT28 Driver
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
420 Core words 480 AT28 Driver 420 Core words
490 TRS80 Drivers

View File

@ -1,7 +1,6 @@
Dictionary Dictionary
List of words defined in Inner core (B390), Core words (B420) Be sure to read usage guide (B3) first.
and Extra words (B150).
31 Glossary 34 Symbols 31 Glossary 34 Symbols
37 Entry management 40 Defining words 37 Entry management 40 Defining words

View File

@ -1,7 +1,7 @@
Entry management Entry management
'? x -- a f Find x it in dict. If found, f=1 and (find) a -- a f Read at a and find it in dict. If found,
a = wordref. If not found, f=0 and 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.

View File

@ -1,8 +1,6 @@
Disk Disk
BLK> -- a Address of the current block variable. BLK> -- a Address of the current block variable.
COPY s d -- Copy contents of s block to d block.
FLUSH -- Write current block to disk if dirty.
LIST n -- Prints the contents of the block n on screen LIST n -- Prints the contents of the block n on screen
in the form of 16 lines of 64 columns. in the form of 16 lines of 64 columns.
LOAD n -- Interprets Forth code from block n LOAD n -- Interprets Forth code from block n

View File

@ -1,4 +1,3 @@
152 LOAD ( extras )
103 105 LOADR 103 105 LOADR
: BROWSE : BROWSE
@ -14,3 +13,4 @@
; ;

16
blk/150
View File

@ -1,14 +1,6 @@
Extra words AT28 Driver
The Core words (B420) section contains the absolute minimum Write to an AT28 EEPROM while making sure that proper timing
needed to get a usable Forth interpreter with input buffer and is followed and verify data integrity.
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 Load with "151 LOAD"
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".

View File

View File

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

View File

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

View File

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

View File

@ -1,5 +0,0 @@
: WIPE BLK( 1024 0 FILL BLK!! ;
( src dst -- )
: COPY SWAP BLK@ BLK> ! BLK! ;

View File

@ -4,5 +4,5 @@ Drivers for the TRS-80 keyboard, video and floppy. At the
moment, they are thin layer over the drivers provided by moment, they are thin layer over the drivers provided by
TRSDOS' SVC. TRSDOS' SVC.
Load the Z80 words with "492 LOAD" and the high level part Load the Z80 words with "162 LOAD" and the high level part
with "494 LOAD". with "164 LOAD".

View File

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) ;
: ' : '
'? (?br) [ 4 , ] EXIT WORD (find) (?br) [ 4 , ] EXIT
LIT< (wnf) (find) DROP EXECUTE LIT< (wnf) (find) DROP EXECUTE
; ;
: ['] ' LITA ; IMMEDIATE : ['] ' LITA ; IMMEDIATE

View File

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

View File

View File

@ -6,5 +6,10 @@
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 @ - ;

View File

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

View File

@ -2,10 +2,10 @@
BLK> @ BLK!* @ EXECUTE BLK> @ BLK!* @ EXECUTE
0 BLKDTY ! 0 BLKDTY !
; ;
: FLUSH BLKDTY @ IF BLK! THEN ;
: BLK@ ( n -- ) : BLK@ ( n -- )
FLUSH
DUP BLK> @ = IF DROP EXIT THEN DUP BLK> @ = IF DROP EXIT THEN
BLKDTY @ IF BLK! THEN
DUP BLK> ! BLK@* @ EXECUTE DUP BLK> ! BLK@* @ EXECUTE
; ;

View File

@ -1,2 +1,4 @@
( 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!! ;

View File

@ -1,6 +0,0 @@
AT28 Driver
Write to an AT28 EEPROM while making sure that proper timing
is followed and verify data integrity.
Load with "481 LOAD"

2
emul/.gitignore vendored
View File

@ -3,5 +3,5 @@
/stage2 /stage2
/forth /forth
/*-bin.h /*-bin.h
/stage0.bin /stage1.bin
/blkfs /blkfs

View File

@ -14,10 +14,7 @@ $(BLKPACK):
$(BIN2C): $(BLKPACK) $(BIN2C): $(BLKPACK)
$(BLKUNPACK): $(BLKPACK) $(BLKUNPACK): $(BLKPACK)
stage0.bin: stage2 xcomp.fs stage0-bin.h: $(BIN2C)
cat xcomp.fs | ./stage2 > stage0.bin
stage0-bin.h: stage0.bin $(BIN2C)
$(BIN2C) KERNEL < stage0.bin > $@ $(BIN2C) KERNEL < stage0.bin > $@
stage1: stage.c $(OBJS) stage0-bin.h stage1: stage.c $(OBJS) stage0-bin.h
@ -26,11 +23,13 @@ stage1: stage.c $(OBJS) stage0-bin.h
stage1dbg: stage.c $(OBJS) stage0-bin.h stage1dbg: stage.c $(OBJS) stage0-bin.h
$(CC) -DDEBUG stage.c $(OBJS) -o $@ $(CC) -DDEBUG stage.c $(OBJS) -o $@
# not dependent on forth.bin to avoid circular deps. stage1.bin: stage1.fs stage1
forth-bin.h: $(BIN2C) ./stage1 < stage1.fs > $@
$(BIN2C) KERNEL < forth.bin > $@
stage2: stage.c $(OBJS) forth-bin.h blkfs-bin.h stage1-bin.h: stage1.bin $(BIN2C)
$(BIN2C) KERNEL < stage1.bin > $@
stage2: stage.c $(OBJS) stage1-bin.h blkfs-bin.h
$(CC) -DSTAGE2 stage.c $(OBJS) -o $@ $(CC) -DSTAGE2 stage.c $(OBJS) -o $@
blkfs: $(BLKPACK) blkfs: $(BLKPACK)
@ -39,7 +38,7 @@ blkfs: $(BLKPACK)
blkfs-bin.h: blkfs $(BIN2C) blkfs-bin.h: blkfs $(BIN2C)
$(BIN2C) BLKFS < blkfs > $@ $(BIN2C) BLKFS < blkfs > $@
forth: forth.c $(OBJS) forth-bin.h blkfs-bin.h forth: forth.c $(OBJS) stage1-bin.h blkfs-bin.h
$(CC) forth.c $(OBJS) -o $@ $(CC) forth.c $(OBJS) -o $@
libz80/libz80.o: libz80/z80.c libz80/libz80.o: libz80/z80.c
@ -51,8 +50,8 @@ emul.o: emul.c
.PHONY: updatebootstrap .PHONY: updatebootstrap
updatebootstrap: stage1 stage1.fs updatebootstrap: stage2
./stage1 < stage1.fs > forth.bin cat xcomp.fs | ./stage2 > stage0.bin
.PHONY: pack .PHONY: pack
pack: pack:

Binary file not shown.

View File

@ -3,7 +3,7 @@
#include <unistd.h> #include <unistd.h>
#include <termios.h> #include <termios.h>
#include "emul.h" #include "emul.h"
#include "forth-bin.h" #include "stage1-bin.h"
#include "blkfs-bin.h" #include "blkfs-bin.h"
// in sync with glue.asm // in sync with glue.asm

View File

@ -3,7 +3,7 @@
#include <unistd.h> #include <unistd.h>
#include "emul.h" #include "emul.h"
#ifdef STAGE2 #ifdef STAGE2
#include "forth-bin.h" #include "stage1-bin.h"
#include "blkfs-bin.h" #include "blkfs-bin.h"
#else #else
#include "stage0-bin.h" #include "stage0-bin.h"

BIN
emul/stage0.bin Normal file

Binary file not shown.

View File

@ -46,7 +46,7 @@ Addressed devices are at B140. To know what you have to paste, open the loader
block (B142) and see what blocks it loads. For each of the blocks, copy/paste block (B142) and see what blocks it loads. For each of the blocks, copy/paste
the code in your interpreter. the code in your interpreter.
Do the same thing with the AT28 driver (B480) Do the same thing with the AT28 driver (B150)
If you're doing the real thing and not using the emulator, pasting so much code If you're doing the real thing and not using the emulator, pasting so much code
at once might freeze up the RC2014, so it is recommended that you use at once might freeze up the RC2014, so it is recommended that you use

View File

@ -12,7 +12,7 @@ CURRENT @ XCURRENT !
H@ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!
0x3000 BIN( ! 0x3000 BIN( !
282 LOAD ( boot.z80 ) 282 LOAD ( boot.z80 )
492 LOAD ( trs80.z80 ) 162 LOAD ( trs80.z80 )
393 LOAD ( icore ) 393 LOAD ( icore )
(entry) _ (entry) _
( Update LATEST ) ( Update LATEST )