mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 10:30:55 +11:00
Compare commits
3 Commits
b89fa2981f
...
ab6a2688fe
Author | SHA1 | Date | |
---|---|---|---|
|
ab6a2688fe | ||
|
58ece9f9a1 | ||
|
f54b1dc504 |
2
blk/048
2
blk/048
@ -1,7 +1,9 @@
|
|||||||
Return Stack
|
Return Stack
|
||||||
|
|
||||||
>R n -- R:n Pops PS and push to RS
|
>R n -- R:n Pops PS and push to RS
|
||||||
|
2>R x y -- R:x y Equivalent to SWAP >R >R
|
||||||
R> R:n -- n Pops RS and push to PS
|
R> R:n -- n Pops RS and push to PS
|
||||||
|
2R> R:x y -- x y Equivalent to R> R> SWAP
|
||||||
I -- n Copy RS TOS to PS
|
I -- n Copy RS TOS to PS
|
||||||
I' -- n Copy RS second item to PS
|
I' -- n Copy RS second item to PS
|
||||||
J -- n Copy RS third item to PS
|
J -- n Copy RS third item to PS
|
||||||
|
2
blk/101
2
blk/101
@ -2,7 +2,7 @@ T ( n -- ): select line n for editing.
|
|||||||
P xxx: put typed line on selected line.
|
P xxx: put typed line on selected line.
|
||||||
U xxx: insert typed line on selected line.
|
U xxx: insert typed line on selected line.
|
||||||
F xxx: find typed string in block.
|
F xxx: find typed string in block.
|
||||||
|
I xxx: insert typed string at cursor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
blk/102
2
blk/102
@ -1,5 +1,5 @@
|
|||||||
50 LOAD+ ( B152, extras )
|
50 LOAD+ ( B152, extras )
|
||||||
1 5 LOADR+
|
1 6 LOADR+
|
||||||
|
|
||||||
: BROWSE
|
: BROWSE
|
||||||
0 ACC ! L
|
0 ACC ! L
|
||||||
|
2
blk/105
2
blk/105
@ -1,5 +1,5 @@
|
|||||||
: _type ( buf -- )
|
: _type ( buf -- )
|
||||||
C< DUP 0xd = IF DROP EXIT THEN OVER DUP _zbuf ( c a )
|
C< DUP 0xd = IF 2DROP EXIT THEN OVER DUP _zbuf ( c a )
|
||||||
BEGIN ( c a )
|
BEGIN ( c a )
|
||||||
C!+ C< SWAP
|
C!+ C< SWAP
|
||||||
OVER 0x0d = UNTIL ( c a ) C! ;
|
OVER 0x0d = UNTIL ( c a ) C! ;
|
||||||
|
15
blk/108
Normal file
15
blk/108
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
: _ilen ( length of str in IBUF )
|
||||||
|
IBUF BEGIN C@+ EOL? UNTIL IBUF - 1- ;
|
||||||
|
: I
|
||||||
|
IBUF _type EDPOS @ 64 /MOD ( cno lno )
|
||||||
|
1+ 64 * _cpos ( cno next-line-ptr )
|
||||||
|
SWAP 63 -^ _ilen ( nlp nb-of-chars-to-move ilen )
|
||||||
|
2DUP > IF
|
||||||
|
SWAP OVER - 1+ ( nlp ilen nbc ) 0 DO ( a ilen )
|
||||||
|
SWAP 1- 2DUP -^ ( ilen a-1 a-ilen-1 ) C@ OVER C!
|
||||||
|
SWAP ( a ilen )
|
||||||
|
LOOP
|
||||||
|
ELSE DROP ( ilen becomes nbc )
|
||||||
|
THEN
|
||||||
|
SWAP DROP IBUF EDPOS @ _cpos ROT MOVE
|
||||||
|
;
|
18
blk/326
18
blk/326
@ -1,13 +1,17 @@
|
|||||||
CODE >R
|
CODE >R
|
||||||
HL POPqq,
|
HL POPqq, chkPS,
|
||||||
chkPS,
|
17 BCALL, ( 17 == pushRS )
|
||||||
( 17 == pushRS )
|
;CODE
|
||||||
17 BCALL,
|
CODE 2>R
|
||||||
|
DE POPqq, HL POPqq, chkPS,
|
||||||
|
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE R>
|
CODE R>
|
||||||
( 20 == popRS )
|
20 BCALL, ( 20 == popRS )
|
||||||
20 BCALL,
|
|
||||||
HL PUSHqq,
|
HL PUSHqq,
|
||||||
;CODE
|
;CODE
|
||||||
|
CODE 2R>
|
||||||
|
20 BCALL, ( 20 == popRS ) EXDEHL, 20 BCALL,
|
||||||
|
HL PUSHqq, DE PUSHqq,
|
||||||
|
;CODE
|
||||||
|
|
||||||
|
7
blk/431
7
blk/431
@ -3,11 +3,8 @@
|
|||||||
: / /MOD SWAP DROP ;
|
: / /MOD SWAP DROP ;
|
||||||
: MOD /MOD DROP ;
|
: MOD /MOD DROP ;
|
||||||
|
|
||||||
( In addition to pushing H@ this compiles 2 >R so that loop
|
( In addition to pushing H@ this compiles 2>R so that loop
|
||||||
variables are sent to PS at runtime )
|
variables are sent to PS at runtime )
|
||||||
: DO
|
: DO COMPILE 2>R H@ ; IMMEDIATE
|
||||||
COMPILE SWAP COMPILE >R COMPILE >R
|
|
||||||
H@
|
|
||||||
; IMMEDIATE
|
|
||||||
|
|
||||||
|
|
||||||
|
2
blk/432
2
blk/432
@ -12,5 +12,5 @@
|
|||||||
: LOOP
|
: LOOP
|
||||||
COMPILE _ COMPILE (?br)
|
COMPILE _ COMPILE (?br)
|
||||||
H@ - ,
|
H@ - ,
|
||||||
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
|
COMPILE 2R> COMPILE 2DROP
|
||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
6
blk/456
6
blk/456
@ -1,10 +1,12 @@
|
|||||||
: .2 DUP 10 < IF SPC THEN . ;
|
: .2 DUP 10 < IF SPC THEN . ;
|
||||||
|
: EOL? ( c -- f ) DUP 0xd = SWAP NOT OR ;
|
||||||
: LIST
|
: LIST
|
||||||
BLK@
|
BLK@
|
||||||
16 0 DO
|
16 0 DO
|
||||||
I 1+ .2 SPC
|
I 1+ .2 SPC
|
||||||
64 I * BLK( + (print)
|
64 I * BLK( + DUP 64 + SWAP DO
|
||||||
|
I C@ DUP EOL? IF DROP LEAVE ELSE EMIT THEN
|
||||||
|
LOOP
|
||||||
NL
|
NL
|
||||||
LOOP
|
LOOP
|
||||||
;
|
;
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
@ -276,31 +276,47 @@ you're already supposed to know that one). Then, run `BYE` to return to TRSDOS
|
|||||||
just halting). Then, you can dump memory to floppy as you already did for
|
just halting). Then, you can dump memory to floppy as you already did for
|
||||||
`RECV`.
|
`RECV`.
|
||||||
|
|
||||||
## Configuration
|
## Sending blkfs to floppy
|
||||||
|
|
||||||
In addition to the generic basic shell, this build of Collapse OS has support
|
As it is, your system fully supports reading and writing to floppy drive 1. It
|
||||||
for floppy drive `:1` as a block device (mapped to device `0`). Block device
|
also had `*CL<` to read a char from `*cl` and `*CL>` to emit a char to `*cl`.
|
||||||
commands work as expected.
|
|
||||||
|
|
||||||
In addition to this, there is a `flush` command to ensure that dirty buffers are
|
That's all you need to have a full Collapse OS with access to disk blocks.
|
||||||
synced to disk. Make sure you run this after a write operation or before
|
|
||||||
swapping disks.
|
|
||||||
|
|
||||||
On top of that, there's CFS support builtin. To enable a FS, type `fson` while
|
First, make sure your floppies are formatted. Collapse OS is currently
|
||||||
the active block device is properly placed (you can initialize a new FS by
|
hardcoded to single side and single density, which means there's a limit of 100
|
||||||
writing `CFS\0\0\0\0` to the disk). If it doesn't error out, commands like
|
blocks per disk.
|
||||||
`fls` and `fnew` will work. Don't forget to flush when you're finished :)
|
|
||||||
|
|
||||||
There is also a custom `recv` command that does the same "ping pong" as in
|
You'll need to send those blocks through RS-232. Begin by taking over the
|
||||||
`recv.asm`, but once. It puts the result in `A`. This can be useful to send down
|
prompt:
|
||||||
a raw CFS: you just need a while loop that repeatedly call `recv:putb a`.
|
|
||||||
|
|
||||||
## Assembling programs
|
' *CL> 0x53 RAM+ !
|
||||||
|
' *CL< 0x55 RAM+ !
|
||||||
|
|
||||||
Running `make` will yield a `floppy.cfs` file that you can dump on a disk. This
|
See B80 for details about those RAM offsets. Your serial link now has the
|
||||||
CFS contains a properly configured `zasm` as well as a test `hello.asm` file.
|
prompt. Now, you can use `/tools/blkup` to send a disk's contents. First,
|
||||||
|
extract the first 100 blocks from blkfs:
|
||||||
|
|
||||||
|
dd if=emul/blkfs bs=1024 count=100 > d1
|
||||||
|
|
||||||
|
Now, insert your formatted disk in drive 1 and push your blocks:
|
||||||
|
|
||||||
|
tools/blkup /dev/ttyUSB0 0 d1
|
||||||
|
|
||||||
|
It takes a while, but you will end up having your first 100 blocks on floppy!
|
||||||
|
Go ahead, `LIST` around. Then, repeat for other disks.
|
||||||
|
|
||||||
|
## Floppy organisation
|
||||||
|
|
||||||
|
Making blkfs span multiple disk is a bit problematic with regards to absolute
|
||||||
|
block references in the code. You'll need to work a bit to design your very
|
||||||
|
own Collapse OS floppy set. See Usage guide (B3) for details.
|
||||||
|
|
||||||
|
## Self-hosting
|
||||||
|
|
||||||
|
As it is, your installment of Collapse OS is self-hosting using instructions
|
||||||
|
very similar to `recipes/rc2014/selhost`. The difference is that instead of
|
||||||
|
writing the binary you have in memory to EEPROM, you'll quit to TRSDOS with
|
||||||
|
`BYE` and use TRSDOS' `DUMP` utility to save to disk like you already did
|
||||||
|
before.
|
||||||
|
|
||||||
By mounting this CFS (running `fson` with the active device properly placed),
|
|
||||||
you can assemble and run a binary from `hello.asm` in the same way that you
|
|
||||||
would in any CFS-enabled shell. You'll then see those sweet "Assembled from a
|
|
||||||
TRS-80" words!
|
|
||||||
|
Loading…
Reference in New Issue
Block a user