from gbso.cpu.insn import * from gbso.cpu.regs import R8, R16 from gbso.optimize import optimize from gbso.program.program import Program rLCDC = 0xFF40 rIE = 0xFFFF IEF_VBLANK = 1 << 0 prgm = Program( outputs=set([R8.A]), insns=[ LD_RR_NN(R16.HL, rLCDC), RES_N_HL(7), RES_N_HL(2), LD_RR_NN(R16.HL, rIE), LD_HL_N(IEF_VBLANK), ], ) prgm_opt = optimize(prgm) for insn in prgm_opt.insns: print(insn.pretty())