[force english] [force russian] [minimalistic design]
Main shit - the best the newest and the most realistic - all about DtZ ! :> My computers: Z80,68K, etc :> SD / SDHC Interface for Grant Searle's CP/M computer
DtZ, Y82 MAPA3M Research, XEPb.org Presents
Note: note the russian spelling of "blya-blya-blya!"

20140924 - SHDC support and new release (2491)
20140904 - new relase (2490)
20140320 - Some minor text clean ups
20140316 - I suspect a stack overflow. Use ChB or enlarge stack in monitor.asm (There was no; another problem fixed)
20140210 - error on scheme found (pins 3 and 1 of UM1:1 was wrong; now corrected on scheme)
20130620 Last software update release 2360


This is SD card interface for Grant Searle's CP/M computer. Originally it has CF interface.
Note: in earlier versions of the scheme UM1:2 5 and UM1:1 2 was connected to U5:13. Corrected. (Now on Pin 14)

Fotos here


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:
  •  -no part of this code, or the whole code may be licenced or patented on any territory or worldwide, or limited by other legal way
  •  -DtZ may use this software according any different licence, but that may not affect or limit other users of the released software

Current limitations

First, it works with some UPD 201409: most! SD cards. Versions before 2491 did not work with SDHC. Still nothing is known about SDXC cards, but I suspect they will not work.
So, for cards are more then 4G you should use SDHC version (read more). It (non-SDHC version) may work with MMC, or may not, I've not tested

If you use cards less then 128M, you will be able to work only with the first disks - saying from A: to C:.

Hotplug is not supported and I believe never will be

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.
You may want to link C000 based system or CE00 based one.
The clear thing is that CE00 system gives you more TPA. From the other point, if you want to rebuild system on board, you may want to use C000 one.
The trick is that C000 based system occupies first 16K (so starts from track 0/sector 0); CE00 system starts with E00 unused bytes. That's generally not a feature, but bug I'll fix sometimes later.
or, for SDHC, cd BIOS

You'll get cbios_CE00.hex (replace CE00 to C000 if you want C000 based system; add _SDHC for SDHC version) and labels.lst
Check labels.lst for you have exceeded 64k. hstBufEnd must be less FF00.
If not, you have to lower TPA (that may happen if you modified cbios.asm for some your's needs). If you have 48k TPA currently (C000 system) and exceeded 64k, you are in BIG trouble (that's not possible if you did not modifed BIOS heavily)
Next, compile CP/M by MakeCPM_CE00 , you'll get cpm22_CE00.hex Clear thing is that SDHC version of CP/M is exactly the same as non SDHC - CP/M does not know anything about that ;-)
Next, create system by ./createimage_CE00 (or ./createimage_SDHC_CE00) , you'll get image.img. It takes some time. It takes significant time on MacOSX 10.4 @ iBook G3/500 !

Making boot media
Then 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

Select image with SDHC in name if you write to SDHC cards and image with no SDHC if you are writing to SD card
The distribution may contain different system images (C000 and CE00 to name), number probably indicates TPA, D means debug, avoid it if you no not need debug.

Booting and loader

You have two options: either burn an rom image (or rebuild it and burn) or use a loader.

If you are using a loader, start your's SBC, locate some loader.hex in distribution set and paste it into terminal window, then
G5000 it.

I provide an ROM image, it's included scince 2360 release as rom.img, you can burn it.

To compile stand-alone loader, goto Loader_and_ROM, run MakeLoader or MakeLoaderDebug
To compile ROM image, first compile (optional) BASIC by MakeBasic, then MakeMonitor, then createROM - you'll get 32k of rom.img, burn it.

Implementation notes

The implementation is delivered from Grant Searle work, so it shares almost everything.
Scince 2340 is it based on IOBYTE aware SG's BIOS 1.0
Scince 2690 it appears to work
In Grant's CF BIOS, 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 BIOS 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 (as I said before)
And yes, in non-C000 based systems that's not possible to regenerate CP/M inside CP/M; I'll fix it later

CPMTOOLS Defs for disk A: of those image:
diskdef sga
    seclen      512
    tracks      512
    sectrk      32
    blocksize   4096
    maxdir      512
    boottrk     1
    os  2.2
On Solaris/Sparc I access the disk as /usr/local/bin/cpmls -f sga /vol/dev/dsk/c2t0d0/unknown_format , on Linux just as /dev/sdb


Use http://z80xxi.blogspot.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

Warning: a serious bug found: it addresses disk in wrong manner, saying B: is the same disk as F:, and C: is G:. That affects only SDHC version.
(Quickfix: CPM/BIOS/sd/setLBAaddrSDHC.asm, line 79: comment out 'and 3') 20140929
Warning: a bug discovered. MakeMonitor script has DTZNOSDHC defined, so included rom.img contains no SDHC code. Recompiling it will generate a working rom.img. Will be fixed in forthcoming maintaining release. 20140925
0.00.04 / 2491
sgsbcsd2491.tar.gz Version with (optional) SDHC support
0.00.03 / 2490
sgsbcsd2490.tar.gz Huge error fix
Those old versions contained a bug making ChA of SIO fully useless
sgsbcsd2360.tar.gz ROM image included 0.00.02 / 2360
sgsbcsd2340.tar.gz Sync with Searle Grants' 1.0 release 0.00.02 / 2340
sgsbcsd2323.tar.gz Relink release 0.00.01 / 2323
CE00/55046 TPA version relink release (and read this ) 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

20181231 Long-awaited FAQ
20170103 SBC Atmega8 + RCA1802 / CDP1802 CPU launched
20141128 Gopher server launched
20141022 2006 Fotos from the roof of my house
20140701 New artwork: "I am stoling Robotron 1715 PC from MESI" for my robotron pages
20140616 Update: 68008 computer by me
20020601 Redesign of my homepage. Still wondering, what's for?
© DtZ 2002 - 2006, 2037