Today you teach the CPU to treat its register pairs - BC, DE, HL, and AF - as single 16-bit values instead of two separate bytes. Every address the CPU touches is 16 bits wide, so these combined views are how you will point at memory for the rest of the project.
Let each register pair (BC, DE, HL, AF) be read and written as a single 16-bit value.
Addresses on the Game Boy are 16 bits wide, but the registers are only 8. The
CPU bridges the gap by pairing registers: B and C together form BC,
and likewise DE, HL, and AF. The first register of each pair holds the
high byte, the second the low byte - so B=0x12, C=0x34 reads as
0x1234.
HL is the workhorse pair used to point at memory, which you will lean on
constantly once instructions start reading and writing RAM. Build the four
combined views now - read and write both directions - and the rest of the CPU
gets a clean 16-bit handle whenever it needs an address.
// high register is the top byte, low register the bottom bytefunc (r *Registers) BC() uint16 {return uint16(r.B)<<8 | uint16(r.C)}func (r *Registers) SetBC(v uint16) {r.B = uint8(v >> 8)r.C = uint8(v)}// DE, HL, and AF follow the identical pattern - a table-driven test covers all four
Register pairs - how B/C, D/E, H/L, and A/F combine into 16-bit values.