Post AQGXkAtdnJC0mRR44W by thorpej@mastodon.sdf.org
 (DIR) More posts by thorpej@mastodon.sdf.org
 (DIR) Post #AQGXjtKd6E5OIvvMdk by thorpej@mastodon.sdf.org
       2022-12-04T00:30:23Z
       
       0 likes, 0 repeats
       
       Ok #retrocomputing enthusiasts! Here’s a 🧵 about a machine that’s been getting a lot of attention lately, thanks to Adrian Black’s video about it: the NABU! I picked up 2 of these little beauties, in addition to one Adaptor (more on that later).
       
 (DIR) Post #AQGXjttN13sK2gB6n2 by thorpej@mastodon.sdf.org
       2022-12-04T00:58:20Z
       
       0 likes, 0 repeats
       
       Here’s the brains of the operation: a Z80A CPU. The 4K boot ROM is right below it.
       
 (DIR) Post #AQGXjuTspJ59rvGGhc by thorpej@mastodon.sdf.org
       2022-12-04T01:00:15Z
       
       0 likes, 0 repeats
       
       Video is handled by the venerable TI TMS9918A.
       
 (DIR) Post #AQGXjvDy3xwgAqp4XA by thorpej@mastodon.sdf.org
       2022-12-04T01:07:11Z
       
       0 likes, 0 repeats
       
       Audio duties are performed by the General Instruments AY-3-8910. This chip is also involved interrupt handling: the one of the 8-bit GPIO ports is connected to an array of NAND gates and is used to mask individual interrupts.
       
 (DIR) Post #AQGXjwCERu9RBl1CT2 by thorpej@mastodon.sdf.org
       2022-12-04T01:11:56Z
       
       0 likes, 0 repeats
       
       This here is probably the most interesting chip on the NABU, even though it’s possibly one of the dumbest: the Western Digital TR1863P UART. This chip is involved in the NABU’s most interesting feature: the network interface. The chip literally has no software controls: all configuration is performed by strapping pins.
       
 (DIR) Post #AQGXjwNDn2wRjq9yb2 by thorpej@mastodon.sdf.org
       2022-12-04T01:03:07Z
       
       0 likes, 0 repeats
       
       Oops, forgot to mention the NEC 8251 UART in the upper left there. That is the interface to the keyboard … more on that later, too.
       
 (DIR) Post #AQGXjxa1Iwm1Tp9iBU by thorpej@mastodon.sdf.org
       2022-12-04T01:17:50Z
       
       0 likes, 0 repeats
       
       The TR1863P provided a 111.8Kbps (1.79MHz / 16) interface to the "Adaptor". The Adaptor interfaced with the CATV network that repeatedly broadcast all of the menus and software for the NABU .. called the "carousel". The NABU didn't send requests to the server (the CATV network was not bi-directional). It told the processor on the Adaptor what file / segment it wanted, and the Adaptor waited for it to come around and then sent to to the NABU.
       
 (DIR) Post #AQGXjyHcgpeTf3YX9E by thorpej@mastodon.sdf.org
       2022-12-04T01:20:53Z
       
       0 likes, 0 repeats
       
       I'm not going to get into the details of the NABU network. Instead, I recommend you check out Adrian's video (https://youtu.be/HLYjZoShjy0) and also the series of videos that DJ Sures has been doing as he hacks on his NABU, getting a network emulator going (https://youtube.com/playlist?list=PLNT_tjSHIQ3lGJR_zOqh9gGeHzykR0spq).
       
 (DIR) Post #AQGXjytCR7i3Xb8Xia by thorpej@mastodon.sdf.org
       2022-12-04T01:29:23Z
       
       0 likes, 0 repeats
       
       The architecture of the NABU is rather straightforward. The Z80A + TMS9918A + AY-3-8910 (and their variants) were used in a few other its contemporaries, notably the MSX computer and the ColecoVision game console. The system has 64K of RAM, a 4K boot rom (there also exist 8K boot ROMs that apparently also had a driver for a floppy controller).
       
 (DIR) Post #AQGXjzP6WVEL8Y41Ro by thorpej@mastodon.sdf.org
       2022-12-04T01:39:32Z
       
       0 likes, 0 repeats
       
       There are provisions for expansion modules (connected to pin headers on the main board). The Adaptor and keyboard connect using RS-422. The printer port is unidirectional parallel (using an oddball connector). And you get composite NTSC video and line level audio output.
       
 (DIR) Post #AQGXjzwQWbswntedO4 by thorpej@mastodon.sdf.org
       2022-12-04T01:45:09Z
       
       0 likes, 0 repeats
       
       The keyboard is really great, with only a couple of layout oddities (such were common on machines of the era). It has just a bit of weight to it, and lovely ALPS switches that sound and feel every bit as awesome as you can imagine. I definitely need to make a NABU keyboard -> USB interface using an Arduino.
       
 (DIR) Post #AQGXk0WaMAoCc2ZVkO by thorpej@mastodon.sdf.org
       2022-12-04T01:47:14Z
       
       0 likes, 0 repeats
       
       The keyboard also has 2 Atari-compatible joystick ports. The microcontroller in the keyboard sends joystick input to the NABU as part of the keyboard protocol.
       
 (DIR) Post #AQGXk17S96IcSNoxDE by thorpej@mastodon.sdf.org
       2022-12-04T01:54:43Z
       
       0 likes, 0 repeats
       
       The keyboard’s heft comes from the metal plate that carries the key switches.
       
 (DIR) Post #AQGXk1ZSSyhVrEvJrc by thorpej@mastodon.sdf.org
       2022-12-04T02:07:50Z
       
       0 likes, 0 repeats
       
       Key switches are soldered directly to the PCB. The keyboard has a 6803 processor and an ADC0809. I guess the A/D converter is used to decode the keyboard matrix (are the switches used to configure voltage dividers?). The serial output (yes, unidirectional) is not obvious at first blush. Need to look at the 74LS chips on the board to see if anything jumps out.
       
 (DIR) Post #AQGXk1yGyiYB6CX8Xg by thorpej@mastodon.sdf.org
       2022-12-04T02:21:35Z
       
       0 likes, 0 repeats
       
       Other chips on the keyboard PCB include: 555 timer, a 74LS253, a 74LS138, a 74LS373, a 74LS74, a UA9638 (that's the RS-422 line driver, so I should trace what pins 2 and 3 are connected to in order to figure out what's generating the serial data), a 74LS02, 2 74LS253s, a 74LS156, and 2 74LS251s.  Also of note, there are provisions for 2 additional joystick ports on the top-right of the controller board.
       
 (DIR) Post #AQGXk2ZUkKKAxdwrYm by thorpej@mastodon.sdf.org
       2022-12-04T02:28:10Z
       
       0 likes, 0 repeats
       
       Anyway, the keyboard seems pretty interesting!  I'll put "dump keyboard controller ROM" and "figure out what's driving the 9638" onto the TODO list. That'll be worth a separate thread on its own.
       
 (DIR) Post #AQGXk30R89sKJCYNYO by thorpej@mastodon.sdf.org
       2022-12-04T02:50:29Z
       
       0 likes, 0 repeats
       
       OH DUH! Of course! The 6803 has a built-in serial interface! Ok, mystery solved. 😂
       
 (DIR) Post #AQGXk3Xl8GWvyY8zUe by thorpej@mastodon.sdf.org
       2022-12-04T05:32:56Z
       
       0 likes, 0 repeats
       
       Ok, so the 6803 has a ~3.5MHz clock input, which is divided by 4 internally to the CPU, giving an E of ~894.8KHz. That, in turn, is divided in the SCI baud rate generator by 16, 128, 1024, or 4096, yielding possible baud rates of ~56Kbps, ~7Kbps, 874bps, or 223bps. What’s your vote?
       
 (DIR) Post #AQGXk4R3oelYk419gu by thorpej@mastodon.sdf.org
       2022-12-04T05:47:28Z
       
       0 likes, 0 repeats
       
       The answer is 2, ~7Kbps!  6992bps, to be precise! Hopefully it won't be too difficult to get an Arduino to receive reliably at close-to-that-rate 😂
       
 (DIR) Post #AQGXk4hMq1oHYdeB6m by publius@mastodon.sdf.org
       2022-12-04T14:30:47Z
       
       0 likes, 0 repeats
       
       @thorpej Using 3.58 MHz NTSC subcarrier oscillators for frequency synthesis jobs used to be commonplace. Even telephone DTMF generators were built around them.
       
 (DIR) Post #AQGXk6L6jlC0eBFQgq by thorpej@mastodon.sdf.org
       2022-12-04T14:02:39Z
       
       0 likes, 0 repeats
       
       Ok! Took a break last night to make dinner and clean the kitchen. The dog got me up early today, so figured I might as well just make some coffee and talk about the keyboard protocol, so here we go!
       
 (DIR) Post #AQGXk7CHY3j9J67tZY by thorpej@mastodon.sdf.org
       2022-12-04T14:06:01Z
       
       0 likes, 0 repeats
       
       The 6803 in the keyboard performs quite a bit of processing, offloading the main CPU from dealing with these tasks. Specifically, all of the switch debouncing is performed in the keyboard, and it tracks some state so that it only interrupts the main CPU when something has changed.
       
 (DIR) Post #AQGXk8gS1NSBuxFVEe by thorpej@mastodon.sdf.org
       2022-12-04T14:09:25Z
       
       0 likes, 0 repeats
       
       The keyboard simply sends ASCII to the main CPU, for the most part. Key repeat is handled by the 6803 and there are no separate "key down" or "key up" events for most keys.
       
 (DIR) Post #AQGXk9RxAlS2IHTRHE by thorpej@mastodon.sdf.org
       2022-12-04T14:13:31Z
       
       0 likes, 0 repeats
       
       There are exceptions, tho, for special function keys (which do not auto-repeat): the arrow keys, the pagination keys (<||| and |||>), YES, NO, SYM, PAUSE, and TV/NABU.  Those have separate "down" and "up" events.
       
 (DIR) Post #AQGXkAtdnJC0mRR44W by thorpej@mastodon.sdf.org
       2022-12-04T14:16:06Z
       
       0 likes, 0 repeats
       
       SHIFT, CAPS, and CTRL are handled by the keyboard. The main CPU never sees those keypresses.  SHIFT does the expected thing (capital letter, or upper key symbol), CAPS only does capital letters, and CTRL strips the upper 2 bits off the normal code for that key.
       
 (DIR) Post #AQGXkBq8HpyrhqnmF6 by thorpej@mastodon.sdf.org
       2022-12-04T14:20:33Z
       
       0 likes, 0 repeats
       
       After the normal ASCII range is where the interesting stuff starts.  0x90-0x95 are keyboard error codes (E1-E6). E1 is "multiple keys depressed" error, E2 and E3 report bad RAM/ROM  self-check, E4's "illegal ISR" presumably means "firmware bug" 😂 . E5 is a heartbeat that is sent every 3.7 seconds (maybe only when idle?), and E6 indicates keyboard power-on reset (or hardware watchdog-generated keyboard reboot).
       
 (DIR) Post #AQGXkCjQyEDUTMfwRM by thorpej@mastodon.sdf.org
       2022-12-04T14:23:48Z
       
       0 likes, 0 repeats
       
       0xE0 - 0xFF is where the special key-up/key-down codes live for the special keys.
       
 (DIR) Post #AQGXkEJH6STpMoS4wa by thorpej@mastodon.sdf.org
       2022-12-04T14:28:46Z
       
       0 likes, 0 repeats
       
       Now, joystick data! Codes 0x80 - 0x81 and 0xA0 - 0xBF encode joystick data. Joystick data comes as a 2-byte packet: the first byte indicates the controller number (0x80 - 0, or 0x81 - 1), and the next byte tells you the new state of the joystick like so:     101FURDLSo, 0xA0 is "joystick returned to resting state", 0xA1 is "joystick engaged left", 0xB4 is "joystick engaged right and fire button pressed".
       
 (DIR) Post #AQGYBKDLG7xdUub3wG by thorpej@mastodon.sdf.org
       2022-12-04T14:35:46Z
       
       0 likes, 0 repeats
       
       @publius heh, yah, I always forget that’s the NTSC colorburst freq … I assume it was used here because the parts were plentiful and thus cheap … no other reason to use that weird freq in the keyboard 😂