Step 1: Get free run!

A project log for Yet Another 68k Homebrew Computer

Simple Homebrew computer based on 68000 CPU

Roman RomanchukRoman Romanchuk 02/11/2022 at 11:340 Comments

Effectively `free running` of the processor is the state where it doing something without involvement from the outside. 

But first some basic info on the processors and execution of the code. CPU effectively doing following steps when powered on in the loop:

  1. Specify address of the command on address pins
  2. Read command from data pins
  3. Execute it

If command execution is not influencing the address from which next command will be fetched - the next command will be fetched from next memory address. 

The idea of `free run` is exactly this: setup minimal configuration of the chip, give to it commands to execute, and verify that address is changing after each command. One of the simplest methods of verification is to attach LED to outputs from processor that indicate the address from which next command will be changed. Usually it doesn't make sense to attach LED to every output that processor using for address, as it working fast enough, that human eye will not see flickering. So I attached the LED only to outputs A21, A22, A23 indicating 3 highest bits of the memory address, these high bits will change slow enough to see LED turning on and off.

So how to get 68000 into free run mode? 

According to data sheet, processor have 3 types of pins: 

  1. Input
  2. Output
  3. Bi-Directional

First thing is to provide enough input to start processor. In case of 68000 it would mean so called `DTACK grounded` configuration:

The next step would be select the command that processor will execute. Usually it's NOP, which stands for 'No Operation', but due to special startup sequence of 68000 it's not possible to use it directly. Looking on different command codes the suitable command would be 'ORI.B #0,D0'. It's not important what it's doing, but it's nice choice as binary representation of this command is: 0. So after initial sequence, processor will start reading command from data pins. As we want to give 0 there - let's tie the all data pins to ground.

What is this initial sequence? 68000 will read first 4 words of memory and use them as address of the program to execute. By providing 0 as input during this sequence we will indicate to processor that first memory address to fetch command will be 0. 

So after put all wires according to the scheme above, I was expecting to see a nice blinking LEDs. As it usually happens - expectation doesn't met reality and LEDs weren't blinking. 

After starring in the datasheet and fiddling with the wires I found out that RESET and HALT lines should be down on power up and go high in some time after CPU start. According to datasheet this period should be at least 100ms. 

So after rewiring schema and providing manual way to power up this pins at later moment (just drop that two wires on separate rail, and manually plug wire from 5V after giving power to rest) I was able to get the thing blink!

Not sure why, but usually it stops blinking after couple dozen of seconds, but seems initial free run is success.  

I drew schematics of free running 68000 setup. As mentioned in previous log this project is about learning by doing, so if you spot any errors or strange things in this schematics - let me know in the comments.