~vdupras/collapseos

5ca99ad4102a7f4b75270e64c6fdda22bd0f8c80 — Virgil Dupras 1 year, 6 months ago 18f6978
trs80: implement a standalone RS-232 driver

No more relying on the TRS-DOS driver!
2 files changed, 17 insertions(+), 13 deletions(-)

M arch/z80/trs80/blk.fs
M doc/hw/z80/trs80.txt
M arch/z80/trs80/blk.fs => arch/z80/trs80/blk.fs +4 -3
@@ 100,9 100,10 @@ EXX, ( unprotect BC ) ;CODE
: FD! ['] @WRSEC SWAP FD@! ;
: FD$ ['] FD@ BLK@* ! ['] FD! BLK!* ! ;

: _err LIT" *CLerr" ERR ;
: *CL< 0 BEGIN DROP 0x0238 @GET UNTIL ;
: *CL> 0x0238 @PUT NOT IF _err THEN ;
: CL$ 0x02 0xe8 PC! ( UART RST ) 0xee 0xe9 PC! ( 9600 bauds )
    0b01101100 0xea PC! ( word8 no parity RTS ) ;
: CL> BEGIN 0xea PC@ 0x40 AND UNTIL 0xeb PC! ;
: CL< BEGIN 0xea PC@ 0x80 AND UNTIL 0xeb PC@ ;
( ----- 612 )
( We process the 0x20 exception by pre-putting a mask in the
  (HL) we're going to write to. If it wasn't a 0x20, we put a

M doc/hw/z80/trs80.txt => doc/hw/z80/trs80.txt +13 -10
@@ 257,8 257,8 @@ And there we go! A Collapse OS launchable from floppy!
# Sending blkfs to floppy

As it is, your system fully supports reading and writing to
floppy drive 1. It also had *CL< to read a char from *cl and
*CL> to emit a char to *cl.
floppy drive 1. It also had CL< to read a char from its RS-232
port and CL> to emit to it.

That's all you need to have a full Collapse OS with access to
disk blocks.


@@ 267,16 267,19 @@ First, make sure your floppies are formatted. Collapse OS is
currently hardcoded to single side and single density, which
means there's a limit of 100 blocks per disk.

You'll need to send those blocks through RS-232. Begin by taking
over the prompt:
You'll need to send those blocks through RS-232. First, let's
initialize the driver with CL$. This driver does not require
the TRS-DOS driver to be loaded. Also, it is hardcoded to
"no parity, 8 bit words, 9600 bauds". Now, let's have the CL
take over the prompt:

    ' *CL> ' EMIT **!
    ' *CL< ' KEY **!
    ' CL> ' EMIT **!
    ' CL< ' KEY **!

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 only, but serial communications (and
blkup) expect CRLF:
See "Aliases" in usage.txt for details. Your serial link now has
the prompt. You will also have to make your newlines CRLF. The
TRS-80 wants CR only, but serial communications (and blkup)
expect CRLF:

    ' CRLF ' NL **!