Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

Reply
 
Thread Tools Display Modes
Old November 24th, 2008, 11:10   #1
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Chip-8/Super Chip emulator PR01

It's yet another one of those...Chip-8/Super Chip-8 emulators. I got inspired by Shendo and his dedication for the same project, thus I started one just for the heck of it, also to test my skills and the performance of the language that I used.

And thus born the 4th emulator ever written in Flash/ActionScript. Well, 4th, I think.

Spent a week debugging, looking up documents, hex editing, disassembling, source code scanning, etc... and the likes to finally get it to this stage.

Usage: just run the .exe file. Control scheme was obviously stolen from Shendo's idea:

1234
QWER
ASDF
ZXCV

for

123C
456D
789E
A0BF

That said, HUGE credit goes to Shendo for thinking up this control scheme, anyone who claims that it's not Shendo's idea is going to get XOR'ed with himself 10 times.

Anyway, included is the game Car (or maybe Sokoban, I don't even remember which one I included anymore). If you want to try any other game out, or test the emulator with your own codes, place the file in the same directory as the executable, and rename it to "ROM" (that's just it, no extension).

If you find the beep noise I included annoying, please feel free to replace it with your own one. It'd better be in mp3 format... though some others may work as well. Experiment. (No, seriously, experiment with it, you never know)

There might still be a couple of rare kinds of insects that got past my extensive bug spray and slipped into this release, so if you come across any of them, please... kindly leave a note, and maybe I'll get back to it if I can.

Also, I would like to thank the following people:

Shendo, for inspiring in the first place

Refraction, for what he posted 3 years ago on Emutalk

Cowgod, for writing an excellent document, though I admit that one did not cover quite a few... things. ;p (led to some crazy bugs that took me a whole day to trace, and I ultimately had had to resort to peeking at another coder's source code)

My girlfriend, for being the reason for all other reasons.

And the coders whose codes helped the debugging majorly. I looked at too many source codes to know which one was whose anymore... so... no specific names listed, sorry guys.

...

Oh no, I didn't forget you.

Hard core Rikki for referring me to an excellent site full of chip-8 emus. Thanks pal, those helped just as you said they would.

And... that's it so far, if I left anything out, please feel free to give me a buzzer. Already got used to it anyway (got buzzed to oblivion when trying to implement the sound system).

And to answer Squall-Leonhart for a question he had earlier, here's what this emu does but others don't:
Low CPU and memory usage for a Flash application. ;p No wait, actually, it uses much less CPU than some other emus of the same system out there. Turn off the Bilinear Filter (Quality to Low) and it's using almost nothing to run.

P.S.: This is not the same as what I posted in the Programming forums, by the way, the source code has changed drastically to allow for a lot of things to happen.

Also releasing this to hopefully get more people to try it at some point, I just can't do it alone at this point. (if something doesn't run as it should, there's a sign of something being unstable, since it's not too big a system, a sign should be enough)
Attached Files
File Type: zip SChip.zip (1.22 MB, 24 views)
File Type: zip schip_swf.zip (16.3 KB, 14 views)

Last edited by runawayprisoner; November 24th, 2008 at 11:19..
runawayprisoner is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old November 24th, 2008, 11:45   #2
Rebel_X
Ƹ̵̡Ӝ̵̨̄Ʒ 龍我雷 Ƹ̵̡Ӝ̵̨̄Ʒ
 
Rebel_X's Avatar
 
Join Date: Sep 2002
Location: Oak Lawn, IL
Posts: 1,200
nice I am happy for you!!

PS: should be in programming section..
__________________

Kuroshіtsuji (Sebastian: "I am one 'hell' of a butler")
Rebel_X is offline   Reply With Quote
Old November 24th, 2008, 12:52   #3
Smooth Criminal
 
Smooth Criminal's Avatar
 
Join Date: Aug 2006
Location: india<<hyderabad..it rocks>>
Posts: 3,608
good work there......
__________________


Quote:
and if I don't care , do I still get to suck your scrotum? please say yes xp
^^posted bysonic

Smooth Criminal is offline   Reply With Quote
Old November 24th, 2008, 15:21   #4
MT
Totally crazy
 
MT's Avatar
 
Join Date: Aug 2005
Location: Brazil
Posts: 3,175
Awesome RAP. =) Congrats, really.
MT is offline   Reply With Quote
Old November 24th, 2008, 16:27   #5
ShendoXT
Moderator
 
ShendoXT's Avatar
 
Join Date: Feb 2006
Location: Croatia
Posts: 4,372
Quote:
Originally Posted by runawayprisoner View Post
That said, HUGE credit goes to Shendo for thinking up this control scheme, anyone who claims that it's not Shendo's idea is going to get XOR'ed with himself 10 times.
Hehe, Doomulation actually suggested that scheme in his docs

(Though I set A to both Z and Y keys for different keyboard layouts...)
__________________
Shendo's software blog

Core i5 2400 3.1 Ghz | ASRock H67M | HD4850 512MB | 8GB DDR3 1333 | 500 GB + 1500 GB HDD
Grundig VLC 7121 C (1080p) 32" | Razer DeathAdder | Logitech G110 | Windows 7 x64
ShendoXT is offline   Reply With Quote
Old November 24th, 2008, 16:41   #6
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Quote:
Originally Posted by Rebel_X View Post
nice I am happy for you!!

PS: should be in programming section..
I already posted a thread about this, but it got boring fast, I guess... mainly because I didn't have too many questions about this, the documents about it were really good, and there was not too many things that were not covered in there.

Plus that thread I opened was a bout Chip-8. This is really Super Chip.

Quote:
Originally Posted by Shendo View Post
Hehe, Doomulation actually suggested that scheme in his docs

(Though I set A to both Z and Y keys for different keyboard layouts...)
Really? I didn't know that. Plus if anyone hasn't tried, the arrow keys are mapped to 2 4 8 6, respectively for up, left, down, right, and 5 is mapped to Spacebar. That config seems to work well for Worm and Space Invaders... and a few more.

I am thinking about compiling my own version of a doc since all of the ones I read omitted a few things, even Cowgod's document had some things described only partially, I think. (well, not that I mind since nocash's Gameboy document, the one I'm reading, is almost hell to figure out what is what)

P.S.: TODO: Mega Chip-8 emulation!!
Oh no... didn't see that coming, did ya? Mega Chip-8 was just demo'ed last year, after all. And up to 2006, there are still games being written to Chip-8, so... I think this emulator/interpreter, could turn out to be a current/next-gen emulator.
runawayprisoner is offline   Reply With Quote
Old November 24th, 2008, 16:53   #7
ShendoXT
Moderator
 
ShendoXT's Avatar
 
Join Date: Feb 2006
Location: Croatia
Posts: 4,372
Quote:
Originally Posted by runawayprisoner View Post
P.S.: TODO: Mega Chip-8 emulation!!
Oh no... didn't see that coming, did ya? Mega Chip-8 was just demo'ed last year, after all. And up to 2006, there are still games being written to Chip-8, so... I think this emulator/interpreter, could turn out to be a current/next-gen emulator.
I saw that on Wikipedia when I was researching about Chip-8.
Unfortunately creator's site doesn't have any info about it (actually it says that specs will be posted soon...)

Anyway good luck if you decide to implement Mega chip emulation.
Btw: If you don't already know there is a video demonstration of Mega chip version of Blinky on Youtube.
__________________
Shendo's software blog

Core i5 2400 3.1 Ghz | ASRock H67M | HD4850 512MB | 8GB DDR3 1333 | 500 GB + 1500 GB HDD
Grundig VLC 7121 C (1080p) 32" | Razer DeathAdder | Logitech G110 | Windows 7 x64

Last edited by ShendoXT; November 24th, 2008 at 17:16..
ShendoXT is offline   Reply With Quote
Old November 24th, 2008, 19:32   #8
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Yepper. Saw that one already. Looks really promising.

I'm actually a bit more interested in this one:



It looks like they didn't just add color support. Guess this means more modifications to the draw command is in order.

Anyway, to pass the time, I guess I'll write a Gameboy emulator next.
runawayprisoner is offline   Reply With Quote
Old November 25th, 2008, 03:53   #9
Rebel_X
Ƹ̵̡Ӝ̵̨̄Ʒ 龍我雷 Ƹ̵̡Ӝ̵̨̄Ʒ
 
Rebel_X's Avatar
 
Join Date: Sep 2002
Location: Oak Lawn, IL
Posts: 1,200
my advice now, -before engaging other emus projects- would be to make dynarec instead of interpreter just for practice, since (S)Chip8 contains so limited instructions (less than 40 I guess) it's gonna be simple and good practice for other projects..

Damn I must say I am jealous, I might think making one myself.. (just curious how many Chip8 emus out there!!!?)
__________________

Kuroshіtsuji (Sebastian: "I am one 'hell' of a butler")
Rebel_X is offline   Reply With Quote
Old November 25th, 2008, 04:47   #10
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,235
Quote:
Originally Posted by Rebel_X View Post
my advice now, -before engaging other emus projects- would be to make dynarec instead of interpreter just for practice, since (S)Chip8 contains so limited instructions (less than 40 I guess) it's gonna be simple and good practice for other projects..
you can't make a dynarec with flash/actionscript.
you need a programming language that supports low-level asm.

actionscript is a 'scripting language', that means it doesn't get compiled into native-code, but instead is run and interpreted by some other application.

if RAP wants to get into more complex systems, i suggest he program in a real programming language (that compiles into native machine-code); unless the goal is just to see if its possible to make emu XXX with actionscript.

sooner or later actionscript will reach its limits; not just in speed, but also in functionality.
more complex emus are probably possible, but the code will be big and messy (because certain features are most-likely not present, i.e. structs, classes, etc..)
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog

Last edited by cottonvibes; November 25th, 2008 at 04:54..
cottonvibes is offline   Reply With Quote
Old November 25th, 2008, 05:25   #11
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Quote:
Originally Posted by Rebel_X View Post
my advice now, -before engaging other emus projects- would be to make dynarec instead of interpreter just for practice, since (S)Chip8 contains so limited instructions (less than 40 I guess) it's gonna be simple and good practice for other projects..

Damn I must say I am jealous, I might think making one myself.. (just curious how many Chip8 emus out there!!!?)
There are 36 instructions in the Chip-8 Interpreter, actually about 42 with Super Chip-8, and the implementations of some things need to be changed. Plus there are some things not mentioned in a few documents, which I would really love to mention because I had hell with them for a days.

And you don't really need to closely follow the procedures of the machine. That was how I got this thing to run so fast to begin with. It's not really a recompiler, but it's close, I think. Best of all, Flash runs on a lot of platforms.

Anyway, already gotten into Gameboy programming, already decoding opcodes (damn... almost 256 instructions this time, not a single byte left out for any reason at all).

Quote:
Originally Posted by cottonvibes View Post
you can't make a dynarec with flash/actionscript.
you need a programming language that supports low-level asm.

actionscript is a 'scripting language', that means it doesn't get compiled into native-code, but instead is run and interpreted by some other application.

if RAP wants to get into more complex systems, i suggest he program in a real programming language (that compiles into native machine-code); unless the goal is just to see if its possible to make emu XXX with actionscript.

sooner or later actionscript will reach its limits; not just in speed, but also in functionality.
more complex emus are probably possible, but the code will be big and messy (because certain features are most-likely not present, i.e. structs, classes, etc..)
The goal currently is just to see the extent to which ActionScript can expand, see if it can really rival Java in terms of performance, or not.

Plus it does have a lot of features at this stage. ActionScript 3.0 ended being a scripting language and turned into something closer to C++ instead. Even the implementation is almost the same, but of course, the absence of struct (classes do exist, and you can create them) and inlining codes as well as define and a few more stuffs really does make some stuffs tedious.

I'm still wondering why they won't implement '~' whereas they let '|', '&' and '^' slide... I miss '~' from C sooo much. It was useful with flags.
runawayprisoner is offline   Reply With Quote
Old November 25th, 2008, 05:30   #12
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,235
btw, some screenshots of the emu in action would be nice
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old November 25th, 2008, 05:53   #13
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Sure thing. Background trying to simulate a TI calculator... Obviously I'm waaayyy off.

LOOPZ runs on my emu, though some other emus have troubles with it for some reason.

P.S.: If you decide to grab this and try it out, you can turn off the bilinear filtering with Quality > Low in the control.

Oh, and found out how to do ~ in AS3! Yay! Now my Gameboy emu can go on without having to rely on heavy string actions. ;p
Attached Images
File Type: jpeg schip00.jpeg (40.8 KB, 10 views)
File Type: jpg schip01.jpg (36.5 KB, 8 views)
File Type: jpg schip02.jpg (43.6 KB, 8 views)
File Type: jpg schip03.jpg (29.1 KB, 5 views)
File Type: jpg schip04.jpg (29.6 KB, 9 views)
File Type: jpg schip05.jpg (45.4 KB, 10 views)
File Type: jpg schip06.jpg (30.7 KB, 10 views)
runawayprisoner is offline   Reply With Quote
Old November 25th, 2008, 06:04   #14
cottonvibes
You're already dead...
 
cottonvibes's Avatar
 
Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,235
thanks for the pics.
nice job.

if you can make a gameboy emu in flash it would be pretty interesting.
__________________

"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein
check out my blog
cottonvibes is offline   Reply With Quote
Old November 25th, 2008, 14:43   #15
Zack
Emu author
 
Zack's Avatar
 
Join Date: Sep 2007
Location: idk
Posts: 266
Nice work man

I decided to start one
__________________
My iPhone / iPod Touch Games :

Zack is offline   Reply With Quote
Old November 25th, 2008, 21:26   #16
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Gameboy CPU instructions are currently causing troubles up and down. That's not to mention the way opcodes are interpreted by the machine, and the way memory, stack and some other stuffs are done. But I'm getting somewhere... hopefully.

Anyway, hope to hear more progress from you soon, Zack. If you have any question, please don't hesitate to ask. I know there are some things that aren't covered in any document, and they could cause some troubles.
runawayprisoner is offline   Reply With Quote
Old November 25th, 2008, 23:47   #17
Zack
Emu author
 
Zack's Avatar
 
Join Date: Sep 2007
Location: idk
Posts: 266
Quote:
Originally Posted by runawayprisoner View Post
Anyway, hope to hear more progress from you soon, Zack. If you have any question, please don't hesitate to ask. I know there are some things that aren't covered in any document, and they could cause some troubles.
We could really do with a sticky for this topic i guess...

Anywhoo, I started making some progress.

I got rom loading/initializing working (i think ) and all the opcodes implemented. At the moment i think only about 30% or less of them are correctly done.

Just fixed a huge bug where my opcode was somehow getting a 0x7810 value... xD
So a few of the opcodes are working now.

It is throwing some weird opcodes into my debug text file though... Going to keep working on it
__________________
My iPhone / iPod Touch Games :

Zack is offline   Reply With Quote
Old November 27th, 2008, 03:59   #18
runawayprisoner
Level 9998
 
runawayprisoner's Avatar
 
Join Date: Nov 2006
Location: Java
Posts: 8,267
Soo... any question you would like to ask? I would love to add as much information to this thread as possible... since it would help... more or less.
runawayprisoner is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:56.

© 2006 - 2008 Emu Forums | About Emu Forums | Advertising Opportunities | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.