Currently it takes ages but displays '0' text from the RAM in the top corner, but there's a bug that I think that it's in the draw_sprite8() function. Will try to fix a.s.a.p
Looks promising, i indeed got the "00" but something like 2 minutes after the start of the emulation.
I don't know what rom you embeded. I can remember this game "Joust" i was playing on a chip8 emu on the hp48 calculator.
Will your emulator be able to run that kind of game ?
If so, then, all i can say, bravo, you did the only emulator in Flash i know
[edit] I noticed you use for var loops, and big ones, like the clear memory one:
code:
clear_mem = function () {
for (var z = 0; z<8192; z++) {
mem[z] = 0;
}
trace("memory cleared");
};
. Would you use while -- loops, you'll save something like 15%-20% run time, maybe is it needed ?
Fastest loop so far seems to be "do while".
Results:
-------
for (local length var): 47.2 ms (8192 times)
for (.length property): 54.1 ms (8192 times)
for..in: 45.7 ms (8192 times)
for var: 48 ms (8192 times)
while ++: 43.9 ms (8192 times)
while --: 40.5 ms (8192 times)
do --: 40.2 ms (8192 times)
lol - I wish that I could see a game too! All the little blinky numbers and stuff is most of the emulation, being able to graphically see this thing is a nightmare, I can't find where the problem is with the bit that shows the actual graphics but i'm working on it.
The big array is the VRAM (which aint doing anything cos of the problem) I was using that to try to see where I was going wrong, the most important part is those register values, which show that it's emulating the internal workings correctly
The big loops only run a couple of times, I made 'em like that to set them all to 0's but were just a hacky temporary thing!
It could in theory play the joust game when it's finished but never practically, this was only ever done as a "this is possible" thing, and will never really run at any practical speed, even with dropping frames (at least I don't think so). Just wanted to try to do something that was not thought possible and make it open source for people to start learning how emulators work using a language that you guys understand so I get some votes for the open source thing this year! lol
Originally posted by RipX Just wanted to try to do something that was not thought possible and make it open source for people to start learning how emulators work using a language that you guys understand so I get some votes for the open source thing this year!
Bringing this back to life...I have re-writen the core over the last 2 days (similar to the old one), added graphics using the flash8 bmp functions..I need to add sound, play with some XOR mode font issues and add controls but it should be up and running soon!
Using the flash8 bmp functions has made the emulator run quickly (definatly playable) with the new core (written in AS1 :|)! It is not yet complete though. The swf is refreshing every frame which means that using frameskip later will increase the speed considerably - all good news - i'll upload the source as soon as it's complete! P.S. the ROM is breakout!