Intel 8080 Emulator

Share your advanced PureBasic knowledge/code with the community.
Booger
Enthusiast
Enthusiast
Posts: 134
Joined: Tue Sep 04, 2007 2:18 pm

Intel 8080 Emulator

Post by Booger »

Hey guys, not finding much fiddling with emulation in these forums. So releasing my project for fiddlers.

8080 emulation is possible up to 250mhz on my desktop(Fastest I have found anywhere on net).

The machine the 8080 runs on is the space invaders motherboard circa 1978(The machine itself needs work)

Most of debug coding is commented out. I'm stopping the project to build a realtime optimized disassembler for cores. Then moving on to other processors, perhaps 6502 and NES hardware.

The project started by porting codes from many sources, but ended up as a total rewrite from scratch as all 8080 emulator code I found was improper and untested on a real 8080 processor. 8080 Core is tested against Russian 8080 copy with assembly test source included. I originally tested against mame, but was given access to a Russian hobby computer for testing.

The core is 8080A-1, motherboard SpaceInvader Midway machine, 1978, if you want to write code for it.(The machine is barely emulated, just barebones to test cpu)
The download should contain all that is needed to compile on 4.51. Please note, Assembly optimizations were made by reading assembler output to make sure registers weren't corrupted with purebasic 4.51 runtime core. As such, not guaranteed to compile on any purebasic version besides 4.51.


https://sites.google.com/site/ajtaji/st ... ects=0&d=1

Enjoy, and be sure to post back any fixes.
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: Intel 8080 Emulator

Post by Thorium »

Great, thx.
I will take a look at the source. I never did a emulator but it's very interresting.

How do you do a proper timing?
Booger
Enthusiast
Enthusiast
Posts: 134
Joined: Tue Sep 04, 2007 2:18 pm

Re: Intel 8080 Emulator

Post by Booger »

Good machines and good software use interrupts for timing. If software uses software loops for timing, it will more than likely malfunction in an emulator. Interupts should be used in all software timing, so hardware owners can change the cpu if needed. The new cpu may run at different speed.

My timing on this machine is only guesstimated. It has two interrupts (Vstart and vBlanc). Timed by using a float reference by 60hz on where it should occur with the pixel clock.

The processor clock nor interupts nor pixel clock are connected to a master clock like they are on the motherboard.

The machine itself is only emulated enough to run my cpu core. Which the emulator can run space invaders, and Part II just fine, plus any of the custom software I wrote for it for testing.
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Intel 8080 Emulator

Post by Zach »

I hope that rom in your package is in the Public Domain....
Booger
Enthusiast
Enthusiast
Posts: 134
Joined: Tue Sep 04, 2007 2:18 pm

Re: Intel 8080 Emulator

Post by Booger »

The 8k rom is an assembled version of this page: http://computerarcheology.com/spaceinva ... s.txt.html

The other roms are written and compiled by myself.

Any other complaints??
epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

Re: Intel 8080 Emulator

Post by epidemicz »

This is amazing!
Image
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Intel 8080 Emulator

Post by DoubleDutch »

Great work. I did an emulator for the 8080 on for the PSX once, it ran at about 6x speed on a 17Mhz MIPS... I ran full whack and used interrupts to match the timing. It ran a few machines, see: http://computingdata.com/consoles/emulators maybe you could get the same machines working without much work?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Booger
Enthusiast
Enthusiast
Posts: 134
Joined: Tue Sep 04, 2007 2:18 pm

Re: Intel 8080 Emulator

Post by Booger »

It ran a few machines, see: http://computingdata.com/consoles/emulators maybe you could get the same machines working without much work?
Indeed impressive, but I believe most of those machines used the z-80 3.5 mhz. Though the z-80 can run most 8080 code unmodified, there are some differences(small but critical), there is an extended opcode set it uses which are not implemented in this current processor core. They would reside in the instruction unknowns in the current jump table with a few modifications to the core microcode I have implemented as the flags are affected just a little different on z-80. The chips clock and interrupts could be implemented using rtsd read from the processor clock if dynamic speed was turned off on the I686 processors.
A laptop with dynamic processor clock would definitely not be useful in this area and emulator would malfunction.

Basicly the above paragraph of nonsense states this is quite possibly above my head alone.

I am going to try to implement the sound portion of the Nintendo 2A03 processor chip instead to see how accurate interrupts can fire in windows.

The custom Virtual computer I am going to build for fun is going to require some type of sound chip for it to be any fun... and is a step towards NES emulation in the process.

I am very please to find someone interested in emulation in these forums. Anyone interested is welcome to join or drop tips or tricks on emulation techniques here.

Thanks

Booger
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Intel 8080 Emulator

Post by DoubleDutch »

Yes, I started with basic 8080 emulation then added the z80 enhancements. The original aim was to get Phoenix running at 60hz vertical (monitor on its side) on a psx with no frameskip or slowdown, etc... It worked with plenty of time to spare. In fact the Phoenix emulator on top of a psx emulator running on Windows usually looks better than the direct MAME version! ;)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Intel 8080 Emulator

Post by Zach »

Booger wrote:The 8k rom is an assembled version of this page: http://computerarcheology.com/spaceinva ... s.txt.html

The other roms are written and compiled by myself.

Any other complaints??

Nope. But you didn't mention that before, so I rightfully questioned it.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Intel 8080 Emulator

Post by blueznl »

Sorry, though I've been fooling around with countless emulators over the years, I'm not much into programming them :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Intel 8080 Emulator

Post by Zach »

Something I always was interested in myself.. But I think far too advanced a topic for me.
Goes without saying knowing ASM for the CPU you want to work with is a big requirement :|
Booger
Enthusiast
Enthusiast
Posts: 134
Joined: Tue Sep 04, 2007 2:18 pm

Re: Intel 8080 Emulator

Post by Booger »

This uses nasty tricks to get around PB register usage... as such it only works with pb 4.51... for those never seen it work a compiled version is here:

https://dl.dropboxusercontent.com/u/540 ... ulator.rar

This is a total hack job...
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Intel 8080 Emulator

Post by Lunasole »

Very cool and very complex stuff
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Intel 8080 Emulator

Post by Kwai chang caine »

Very nice....return in my 14 years old :mrgreen:
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
Post Reply