A byte is eight binary bits. It can be viewed as two four-bit nibbles, making it useful for splitting instruction data and storing raw values. section 5.7.1
Bytes appear in two practical forms:
- Instruction data: a CHIP-8 opcode contains a high byte and a low byte; each byte can be divided into high and low nibbles for decoding. section 5.7.1
- Stored data: a key-value store represents keys and values as sequences of bytes, using [u8] for arbitrary-length data. section 7.5.1
- Text data: Rust distinguishes a single byte literal such as b'a' from a one-byte byte slice such as b"a". section 10.6
Extracting bytes and nibbles from an opcode
Given opcode 0x71E4, masking and shifting extract c = 0x7, x = 0x1, y = 0xE, and d = 0x4. Wider fields can also be read as nnn = 0x1E4 or kk = 0xE4. section 5.7.1
Listing 5.18 Definition of the CPU used in listing 5.22
struct CPU {
current_operation: u16, #1
registers: [u8; 2], #2
}
A compact CPU definition shows bytes in Rust through u8 register storage alongside a larger u16 current operation. section 5.7.1






