Author Archives: peterbjornx

Arduino bootstrapped 68008 computer 7

After a fellow TkkrLab member donated some old chips (including some 68008 and Z80 CPUs) to the hackerspace I wanted to try to build a computer with the 68008 processor.

The 68008 processor is the 8-bit bus version of the 68000, which is the first 68k architecture processor. It is a 16-bit processor that was designed with forward compatibility in mind and to achieve that goal all of its internal registers (except for the status register) are 32-bits. The 68008 is interesting because it has a relatively low pin count and is therefore quite easy to use on a breadboard.


The computer at it is at the moment


I looked up the datasheet for the processor and noticed that it allowed a device on the bus to add wait states as long as needed to complete a transfer, this sparked the idea to use an Arduino as “boot ROM”. I came up with a system where the arduino would dynamically generate 32 byte chunks of 68k machine code to load data into the RAM, disable the arduino bus interface and reset the processor afterwards, booting the new code from RAM.

The idea was simple: Make the glue logic map the first 64K of address space to the Arduino until it signalled boot complete, When that happened it would map the RAM to the first 64K and reset, executing the code that was uploaded.

The implementation yielded some interesting problems: First, the Arduino turned out to be too slow at releasing ~DTACK which caused the processor to assume every read was immediately completed until the arduino released the line. I fixed this by adding a D flip-flop with the D input tied high, the reset input connected to NOT ~AS and the clock connected to the Arduno. The inverting output of the flip-flop is connected to ~DTACK so that the Arduino can assert ~DTACK by setting the clock input high, and once the cycle is complete the processor will release ~AS and the flipflop will clear, causing ~DTACK to be released until the Arduino pulses the clock input again.

When this was fixed the setup would still not work: Although setting the reset vectors appeared to work (I have the Arduino log the adresses requested from it) I could not get it to run a simple “loop: jmp loop”… After a lot of trial and error I discovered i had not connected D7 from the Arduino, as soon as I fixed this it worked: The logs indicated the processor repeatedly fetching address 8 through 11, indicating it was actually looping.

I could, however, not write data anywhere as the Arduino was still way too slow at releasing the bus so I had to add a bus transceiver between the Arduino and the bus to prevent the Arduino and 68008 driving it at the same time.

While doing this I realized that I could never write to the RAM while the bootstrap mode was enabled: Temporarily disabling that mode as I had intended to do would have caused the ~DTACK line to be asserted immediately by the RAM on any cycle after that so the Arduino would not have been able to (reliably) disable it again. To solve this I decided to map the third 64K block of address space to the RAM without routing it through the bootstrap logic so that I can write to the RAM while the Arduino is still mapped on the first 64K.

Now that I finally had the design flaws ironed out I decided to write a simple program for the LED attached to the digital output:

DL 0
DL 8
MOVE.B D1, $010000




When I tried to run this code the processor would lock up after fetching the MOVE.B D1, $01000 instruction. Turns out I did not make the digital output register assert ~DTACK, causing the processor to wait for it forever. This was a simple fix: I added an inverter between the write enable input of the register and the ~DTACK output, causing the digital output register accesses to always complete immediately. I had now arrived at the (hopefully) correct glue logic combination to make this thing work.

Having done so much simple testing I wanted to finally see something happen on the breadboard and wrote this simple blink program:

DL 0
DL 8


SUBQ #1, D0

MOVE.B D1, $010000

Against all expectations, this worked right away: The led started blinking nicely, al be it very slowly: The Arduino fetches take 1 millisecond per byte.

I have not yet tried writing to the RAM or disabling the Arduino but the most tricky part of the build works: The slow 8-bit micro acting as ROM.

I have uploaded the Arduino code to pastebin here and the schematics are available online here.

When I get back to the hackerspace I am going to test the RAM and add a 68901 multifunction peripheral to the mix.


A review of the “fine European craftmanship” in a French-built oscilloscope 1

A couple of weeks ago my neighbour gave me an old cold war-era analog dual channel oscilloscope, I already owned an expensive Tektronix scope so I decided to take it apart.
The first thing I noticed was that there were no optocouplers present on the E.H.T. * board and after closer inspection I found that the “Focus” and “Brilliance” controls were directly connected to the -2 kV rail and that the user was only protected from these potentially lethal voltages by the plastic knobs on those potentiometers. Obviously this is a very dangerous situation as loss of a knob could result in electrocution.
Another curious aspect of this oscilloscope’s design was the fact that the CRT was mounted tightly into a plastic clamp, possibly causing the tube to break if the oscilloscope was to be exposed to any kind of mechanical abuse, which poses a significant risk to the user as the tube might violently explode when broken.
Besides these safety issues I also noticed a peculiar choice of materials for the chassis and mechanical supports, for simple mounting brackets which did not need to support any weight they chose to use thick pressed steel whereas they used injection-molded plastic for the main structural supports.
When i finished examining the device and tried to reassemble it I ran into a couple of problems: First of all the colour coding was not unique and all of the markings on the connectors were in French, they also neglected to mark the signal and ground pins for the RF connections. Because of these issues I was not able to successfully reassemble the oscilloscope, which however unfortunate, did yield me a very cool, round, Telefunken CRT!
One thing I have learned from this is that something being European made does not inherently mean it is of good quality.

[Library/Games] Java OpenGL based graphics engine

Two years ago I wanted to replace the engine of an old game I reverse engineered with a more modern one, but writing the whole new engine into the game seemed like a waste to me so I wrote this graphics engine. It has API’s for low level OpenGL features and is based on LWJGL, but also includes very high level interfaces which allow you to construct an application without knowing anything about OpenGL or computer graphics.
Continue reading

[FPGA] RISC Processor

I designed and implemented this processor for my HAVO (secondary school) final assignment, for which it scored 10 out of 10 points and about which the local university(Universiteit Twente) who helped my school assess it said it would have been usable as a thesis for CS master.

It has 32 general registers and a link register for function returns, it supports direct, indirect and indexed addressing modes and has almost all basic operations implemented as instructions.

I also wrote an assembler for it, which is included in the Google Code project linked to below.
Continue reading

[FPGA] VGA text mode controller

After I got the RISC processor working I wanted it to do something more visual than writing to an memory mapped 7-segment LED display so I decided to write a VGA controller for it, obviously I didn’t want to have to write a graphics and font library for it so I decided to do a text mode VGA controller rather than a full graphics controller.
Continue reading

Welcome to my new website 2

First of all, welcome to my new website!

I will use this site as a portal to the many different projects and services i have worked on or offer and to keep you posted about ideas i might have, don’t worry, i will not use this site to bother you with boring aspects of my life as some people do, there is a better place for that: Facebook ;-) . With this site i hope to create a single compact home for all of my past and present work, combining information and resources from all of the different sites and communities i have used in the past.


Continue reading