DtZ, Y82 MAPA3M Research, XEPb.ru Presents
Note: note the russian spelling of "blya-blya-blya!"
Preface

This is SD card interface for Grant Searle's CP/M computer. Originally it has CF interface. Schematics of SD interface
here
, but
SOFTWARE IS DESIGNED TO RUN AT PORT 8! SO CHANGE U5:13 to U5:14 ON THE SCHEME!
But can be easily recompiled.

Fotos here


Licence

I use some code from Grant Searle. I have his permission to redistribute this software as part of my work. So the licence should be like that:
 The parts of the software written by Grant Searle is written by Grant Searle or was got by Grant Searle I-do-not-know-where-and-ask-him;
 The code written by DtZ should be treated as public domain with the following limitation:

Current limitations

First, it works with some SD cards. It does not work with SDHC and SDXC cards. So your's card must be less then 4G and must not be marked as SDHC or SDXC. It may work with MMC, or may not, I've not tested

Next, card must be from 128M (never tried) to 2G

Tested: Kingston SD/512 (with some tropic isle on it), Apacer 1G AP1GSD60, some 2G MicroSD (Transcend or Kingston?) - all that works. I was unable to init Toshiba SD-M16 16M card, do not understand why.

Next, I do not provide ROM code for loading, this is forthcoming, read more to find how to load it.

Currently, TPA is limited to 48k (actually it detects as 51206 bytes, that's right), I'll raise it somehow

Hotplug is not supported and I believe never will be

As for my own setup, I have 2.4576MHz quarts/38400 baud serial interface, RS232 connection on channel 2 of SIO. I think it should work with channel 1, cause I preserve passing IOBYTE from monitor, and I think it should work in 7Mhz or even higher (or lower) (maybe you'll get "Cannot Init SD" by loader; try to load it once again)
UPD: It works on 7Mhz, as expected



Making bootable SD card

Compiling under linux (and generally unix, I've tried MacOSX 10.4/ppc too):
if you do not want to compile, skip to here

First, get tpasm http://www.sqrt.com/ ftp://ftp.ct0.com/pub/tpasm.tgz (or check my site - I probably have a mirror)
Next, install (or check you have installed) TCL, 8.3 and later is ok, maybe 8.2, I do not remember if 8.1 ok. I use it as a part of linking tools (mload.tcl), or you may rewrite it the way you like.

cd BDOS
./MakeBDOS

You'll get cbios.hex and labels.lst
Check labels.lst for you have exceeded 64k. hstBufEnd must be less FF00.
If not, you have to lower TPA. If you have 48k TPA currently, you are in BIG trouble
Next, compile CP/M by MakeCPM , you'll get cpm22.hex
Next, create system by ./createimage , you'll get image.img. It takes some time. It takes significant time on MacOSX 10.4 @ iBook G3/500 !

Making boot media
Then, check your SD is SD, not more 2G, insert your's SD card in reader, find it as /dev/sdX, be very carefull, because if you write this to your's boot drive, you'll make it unusable.
Became root and write filesystem to SD (~16M)
dd if=notempty.img of=/dev/sdX
Next, write the system to the first track of SD
dd if=image.img of=/dev/sdX

The distribution may contain different system images, number probably indicates TPA, D means debug, avoid it if you no not need debug.

Booting and loader

Start your's SBC, locate some loader.hex in distribution set and paste it into terminal window, then
G5000 it.
If you see "Initing MMC
Cannot send CMD1
", G5000 it once again. (this still happens with one of my SD cards; it's not critical, I'll fix in on next release)
I'll provide some ROM image, later

Implementation notes

The implementation is delivered from Grant Searle work, so it shares almost everything.
In Grant's CF BDOS, system is loaded from offset 0 of CF card - it takes $3000 bytes of $4000 bytes of the whole track-0 - to $D000 - $FFFF memory locations.
In my SD BDOS I load the whole $4000 bytes from track-0, but it does not mean the system always should be $4000 bytes - it may be shorter, saying $3000 bytes system should start from $1000 offset of SD card.

Feedback

Use http://z80xxi.livejournal.com/ for feedback

Distribution set

Distribution set naming
sgsbcsdYYMV.tar.gz sgsbcsd is the name of the project, YY is decimal years from 1990 (as for all DtZ's software), M is [1-b] month,V is [0-9a-z] release of the file

sgsbcsd2323.tar.gz Relink release 0.00.01 / 2323
CE00/55046 TPA version relink release and minor changes in loader
For assemling use BIOS/MakeBDOS_CE00 , next MakeCPM_CE00, next createimage_CE00
sgsbcsd2322.tar.gz Bugfix release 0.00.01 / 2322
Notice: 20130204 looks like error caught, wait for bugfix release
Notice: bugfix release sgsbcsd2322.tar.gz is expected 20130203-20130205
Notice: looks like it have errors in current and fothcoming release ;-) on write block (and possibly warm boot) - if you use debug version of system you may help
sgsbcsd2321.tar.gz Initial release 0.00.01 / 2321