Close

Video, Audio, Progress!

A project log for MC68000 Computer

My attempt at building a small computer based around a full Motorola 68000 processor.

Hayden KroepflHayden Kroepfl 05/12/2016 at 03:220 Comments

Alright so it's been quite a while since I posted an update. Most of the work done on this update was done a few months ago, but school got in the way of getting it polished up a bit and written up. So, things that have been done since my last update. First things is that I've added a custom color NTSC serial terminal based on a ATMEGA328.




The video terminal is based on an earlier project of mine which was a B/W 40 column terminal with PS/2 keyboard running on a stock Arduino Duemilanove. For this project I decided I wanted a color terminal, so I redesigned the project from scratch using a bare ATMEGA328, A 14.318MHz crystal (4x NTSC color burst), and a 4 bit shift register to generate different phases of 3.8MHz. The downside of moving to color with the lower clock frequency was that I was unable to squeeze out more than 32 columns of text properly (also not helped by the SPI hardware in the ATMEGAs putting out a 9th bit for every byte sent). To support color over the serial terminal I added a parser for ANSI escape sequences to the terminal, and assigned the various colors I got from the shift register to the ANSI colors.



The second major addition was to add a YM2149F programable sound generator. I wanted my computer to be able to play chip-tunes of some sort, and the YM2149F used in the Atari ST seemded like a good candidate. The only downside to this chip was it's weird bus inheritied from the AY-3-8910, which I had to add an AND gate (7402) to my circuit to develop my minimal interface circuit. Since I wanted to use as little logic as possible, access the chip is a little odd. To select a register you write to $180000 with the register number, to write to the register you write the value to $180002, and if you want to read the value of the register you read from $180000. The chip also gives me access to 2 more 8-bit parallel ports if they are needed.



Finally the interrupt line was hooked up from the 68681 DUART to interrupt line one on the 68000. The proper way to do this would be to hook it up through a priority encoded, but since we're only dealing with one interrupt source we can simply hook it up to the low bit, and tie the others low. With the interrupt line we can now have an interrupt handler listen for new data recieved by the serial port, and put that into a ring buffer. Rather than having to poll for new data constantly. This also lets us recieve serial data when the program is busy doing other things. Another feature we can now use is the DUARTs built in timers and counters. For my computer I programed a 300Hz timer to serve as the main system tick as it was divideable by both 50Hz for the Atari ST music, and 60Hz for VSYNC. Though this may be too fast if I decide to write a multi-tasking operating system later since there's only around 13,000 cycles at 4MHz between interrupts.



To take advantage of these hardware upgrades the monitor program was updated to handle the interupts, as well as including a simple interrupt driven player for YM2149 chiptunes. I used the MYM format used by the Oric Software Development Kit (http://osdk.defence-force.org/index?page=documentation&subpage=ym2mym) as an alternative to the YM format for computers with limited memory. The YM format is optimized to be decompressed in full into memory, which would take around 250k for a standard song. The MYM is optimized to be decompressed in 128 length frames. My implementation of the decoder is far from optimal at decoding the format as there is a noticable pause every 2.5s as it refills the buffer. This is due to the decoder taking much longer than the 1/50th of a second that it has before the next register dump is needed.

Discussions