Do Chip-8 graphics use bits or bytes?

410 views Asked by At

I've been following this tutorial: http://www.codeslinger.co.uk/pages/projects/chip8.html in an attempt to make a Chip-8 emulator, but I don't understand the Draw opcode. The tutorial linked says to make a 64 x 32 array of bytes to hold the data for the screen, and I've seen the same elsewhere.

My problem is, the graphics are drawn bit by bit, rather than byte by byte. The explanation to this question How does CHIP 8 graphics rendered on screen?, for example, says that each byte contains 8 pixels of sprite data. If each byte contains 8 pixels, and the screen is 64 x 32 pixels, and there are 64 x 32 byte screens in all the Chip-8 emulators and tutorials I'm seeing, does that mean each pixel is made of 8 pixels? Also, since the pixels are really just drawn in rows, that would mean the screen is really (64*8) x 32. That just doesn't really make sense, and I can't find anyone else asking this question.

1

There are 1 answers

3
Monsterjamp On BEST ANSWER

The Chip8 only has 2 colors black and white. Therefore each pixel can be represented with a bit. The screen's dimensions are 64 pixels by 32 pixels. So the screen can be represented as 64 bits * 32 bits (8 bytes * 4 bytes).

If I wanted to draw a straight line, the sprite data will look like this:

11111111

or visually:

********

Whereas a dotted line would look like this:

11011011

** ** **