SB600 - CP1 SD card interface (SMD version)   (user friendly)

 

 

SB600/C1P/UK101 adding SD card option

  

BOM

POS ID Footprint PCS NAME
1 J5 PinHeader_2x08_P2.54mm_Vertical 1 Connector_Generic:Conn_02x08_Counter_Clockwise
2 J6,J7 PinHeader_1x12_P2.54mm_Vertical 2 Conn_01x12  use turned gold plated pins !!!!
3 U2 DIP-20_W7.62mm_LongPads 1 ATF16V8-10ns
4 U1 SOIC-20W_7.5x12.8mm_P1.27mm 1 SN74LS374DWR2
5 J2 PinHeader_1x02_P2.54mm_Horizontal 1 Conn_01x02
6 C1,C7,C4,C3,C5,C2 C_0402_1005Metric_Pad0.74x0.62mm_HandSolder 6 0402B104K500HI 100nF
7 J4 PinHeader_2x03_P2.54mm_Vertical 1 Conn_02x03_Odd_Even
8 U5,U4 SOIC-16_3.9x9.9mm_P1.27mm 2 SN74LS595D
9 U3 TQFP-32_7x7mm_P0.8mm 1 ATmega328-A
10 J3 PinHeader_1x06_P2.54mm_Vertical 1 Conn_01x06
11 R2 C_0603_1608Metric_Pad1.08x0.95mm_HandSolder 1 RC0603FR-071K2L 1.2k
12 R1 C_0603_1608Metric_Pad1.08x0.95mm_HandSolder 1 CR164700F 470
13 C6 C_0603_1608Metric_Pad1.08x0.95mm_HandSolder 1 GMC10CG391J50NTD 390p

INTERFACE

SD card inteface       RS232 TTL / USB interface

 

SD CARD INTERFACE (OPTIONAL USB-RS232 TTL ADAPTER):

 

  full size SD card interface    6-Pin PL2303HXD

 

To connect the SD card module with the above SD card interface, it can be directly soldred to the module, or a 16pin IDC ribbon cable is used.
A cable has the advantage that the SD-card slot can be placed in the computer case, where needed.

 

 

ACIA SOFTWARE:

 

The extended ACIA Control register

For OSI computers, after ACIA Reset and a time of 2 sec, OSI autoboot (M/L) is active (software reset).

Bootloader code BOOT.SYS will be loaded from SD-card when pressing "L". Otherwise nothing will happen.

 

The extended ACIA Control register is adressed by the control bits CR5,CR6 = 11 followed by a conventional Data out command. Extended commands are grouped into 16 basic sections (upper 4 bits). Within each sections 16 sub functions can be selected (lower 4 bits). In total, 256 extended ACIA control functions are possible.

Extended section (high nibble)  - Extended sub function number (low nibble)

 

If auto-pre-set is enabled, EEPROM specified parameters (Baudrate, bits,RTS,CTS…) will be used to initialize the ACIA on power up.

 

Hardware serial output/Input of data is not active during special function mode !

Note: If operation was successful, in some funtions 0x01 is returned, on Error a value of zero is returned.
 
Section 0 Set/Clear and special functions
  0: do nothing
  1: return version info return 1 byte (00..),
  2: reset all special functions, no return value
  3: select RS232 internal port, no return (uses system RX/TX lines)
  4: select RS232 external port, no return (uses onboard pin header RX/TX lines)
  5: Set FIFO to 2 , no return (RTS/CTS handshake by user)

  7: Set FIFO to 4 , no return (RTS/CTS handshake by user)

  7: Set FIFO to 8 , no return (RTS/CTS handshake by user)

  8: Set FIFO to 16 , no return (provides automatic RTS/CTS handshake)

  9: read 1 byte from EEPROM, startL, startH, return 1 bytes  (0 to 1023)

  10: write 1 bytes from EEPROM, startL, startH, byte, return 1 byte (control), start at 16
  11: activate(1)/deactivate(0) setup on Boot from EEPROM parameter table, no return
  12: write setup to EEPROM,  return 1 byte


Section
1 Execute Loader Code in binary with leading start address, no return value (just expreimental)
  0: PreLoader (0240) to load BOOT.SYS from SD
  1…: more code can be placed into ATMEGA, if needed

Section
2 Select baud rate, no return value (SW=software defined, HW=by OSI typical TX clocks)
Note: HW are the only baud rates supported by emulation and TX clock analysis at startup

  TX clock cannot be used directly for the emulated UART due to hardware restrictions !
  Only TX clock divider by 1 (Syncron mode of UART) exist
  0: restore from SW to HW serial baud rate from initial reading of TX clock (true serial clock)

  1: 150 only SW

  2: 300 +HW

  3: 600 +HW

  4: 1200 +HW

  5: 2400 +HW

  6: 4800 +HW

  7: 9600 +HW

  8: 14400 only SW

  9: 19200 +HW

  10: 38400 +HW

  11: 57600 only SW -> transmit works, rest not reliable

  12: 76800 only SW -> non standard, not tested

  13: 115200 only SW -> transmit works, rest not reliable

  14: 125000 only SW -> not tested

  15: 31250 only SW ->> MIDI IN/OUT, +1.58% faster compared to MIDI

Section 3 SD card functions
Note: Only a single file can be opened for R/W. If SD operation holds for more than 1 sec,
  a soft reset will be initiated to restart the ACIA emulation. So writing to a file in intervals separated by more than 1 sec
  will not work !!  If operation was successful, a 0x01 is returned, elsewhere
  a zero

  0: start and check SD card, returns 1 if available, 0 if not (will cause WDT Reset)
  1: close and eject SD card, no return (card needs to be re-inserted !)
  2: return SD card error code, return 1 byte
  3: set filename, name ends with byte zero (max 24 characters incl. zero)
  4: check if file exist, return 1 byte
  5: set path, ends with byte zero (max 32 characters)
  6: return directory list, name plus zero. Ends with zero or if not available. Also zero after break
  7: get free disk space in MB, return 2 bytes 16bit
  8: get file size in bytes, return 2 bytes 16bit, return 0, if file larger than 65535 bytes
  9: read file, 2 bytes file size, 0=Error or no file, followed by binary data
  10: create folder in selected path (folder name in filename) return 1 byte
  11: delete folder in selected path (folder name in filename), return 1 byte

  12: delete file or folder, return 1 byte

  13: rename file, new filename, name ends with byte zero (max 24 characters), return 1 byte
         Note: before rename, do step 3,5 and 4, to define file to be renamed !
  14:write file, 2 bytes file size,  return 1 byte  0/1 , if file allocation complete.
       followed by binary data, terminated by write to control port,   return 1 byte  0/1 when done
  15:Get last SD Error, return 1 byte

Section 4 IRQ enable/disable timer, does not set IRQ flag in Status register
Note:
 can be active even in IRQ enable is not set, IRQ resets after 10µsec by itself
  0: disable timer IRQ

  1: IRQ on CTS goes low. IRQ resets after 14µsec by itself

Note: CTS can be used as an interrupt input and disables normal CTS behavior
  2: IRQ 128 µsec
  3: IRQ 256 µsec
  4: IRQ  512 µsec
  5: IRQ 1.024 msec
  6: IRQ 2.048 msec
  7: IRQ 4.069msec
  8: IRQ 10 msec
  9: IRQ 16.67 msec (60 Hz)
  10: IRQ 20 msec (50 Hz)
  11: IRQ 32.78 msec (max)
  12: read OSCCAL factory calibration value, return 1 byte
  13: read actual OSCCAL, return 1 byte
  14: write OSCCAL, changing will lead to non function TX/RX baud rates !!

  15: reset OSCCAL to calibration value

Note: to use IRQ on ACIA, you have to connect pin 7 (Socket of ACIA) with the CPU IRQ line Pin 4,
  in case you are using an OSI 600 board, OSCAL allows variation of system clock in a range of +/- 25%


Other Ideas not implemented yet:

-Using PD5 (RTS) output as fast PWM (8bit 31khz)
-Using Debug port for Serial IN/OUT and selection by RTS with 1 byte in 2 usec
-Using Debug port for SPI RAM/FLASH memory, selection by RTS 

 

SOFTWARE FOR OPERATION

CONFIG.PRG:
This BASIC program allows to configure "STANDARD BAUDRATE", "FIFO AUTO HANDSHAKE", "RS232 PORT" and "CONFIGURATION OPTIONS"  to enable/disable parameter pre-set during startup or to save the parameters in an EEPROM on the module.

BOOT.SYS:
This Assembler program represents an user interface to view files stored on the SD card, go into subfolders and execute three types of programs, if they have the correct extensions.
This program is a very good example, how to use the new
extended ACIA Control functions listed above.

There are different versions of BOOT.SYS for different memory configurations like 4k, 8k, 16k, 24k 32k and 40k systems. The reason is, BOOT.SYS places itself at the TOP of memory and leaves the BASIC memory untouched.
Note: To run some of the larger games like Monstermaze, you will need more than 8K memory to avoid program collision in the TOP of memory.

 

Note: to use BOOT.SYS on OSI sytems, a cold-start has to be done to initialize ROM BASIC.

Recognized file extensions:

.PRG - This are binary programs with two leading bytes representing the start address (like Commodore software)

.BAS - This is the standard BASIC text file from Cassette, like it is generated during a listing

.LOD - This is the standard MACHINE CODE text file from Cassette or other machine code programs

.HEX  and .65V - same as LOD

In addition, BASIC programs can come in form of a .PRG file. These Basic files have a special header to allow the BASIC program to be stored in Binary format. It speeds up program loading by more than a factor of 10. To store BASIC programs in .PRG format, you can use my Emulator and save your program under Load/Save Binary in the file menu.
Note: filenames can have small or upper letters, spaces are not allowed, length is max 23 charcters incl. extension.
Note: BOOT.SYS can be relaced any time by a more comprehensive user program, if needed.

BASIC_PLUS.PRG:
This Assembler program represents an BASIC command extension. It provides nine new BASIC commands to manage the SD card within a BASIC program. If BOOT.SYS is replaced with BASIC_PLUS.PRG (rename BASIC_PLUS.PRG to BOOT.SYS in the root folder or the SD) and you get the BASIC command extensions available at startup. BOOT.SYS can also be replaced by a BASIC AutoStart program to function similar to the OS65D BASIC operating system.

 New BASIC commands:

        - SDLIST (prints current folder content)
        - SDLOAD "FILENAME",[ADDRESS] (loads a basic or machine code program)
        - VAL=SDSAVE "FILENAME",[START ADDRESS, END ADDRESS] (saves a basic or machine code program)
        - SDRUN  "FILENAME",[ADDRESS] (loads and runs a basic or machine code program)
        - VAL=SDLEN  "FILENAME" (gets file size)
        - SDGOTO "PATH" (defines selected folder)
        - VAL=SDLOG (gets last SD error)
        - VAL=SDCLEAR "FILENAME" (deletes file)
        - VAL=SDFRE (initialize SD card and checks free space in Mbytes)

Note: Running the standard BOOT.SYS program will end the new BASIC commands to be recognized in BASIC.

HARDWARE AVAILABILITY

If you are interested in the SD card module, I could provide the PCB and the programmed PLD plus microcontroller either in the SMD or DIP version. All other standard components or connectors, sockets , SD card interface or USB to RS232 TTL and so on are not included.
I do no PCB assembley. The SMD version will include some of the TTL ICs and passive components and only need pin headers and SD card interface.The price for the pre-assembled PCB incl. µC and PLD is 26 EUR plus shipping.

So you need to have sufficient soldering skills and need to buy some some of the additional components to finally assemble the boards. PLD and contoller firmware source are not part of the SD card interface.
If you are interested, please send me a note to the below shown E-mail address.

  

 

 Schematics

Schematics

 

 

Last Update: May 2025