PX-4 cartridge information

Source: OSRM I-15 (registers), OSRM I-64 (modes), II-500 (cartridges), III-14 (programs), Technical Manual

What isn't very clear from the manuals:

Usually the O.S. has figured out the cartridge mode and cartridge identifier at Reset/Power On, but sets the interface in reset mode (/CSR bit, IOCTRL) and applies the pseudo-reset. The reset and the pseudo-resets, two of them, have to be cleared before the cartridge can be accessed.

I/O Registers copied in RAM (I-38, II-500). When changes are written to the ports, update the OS copy too:

P00h CTRL1  0F001h RZCTRL1
P04h IER    0F53Eh RZIER
P05h BANKR  0F5EDh RZBANKR
P13h        0F53Fh CRGDEV
P15h ARTMR  0F003h RZARTMR
P16h ARTCR  0F004h RZARTCR
P18h SWR    0F005h RZSWR
P19h IOCTLR 0F006h RZIOCTLR

Interesting ports:

CTRL1 (Control Register, P00h, write mode, P00h, I-16) (writing disables pseudo-reset for CTRL1, IER, BANKR):

 7 6 5 4 3 2 1 0
 | | | | | | | |
 | | | | | | | +---- SLBCR Select trigger for FCR; 0 = bar code reader, 1 = external cassette input
 | | | | | +-+------ BCR1, BCR1 Barcode mode select
 | | | | +---------- SWBCR Barcode Power Switch; 0 = off, 1 = on
 +-+-+-+------------ Baud Rate Generator Select

IOSTR (IO Status Register, P16h, read mode, I-32):

 7 6 5 4 3 2 1 0
 | | | | | | | |
 | | | | | | | +---- PBUSY  Busy signal from the Centronics interface
 | | | | | | +------ PERR   Error signal from the Centronics interface
 | | | | | +-------- SIN    Status signal from the SIO interface
 | | | | +---------- RXD    Serial data input
 | | | +------------ RCD    RS-232C CD signal
 | | +-------------- RCTS   RS-232C CTS signal
 | +---------------- CSEL   Cartridge option select signal ; 0=HS mode, 1 other mode
 +------------------ CAUD   Audio input signal from the cartridge connector

ARTCR *ART Command Register, P16h, write mode, I-32):

  7 6 5 4 3 2 1 0
  x x | | | | | |
      | | | | | +--- TXE   Controls serial transmission; 0=disable, 1=enable
      | | | | +----- RDTR  RS-232C DTR signal
      | | | +------- RXE   Controls serial reception; 0=disable, 1=enable
      | | +--------- SBRK  Break output; 1=forces TXD low
      | +----------- ER    Resets OE, FE and PE bits
      +------------- RRTS  RS-232C RTS signal

SWR (Switch register, P18h, write mode, I-33) (writing disables pseudo-reset for SWR, ARTMR, ARTCR):

 7 6 5 4 3 2 1 0
 x x x | | | | |
       | | | | +---- CSW0 \                      / CSW0=0; CSW1=0: HS mode, CSW0=1; CSW1=0: IO mode,
       | | | +------ CSW1 -- Cartridge I/F mode  - CSW0=0; CSW1=1: DB mode, CSW0=1; CSW1=1: OT mode.
       | | +-------- SSW0 \               / SSW0=0; SSW1=0: RXD+TXD=CartSIO, SSW0=1; SSW1=0: RXD+TXD=RS-232C,
       | +---------- SSW1 -- Serial mode  - SSW0=0; SSW1=1: RXD+TXD=SIO, SSW0=1; SSW1=1: RXD=RS232C; TXD=SIO
       +------------ AUSW  masks CAUD (audio from cartridge) ; 0=mask off, 1=masks on

IOCTRL (IO Control Register), P19h, write mode, I-35):

 7 6 5 4 3 2 1 0
 | | | | | | | |
 | | | | | | | +---- PSTB Centronics interface strobe signal 0 = Normal, 1 = Data Strobe
 | | | | | | +------ /PINT Initial output for Centronics interface. o initialized the printer
 | | | | | +-------- SOUTControl signal for the SIO interface
 | | | | +---------- /CSR Cartridge reset signal. 0 = Reset cartridge, 1 = Normal cartridge operation mode (? enables pseudo-reset?)
 | +-+-+------------ Keyboard LED2, LED1, LED0, (CAPS, NUM, INS)
 +------------------ SP Output to loudspeaker. 0 = connects cartridge CAUD line to speaker, 1 = disconnects CAUD

The four cartridge types/modes (I-64)

                                              CWS1  CWS0 
* HS 00h (Handshake mode)                       0     0
* DB 01h (Data bus mode, four addresses)        1     0
* IO 02h (4 bit output bus, 4 bit input bus)    0     1
* OT 03h (8 bit latched output bus)             1     1

SWR bits 2 & 3 (I-34):

 SSW1  SSW0
  0     0     Cartridge SIO (RXD & TXD)
  0     1     SIO (RXD & TXD)
  1     0     RS-232C (RXD & TXD)
  1     1     RS-232C (RXD) & SIO (TXD)

Pseudo -reset (I-36):

Cartridge modes

HS mode (I-68):

HS mode register Read Write P10h CHSIR data byte CHSOR data byte P11h CHSSR flags CHSCR command byte P12h - P13h -

CHSSR flags (read mode):

 7 6 5 4 3 2 1 0
 x x x x x | | |
           | | +---- OBF  - output buffer full (Pine to Cartridge)
           | +------ IBF  - input buffer full (Cartridge to Pine)
           +-------- CAB1 - Cartridge status data

Request cartridge code (Micro drive and Cartridge printer):

DB mode (I-70):

upper nibble:

    0000 No cartridge
    0001 ROM cartridge        DB mode, device code 01h
    0010 RAM cartridge        DB mode, device code 02h
    1000 PROM writer cart.    DB mode, device code 08h !
    1000 Microcassette drive  HS mode, device code 08h !
    1001 Cartridge printer    HS mode, device code 09h
    1110 DMM cartridge        IO mode, device code 0Eh
    1111 Modem cartridge      IO mode, device code 0Fh

DB mode registers

           Read               Write
    P10h  not used           CDBORO LSB byte address
    P11h  not used           CDBOR1 MSB byte address
    P12h  CDBIR2  data byte  CDBOR2  data byte
    P13h  Device ID          CDBOR3 bit 0 is Power (0 is off, 1 is on)

P13h Rd:

    0000 0001 ROM cartridge
    0000 0010 RAM cartridge

asm example:

LD      A, (RZSWR)    ; RZSWR: 0F005h, SWR: 18h
AND     0FCh          ; clear bits 0 and 1
OR      02h           ; set bit 1 for DB mode
LD      (RZSWR), A    ; save value
OUT     (SWR), A      ; switch mode

IO mode (I-69):

      Read                  Write
P10h CIOR CDB7-4, CDB3-0  CIOR CDB7-4, CB3-0 is a don't care nibble
P11h Not used             Not used
P12h Not used             Not used
P13h Not used             Not used

The DMM and Modem cartridges use the Cartridge SIO for communication. The BRG0-3 bits in CTRL1, P00h set the Baud rate (I-17).

CDB0 - RDY signal, CDB4 - 0 = Power-on, 1 = Power-off

LD      A, (RZSWR)    ; RZSWR: 0F005h, SWR: 18h
AND     0FCh          ; clear bits 0 and 1
OR      01h           ; set bit 0 for IO mode
LD      (RZSWR), A    ; save value
OUT     (SWR), A      ; switch mode

OT mode (I-71):

      Read                        Write
P10h COTR Output port contents   COTR data byte
P11h -                           -
P12h -                           -
P13h -                           -

OT mode is a single 8 bit latch on P10h which contents can be read back.

Cartridge interface initialization

A cartridge access order that works:

Latest update: 2023-04-23

e-mail