Jump to content


Photo

(s)chip8 Emulator


  • Please log in to reply
58 replies to this topic

#1 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 06 October 2007 - 01:00 AM

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.s...p8/CHIP8/GAMES/

Some super chip roms:
http://www.zophar.ne...p8/sc-games.zip

Edited by Bathy, 12 October 2009 - 10:32 PM.

  • 1

#2 The eleventh plague of Egypt

The eleventh plague of Egypt

    GMC Member

  • GMC Member
  • 1043 posts
  • Version:Unknown

Posted 06 October 2007 - 11:53 AM

Nice, will edit after trying.
  • 0

#3 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 06 October 2007 - 11:05 PM

Nice, will edit after trying.

<{POST_SNAPBACK}>


Looks like you forgot to come back :(


Anyhow, I don't expect many to find interest in this, but those who are interested in emulators/how they work would probably find this to be very useful.
  • 0

#4 thetagames

thetagames

    Informatikmeister

  • GMC Member
  • 1001 posts

Posted 06 October 2007 - 11:17 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
  • 0

#5 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 06 October 2007 - 11:29 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

<{POST_SNAPBACK}>


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().

Edited by Bathy, 06 October 2007 - 11:33 PM.

  • 0

#6 thetagames

thetagames

    Informatikmeister

  • GMC Member
  • 1001 posts

Posted 06 October 2007 - 11:41 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().

<{POST_SNAPBACK}>

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.
  • 0

#7 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 06 October 2007 - 11:47 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().

<{POST_SNAPBACK}>

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.

<{POST_SNAPBACK}>


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.s...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.

Edited by Bathy, 06 October 2007 - 11:52 PM.

  • 0

#8 thetagames

thetagames

    Informatikmeister

  • GMC Member
  • 1001 posts

Posted 07 October 2007 - 12:58 AM

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.s...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.

<{POST_SNAPBACK}>

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! :( ) Hurray for near-machine languages! For the casual player, maybe you could use key-mapping to the arrow keys? I don't know if that would work, though.
  • 0

#9 The eleventh plague of Egypt

The eleventh plague of Egypt

    GMC Member

  • GMC Member
  • 1043 posts
  • Version:Unknown

Posted 07 October 2007 - 07:47 PM

I can't play the game nor hear any sound: what are the controls ?
  • 0

#10 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 07 October 2007 - 09:43 PM

I can't play the game nor hear any sound: what are the controls ?

<{POST_SNAPBACK}>


The first place I would check would be the post that contains the download link... :)
  • 0

#11 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 08 October 2007 - 11:06 PM

I updated to version 0.5, the information is in the changelog in the first post.
  • 0

#12 thetagames

thetagames

    Informatikmeister

  • GMC Member
  • 1001 posts

Posted 09 October 2007 - 02:32 PM

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
  • 0

#13 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 10 October 2007 - 12:01 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.

<{POST_SNAPBACK}>

You can change the 2 colors in the create event :D

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 :D

Edited by Bathy, 10 October 2007 - 12:07 AM.

  • 0

#14 mme

mme

    MME

  • GMC Member
  • 1007 posts

Posted 11 October 2007 - 07:44 AM

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
  • 0

#15 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 12 October 2007 - 09:30 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. ;)
  • 0

#16 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 13 October 2007 - 01:10 AM

Hey guys, I updated the link.

Also, here are some features I am considering adding:

- Assembler/Disassembler
- Built in font
- Sound
- Better documentation

Edited by Bathy, 13 October 2007 - 01:11 AM.

  • 0

#17 thetagames

thetagames

    Informatikmeister

  • GMC Member
  • 1001 posts

Posted 13 October 2007 - 03:14 PM

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
  • 0

#18 Bathy

Bathy

    GMC Member

  • New Member
  • 504 posts

Posted 15 October 2007 - 01:59 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

<{POST_SNAPBACK}>


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.
  • 0

#19 CKY2K

CKY2K

    GMC Member

  • New Member
  • 296 posts

Posted 17 October 2007 - 12:38 PM

Really awesome.
  • 0

#20 gamma games

gamma games

    GMC Member

  • New Member
  • 223 posts

Posted 21 October 2007 - 12:46 AM

Ehm.. it sounds cool but, um.... what is it? Please post screenie.. (unless its like.. not a gameish thingy..)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users