logo

 

Design

This "backpack" addon circuit connects to the SGB cartridge slot and acts like a 32KB cartridge made of RAM. It controls the /RESET line to take the SGB CPU off the data bus and disconnects the address bus with 245 transceivers when code is uploaded from the computer to the RAM through an ATMega8 microcontroler.

The data bus is shared with the ATMega8 and 2 273 latches to set the address bus in upload mode.
The serial communication speed is 250kbps which gives a 32KB copy time of about 2 seconds.

Schematic & parts list
  • 40*40 stripboard
  • 4 M3 screws, spacers and bolts
  • 2 74HC245
  • 2 74HC273
  • 1 ATMega8
  • 16MHz quartz
  • Any NPN transistor
  • 2 LEDs
  • A few resistors (330 ohms, 47kohms...)
  • CXK58256 or similar 32K*8 SRAM
  • Tiny wires

Stripboard layout: maybe.

Firmware & protocol

Download C source for AVRStudio 4 and hex file.

On power up, the SDB says "Hello" and waits for a "!" character. It stays offline so it lets the SGB run normally.
When a "!" is received, "?" in answered, telling the SDB is awaiting a command.

  • "V" returns the version number ("1" for now). Stays offline.
  • "X" resets the SGB, replies "x".
  • "W" puts the SDB online and awaits 32768 bytes of data to fill up the RAM, the SGB stays in reset until the transfer is done. Replies "w" and a 8 bits checksum. Returns to offline mode.
  • "R" puts the SDB online and sends 32768 bytes of data contained in the RAM, the SGB stays in reset until the transfer is done. Transfer ends with "r" and a 8 bits checksum. Returns to offline mode.

Write flow:

  • Drive /RESET low
  • Isolate the address bus
  • Drive the data bus, address bus and RAM control lines
  • Set checksum to zero
  • Set address bus LSB
  • Set address bus MSB
  • Wait for byte receive
  • Add to checksum
  • Set data bus
  • Clock RAM /WE
  • Loop 32768 times
  • Send "w" and checksum

Read flow:

  • Drive /RESET low
  • Isolate the address bus
  • Drive the data bus, addres bus and RAM contro lines
  • Set checksum to zero
  • Set address bus LSB
  • Set address bus MSB
  • Tristate data bus
  • Get byte from RAM
  • Send byte
  • Add to checksum
  • Loop 32768 times
  • Send "r" and checksum
Transfer software

The source is very dirty and full of hardcoded parameters, feel free to change anything and redistribute/port at will.
Serial port API module written by David Hitchner.

Serial port configuration: 250000,N,8,1.

VB6 source code and executable.

footer
symbol symbol symbol symbol symbol