(s)chip8 Emulator, An emulator learning tool |
![]() ![]() |
(s)chip8 Emulator, An emulator learning tool |
Oct 6 2007, 01:03 AM
Post
#1
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
This is a real emulator. It emulates the CHIP8 and Super CHIP8 hardware and loads/plays the roms.
Changelog Version 0.6 - Fixed bugs with the input - Made some small code changes here and there - Added a variable for blink reduction Version 0.5 - Fixed CPU resetting and set it to the backspace key - moved font loading to a separate script - added key to load a rom (O key) - added more comments - added info Features: - Supports most, if not all chip8 and super chip8 opcodes - Should play most roms - Easy to learn from - I included 1 public domain rom (breakout) - Can see the cpu instructions if you run in debug mode - Disabled sound since it's just annoying beeps (ie, internal speaker) Controls: - Space: Pause - Backspace: Reset CPU - 'O': Load rom - keypad: Game controls (keys vary per game) - Run in debug mode to see the cpu instructions - remember to enable num-lock Notes: There may be bugs Chip8 notes - There are 16 8 bit registers, the last one is used as the carry flag, and 1 16 bit register (I) - Memory 0-$200 is reserved for the font file - the stack is normally 16 levels but my implementation has 25 - there are normally 2 timers, but this implementation only uses 1 (1 is normally used for sound) - the graphics are mono with resolution of 64×32 (double in super chip 8 mode) - the cpu opcodes are 2 bytes each. Mirror Wikipedia: http://en.wikipedia.org/wiki/CHIP-8 Below are public domain Some Chip 8 roms: http://www.pdc.kth.se/~lfo/chip8/CHIP8/GAMES/ Some super chip roms: http://www.zophar.net/roms/files/chip8/sc-games.zip This post has been edited by Bathy: Oct 12 2009, 10:35 PM |
|
|
|
Oct 6 2007, 11:56 AM
Post
#2
|
|
|
GMC Member Group: GMC Member Posts: 1079 Joined: 2-May 06 From: Your closet... Member No.: 49401 |
Nice, will edit after trying.
|
|
|
|
Oct 6 2007, 11:08 PM
Post
#3
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
|
|
|
|
Oct 6 2007, 11:20 PM
Post
#4
|
|
|
Informatikmeister Group: GMC Member Posts: 989 Joined: 23-September 06 Member No.: 60031 |
An emulator with Game Maker? Interesting.
It looks pretty good, although there could be a little more documentation, as I'm interested in how this works. Why did you disable the sound? The CPU beeping would add to this much, since there is no other sound. You should give the player the option to change this option. Good job! ~ Theta Games |
|
|
|
Oct 6 2007, 11:32 PM
Post
#5
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
QUOTE (thetagames @ Oct 6 2007, 04:20 PM) An emulator with Game Maker? Interesting. It looks pretty good, although there could be a little more documentation, as I'm interested in how this works. Why did you disable the sound? The CPU beeping would add to this much, since there is no other sound. You should give the player the option to change this option. Good job! ~ Theta Games Thanks for the response. I disabled sound because it was just simple beep or not beep, the sound used in chip8 is very basic, if you guys want it, I can always just throw it back in as it's only a few lines. And you're right about the documentation, most of the action happens in cpu_step and each case is commented, but I know those comments may not help much for some people since they're not very descriptive. One suggestion is to run in debug mode and watch the messages and you can watch the emulator step through each instruction. Another thing you can do is use space to pause, so let's say you are playing breakout and want to see what happens when the ball hit's a brick, you can pause it quickly and look at the cpu instructions, and then match those instructions with the code/comments in cpu_step(). This post has been edited by Bathy: Oct 6 2007, 11:36 PM |
|
|
|
Oct 6 2007, 11:44 PM
Post
#6
|
|
|
Informatikmeister Group: GMC Member Posts: 989 Joined: 23-September 06 Member No.: 60031 |
QUOTE (Bathy @ Oct 6 2007, 06:32 PM) Thanks for the response. I disabled sound because it was just simple beep or not beep, the sound used in chip8 is very basic, if you guys want it, I can always just throw it back in as it's only a few lines. And you're right about the documentation, most of the action happens in cpu_step and each case is commented, but I know those comments may not help much for some people since they're not very descriptive. One suggestion is to run in debug mode and watch the messages and you can watch the emulator step through each instruction. Another thing you can do is use space to pause, so let's say you are playing breakout and want to see what happens when the ball hit's a brick, you can pause it quickly and look at the cpu instructions, and then match those instructions with the code/comments in cpu_step(). Do you mean the GM Debug mode? How would I do that. Also, I forgot to mention. You should use the arrow keys, rather than the numpad. It is just a more common emulator standard. Will there be a (simple) interface to load ROMS once the emulator has started? Or will this remain a learning tool? You should really make a professional executable, with options to load different roms, and do things like disable/enable sound, etc. |
|
|
|
Oct 6 2007, 11:50 PM
Post
#7
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
QUOTE (thetagames @ Oct 6 2007, 04:44 PM) QUOTE (Bathy @ Oct 6 2007, 06:32 PM) Thanks for the response. I disabled sound because it was just simple beep or not beep, the sound used in chip8 is very basic, if you guys want it, I can always just throw it back in as it's only a few lines. And you're right about the documentation, most of the action happens in cpu_step and each case is commented, but I know those comments may not help much for some people since they're not very descriptive. One suggestion is to run in debug mode and watch the messages and you can watch the emulator step through each instruction. Another thing you can do is use space to pause, so let's say you are playing breakout and want to see what happens when the ball hit's a brick, you can pause it quickly and look at the cpu instructions, and then match those instructions with the code/comments in cpu_step(). Do you mean the GM Debug mode? How would I do that. Also, I forgot to mention. You should use the arrow keys, rather than the numpad. It is just a more common emulator standard. Will there be a (simple) interface to load ROMS once the emulator has started? Or will this remain a learning tool? You should really make a professional executable, with options to load different roms, and do things like disable/enable sound, etc. I can't make it the arrow keys because each rom is different, sure breakout uses the arrows on the keypad, but some games have totally different controls. The original keyboard was 16 keys, just like our keypad, that is why almost all chip8 emulators use the keypad. I suggest reading this page: http://www.pdc.kth.se/~lfo/chip8/CHIP8.htm I'm probably not going to make much of an interface for now, but maybe if I get bored or something, I might. This post has been edited by Bathy: Oct 6 2007, 11:55 PM |
|
|
|
Oct 7 2007, 01:01 AM
Post
#8
|
|
|
Informatikmeister Group: GMC Member Posts: 989 Joined: 23-September 06 Member No.: 60031 |
QUOTE (Bathy @ Oct 6 2007, 06:50 PM) I can't make it the arrow keys because each rom is different, sure breakout uses the arrows on the keypad, but some games have totally different controls. The original keyboard was 16 keys, just like our keypad, that is why almost all chip8 emulators use the keypad. I suggest reading this page: http://www.pdc.kth.se/~lfo/chip8/CHIP8.htm I'm probably not going to make much of an interface for now, but maybe if I get bored or something, I might. Very interesting. I guess you learn something new every day. I have various Atari emulators, but didn't know a whole lot about Chip8. This was very informative. I might look into this further, as it would be very cool to program Chip8 with the emulator on the site. You should make this option for your emulator, although it is not necessary. I guess this machine read from cassette tapes? How would that work? I'm very curious. I see now why you use the numpad. Programming in hexadecimal is pretty much as hard-core as you can get (save maybe binary! |
|
|
|
Oct 7 2007, 07:50 PM
Post
#9
|
|
|
GMC Member Group: GMC Member Posts: 1079 Joined: 2-May 06 From: Your closet... Member No.: 49401 |
I can't play the game nor hear any sound: what are the controls ?
|
|
|
|
Oct 7 2007, 09:46 PM
Post
#10
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
|
|
|
|
Oct 8 2007, 11:09 PM
Post
#11
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
I updated to version 0.5, the information is in the changelog in the first post.
|
|
|
|
Oct 9 2007, 02:35 PM
Post
#12
|
|
|
Informatikmeister Group: GMC Member Posts: 989 Joined: 23-September 06 Member No.: 60031 |
I like the option to load different roms. Actually, this runs better on my XP than the actual chip8 emulator that was on that site that you linked to. (that one runs too quickly)
You should make the colours white-on-black, rather than yellow-on-black. It really doesn't matter that much, though. I noticed that with that chip8 emulator, if you don't load any rom, you can enter a hexadecimal editor that allows you to programme your own games. Would that be difficult to implement? That would be really cool. ~ Theta Games |
|
|
|
Oct 10 2007, 12:04 AM
Post
#13
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
QUOTE (thetagames @ Oct 9 2007, 07:35 AM) I like the option to load different roms. Actually, this runs better on my XP than the actual chip8 emulator that was on that site that you linked to. (that one runs too quickly) You should make the colours white-on-black, rather than yellow-on-black. It really doesn't matter that much, though. You can change the 2 colors in the create event About your assembler question, I have thought about it, but I probably wouldn't be writing in in GM. Anyways, glad you like the engine This post has been edited by Bathy: Oct 10 2007, 12:10 AM |
|
|
|
Oct 11 2007, 07:47 AM
Post
#14
|
|
|
MME Group: GMC Member Posts: 1088 Joined: 20-September 05 From: The Netherlands Member No.: 35438 |
Looks very good
probley wont use it but very nice. One problem though 1. RAPIDSHARE - Please dont use this its a horrible host to download off |
|
|
|
Oct 12 2007, 09:33 AM
Post
#15
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
QUOTE (mme @ Oct 11 2007, 12:47 AM) Looks very good probley wont use it but very nice. I don't expect anyone to 'use it', it's supposed to be a learning tool for advanced programmers who have an interest in emulators and wish to know how they work. I really doubt people would get much joy out of playing atari style games. |
|
|
|
Oct 13 2007, 01:13 AM
Post
#16
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
Hey guys, I updated the link.
Also, here are some features I am considering adding: - Assembler/Disassembler - Built in font - Sound - Better documentation This post has been edited by Bathy: Oct 13 2007, 01:14 AM |
|
|
|
Oct 13 2007, 03:17 PM
Post
#17
|
|
|
Informatikmeister Group: GMC Member Posts: 989 Joined: 23-September 06 Member No.: 60031 |
I'm liking how this is coming along. I can't wait for the assembler, if you decide to put it in. It would be pretty neat to try to program games with this.
I've tried this with other roms, like PONG and TETRIS, and everything runs very smoothly. Good job! ~ Theta Games |
|
|
|
Oct 15 2007, 02:02 AM
Post
#18
|
|
|
GMC Member Group: GMC Member Posts: 555 Joined: 10-July 04 From: The shadows Member No.: 11458 |
QUOTE (thetagames @ Oct 13 2007, 08:17 AM) I'm liking how this is coming along. I can't wait for the assembler, if you decide to put it in. It would be pretty neat to try to program games with this. I've tried this with other roms, like PONG and TETRIS, and everything runs very smoothly. Good job! ~ Theta Games Thanks man. Hopefully I will have the assembler/disassembler done soon, it should make it a bit easier for some people to understand the logic behind the code. |
|
|
|
Oct 17 2007, 12:41 PM
Post
#19
|
|
|
GMC Member Group: GMC Member Posts: 210 Joined: 11-January 05 Member No.: 19712 |
Really awesome.
|
|
|
|
Oct 21 2007, 12:49 AM
Post
#20
|
|
|
GMC Member Group: GMC Member Posts: 230 Joined: 4-September 06 Member No.: 58755 |
Ehm.. it sounds cool but, um.... what is it? Please post screenie.. (unless its like.. not a gameish thingy..)
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 9th February 2010 - 02:23 PM |