More on my 8080 emulator…

September 8, 2011 | Emulation, My Projects | By: Mark VandeWettering

I spent some more time hacking on my emulator today. The key to getting an emulator to work is to have good, clear references on how the system works, and some example code that torture tests your simulator. Except for the DAA instruction (more on that later), the documentation for the 8080 is pretty good, and reading about several of the VHDL and Verilog simulations of the 8080 turned me onto CPUDIAG.ASM, a program which was designed to exercise the 8080 (apparently early NEC clones of the 8080A had difficulties with the DAA instruction). As it turns out, this little chunk of code proved to be incredibly useful.

;***********************************************************************
; MICROCOSM ASSOCIATES  8080/8085 CPU DIAGNOSTIC VERSION 1.0  (C) 1980
;***********************************************************************
;
;DONATED TO THE "SIG/M" CP/M USER'S GROUP BY:
;KELLY SMITH, MICROCOSM ASSOCIATES
Click here for the complete source.

After a couple of hours more tinkering, my efforts were rewarded with:

::: brainwagon 8080 emulator version 0.0
::: 1453 bytes of code loaded.

 CPU IS OPERATIONAL

Huzzah! Okay, there are still a few things this thing doesn’t test, like interrupts and the like. And I couldn’t figure out how the DAA instruction is supposed to work. It’s not clear to me that SIMH implements this properly either, a quick peek at their code seems to show that none of the ADD instructions do anything to set the auxillary carry bit. For now, I just commented out the offending tests. I’ll put them back in when I have some confidence that I understand how they are supposed to work.

Now that the instructions basically work, it appears that the next thing to do would be to try to figure out how to boot CP/M on the virtual machine. Then… tidy it up to see if I can shrink the code (the code for my linux box is about 12K). Then… well, we’ll see.

Share Button
Be Sociable, Share!

Comments

Comment from svofski
Time 9/9/2011 at 3:46 am

This test covers the basic functionality but it’s not comprehensive. You may find this test interesting:
http://www.sunhillow.eu/8080exerciser/
It helped me fish out quite a few bugs in T80 core.

Comment from Mark VandeWettering
Time 9/9/2011 at 1:48 pm

Excellent, very helpful! Thanks a bunch for the link. My emulator fails (naturally), but so does simh, which I thought would be a pretty reasonable baseline. I’m sure it will prove very useful as I iron out problems.

Comment from Mark VandeWettering
Time 9/9/2011 at 2:05 pm

Surfing on your web page, I realize that you are the creator of the Glass TTY VT220 font I use regularly. Thanks for that too!

Comment from svofski
Time 9/9/2011 at 6:09 pm

You’re welcome :) On the same page there’s also a 8080 assembler written in javascript, may turn out to be handy at the moment.

Write a comment






× 6 = twelve