Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MadDoc

macrumors 6502
Original poster
Apr 25, 2005
329
5
UK
Hello,

I have started a project to write a Z80 emulator. For those of you who don't know what the Z80 is, it's a microprocessor that was used to power the GameBoy, Sinclair Spectrum, Amstrad CPC, Sega Master System and many other great (older) systems.

I'm not a programmer by profession. I have started this project as a proof of concept really. My ultimate goal is to create a working Spectrum / Amstrad emulator using REALbasic only. The finished programme will run on Mac, Linux and Windows.

The project is supposed to be a learning experience for myself and others. The project begins by learning about binary numbers and the structure of microprocessors and slowly moves up through code examples to a finished and (hopefully) working emulator.

If you are interested then please visit the site or the forums. It would be nice to see you!

Thanks,

MadDoc
 

bronxbomber92

macrumors regular
Nov 23, 2006
109
0
Very cool! I once wrote a chip8 emulator (very badly, mind you). I kind of started with out really knowing any of the basic stuff I should of, so most was a guessing game. :p

I hope to see this work! I would enjoy making myself one someday (now that I know binary, hexadecimal, and some ASM :) ).
 

MadDoc

macrumors 6502
Original poster
Apr 25, 2005
329
5
UK
Thanks for the encouragement.

Be sure to pop over and read the articles or even even offer any suggestions you may have from your chip8 experience.

MadDoc,
 

GeeYouEye

macrumors 68000
Dec 9, 2001
1,669
10
State of Denial
Good luck, but I suspect you will find your task MUCH easier if you code it in C instead of RealBASIC.

Also remember that the Z80 emulation alone is not enough to get a working system emulator, unless the Z80 controls the screen memory directly which is possible (and I think is the case on, say, the TI-83), but not guaranteed.
 

MadDoc

macrumors 6502
Original poster
Apr 25, 2005
329
5
UK
Good luck, but I suspect you will find your task MUCH easier if you code it in C instead of RealBASIC.

Also remember that the Z80 emulation alone is not enough to get a working system emulator, unless the Z80 controls the screen memory directly which is possible (and I think is the case on, say, the TI-83), but not guaranteed.

Appreciated. Doing it in REALbasic is more of a proof-of-concept project than anything else. I will need to write a bit (but not too much more) than the Z80 core to play anything but the hardest bit is likely to be the core.

MadDoc,
 

MadDoc

macrumors 6502
Original poster
Apr 25, 2005
329
5
UK
Look forward to seeing you over there bobber ;)

I have just written another article. It certainly does take a lot of ground work before you can even write any code that's for sure!

MadDoc,
 

ChrisA

macrumors G5
Jan 5, 2006
12,907
2,152
Redondo Beach, California
Hello,

I have started a project to write a Z80 emulator. For those of you who don't know what the Z80 is, it's a microprocessor that was used to power the GameBoy, Sinclair Spectrum, Amstrad CPC, Sega Master System and many other great (older) systems.

I'm not a programmer by profession. I have started this project as a proof of concept really. My ultimate goal is to create a working Spectrum / Amstrad emulator using REALbasic only. The finished programme will run on Mac, Linux and Windows.

The project is supposed to be a learning experience for myself and others. The project begins by learning about binary numbers and the structure of microprocessors and slowly moves up through code examples to a finished and (hopefully) working emulator.

If you are interested then please visit the site or the forums. It would be nice to see you!

Thanks,

MadDoc

A Z80 emulator? Why not just use one of the existing Z80 emulators? There are a few around. I remember back in 1982 or 83 I was a system programmer working on a CDC mainframe that was old even in the 1980's. We had a Z80 emulator. It was written in Pascal. Z80 code would actually run faster under emulation on the CDC machine than it would on a real Z80. Today, a PC would be even faster.

Look at this project. It may be exactly what you need. It's a Z80 emulator written as a library that can be included into a larger project, perhaps to emulate a Sinclare or old S100 system. It would be fun to boot up CP/M on a Mac.
http://sourceforge.net/projects/z80ex/

Notice that the author of the above takes care to fully emulate the TIME that each operation takes. Old code from the Z80 era many times used software timing loops and you would mess up things like games and animation if you got the timing wrong. Only later after PCs had been around for a few years did people get away from software timing loops and start reading clocks

I do remember the Z80 well. There was an engineering class I took as an undergrad at UCLA where they went over the design of both the Intel 8080 and Zilog Z80 in great detail. Turns out the Z80 was designed by some people who left Intel after finishing the 8080 and wanted to make a CPU using a different design (the Z80 used mico-code. The 8080 used hard logic so it was a good comparison design study.)
 

MadDoc

macrumors 6502
Original poster
Apr 25, 2005
329
5
UK
I think some people might be missing the point of this project.

I know there are other fully functional, open source Z80 emulators out there.

The point of this project is three-fold:

1. As a pedagogical exercise
2. To prove that a Z80 can be written in REALbasic (which is my preferred coding language)
3. For fun. I really want to write an emulator and have done for some time.

Now I appreciate that writing an XBOX emulator or a PS2 emulator for the Mac would get me more friends no doubt but I don't have the time, skills or knowledge to do so but I do think (I hope) I am capable of writing a Z80 emulator.

Also, it's an opportunity for people to follow along with the progress, learn something and help out.

MadDoc,
 

bobber205

macrumors 68020
Nov 15, 2005
2,182
1
Oregon
Well I think it's cool.

If you don't mind, what kind of schooling background do you have if any?

What have you done in the past has helped you w/ this project?
 

MadDoc

macrumors 6502
Original poster
Apr 25, 2005
329
5
UK
As far as my schooling background I went to Medical school for 6 years and am a Physician. Regarding computing though, I'm mainly self-taught. I've got 2 maths A-levels though.

Previously, I have done backend work on a number of projects including DarkSigns.

What have done in the past that will assist me in writing an emulator? Hmm, tricky as I have never written a fully functional emulator. I began writing a Z80 about three years ago but for several reasons the project stalled. Mainly poor preparation and organisation - leaving me with a mess of poorly written code. Also, I was doing my finals at the time and didn't really have the time needed to fulfill the project. As it stands now, I've got quite a lot of free time (and am quite bored!).

MadDoc,
P.S. I'm glad you like the idea :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.