Z80 processor IDE

Z80 Header2

This is a page about my freeware Z80 IDE program which is an editor / emulator / debugger / assembler / disassembler for the Z80 all in one portable Windows executable. Many years ago when I was programming the Z80 professionally and at home, tools were very expensive. There was not much freeware or opensource, but trough my employer I had most of the tools I needed. When I was twenty years old in 1979 I bought my first real computer, the Tandy TRS-80 model I level II with a Z80 processor at its heart. I wrote a lot of programs in Z80 assembler for this computer and all computers I bought after that had a Z80 processor like the Sinclair Spectrum and later the MSX. My first IT job was developing hardware and software on embedded Z80 systems (cash register and machine control systems) in assembler and PL/Z. After that I started working at Micro Technology (an MSX hardware supplier) and there I was also programming a lot in Z80 assembler, bat I also learned to write in C and I had a good C compiler for the Z80. assembler. The Z80 was a genius design for its time and its funny that this processor is still used a lot in for instance the Nintendo Gameboy but also in the Texas Instrument scientific calculators. Also there is a growing group of computer hobbyist that keep the processor alive by creating new single board computers based on the Z80 processor. For development and debugging Z80 assembler code, this freeware IDE can be used. Regards, Hein Pragt.

I also have a Facebook Group on Retro Computing and Electronics, feel free to join!

Z80 workbensch editor / emulator / debugger

Z80 Workbench

To be able to program for the z80 you need an assembler or compiler. I personally still like to write in Z80 assembler but I could no longer find tools for Windows 10. There were still some programs to download but most of them worked at DOS level. After some searching I decided that it was time for a new hobby project, building a complete integrated Z80 development environment. I found a pretty good assembler and good portable C code from an emulator and the rest I had somewhere in my code library. The result is Z80 workbench, a portable x64 Windows program that includes an editor, assembler, disassembler, emulator, single step debugger, Intel hex read / write function a terminal window, an MPF-1 compatible seven segment display with 8 LEDs and keyboard support.

Installation

Download the zip file and unzip it at the place where you want to install it on your hard drive. Then create a shortcut to the program to the desktop and the program is ready for use. It is a so-called portable program which means that it does not use external sources or libraries and does not use the registry. After removing the directory from this program, it has also disappeared completely from your system.

First time use

To practice there is an example4.asm file in the example directory, which you can load after which it will be in the shown in the middle edit window. Now you can convert this into machine code by means of the assemble button, this will appear on the left of the screen and be put into the virtual memory of the emulator. The last (or first) .org statement will also be put in the program counter and by simply pressing the run button you can execute the program and follow it on the screen. This will not be very fast because every instruction will perform a screen update of all registers. If you want the program to run faster, you can disable the update of the registry block by means of the update checkbox. You can now modify the program, reassemble it and run it again.

The basic2.asm is an example of the basic assembler file from Grant Searle, I only added a modified BIOS file at the end and an .org 0000h at the end to set the start adresss.

The monitor.asm is an example of the sourcode of a simple monitor program to input hex bytes a an address, dump bytes of ans address to terminal and call an aadress in memory.

By means of the step button you can execute the program instruction by instruction and check the output and the registers. You can also enter the break address, the emulator will then stop at a run command at this address and display the registers of that moment. When 0000 is entered in the break field it will be ignored.

You can save the modified code as an asm file again but also save it as a hex file so that you can load the binary code in a circuit or ep(rom) for a real Z80 circuit. You can also read an Intel-Hex file, which will then be loaded into the internal emulator memory. You can also run tis code when you put the correct start address in the program counter. You can also disassemble this internal emulator memory code after which the source code will appears in the edit screen in the middle. This can then be changed and written back into the emulator memory by means of assemble button.

I/O map

The emulator has a standard number of I/O ports for input from the keyboard and output to the terminal screen or the seven segment displays / LEDs. In example4 there is an example of both.

  • In port 1: Returns the character of the keyboard in A register, when there is no sign a 0 character will be returned.
  • In port 2: Return the status of the keyboard, 0 no keystroke is available, unequal to 0 means a keystroke is available. The character must then be read on port 1.
  • Out port 1: Data for terminal or seven segment display. When Out port 2 is a 0, the data will go to the terminal. If port 2 is unequal to zero, the data will go to the seven segment display.
  • Out port 2: Selection terminal (0) or seven segment display. When a segment select bit (0..5) is 1, the display data will be send to each seven segment display that has its bit set to 1. It is therefore possible to address each display individually as well as multiple displays at the same time. To turn everything off, first set 0xff to port two and then a 0 to port 1. To switch back to the terminal, you have to write a 0 to port 2 again. (In contrast to the MPF-1, the data of the display is latched.)
  • Out port 3: This port is a latch to the eight LEDs where each bit controls an LED.

Credits: Credits go to Jorge Giner Cordero for letting me use and distribute his Z80 assembler.

Version 2.01 – 2.04

After version 1.07 I decided to add full support for a Z80-MBC2 emulator including CP/M 2.2 because I use this board and then I noticed some errors in the Z80 emulator code. So I decided to fix that and before I knew I was starting to rewrite all of the emulator code and now it is good and supports a lot of extra undocumented features of the Z80 processor. For CP/M 2 I needed a VT100 terminal, I had the code from 30 years ago when I write my own terminal when I was working with a DEC 750 VMS machine so I could reuse this code with some adjustments for Windows. When debugging the Z80 emulator I needed better breakpoint and tracing so I also added all these features. By this time I realized this would not just be version 1.08 but it is clearly a major upgrade so I decided to go for version 2.01. I included som CP/M disks and some old CP/M programs I still had as well. Just click Z80-MBC2 CP/M 2.2 in the main menu and then push the RUN button and you are on a Z80-MBC2 emulator machine with VT100 terminal and a few disk drives.I hope you like the new features and I will continue to improve this Z80 workbench, I have some new options in mind, like CP/M disk management and support for emulating more hardware and machines as well. In version 2.04 I added full support for hardware and software emulation of the famous MPF-1 board. I support the basic board, with an on screen keyboard, the 8255 I/O chip and the keyboard and display scan as well. I do not support tape load and tape save, these buttons link to the standard save hex and load hex as nice replacements. You can use the debugging solutions of the MPF-1 in combination with the debugging solutions of the IDE and you can use the assembler / disassembler together with the MPF-1. For the MPF-1 I also added support for the Z80 None Maskable Interrupt because the MPF-1 uses that for single stepping. And as usual I added one example program for the MPF-1.

Buy Z80 chips and support chips

I also have a webshop where you can buy all kind of Z80 chips and support chips to repair or create youre own Z80 board.

https://www.heinpragt.nl/?s=z80&post_type=product

Download

Here you can download the latest version if this IDE. This download is a zip file containing a portable x64 (and a x32 version) Windows exe programs, two example directories, a CP/M disks directory and an assembler directory and a MPF-1 directory. The zip file is just a container, only copy the “z80_workbenchdirectory from the zip file to a location on your harddrive.
There was a last minute bug in the 204 version, the SIMPLE mode did not work correct anymore, this is fixed in the 204A version.

https://www.heinpragt.nl/?product=z80-processor-ide

  • Version 2.04
    • Fixed seven segment display blanks and errors after heavly use.
    • Fixed seven segment display lines are wider now.
    • Fixed R register is now functioning like it should.
    • Added MPF-1 emulation, with original ROM and keyboard and display in true MPF-1 mode.
    • Added MPF-1 hardware emulation (8255) and ram / rom mapping.
    • Added mpf1 directory with hex code of ROM and example assembler file.
    • Added None Maskable Interrupt button and correct handling in emulator.
  • Version 2.03
    • Included latest version 1.10 of uz80as.exe in this project.
    • Added -u option to assembler to enable undocumented instructions.
    • Fixed false caret display in VT100 terminal.
    • Fixed error in VT100 terminal with 80th character on next line.
  • Version 2.02
    • Fixed error in VT100 handling that would cause a crash of the program.
    • Added new cursor handling in VT100 using the Windows caret.
  • Version 2.01
    • Complete rewrite of the Z80 emulator code, it now also supports all the undocumented features.
    • Added full Z80-MBC2 emulation mode (inluding CP/M 2.2), including R/W SP/M disk images from Z80-MBC2.
    • Added the CP/M drives from Z80-MBC2 and an extra drive H: that contains some old CP/M programs I had like Sargon Chess, an Aventure game and Zork.
    • Click Z80-MBC2 CP/M 2.2 in the main menu, push the RUN button and you are on a Z80-MBC2 machine with VT100 terminal and a few disk drives.
    • Changed the layout of the screen to fit a complete functional VT100 terminal emulation.
    • Added a notification window for errors and tracing.
    • Removed cycle counting.
    • Added new top menu items for window and terminal settings.
    • Added support for monitting and editing 4 memory locations realtime (Handy for memory mapped I/O).
    • Added support for breakpoint on memory access.
    • Added support for start of trace on breakpoint instead of stopping.
    • Added support for loading binary files (like roms) into memory.
    • Improved disassembler, better syntax and newlines after jumps and return statements.
    • Added realtime tracing in notification window with address and disassembled instruction.
    • Beside x64 there is also now a x32 version.
    • Added feature to write all terminal output to a file in the base directory.

Older version.

Download z80_workbench106.zip (2021)


  • Version 1.06
    • Now really fixed the directoryname with spaces problem.
    • The split between the list window and the edit window can now be dragged to change the sizes.
    • Fixed windows order and size error after minimize of window.
  • Version 1.05
    • Fixed the directoryname with spaces problem.
    • Added ROM and RAM space imput boxes, emulator will halt on write to ROM or R/W outside memory, with error address in break textbox.
    • Popup message with warning when trying to edit during emulation!
    • Imnproved CPU box panel layout and added Error textbox.
    • Layout of windows now more stable.
    • Added another example file.
  • Version 1.04
    • Improved some editing functions.
    • Added the ‘C’ style output of the Hex code.
  • In version 1.03 I fixed some buffer size bugs, I cleaned up the code, I made rezize possible with relative sizes of all windows, fixed some layout issues and added a monotor.asm example file.

Z80 links, tips and documents

More pages on software development

Comments

  1. Obren Masic
    Obren Masic

    LOVE your project.

    I am an OOOLD geezer who used to do some coding on a SpectraVideo 328 in the 80:s. Recently I had an urge to return to the roots, after seeing a YouTube video about the AGON Light. While I was tempted at first started to buy one, it appeared to be to much hardware overhead for me/my purpose, having to interface with a monitor, add an extra keyboard and stuff.
    I am a software dude and like to have everything collected on my modern Windows 10 machine and keep things minimal. Your workbench is JUST what I was looking for. To play around with!

    Kudos to you Sir. And Thank You.

  2. DANIEL CARPINETTI
    DANIEL CARPINETTI

    Hi, hope you are doing good.

    First of all, thank you for putting a effort on such thing and give us free.

    Just send this message to help you improve the app.

    there are some bugs on the Assembler for the last version 2.04. See the code bellow:

    0000 ; ProntoZ80 kernel v0.6

    0000

    0000 .org 0

    0000

    0000 ; Init the Stack Pointer

    0000 21 00 00 ld hl, fffah

    0003 F9 ld sp, hl

    0004

    0004

    0004 3E 00 ld a, C3h

    0006 32 00 00 ld (FFFBh), a

    0009 3E 00 ld a, 00h

    000B 32 00 00 ld (FFFCh), a

    000E 3E 80 ld a, 80h

    0010 32 00 00 ld (FFFDh), a

    Hope to have this fixed.

    1. admin Post
      Author
      admin

      I did not write the assembler, this is written by Jorge Giner Cordero, as you can read in the assembler directory. I sent some remarks to him a while ago and sometimes he releases new versions of the assembler. You can always copy a more recent version into the assembler directory.
      Regards, Hein Pragt

  3. John Dammeyer
    John Dammeyer

    Impressive piece of work. Just looking into using it to disassemble an S100 extended BIOS. The source code was never released and I’d like to make it work with a new dual SD/IDE S100 card.

  4. Rüdiger Kupke
    Rüdiger Kupke

    Hi there,

    today 21th Jan 2024, I downloaded the IDE workbench from the wenshop. The assembler button is not working. Now I see here in the text above, that version 204A has a fix for that. Do nybody know, where I can get these version
    Thanks and best

    1. admin Post
      Author
      admin

      I contacted you by email, the IDE uses an external assembler that is called in the background using a exec instruction. If the path is too long this will fail, please make sure that the program is not too deep in a subdirectory. Also the zip file is just a container, do not copy this also, only copy the directory “z80_workbench” inside the zip file to a location on your harddrive. I read your return email saying this fixed the problem, I put this answer here for other users.
      Kind regards,
      Hein Pragt

Leave a Reply

Your email address will not be published. Required fields are marked *