mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 20:18:06 +11:00
Compare commits
No commits in common. "a36db99651d970ef575b0f0b22dfc50fb2d7a29a" and "15acf30ca3aa2845b5649b589f051fe248c70d0a" have entirely different histories.
a36db99651
...
15acf30ca3
2
blk/103
2
blk/103
@ -1,4 +1,4 @@
|
|||||||
CREATE ACC 0 ,
|
VARIABLE ACC
|
||||||
: _LIST ." Block " DUP . NL LIST ;
|
: _LIST ." Block " DUP . NL LIST ;
|
||||||
: _NUM
|
: _NUM
|
||||||
ACC @ SWAP _pdacc
|
ACC @ SWAP _pdacc
|
||||||
|
6
blk/104
6
blk/104
@ -1,7 +1,7 @@
|
|||||||
( Cursor position in buffer. EDPOS/64 is line number )
|
( Cursor position in buffer. EDPOS/64 is line number )
|
||||||
CREATE EDPOS 0 ,
|
VARIABLE EDPOS
|
||||||
CREATE IBUF 64 ALLOT0
|
CREATE IBUF 64 ALLOT
|
||||||
CREATE FBUF 64 ALLOT0
|
CREATE FBUF 64 ALLOT
|
||||||
: _cpos BLK( + ;
|
: _cpos BLK( + ;
|
||||||
: _lpos 64 * _cpos ;
|
: _lpos 64 * _cpos ;
|
||||||
: _pln ( lineno -- )
|
: _pln ( lineno -- )
|
||||||
|
8
blk/105
8
blk/105
@ -6,9 +6,7 @@
|
|||||||
( user-facing lines are 1-based )
|
( user-facing lines are 1-based )
|
||||||
: T 1- DUP 64 * EDPOS ! _pln ;
|
: T 1- DUP 64 * EDPOS ! _pln ;
|
||||||
: P IBUF _type IBUF EDPOS @ _cpos 64 MOVE BLK!! ;
|
: P IBUF _type IBUF EDPOS @ _cpos 64 MOVE BLK!! ;
|
||||||
: _mvln+ ( ln -- move ln 1 line down )
|
: _mvln+ ( ln -- move ln 1 line further )
|
||||||
DUP 14 > IF DROP EXIT THEN
|
DUP 14 > IF DROP EXIT THEN
|
||||||
_lpos DUP 64 + 64 MOVE ;
|
_lpos DUP 64 + 64 MOVE
|
||||||
: _mvln- ( ln -- move ln 1 line up )
|
;
|
||||||
DUP 14 > IF DROP 15 _lpos _zbuf
|
|
||||||
ELSE 1+ _lpos DUP 64 - 64 MOVE THEN ;
|
|
||||||
|
12
blk/122
12
blk/122
@ -8,9 +8,9 @@ Block Editor (B100). Refer to documentation there.
|
|||||||
|
|
||||||
'o' inserts a blank line after the cursor. 'O', before.
|
'o' inserts a blank line after the cursor. 'O', before.
|
||||||
|
|
||||||
'D' deletes "modifier" lines at the cursor.
|
'f' puts the contents of your previous cursor movement into the
|
||||||
|
find buffer. If that movement was a forward movement, it brings
|
||||||
|
the cursor back where it was. This allows for an efficient
|
||||||
|
combination of movements and 'E'. For example, if you want to
|
||||||
|
delete the next word, you type 'w', then 'f', then check your
|
||||||
(cont.)
|
"F" buffer to be sure, then press 'E'. (cont.)
|
||||||
|
7
blk/123
7
blk/123
@ -1,10 +1,3 @@
|
|||||||
'f' puts the contents of your previous cursor movement into the
|
|
||||||
find buffer. If that movement was a forward movement, it brings
|
|
||||||
the cursor back where it was. This allows for an efficient
|
|
||||||
combination of movements and 'E'. For example, if you want to
|
|
||||||
delete the next word, you type 'w', then 'f', then check your
|
|
||||||
"F" buffer to be sure, then press 'E'.
|
|
||||||
|
|
||||||
'X' deletes "modifier" characters following cursor.
|
'X' deletes "modifier" characters following cursor.
|
||||||
|
|
||||||
'R' goes into replace mode at current cursor position.
|
'R' goes into replace mode at current cursor position.
|
||||||
|
4
blk/130
4
blk/130
@ -8,7 +8,5 @@
|
|||||||
EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
|
EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
|
||||||
THEN UNTIL mode! SPC contents ;
|
THEN UNTIL mode! SPC contents ;
|
||||||
: $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN
|
: $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN
|
||||||
_U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf BLK!! contents ;
|
_U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf contents ;
|
||||||
: $o EDPOS @ 64 < IF EXIT THEN EDPOS @ 64 + EDPOS ! $O ;
|
: $o EDPOS @ 64 < IF EXIT THEN EDPOS @ 64 + EDPOS ! $O ;
|
||||||
: $D acc@ 0 DO 16 EDPOS @ 64 / DO i _mvln- LOOP LOOP
|
|
||||||
BLK!! contents ;
|
|
||||||
|
6
blk/131
6
blk/131
@ -3,12 +3,14 @@
|
|||||||
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
|
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
|
||||||
UPPER 'Q' = ;
|
UPPER 'Q' = ;
|
||||||
: bufp ( buf -- )
|
: bufp ( buf -- )
|
||||||
DUP 64 + SWAP DO i C@ 0x20 MAX EMIT LOOP ;
|
DUP 64 + SWAP DO
|
||||||
|
i C@ DUP 0x20 < IF DROP 0x20 THEN EMIT
|
||||||
|
LOOP ;
|
||||||
: bufs
|
: bufs
|
||||||
1 aty ." I: " IBUF bufp
|
1 aty ." I: " IBUF bufp
|
||||||
2 aty ." F: " FBUF bufp ;
|
2 aty ." F: " FBUF bufp ;
|
||||||
: c<over KEY DUP EMIT DUP 0x0a = IF DROP 0x0d THEN ;
|
: c<over KEY DUP EMIT DUP 0x0a = IF DROP 0x0d THEN ;
|
||||||
: VE ['] c<over 0x08 ( C< override ) RAM+ !
|
: VE ['] c<over 0x08 ( C< override ) RAM+ !
|
||||||
clrscr 0acc 0 PREVPOS ! contents
|
clrscr 0acc 0 EDPOS ! 0 PREVPOS ! contents
|
||||||
BEGIN status bufs setpos KEY handle UNTIL
|
BEGIN status bufs setpos KEY handle UNTIL
|
||||||
0 0x08 RAM+ ! 19 aty ;
|
0 0x08 RAM+ ! 19 aty ;
|
||||||
|
1
blk/155
1
blk/155
@ -2,4 +2,3 @@
|
|||||||
SWAP 2 PICK + ( a b a+n ) ROT ( b a+n a ) DO ( b )
|
SWAP 2 PICK + ( a b a+n ) ROT ( b a+n a ) DO ( b )
|
||||||
DUP I C!
|
DUP I C!
|
||||||
LOOP DROP ;
|
LOOP DROP ;
|
||||||
: ALLOT0 ( n -- ) H@ OVER 0 FILL ALLOT ;
|
|
||||||
|
14
blk/493
14
blk/493
@ -1,16 +1,16 @@
|
|||||||
CODE (key)
|
CODE (key)
|
||||||
A 0x01 LDrn, ( @KEY )
|
A 0x01 LDrn, ( @KEY )
|
||||||
0x28 RSTn,
|
0x28 RSTn,
|
||||||
PUSHA,
|
L A LDrr, H 0 LDrn,
|
||||||
|
HL PUSHqq,
|
||||||
;CODE
|
;CODE
|
||||||
CODE (emit)
|
CODE (emit)
|
||||||
BC POPqq, ( c == @DSP arg ) chkPS,
|
BC POPqq, ( c == @DSP arg )
|
||||||
|
chkPS,
|
||||||
A 0x02 LDrn, ( @DSP )
|
A 0x02 LDrn, ( @DSP )
|
||||||
0x28 RSTn,
|
0x28 RSTn,
|
||||||
;CODE
|
;CODE
|
||||||
CODE AT-XY
|
CODE BYE
|
||||||
DE POPqq, H E LDrr, ( Y )
|
HL 0 LDddnn,
|
||||||
DE POPqq, L E LDrr, ( X ) chkPS,
|
A 0x16 LDrn, ( @EXIT )
|
||||||
A 0x0f LDrn, ( @VDCTL ) B 3 LDrn, ( setcur )
|
|
||||||
0x28 RSTn,
|
0x28 RSTn,
|
||||||
;CODE
|
|
||||||
|
5
blk/494
5
blk/494
@ -1,8 +1,3 @@
|
|||||||
: LINES 24 ; : COLS 80 ;
|
|
||||||
CODE BYE
|
|
||||||
HL 0 LDddnn,
|
|
||||||
A 0x16 LDrn, ( @EXIT )
|
|
||||||
0x28 RSTn,
|
|
||||||
CODE @DCSTAT ( drv -- f )
|
CODE @DCSTAT ( drv -- f )
|
||||||
BC POPqq,
|
BC POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
|
@ -212,12 +212,69 @@ session on the other, type a few characters, and try `pingpong` again.
|
|||||||
|
|
||||||
## Saving to disk
|
## Saving to disk
|
||||||
|
|
||||||
If everything went well, you could run Collapse OS with `g3000<return>`.
|
If everything went well, you could run Collapse OS with `g3000<return>`. You
|
||||||
But instead of doing that, why not save it to disk?
|
would get a usable Collapse OS prompt. But don't do that just yet. That
|
||||||
|
executable bootstraps itself from code and it takes a while to do that every
|
||||||
|
time you launch it. You don't want that right? Let's save a compiled version of
|
||||||
|
it to disk.
|
||||||
|
|
||||||
dump cos/cmd:1 (start=x'5000',end=x'7000',tra='5000')
|
Turn off the debugger (which can mess up some things) and save your sent
|
||||||
|
content as-is by following the instructions you had for the `RECV` program.
|
||||||
|
This way, if you mess up a step below, you can quickly start over. Now you can
|
||||||
|
launch Collapse OS. Then, we need to:
|
||||||
|
|
||||||
And there we go! A Collapse OS launchable from floppy!
|
* Reclaim wasted memory
|
||||||
|
* Create hook entry
|
||||||
|
* Update LATEST
|
||||||
|
* Write down initialization code
|
||||||
|
* Write memory to floppy
|
||||||
|
|
||||||
|
### Reclaim wasted memory
|
||||||
|
|
||||||
|
During initialization, `RDLN$` allocated memory in `HERE` for its input buffer.
|
||||||
|
If you don't reclaim that space, that will be dead space in your binary.
|
||||||
|
|
||||||
|
You can reclaim that space with `FORGET _` which will rewind to before we
|
||||||
|
defined our initialization routine (see xcomp.fs).
|
||||||
|
|
||||||
|
However, that is not enough. If you only do that, there will be a conflict
|
||||||
|
between the rdln input buffer and your `HERE` space! So we need to go put that
|
||||||
|
input buffer somewhere else first. Therefore, your commands will be:
|
||||||
|
|
||||||
|
500 ALLOT RDLN$ FORGET _
|
||||||
|
|
||||||
|
### Create hook entry
|
||||||
|
|
||||||
|
That one is easy:
|
||||||
|
|
||||||
|
(entry) _
|
||||||
|
|
||||||
|
### Update LATEST
|
||||||
|
|
||||||
|
At this point, both `HERE` and `CURRENT` point to your future `LATEST`.
|
||||||
|
|
||||||
|
H@ 0x08 BIN+ !
|
||||||
|
|
||||||
|
Done.
|
||||||
|
|
||||||
|
### Write down initialization code
|
||||||
|
|
||||||
|
You'll do something similar to what we do in xcomp, except you'll have to add
|
||||||
|
"HERE rewinding" code because by default, `HERE` starts at RAMSTART+0x80. So:
|
||||||
|
|
||||||
|
," CURRENT @ HERE ! (ok) RDLN$ "
|
||||||
|
|
||||||
|
As soon as `RDLN$` is called, the `C<` pointer changes and gives control to
|
||||||
|
keyboard, giving us our full forth interpreter.
|
||||||
|
|
||||||
|
### Write memory to floppy
|
||||||
|
|
||||||
|
What you currently have in memory is gold. You want that on floppy. First, run
|
||||||
|
`H@ .X` to know your upper bound (and `0 BIN+ .X` to know your lower one, but
|
||||||
|
you're already supposed to know that one). Then, run `BYE` to return to TRSDOS
|
||||||
|
(the TRSDOS driver overrides `BYE` so that it calls the proper SVC instead of
|
||||||
|
just halting). Then, you can dump memory to floppy as you already did for
|
||||||
|
`RECV`.
|
||||||
|
|
||||||
## Sending blkfs to floppy
|
## Sending blkfs to floppy
|
||||||
|
|
||||||
@ -237,12 +294,7 @@ prompt:
|
|||||||
' *CL< 0x55 RAM+ !
|
' *CL< 0x55 RAM+ !
|
||||||
|
|
||||||
See B80 for details about those RAM offsets. Your serial link now has the
|
See B80 for details about those RAM offsets. Your serial link now has the
|
||||||
prompt. You will also have to make your newlines CRLF. The TRS-80 wants CR
|
prompt. Now, you can use `/tools/blkup` to send a disk's contents. First,
|
||||||
only, but serial communications (and `blkup`) expect CRLF:
|
|
||||||
|
|
||||||
' CRLF 0x0a RAM+ !
|
|
||||||
|
|
||||||
Now, you can use `/tools/blkup` to send a disk's contents. First,
|
|
||||||
extract the first 100 blocks from blkfs:
|
extract the first 100 blocks from blkfs:
|
||||||
|
|
||||||
dd if=emul/blkfs bs=1024 count=100 > d1
|
dd if=emul/blkfs bs=1024 count=100 > d1
|
||||||
@ -260,14 +312,6 @@ 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
|
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.
|
own Collapse OS floppy set. See Usage guide (B3) for details.
|
||||||
|
|
||||||
## Coming back to keyboard
|
|
||||||
|
|
||||||
Once you're done, you will want to go back to local control:
|
|
||||||
|
|
||||||
' CR 0x0a RAM+ !
|
|
||||||
0 0x55 RAM+ !
|
|
||||||
0 0x53 RAM+ !
|
|
||||||
|
|
||||||
## Self-hosting
|
## Self-hosting
|
||||||
|
|
||||||
As it is, your installment of Collapse OS is self-hosting using instructions
|
As it is, your installment of Collapse OS is self-hosting using instructions
|
||||||
|
Loading…
Reference in New Issue
Block a user