From 124da6adec734c999282d3251cc11f3d2de1a170 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 16 Aug 2020 14:30:33 -0400 Subject: [PATCH] Move SD Card subsystem outside of RC2014 recipe and add protocols Although the SPI Relay driver is RC2014-specific, the SD Card driver is generic enough to be a subsystem. That's the second subsystem we add and this warrants, I think, the formalization of a new concept: protocols. --- blk/001 | 5 +++-- blk/410 | 10 +++++----- blk/420 | 10 ++++++++++ blk/{603 => 423} | 0 blk/{604 => 424} | 0 blk/{605 => 425} | 0 blk/{606 => 426} | 0 blk/{607 => 427} | 0 blk/{608 => 428} | 0 blk/{609 => 429} | 0 blk/{610 => 430} | 0 blk/{611 => 431} | 0 blk/{612 => 432} | 0 blk/{613 => 433} | 0 blk/{614 => 434} | 0 blk/{615 => 435} | 0 blk/580 | 2 +- blk/595 | 6 +++--- blk/{618 => 599} | 0 blk/600 | 11 ----------- doc/protocol.txt | 27 +++++++++++++++++++++++++++ recipes/rc2014/sdcard/README.md | 4 ++-- recipes/rc2014/xcomp.fs | 2 +- 23 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 blk/420 rename blk/{603 => 423} (100%) rename blk/{604 => 424} (100%) rename blk/{605 => 425} (100%) rename blk/{606 => 426} (100%) rename blk/{607 => 427} (100%) rename blk/{608 => 428} (100%) rename blk/{609 => 429} (100%) rename blk/{610 => 430} (100%) rename blk/{611 => 431} (100%) rename blk/{612 => 432} (100%) rename blk/{613 => 433} (100%) rename blk/{614 => 434} (100%) rename blk/{615 => 435} (100%) rename blk/{618 => 599} (100%) delete mode 100644 blk/600 create mode 100644 doc/protocol.txt diff --git a/blk/001 b/blk/001 index f9b4012..1198ed5 100644 --- a/blk/001 +++ b/blk/001 @@ -6,10 +6,11 @@ MASTER INDEX 160-199 unused 200 Z80 assembler 260 Cross compilation 280 Z80 boot code 350 Core words -410 PS/2 keyboard subsystem 420-489 unused +410 PS/2 keyboard subsystem 420 SD Card subsystem +440-489 unused 490 TRS-80 Recipe 520 Fonts 550 TI-84+ Recipe 580 RC2014 Recipe -620 Sega Master System Recipe +600-619 unused 620 Sega Master System Recipe 650 AVR assembler 690-729 unused 730 8086 assembler 800 8086 boot code 830 PC/AT recipe diff --git a/blk/410 b/blk/410 index 0496601..e14dd28 100644 --- a/blk/410 +++ b/blk/410 @@ -1,10 +1,10 @@ PS/2 keyboard subsystem -Provides (key) from a driver providing (ps2kc). That is, for a -driver taking care of providing all key codes emanating from a -PS/2 keyboard, this subsystem takes care of mapping those key- -strokes to ASCII characters. This code is designed to be cross- -compiled and loaded with drivers. +Provides (key) from a driver providing the PS/2 protocol. That +is, for a driver taking care of providing all key codes emanat- +ing from a PS/2 keyboard, this subsystem takes care of mapping +those keystrokes to ASCII characters. This code is designed to +be cross-compiled and loaded with drivers. Requires PS2_MEM to be defined. diff --git a/blk/420 b/blk/420 new file mode 100644 index 0000000..57434be --- /dev/null +++ b/blk/420 @@ -0,0 +1,10 @@ +SD Card subsystem + +Load range: B423-B436 + +This subsystem is designed for a ad-hoc adapter card that acts +as a SPI relay between the z80 bus and the SD card. It requires +a driver providing the SPI Relay protocol. + +Through that layer, this driver implements the SDC protocol +allowing it to provide BLK@ and BLK!. diff --git a/blk/603 b/blk/423 similarity index 100% rename from blk/603 rename to blk/423 diff --git a/blk/604 b/blk/424 similarity index 100% rename from blk/604 rename to blk/424 diff --git a/blk/605 b/blk/425 similarity index 100% rename from blk/605 rename to blk/425 diff --git a/blk/606 b/blk/426 similarity index 100% rename from blk/606 rename to blk/426 diff --git a/blk/607 b/blk/427 similarity index 100% rename from blk/607 rename to blk/427 diff --git a/blk/608 b/blk/428 similarity index 100% rename from blk/608 rename to blk/428 diff --git a/blk/609 b/blk/429 similarity index 100% rename from blk/609 rename to blk/429 diff --git a/blk/610 b/blk/430 similarity index 100% rename from blk/610 rename to blk/430 diff --git a/blk/611 b/blk/431 similarity index 100% rename from blk/611 rename to blk/431 diff --git a/blk/612 b/blk/432 similarity index 100% rename from blk/612 rename to blk/432 diff --git a/blk/613 b/blk/433 similarity index 100% rename from blk/613 rename to blk/433 diff --git a/blk/614 b/blk/434 similarity index 100% rename from blk/614 rename to blk/434 diff --git a/blk/615 b/blk/435 similarity index 100% rename from blk/615 rename to blk/435 diff --git a/blk/580 b/blk/580 index ea36c85..dbb6e64 100644 --- a/blk/580 +++ b/blk/580 @@ -5,4 +5,4 @@ ACIA, SD card and AT28 EEPROM. 581 ACIA 586 Zilog SIO driver 592 AT28 EEPROM 595 SPI relay -600 SD card 618 Xcomp unit +599 Xcomp unit diff --git a/blk/595 b/blk/595 index 93f8d18..f8a7eec 100644 --- a/blk/595 +++ b/blk/595 @@ -1,12 +1,12 @@ SPI relay driver This driver is designed for a ad-hoc adapter card that acts as a -SPI relay between the z80 bus and the SPI device. Sending any- +SPI relay between the z80 bus and the SPI device. Sending any- thing on SPI_CSLOW and SPI_CSHIGH is expected to select/deselect -the device, and writing to SPI_DATA is expected to initiate a +the device, and writing to SPI_DATA is expected to initiate a byte exchange. The result of the exchange is excpected to be re- trieved by reading SPI_DATA. -Provides (spie) (enable), (spid) (disable), (spix) (xchange). +Provides the SPI relay protocol. Load driver with "596 LOAD". diff --git a/blk/618 b/blk/599 similarity index 100% rename from blk/618 rename to blk/599 diff --git a/blk/600 b/blk/600 deleted file mode 100644 index 511e952..0000000 --- a/blk/600 +++ /dev/null @@ -1,11 +0,0 @@ -SD Card driver - -Load range: 603-616 - -This driver is designed for a ad-hoc adapter card that acts as a -SPI relay between the z80 bus and the SD card. It requires a SPI -driver providing (spix), (spie) and (spid), which oh surprise! -is included in Collapse OS at B595. - -Through that layer, this driver implements the SDC protocol -allowing it to provide BLK@ and BLK!. diff --git a/doc/protocol.txt b/doc/protocol.txt new file mode 100644 index 0000000..c8d2d90 --- /dev/null +++ b/doc/protocol.txt @@ -0,0 +1,27 @@ +# Protocols + +Some subsystems (and in the case of KEY and EMIT, the core) re- +quire drivers to implement certain words in a certain way. For +example, the core requires drivers to implement (key) and (emit) +or else it won't know how to provide a console. + +These protocols are described here. + +# TTY protocol + +(key) -- c Returns the next typed key on the console. + If none, block until there is one. +(emit) c -- Spit a character on the console. + +# PS/2 protocol + +(ps2kc) -- kc Returns the next typed PS/2 keycode from the + console. Blocking. + +# SPI Relay protocol + +(spie) -- Enable SPI device +(spid) -- Disable SPI device +(spix) n -- n Perform SPI exchange (push a number, get a + number back) + diff --git a/recipes/rc2014/sdcard/README.md b/recipes/rc2014/sdcard/README.md index d98f92a..d90b5a2 100644 --- a/recipes/rc2014/sdcard/README.md +++ b/recipes/rc2014/sdcard/README.md @@ -78,10 +78,10 @@ declaring `SPI_DATA`, `SPI_CSLOW` and `SPI_CSHIGH`, which are respectively `4`, This driver provides `(spix)`, `(spie)` and `(spid)` which are then used in the SDC driver. -The SDC driver is at B600. It gives you a load range. This means that what +The SDC driver is at B420. It gives you a load range. This means that what you need to insert in `xcomp` will look like: - 603 616 LOADR ( sdc ) + 423 436 LOADR ( sdc ) You also need to add `BLK$` to the init sequence. diff --git a/recipes/rc2014/xcomp.fs b/recipes/rc2014/xcomp.fs index 9a4684c..dd40448 100644 --- a/recipes/rc2014/xcomp.fs +++ b/recipes/rc2014/xcomp.fs @@ -1,3 +1,3 @@ -618 LOAD +599 LOAD ORG @ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!