MSX Assembly Page

Sony HBI-55 Data Cartridge / Yamaha UDC-01 Data Memory

The Sony HBI-55 and the technically equivalent Yamaha UDC-01 are 4 kB SRAM data cartridges. This SRAM, or static RAM, is very low power memory whose contents are preserved when the computer is off by means of a little battery.

Amongst others they are used by the internal firmware in Sony’s HB-55 and HB-75 computers and by Yamaha’s CX5M music computer software. The Sony HB-55 and HB-75’s firmware also add the ability to store a BASIC program on the HBI-55 using the SAVE "CAT:" and LOAD "CAT:" commands.

Memory access

The HBI-55 uses the 8255 PPI (Programmable Peripheral Interface) as a controller IC to access the memory. If this sounds familiar, that’s right; all MSX computers also contain a PPI to deal with slot selection, keyboard I/O etc. The HBI-55 has a PPI of its own to access the SRAM at I/O ports 0B0H-0B3H.

Here’s a little block diagram:

   IRQ and A2-A7    A0-A1 RD/WR  D0-D7
  ┌─────────────┐    │ │   │ │  ││││││││
  │Adresdecoding├─┐  │ │   │ │  ││││││││
  └─────────────┘ │  │ │   │ │  ││││││││
  ┌───────────────┴──┴─┴───┴─┴──┴┴┴┴┴┴┴┴─┐
  │8255 Programmable Peripheral Interface│
  └───┬┬┬┬┬┬┬┬────┬┬┬┬┬┬┬┬────┬┬┬┬┬┬┬┬───┘
     C││││││││   B││  ││││   A││││││││
      ││││││││    ││  │││└───┐││││││││
      ││││││││    ││  ││└───┐│││││││││
      ││││││││    ││  │└───┐││││││││││
      ││││││││    ││  └───┐│││││││││││
    ┌─┴┴┴┴┴┴┴┴────┴┴──────┴┴┴┴┴┴┴┴┴┴┴┴─┐
    │  D0-D7   W/R  EN        A0-A11   │
    │       4 Kilobyte static RAM      │
    └──────────────────────────────────┘

The PPI’s three ports and control register are set up as follows:

PortRegisterValue
0B0HPort AAddress bits 0-7
0B1HPort Bbit 0-3: Address bits 8-11
bit 6: Set to 1
bit 7: Read (1) or write (0)
0B2HPort CData read / write
0B3HControl89H: Read
80H: Write

First, configure the PPI for reading or for writing using the control register (0B3H). Output 89H to read, or 80H to write. For more details about these values, consult the PPI documentation.

Next, set the 12-bit address. Write the lowest eight address bits to port A (0B0H), and the highest four address bits to bits 0-3 of port B (0B1H). Additionally, set bit 6 of port B to 1, and set bit 7 to indicate whether to read (1) or to write (0). That’s right, you need to indicate whether to read or write again, this time you’re instructing the SRAM itself.

Finally, read or write the value through port C (0B2H).

Here’s some example BASIC code:

10 ' HBI55.BAS by Bjorn Lammers
20 ' Controlling the
30 ' Sony Data Cartridge
40 '
50 ' Writing
60 INPUT "Adress";AD
70 INPUT "Data";DT
80 ' Control register
90 OUT &HB3,&H80
100 ' Adress low
110 OUT &HB0,AD AND &B11111111
120 ' Adress high
130 OUT &HB1,(AD\256) OR &B01000000
140 ' Data
150 OUT &HB2,DT
160 ' Reading
170 INPUT "Adress";AD
180 ' Control register
190 OUT &HB3,&H89
200 ' Adress low
210 OUT &HB0,AD AND &B11111111
220 ' Adress high
230 OUT &HB1,(AD\256) OR &B11000000
240 ' Read data
250 DT=INP(&HB2)
260 PRINT "Data: &H"+HEX$(DT)
270 END

Grauw