Joypad, Timer and IRQ ...

The Joypad

(This information is from Robert Kemmetmueller <rskm@VNET.IBM.COM>)

The TG-16 controller uses a 74HC157 IC, which is a quad 2-line-to-1-line data selector/multiplexer with noninverting output. The console does a "double-poll", getting the values of the U D L R pad switches once, and then the R S I II buttons.

The Avenue6 pad uses three of those ICs, one to "double-poll" the usual (U D L R, R S I II) buttons, another to "double-poll" the (- - - -, III IV V VI) buttons, and the third IC continuously switches WHICH of those ( ) sets is sent when the console polls.

The software running on the console never knows which set it'll get on any given poll, but it can TELL which set because the "- - - -" means all 4 directions were pushed. Older titles don't know how to handle that. (Watch Bomberman go spastic when your controller is set to type "B"!)

$1000(W)select

  • [bit 0] select high / low nibble
  • [bit 1] reset the counter in the multitab
$1000(R)status

  • [bit 0-3] read values
  • [bit 6] Country mode (1=US, 0=Japan)

The Timer

The timer counts with base frequency of 6.9 kHz. It generates the TIQ IRQ as soon as it reaches 0, and reloads the register immediately.

$0C00(W)counter preload
$0C00(R)counter value
$0C01(W)timer enable (only bit 0 used)
$0C01(W)timer status

IRQ mask and status

$1402(R/W)IRQ mask
  • [bit 3-7] (no used)
  • [bit 0] IRQ2D
    • 0: enable
    • 1: disable
  • [bit 1] IRQ1D
    • 0: enable
    • 1: disable
  • [bit 2] TIQD
    • 0: enable
    • 1: disable
$1403(R)IRQ status
  • [bit 3-7] (no used)
  • [bit 0] IRQ2
    • 0: have no IRQ
    • 1: have IRQ
  • [bit 1] IRQ1
    • 0: have no IRQ
    • 1: have IRQ
  • [bit 2] TIQ
    • 0: have no IRQ
    • 1: have IRQ
$1403(W)Reset TIQD

Extensions for the CD-ROM system

$1803(R)disable backup memory
$1807(W)enable backup memory

The arcade card

(This information is from Nimai Malle<nmalle@newssun.med.miami.edu>)

There are four ports to access the memory from the CPU. Each port is one word. Each port can point to a separate address in the arcade card memory. Settings for the ports are also completely independent. The addresses are determined by a "base address" (3 bytes) and an "offset" (2 bytes). Reading and writing is possible from all ports, and each can be set to auto increment or decrement the offset or the base address. Also, there is a bit one can "hit" that causes the base and offset to be added, with the result being stored in the base. This COULD be used as a fast 3 byte adder. There is also a 4 byte read/write barrel roller. Basically, you can store any 4 byte value in this register(s) and write the number of times you wish to shift or roll to a 5th register and you can read the result immediately. This is very limited, but a good hacker could find some tricky little application. I was able to optimise division and multiplication routines, also optimised a run length decoder using this feature...

$1Axx(R/W)unknown