Emulating A Z80 Computer With An AVR Chip

[Sprite_tm] dusted off his assembly skills and managed to emulate a Z80 computer using an AVR ATmega88. He’s using an SD card in place of the floppy and a 128 KB DRAM chip to handle the memory for the emulated machine. An FT232 board gives him terminal access which he uses for input and display. As you can see, the hardware is much simpler than building the original would have been. He makes up for this with complicated firmware. In the end, the emulated core occupies about 2 KB of programming space after he followed the Z80 Propeller project’s idea of dividing the instructions into different modules and using a lookup table to access them.

13 thoughts on “Emulating A Z80 Computer With An AVR Chip

  1. This is pretty awesome. I’ve toyed with the thought of implementing an emulator on the AVR, it’s good to see someone actually do it!

    It might be easier to emulate a simpler processor like a 6502. And if you use a 40-pin chip, you have enough I/O pins for an 8-bit data bus. Apple II emulator for AVR, anyone?

  2. # It was also found in home video game consoles such as the ColecoVision,[78] Sega Master System[79] and Sega Game Gear video game consoles, as an audio co-processor in the Sega Mega Drive and as an audio controller and co-processor to the Motorola 68000 in theSNK Neo-Geo.
    # Nintendo’s Game Boy and Game Boy Color handheld game systems used a Z80[80] with a slightly different instruction set (the index registers and alternate register set are missing, but auto-increment/decrement addressing modes have been added), manufactured by Sharp Corporation. Game Boy Color is notable for its ability to selectively double the CPU clock speed when running Game Boy Color software. The Game Boy Advance series of products originally included this same modified Z80 for backward compatibility. However, this changed with the release of the Game Boy Micro.
    # In Russia, Z80 and its clones were widely used in Caller ID systems.

  3. Hey, this is great. Thanks for the link to my propeller project. I’m reading through your writeup now. The DRAM is something we considered on the propeller but never have quite got working. It saves a lot of chips – well done on that one! I might see if we can pull together some of the people working on different external ram solutions using this thread http://forums.parallax.com/forums/default.aspx?f=25&m=405722&p=26

    There are some ideas we could jointly brainstorm with caching bits of memory to speed things up. I’m bursting with ideas now!

  4. I’ve been toying with the idea of writing emulators for various old CPUs on AVR as a means of expanding program space and eliminating MCU reflashing. I got pretty far with an 8051 emulator (http://sourceforge.net/projects/funk51/), although I did manage to get Tetris running on it, using a shared memory interface for performing video, timing, and gamepad syscalls… This is slicker, and probably a lot faster ;)

  5. I’ve been using the AVR chips for several years. I learned assembly programming on Z-80 in about 1980. Yes, I am that old. They’re tons of fun and I get paid. I almost feel guilty taking money for it.

Leave a Reply to kernelcodeCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.