Close

20241110 -- PPI (8255) Catalogue

A project log for ROM Disassembly - Cefucom-21

Peering into the soul of this obscure machine

ziggurat29ziggurat29 2 days ago0 Comments

Today I went though all the references to the 3 Programmable Peripheral Interface (PPI; 8255) devices.  To my relief they are configured once and stay that way.  Also, they are all set to be garden-variety gpio -- no special modes.

8255 Summary:

8255a:
Port A: in
Port B: out
Port C: in

8255b:
Port A: out
Port B: out
Port C (upper): out
Port C (lower): in

8255c:
Port A: in
Port B: in
Port C: out

Mostly I don't know what these do, though, because I have no schematic.  It's worth noting that my nomenclature of "8255a" and "CTCa" is purely made up.  I don't know what actual device on the board these are associated with.  Otherwise I'd use the parts marking on the board.  If I ever find out, then I'll update the info.  This did send me on a side activity of going through the screen shot and collecting all the parts.  (Well, just the IC's.)  So I made a BOM for future reference.  The BOM occasionally gives me some ideas; e.g. there are two 7474's on board.  Maybe clock dividers?  And if someone has a physical board and is willing, I can be specific about requests to buzz out specific pins.  (Especially the address decoders to the various chip selects would be handy!)

I can say that 8255b-a is unused, and that the unusual 8255b-c is used for the bit-bang serial, and possibly RTS/CTS.

Watchdog?

In the course of this, I found a bit which is polled periodically, and will reset a down counter.  If the counter reaches zero, a request for reboot is flagged.  This check is registered in the CTCb2 task list (entry 1).

0D7D  isrCTCb2task01_watchdog_D7D:
D7D DB 69      in  a, (69h)              ; 8255c-b; checking b6
0D7F 47        ld  b, a
0D80 DB 69     in  a, (69h)              ; 8255c-b; checking b6
0D82 B8        cp  b
0D83 20 14     jr  nz, resetWatchdog_D99 ; transitioned during subsequent reads; lets try again
0D85 CB 77     bit     6, a
0D87 20 10     jr  nz, resetWatchdog_D99 ; b6 = 1 == system ready?
0D89 3A 69 C0  ld  a, (byte_C069)        ; XXX a watchdog timer; initted to 5 on 69h b6 set (system ready)
0D8C 3D        dec     a
0D8D 32 69 C0  ld  (byte_C069), a        ; XXX a watchdog timer; initted to 5 on 69h b6 set (system ready)
0D90 20 0C     jr  nz, nullsub_10        ; leave
0D92 3E FF     ld  a, 0FFh
0D94 32 68 C0  ld  (byte_C068), a        ; XXX flag causing warm boot (or maybe sleep) in main task 00
0D97 18 05     jr  nullsub_10
0D99         resetWatchdog_D99:
0D99 3E 05     ld  a, 5                  ; give it 5 chances to come back
0D9B 32 69 C0  ld  (byte_C069), a        ; XXX a watchdog timer; initted to 5 on 69h b6 set (system ready)
0D9E         nullsub_10:
0D9E C9        ret

I'm calling this a 'watchdog' for now, but it might actually be something else that isn't supposed to stay low for too long.  Maybe a sensor of some sort.

Ring Counter?

Maybe the most interesting find was three bits that are configured in what appears to be a ring counter:

5D44         sub_5D44:
5D44 3A 02 81  ld  a, (byte_8102)
5D47 32 03 81  ld  (byte_8103), a
5D4A 21 B0 80  ld  hl, byte_80B0
5D4D CB 96     res     2, (hl)             ; clear
5D4F CB 8E     res     1, (hl)
5D51 CB 86     res     0, (hl)
5D53 3D        dec     a
5D54 28 07     jr  z, was0_5D5D
5D56 3D        dec     a
5D57 28 07     jr  z, was1_5D60
5D59 3D        dec     a
5D5A 28 07     jr  z, was2_5D63
5D5C C9        ret
5D5D        was0_5D5D:
5D5D CB CE     set     1, (hl)
5D5F C9        ret
5D60        was1_5D60:
5D60 CB D6     set     2, (hl)
5D62 C9        ret
5D63        was2_5D63:
5D63 CB C6     set     0, (hl)
5D65 C9        ret

and later: 

047D F3        di                  ; critical section
047E 3A B0 80  ld  a, (byte_80B0)  ; XXX a bitfield; also goes out 8255b-b
0481 E6 07     and     7           ; just the lower 3 bits
0483 32 B0 80  ld  (byte_80B0), a  ; XXX a bitfield; also goes out 8255b-b
0486 FB        ei                  ; end critical section
0487 D3 65     out     (65h), a    ; 8255b-b

A ring counter is a bit peculiar and in this product maybe drives a 4-wire 3-phase stepper motor.  Such a motor might be useful for advancing the paper roll display.

Discussions