Tag Archives: z80

z80 development workflow on mac osx

After trying different z80 assemblers and simulators, I have found a z80 development workflow that works well for me on my mac .

There are quite a few open source tools to use, and finding the right combination has really improved my z80 assembly learning.

The z80 development workflow

I have come up with the following workflow:

z80 development workflow

There are four stages of my work flow. If it looks similar to a edit/compile/debug cycle then you are right.

1. Text Editor

You need a way to write your z80 code. Any text editor will do really, however I am currently using sublime 3. I don’t have any syntax highlighting  setup as of yet, as I haven’t found a suitable one as of yet (maybe I should create my own). All my code is saved as .asm files.

2. z80 Assembler

Once you have your .asm files you need to assemble them using an assembler. I am currently using zasm which seems to be one of the better ones with full documentation and is actively being developed. What separates zasm from other assemblers is that it has some features that I may use in the future, such as macros, that other assemblers didn’t support or was klunky.

More importantly, zasm can also output Intel Hex so I can run in a simulator (more about that below) as well as raw binary files ready for EEPROM uploading. zasm also produces a nice source listing file for later reading and checking.

3. z80 Simulator

I am currently using the z80 simulator from the z80pack suite. I am only using the z80sim component. Why am I not using the z80asm assembler from the z80pack suite? It doesn’t appear to support assembler macros, and it is a rather simple assembler, with a small number of features. There was a limited amount of documentation to get me started with it.

The z80sim application only supports 2 formats, the Intel Hex format and a ‘mostek header’ format which the z80asm in the suite outputs, and zasm (my preferred assembler) does not. It does however output Intel Hex files so that’s why I’m doing that.

The z80pack simulator is nice as you can set software breakpoints and manipulate the z80 memory, registers and flags as you step through your code. It also has a nice text input and text output interface (using port 1) for debugging output devices.

I did come across another z80 simulator which looked really nice and with a tty terminal front end to display all the z80 registers, memory, etc, however I couldn’t get it to compile on my mac (suspect its a 64-bit thing), and I didn’t really want to run a seperate virtual linux machine just to run a simulator.

4. Upload to EEPROM

Once I’m happy with my program, and I want to do some real testing on real hardware I re-assemble my code into a binary file (rather than the hex format I use for the simulator). This allows me to upload the raw datafile into my EEPROM programmer, and then insert the EEPROM into my Whizz80 computer system so I can see it running.

I haven’t uploaded any EEPROM code as of yet as the hardware is still being developed, but I’ll be providing more details about my EEPROM programming at a later date.

 

I’ve also documented this z80 development workflow on the main whizz80 website.

Whizz-80 System Design – it begins here

The system design of the Whizz-80 computer is a little different to what most people seem to be creating. There are many designs of a z80 computer that are based around a single board. While a single board self contained computer is cool and trendy, it doesn’t really give you the flexibility to upgrade, change or expand the system when you want to try something new or add extra functionality. I’m intending on the system to grow and expand as I develop it (it is iterative process as I learn, so mistakes would be made). Because of this I am deciding to use a modular approach and have divided up the computer into 5 distinct core modules. These modules are:

  • Power
  • Timing
  • System
  • IO Bus
  • Monitor
Whizz-80 System Design
Whizz-80 System Design

Each module is designed to be self-contained and can be swapped out with a different (upgraded or fixed) module as required. For example you could swap out the timing module of a slow clock cycle to a faster one, or a manual clock cycle (push button), without impacting the design of the rest of the computer. If I need to up the power requirements I can simply change the power module. If I need more IO output ports or change the entire way input/output is performed then I can swap out this module without affecting the rest of the system.

The system design and concept is heavily influenced by this webpage.  I have taken ideas from this page and have extended it for my own purposes.

Here is a brief description of each module. I will be going into more detail about each individual module as they are built.

Power module

The power module supplies power to the whole system design.
Output of this module is to the System board, and consists of +5v, ground and any reset signals. I’ve linked the reset signal to the powerboard as resets are generally associated with power on/off and restarts. I may create a sub-module of the power module for reset as there are different ways to perform a reset function. (I may need a reset and a /reset signal).

Timing Module

Outputs to the system module. Receives power and /wait /m1 signals (for manual clock controls). Provides a clock signal to the system board (and any other devices as required).
from a simple single step push button, 555 timers, crystal circuilts, and all the way up to a 2Mhz oscillator. I am capping the max speed that I intend to build for to 2Mhz as the faster you make the signals, the more important it becomes with the length of your wires between ICs and interference. I’m not interested in fast clock speeds.

System Module

This is the critical module in the system design as it contains the z80 CPU and memory circuits (ROM/RAM) and any other circuitry required to manage the core system components such as some IO logic circuitry that helps hand off any signals to any other modules (such as the IO Bus module). All other modules connect to the main system module. It is the central module (see diagram above).

IO Bus Module

This module contains the I/O Bus where extra peripherals modules are connect to. It is designed to allow multiple input/output devices to be connected to it via their own ‘sub-module’ card. As this is such an important module (it is the interface to the outside world), more detail would be given on this module later.

Monitor Module

This module is used for debugging the system. Displays the address, data and control busses in a nice format for debugging. It is not a system dependant module, i.e. this module can be removed and the system is still fully functional, you just won’t be able to see the buses. (If you are running a fast clockspeed then you won’t need to watch the bus anyway).

System Design

This is a rather simplified description of the Whizz-80 system, and it only the electronic hardware. This system design is also in a state of flux, as the design may change as new ideas are tested. I am not going to build an enclosure yet as I don’t even know what the final version (if there is one) will look like.

Hopefully I can look back on these blog posts and see how the Whizz-80 system had evolved over time.

Beyond the Arduino

I’ve been playing around with the Arduino for a while now (offline to the blog) and while it is a great platform to get into the embedded arena (and electronics in general), I am yearning for something a little bit more, something beyond the Arduino.

I haven’t done a blog post in a while (I had great plans on posting my experiments and circuits as I learned) but the time it takes to create a post on a simple circuit that I built during the learning iteration process just didn’t work.

I was keen to move onto the next ‘idea’ so by the time it came to sit down and write something it was 3 mini-projects later. All I can say is that the best way to learn is to just physically build it.

Recently I’ve been studying digital circuits (nand2tetris is a good course) instead of analogue circuits and have been fascinated on how an actual the computer works (right down to the inner workings of the logic chips).

I think it is now time to move beyond the Arduino and get myself into some other projects. Maybe something that isn’t Arduino but is a little bit old and feeds my nostalgic urge (hint: z80).