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.
This commit is contained in:
Virgil Dupras 2020-08-16 14:30:33 -04:00
parent 44a4c59525
commit 124da6adec
23 changed files with 52 additions and 25 deletions

View File

@ -6,10 +6,11 @@ MASTER INDEX
160-199 unused 160-199 unused
200 Z80 assembler 260 Cross compilation 200 Z80 assembler 260 Cross compilation
280 Z80 boot code 350 Core words 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 490 TRS-80 Recipe 520 Fonts
550 TI-84+ Recipe 580 RC2014 Recipe 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 650 AVR assembler 690-729 unused
730 8086 assembler 730 8086 assembler
800 8086 boot code 830 PC/AT recipe 800 8086 boot code 830 PC/AT recipe

10
blk/410
View File

@ -1,10 +1,10 @@
PS/2 keyboard subsystem PS/2 keyboard subsystem
Provides (key) from a driver providing (ps2kc). That is, for a Provides (key) from a driver providing the PS/2 protocol. That
driver taking care of providing all key codes emanating from a is, for a driver taking care of providing all key codes emanat-
PS/2 keyboard, this subsystem takes care of mapping those key- ing from a PS/2 keyboard, this subsystem takes care of mapping
strokes to ASCII characters. This code is designed to be cross- those keystrokes to ASCII characters. This code is designed to
compiled and loaded with drivers. be cross-compiled and loaded with drivers.
Requires PS2_MEM to be defined. Requires PS2_MEM to be defined.

10
blk/420 Normal file
View File

@ -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!.

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -5,4 +5,4 @@ ACIA, SD card and AT28 EEPROM.
581 ACIA 586 Zilog SIO driver 581 ACIA 586 Zilog SIO driver
592 AT28 EEPROM 595 SPI relay 592 AT28 EEPROM 595 SPI relay
600 SD card 618 Xcomp unit 599 Xcomp unit

View File

@ -7,6 +7,6 @@ the device, and writing to SPI_DATA is expected to initiate a
byte exchange. The result of the exchange is excpected to be re- byte exchange. The result of the exchange is excpected to be re-
trieved by reading SPI_DATA. trieved by reading SPI_DATA.
Provides (spie) (enable), (spid) (disable), (spix) (xchange). Provides the SPI relay protocol.
Load driver with "596 LOAD". Load driver with "596 LOAD".

View File

11
blk/600
View File

@ -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!.

27
doc/protocol.txt Normal file
View File

@ -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)

View File

@ -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 This driver provides `(spix)`, `(spie)` and `(spid)` which are then used in the
SDC driver. 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: 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. You also need to add `BLK$` to the init sequence.

View File

@ -1,3 +1,3 @@
618 LOAD 599 LOAD
ORG @ 256 /MOD 2 PC! 2 PC! ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!