• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Offtopic › Delfino Plaza v
« Previous 1 ... 60 61 62 63 64

Chip8 Emu Help
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Chip8 Emu Help
06-23-2009, 06:40 PM
#2
thegamefreak0134 Offline
Exit Mouse
***
Posts: 165
Threads: 14
Joined: Mar 2009
The draw opcode is what makes the Chip8 tick. As I recall, it uses one register to point into memory at a byte, and some other registers to represent an x,y coordinate onscreen. To perform the draw, you *xor* the screen at that location for every 1 bit in the byte referenced. In other words, if the bit pattern for the byte you're drawing is:

10101010

then you're going to change the value of 4 pixels. Remember, this is an LCD screen, you get on or off only for your pixels. Importantly, and most game logic takes advantage of this, that opcode should also store a flag representing whether or not it "hit" something while it was drawing. In other words, if when inverting your pixels for this opcode any pixel turns *off*, it needs to set a flag. Games will often use this feature to "test" an area of the screen. For example, in a pong game, I could increment the ball position by 1 in both directions each time, and then use this flag to tell me if I hit a wall or a paddle. It's basic collision detection usually, although how its handled is largely up to the game logic.

I can't compile for mac or I would take a look at your code, but I wrote a similar project like this myself. I never got it finished (I was having some weird opcode handling bugs) but I got it working well enough that a bunch of the demo games would play just fine. I should actually try doing it again now that I think about it.

Good luck, and may the force be with you. If nothing else, this will at least teach you that emulation is not to be taken lightly. ^_^ Chip8 is as simple as it gets.

-gamefreak
The only good zombie is a live zombie.
Website Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Chip8 Emu Help - gergep - 06-23-2009, 07:23 AM
RE: Chip8 Emu Help - thegamefreak0134 - 06-23-2009, 06:40 PM
RE: Chip8 Emu Help - Thircase - 06-23-2009, 07:19 PM
RE: Chip8 Emu Help - gergep - 06-24-2009, 12:30 AM
RE: Chip8 Emu Help - gcp111 - 06-24-2009, 08:28 PM
RE: Chip8 Emu Help - gergep - 06-25-2009, 01:02 AM
RE: Chip8 Emu Help - gcp111 - 06-25-2009, 06:28 AM
RE: Chip8 Emu Help - gergep - 06-25-2009, 07:11 AM
RE: Chip8 Emu Help - gcp111 - 06-25-2009, 08:47 AM
RE: Chip8 Emu Help - gergep - 06-26-2009, 10:09 AM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 2 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode