As3 Space Invaders Emulator For Dummies (Source code)
“You have to wanna make something, so if there is not something wanna make then there is not much you can do to make somebody else to make something.”
Chaosradio international 2007 podcast
Bre prettis
How to play:
C for insert coin
1 for player 1
2 for player 2
R Resets the game
Backspace Tilts the emulator (game over if someone kicks the machine
)
Code Features:
- Logic separated on the intel 8080 from the actual implementation of the Space invaders emulator, this was intented to have a separated class that only has intel 8080 logic and could be used/extended/improved and anyone want to use it for another project/emulation/cool shit (doug mccune magic word!)
- Added a Skin interface in order to have the ability to implement any kind of video screen and not just only a bitmap for the classic one (examples of this will come later in future posts)
- Added plenty of comments (not to all functions you will see why
)
- Created statically the opcode table function dictionary instead of dinamycally
Long boring story:
A few months ago i saw that tibo (Thibault Imbert http://www.bytearray.org/ ) released a space invaders arcade emulator, i remember that i told my coworkers “holy shit this guy is awesome”, we took a peek inside the code and as soon we touch the intel 8080 we were like O_o what the….., we thought that it was very complicated (but we never try to play with it),a few days ago i tried to reproduce and see how difficult it would be to code it from the beggining (it took me 5 days) to have the projected recoded following the tibo code logic guidelines (i had to use some hex comparing sentences because of a ugly bug) and the blitz tutorial giving birth to the my own space invaders emulator n_n.
Source code:
The code is released under the MIT license and is alocated in github where you can download/fork/see it
http://github.com/ozipi/As3_SpaceInvaders_Emulator
References:
Tibo AS3 Space Invaders Arcade emulator ( http://www.bytearray.org/?p=622 )
Blitz Max tutorial by Remi Veilleux ( http://sites.google.com/site/rveilleux/arcadechapter1 )
Intel 8080 Instruction set ( http://www.comsci.us/cpu/8080/matrix.html | http://www.comsci.us/cpu/8080/isindex.html )
Intel 8080 General explanation ( http://www.cpu-world.com/Arch/8080.html | http://en.wikipedia.org/wiki/Intel_8080)
On future posts i’ll try to explain it in a easy way for the people that has never touch any binary code with the byte arrays or has some trouble trying to imagine how to code an emulator (like a was a week before), so as3 experts please be patient :p
Thanks to Thibault Imbert (same guy from the wiiflash project), Remi Veilleux, and the guys that posted the specifcations, i have learned a lot on how to use the bytearrays and the bitwise operators and how the interpreted emulation works in general.
Get some fun!
As3 Space Invaders Emulator For Dummies (Source code) « ozipi emulator emulate 2:15 am on November 26, 2009 Permalink
[...] Originally posted here: As3 Space Invaders Emulator For Dummies (Source code) « ozipi [...]
8080 Emulator on AS3 | zerokernel.com 5:49 pm on December 3, 2009 Permalink
[...] http://ozipi.com/?p=129 Share and Enjoy: [...]
Suss 7:06 pm on December 7, 2009 Permalink
I always get the GAME OVER hahaha
cool =)