Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Pollyanna
Mar 5, 2005

Milk's on them.


I'm making an emulator for this too! It's taught me quite a bit of CS fundamentals I wouldn't get otherwise, but I still have a ways to go.

Adbot
ADBOT LOVES YOU

Pollyanna
Mar 5, 2005

Milk's on them.


Internet Janitor posted:

edit: oh, and one more thing- please do NOT use cowgod's technical reference as a source of opcode descriptions. It gets a number of things subtly wrong. Mastering Chip8 is a much more accurate resource. The testquirks.8o program illustrates some of these differences, and in all three of the behaviors Octo is doing what Scaevolus confirmed the original Chip8 interpreter did.

Oh poo poo, I should have used this when I started refactoring my JS implementation of it. This looks much nicer!

Pollyanna
Mar 5, 2005

Milk's on them.


I'm trying to build up a "schematic" for a Chip8 machine (memory + logic) as one of my projects. I'm compiling a list of what a typical Chip8 machine "has" and what it "does". What the machine does is simple, that's the interpreter and the opcodes, but I'm a little bit hazy on the memory structure. Does this look fair?

Markdown code:
- ChipJS has:
  - 4096 bytes of **RAM**
    - in classic machines, addresses 0x000 through 0x1FF are taken up by the language interpreter, but that will not be the case in ChipJS
    - regardless, ChipJS will assume all programs begin at 0x200 in memory
  - 16 **8-bit registers**, V0 through VF
    - hold numbers between 0 and 255, or 0x00 and 0xFF
    - VF is commonly used as a "status" flag
  - a 12-bit **address register**, I
    - used for keeping track of an address in memory
    - e.g. 0x200, 0x3FF
  - a 16-level **return stack**
    - essentially a stack of 12-bit addresses like I
    - allows for subroutines
  - a **program counter**
    - keeps track of where in memory the program is currently executing
  - a **stack pointer**
    - keeps track of the position in the subroutine stack
  - a **pixel display**, implemented as a 2D array
    - 64x32 pixels, potentially other sizes as well
  - an 8-bit **sound timer** register
  - an 8-bit **delay timer** register
Another question: where do most programs "assume" font data is located? I don't see any regularly defined addresses for the font sprites.

Pollyanna fucked around with this message at 19:34 on Dec 7, 2014

Pollyanna
Mar 5, 2005

Milk's on them.


I'm wondering how to unit/integration test a CHIP-8 interpreter. The thing about the language is that it can run for forever if you let it, so it's a little complicated to tell your tests exactly when your tests are done. If I call chipJS.run(program), then either the program needs to finish running - which can lengthen tests and how do you determine if it's "finished'? - or you can simply have it run via setInterval(), in which case you'll need a callback in order to tell your tests that you're done - and you still have to determine a finished state. Do you run for only a set amount of time? How do you know you've gone on long enough? Does the interpreter only run until it detects an infinite loop state? If so, should it handle the exiting itself or should you do it?

This is definitely something I'm not very good at wrapping my head around. :psyduck:

Pollyanna
Mar 5, 2005

Milk's on them.


Goddamn, that's cool. I really need to get into games development, like, for real instead of just posting about it on the internet.

In related news though, we showed our projects at a meet & greet recently and everyone was blown away by my explanation of my Javascript virtual machine :v: It's really funny to me, cause it feels like something very basic and that needs infinitely more iteration to even get close to Octo, yet people are like "woah bitshifting goddamn". I suppose it's a boost to my ego, but...

Adbot
ADBOT LOVES YOU

Pollyanna
Mar 5, 2005

Milk's on them.


ExiledTinkerer posted:

The Gameduino Project guy did a (porting and such) thing apparently:

http://excamera.com/sphinx/article-chip8.html#chip8

Aw, and I was hoping I'd be the first to do this. :(

I still wanna do this, of course.

  • Locked thread