func (gb *GameBoy) PUSH_qq(ins []uint8) int {
	reg := Reg16ID((ins[0] >> 4) & 0x3)
	if reg == 0x3 {
		reg = 0x5
	}
	val := gb.get16Reg(reg)
	lowVal := uint8(val)
	highVal := uint8(val >> 8)
	gb.regs[SP] -= 1
	gb.mainMemory.write(gb.get16Reg(SP), highVal)
	gb.regs[SP] -= 1
	gb.mainMemory.write(gb.get16Reg(SP), lowVal)
	gb.regs[PC] += uint16(len(ins))
	return 16
}
PUSH qq 1B
package main
import (
	"encoding/binary"
	"math/bits"
)
func (gb *GameBoy) LD_r_r(ins []uint8) int {
	r1 := Reg8ID((ins[0] & 0x38) >> 3)
	r2 := Reg8ID(ins[0] & 0x07)
	gb.set8Reg(r1, gb.get8Reg(r2))
	gb.regs[PC] += uint16(len(ins))
	return 4
}
func (gb *GameBoy) LD_r_n(ins []uint8) int {
	n := ins[1]
	r := Reg8ID(ins[0] >> 3)
	gb.set8Reg(r, n)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_r_hl(ins []uint8) int {
	r := Reg8ID((ins[0] & 0x38) >> 3)
	address := gb.get16Reg(HL)
	gb.set8Reg(r, gb.mainMemory.read(address))
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_hl_r(ins []uint8) int {
	r := Reg8ID(ins[0] & 0x07)
	address := gb.get16Reg(HL)
	gb.mainMemory.write(address, gb.get8Reg(r))
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_hl_n(ins []uint8) int {
	n := ins[1]
	address := gb.get16Reg(HL)
	gb.mainMemory.write(address, n)
	gb.regs[PC] += uint16(len(ins))
	return 12
}
func (gb *GameBoy) LD_a_bc(ins []uint8) int {
	address := gb.get16Reg(BC)
	gb.set8Reg(A, gb.mainMemory.read(address))
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_a_de(ins []uint8) int {
	address := gb.get16Reg(DE)
	gb.set8Reg(A, gb.mainMemory.read(address))
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_a_c(ins []uint8) int {
	address := uint16(gb.get8Reg(C)) + 0xff00
	value := gb.mainMemory.read(address)
	gb.set8Reg(A, value)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_c_a(ins []uint8) int {
	value := gb.get8Reg(A)
	address := uint16(gb.get8Reg(C)) + 0xff00
	gb.mainMemory.write(address, value)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_a_n(ins []uint8) int {
	address := uint16(ins[1]) + 0xff00
	value := gb.mainMemory.read(address)
	gb.set8Reg(A, value)
	gb.regs[PC] += uint16(len(ins))
	return 12
}
func (gb *GameBoy) LD_n_a(ins []uint8) int {
	address := uint16(ins[1]) + 0xff00
	value := gb.get8Reg(A)
	gb.mainMemory.write(address, value)
	gb.regs[PC] += uint16(len(ins))
	return 12
}
func (gb *GameBoy) LD_a_nn(ins []uint8) int {
	address := binary.LittleEndian.Uint16(ins[1:])
	gb.set8Reg(A, gb.mainMemory.read(address))
	gb.regs[PC] += uint16(len(ins))
	return 16
}
func (gb *GameBoy) LD_bc_a(ins []uint8) int {
	address := gb.get16Reg(BC)
	gb.mainMemory.write(address, gb.get8Reg(A))
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_de_a(ins []uint8) int {
	address := gb.get16Reg(DE)
	gb.mainMemory.write(address, gb.get8Reg(A))
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_nn_a(ins []uint8) int {
	address := binary.LittleEndian.Uint16(ins[1:])
	gb.mainMemory.write(address, gb.get8Reg(A))
	gb.regs[PC] += uint16(len(ins))
	return 16
}
func (gb *GameBoy) LDI_a_hl(ins []uint8) int {
	address := gb.get16Reg(HL)
	value := gb.mainMemory.read(address)
	gb.set8Reg(A, value)
	gb.set16Reg(HL, address+0x1)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LDD_a_hl(ins []uint8) int {
	address := gb.get16Reg(HL)
	value := gb.mainMemory.read(address)
	gb.set8Reg(A, value)
	gb.set16Reg(HL, address-0x1)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LDI_hl_a(ins []uint8) int {
	value := gb.get8Reg(A)
	address := gb.get16Reg(HL)
	gb.mainMemory.write(address, value)
	gb.set16Reg(HL, address+0x1)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LDD_hl_a(ins []uint8) int {
	value := gb.get8Reg(A)
	address := gb.get16Reg(HL)
	gb.mainMemory.write(address, value)
	gb.set16Reg(HL, address-0x1)
	gb.regs[PC] += uint16(len(ins))
	return 8
}
func (gb *GameBoy) LD_dd_nn(ins []uint8) int {
	reg := Reg16ID(ins[0] >> 4)
	nn := binary.LittleEndian.Uint16(ins[1:])
	gb.set16Reg(reg, nn)
	gb.regs[PC] += uint16(len(ins))
	return 12
}
func (gb *GameBoy) LD_sp_hl(ins []uint8) int {
	gb.set16Reg(SP, gb.get16Reg(HL))
	gb.regs[PC] += uint16(len(ins))
	return 8
}