Collapse OS Documentation Browser


asm/ code/ hw/ algo.txt arch.txt avr.txt blk.txt blksrv.txt bootstrap.txt cross.txt design.txt dict.txt dis.txt drivers.txt ed.txt emul.txt faq.txt grid.txt grok.txt impl.txt intro.txt me.txt mspan.txt ps2.txt rxtx.txt sdcard.txt sega.txt selfhost.txt spi.txt usage.txt wordtbl.txt

Accessing SD cards

SD cards support the SPI protocol. If you have a SPI relay and
a driver for it that implement the SPI protocol (doc/spi),
you're a few steps away from accessing SD cards!

What you need to do is to add the SDC subsystem to your Collapse
OS binary. First, define SDC_DEVID to a mask selecting the
proper device on your SPI relay (this is what is sent to
"(spie)"). For example, a SDC_DEVID or 1, 2, 4, or 8 would
select SPI device 1, 2, 3 or 4.

The subsystem is loaded with "250 258 LOADR".

Once that subsystem is loaded, you need to create aliases that
will plug into the BLK subsystem (doc/blk). Add this to your

ALIAS SDC@ (blk@)
ALIAS SDC! (blk!)

You can now load BLKSUB and end the rest of your xcomp normally.

At runtime, the SD card that was inserted needs to be initial-
ized. You can do it with SDC$. If you have no error, it means
that the system can spek to your card, that sync is fine, etc.
You can read/write right now. SDC$ needs to run every time a new
card is inserted.

Collapse OS' SDC drivers are designed to read from the very
first 512 sector of the card, mapping them to blocks
sequentially, 2 sectors per block.

Collapse OS and its documentation are created by Virgil Dupras and licensed under the GNU GPL v3.

This documentation browser by James Stanley. Please report bugs on github or to

This page generated at 2022-05-19 21:05:03 from documentation in CollapseOS snapshot 20220509.