Here it is - a “working” Chip8 emulator done using Actionscript3. This idea came from André Michelle when he asked in the Flashforum who would be interested in working on an emulator. I am always interested in working with assembler, memory access and things like shellcode. :)
I found a lot of information about emulating Chip8 using Google. Good resources were EmuTalk.net, CHIP8 (also an emulator), and a list where all ASM instructions are explained.
Emulating Chip8 is a very easy thing. You have just a small manageable piece of instructions and a simple sort of memory. But I have to mention that my emulator has got some bugs because it is hard to test your piece of work. An error could be in every function (like add, substract, etc.) or even where a variable gets stored in the register.
Because of this I wrote a simple disassembler. The output is the whole rom in ASM syntax which Flash “evaluates”.
This is how the debugger outputs the instructions (Address: opCode ASMequivalent):
[code]0×03a3: 0×13af jmp 943
0×03af: 0xa50a mvi 1290
0×03b1: 0xf01e adi v0
0×03b3: 0xdbc6 sprite v11,v12,6[/code]
In fact it is not very easy to recognize an error but makes it more comfortable. I would suggest to take a look at the function in AS3 instead of trying to figure out what the ASM code really does but I was able to find some bugs with the ASM instructions. Another thing with the memory was comparing my memory to the memory of an emulator written in C++.
Currently all keys are a little bit screwed because I have no time to take a closer look here. You can play the MISSILE rom online and of course play around with the sourcecode which has a lot of comments. You can press i to shot if you play the MISSILE game; space resets the emulator. Have fun with this oldschool machine :o)




Awesome. I love stuff like that.
Anyone wants to team up with me to write a MOS 6502 emulator? :)
claus dot wahlers at gmail dot com
Very Cool! If you have any AS3 performance tuning questions, send them my way.
Actually you can also emulate Chip8 with AS2.0 and Flash8… Check my emulator on http://newgrounds.com/portal/view/260625 …
Actually, i wrote a chip8 emulator some time ago in actionscript 1
Winrar thought me that zip file
http://je2050.de/files/source/chip8.zip
is broked, can you upload again?
Dark-N
Don’t use winrar to open it use Windows’ own Compressed file archive-er thing :D
very cool! so when is a gameboy or nintendo version coming ;)
Hi there !. I would like to ask about the sub operation. Let’s say that we have the following instruction sub v1, v2. Register v1 has the value 180 and v2 has the value 190. The final result in v1 is 245 and vf is set to 01 ? Is that correct ?
Thanks !