raphnet.net banner

SD-Cart JR: MMC/SD card reader cartridge for PCjr

twitter@raphnetlabs
Buy Me a Coffee at ko-fi.com
Contents

Overview

SD-Cart JR

SD-Cart JR

SD-Cart JR is a PCjr cartridge which makes it possible to use MMC (or compatible) memory cards under DOS.

Current performance: Reads at 33 kB/s, writes at 22 kB/s. Already faster than floppies (10 kB/s), but there is still room for improvement. The driver may gain a few kB/s in performance in the future.

goto top


Electronics

Quite a few signals from the PCjr BUS are available on the cartridge slot, but there is no write signal. Still, this does not mean the cartridge slot cannot send information, since the address being read is in itself outgoing data! So I divided the cartridge memory space and arranged so that reading from certain address ranges would have specific side effects. (Select/Deselect the card, load a value to transmit, etc).

Since the cards communicate serially (SPI), I used a pair of shift registers (one for transmitting to the card and another for receiving) to performe parallel/serial conversion in the hope of getting better performance by exchanging full bytes with the PCjr...

The cartridge uses the CS2 signal from the slot and is therefore visible from D0000 to D7FFF.


Schematic, page 1 - PCjr Cartridge, address decoding and ROM

Schema, page 1

Schematic, page 2 - Shift Registers, card interface (voltage regulator and level converters)

Schema, page 2
Before making a PCB, I tested everything on a breadboard, but not entirely without soldering. To access the cartridge signals, I soldered wires between one of my cartridge PCBs and the DIP components on the breadboad. For the card slot, I used a small Adafruit PCB which came with its own regulator, level converter and microsd slot.

My test setup

My test setup

Wires soldered to a cartridge PCB

Wires soldered to a cartridge PCB



Once I got everything working correctly, I designed an equivalent PCB, but changed a few things.

First, instead of using an Adafruit microsd module, I decided to use a large card slot for MMC and "normal" SD cards instead of microsd only. Considering the practical limits regarding disk space (i.e, What DOS supports and if one does not want to wait an eternity when available disk space is being computed), I wanted to support and use old low capacity cards from my parts bin instead of modern cards with excessively large capacities.

Next, I also wanted the circuit to fit in a cartridge shell, so I used surface mount components to save space. The resulting PCB can fit in a cartridge shell, provided you cut some plastic here and there...

And the final addition, a footprint for installing a ROM for booting directly on the card, as if it were a hard drive.

Final PCB

Final PCB


goto top


Software

My requirements for the software were:
  1. I want to run stuff on the card, so its contents must be accessible as if it were a floppy or hard drive. In other words, it must have a drive letter, such as c:
  2. Moving the card to another (modern) machine to exchange files with my PCjr must be possible.
  3. I would like to be able to boot on the card, as if it were a hard drive, without using floppies.
For the second requirement above, it was easy. Memory cards are normally partionned like hard disks are, using a partition table in the MBR, and normally the first (and only) partition covers all the available spacce. And this partition normally contains a FAT (FAT12, FAT16, FAT32..) file system, depending on the available space. Very standard and well supported by DOS, Linux, Windows, Mac OS... Still, some limitations must be considered, such as what your PCjr DOS version supports. For instance, DOS 2.10 does not know FAT16, DOS 3.3 does not support FAT16B... Creating a smaller partition and reformatting may be necessary.


The sdcart.sys device driver

Example config.sys

Example config.sys

I coded a simple device driver for DOS which scans the card to find the first partition and renders it available as a DOS drive. Installation is a simple matter of adding DEVICE=SDCART.SYS to config.sys.

The card contents will be made available through the first free drive letter at the time the driver was installed. Changing the card without restarting is supported. The driver detects removed or replaced cards and lets DOS know about it.

If you already have a hard drive, possibly jrIDE, or do not wish to boot on a card (reqirement 3), the sdcard.txt device driver is all you need.



Boot ROM

System booted on an 64MB MMC card

System booted on an 64MB MMC card

I also created a Boot ROM for PCjr which replaces int 13h (The BIOS disk services) to make it possible to use a card for booting as if it were a hard drive. When using this ROM, sdcard.sys is not necessary, DOS supports the card as a hard drive. Fdisk and format can even be used normally.

At the moment, this ROM is experimental and incomplete, but still functional. Current implementation:


Also, since I do not have a jrIDE yet, I'm not sure if my boot ROM plays well with it. But I think it should, in theory the card will be installed as secondary (81h) disk drive.



sdpart.com

sdpart.com showing card informations

sdpart.com showing card informations

Fdisk does not support devices accessed trough a drivers such as sdcart.sys, and therefore cannot be used to display partition information. Memory cards also contain additional data stored in registers (such as CID and CSD) including the manufacturer, model and serial numbers...

The sdpart.com tool can display and partly decodes the contents of those registers and show how a card is partitioned. There is also basic functionality for creating a new MBR and a partition up to 32M. The name "sdpart" implies that this should be a full partitioning tool for memory cards. In the long run it may become so, but right now, it is extremely limited. Still, it is a good tool to test if a card is compatible or it may help understand why things are not working.

The format command included with DOS has a similar limitation in that it cannot format the sdcart.sys drive. Maybe one day I will write an sdformat tool, but meanwhile cards must be formatted under another OS, or using the boot ROM.

goto top


Downloads

Version v01
November 17, 2020 (Tuesday)
  • Initial release
File(s):
sdcjr01.zip (9.8 KB)
This project is also available on GitHub!
To request features, report issues or contribute, you may send me an email or use the GitHub repository:
https://github.com/raphnet/sdcartJR

goto top


Where to get the hardware

Ready to use, tested PCBs are available from my online store:
https://www.raphnet-tech.com/products/sdcartJR/

Component side

Component side

Solder side

Solder side


goto top


References


goto top


Disclaimer

I cannot be held responsible for any damages that could occur to you or your equipment while following the procedures present on this page. Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability of the informations on this page. Please note, however, that the procedures above have worked in my case without any damages or problems.

Now you cannot say that I did not warn you :)

goto top


Any trademarks used on this site are the property of their respective owners.
Copyright © 2002-2020, Raphaël Assenat
Website coded withWebsite coded with vimLast update: November 17, 2020 (Tuesday)