gameboy superoptimizer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
450 B

3 years ago
  1. from gbso.insn import *
  2. from gbso.optimize import optimize
  3. from gbso.program import Program
  4. from gbso.regs import R8, R16
  5. rLCDC = 0xFF40
  6. rIE = 0xFFFF
  7. IEF_VBLANK = 1 << 0
  8. prgm = Program(
  9. outputs=set([R8.A]),
  10. insns=[
  11. LD_RR_NN(R16.HL, rLCDC),
  12. RES_N_HL(7),
  13. RES_N_HL(2),
  14. LD_RR_NN(R16.HL, rIE),
  15. LD_HL_N(IEF_VBLANK),
  16. ],
  17. )
  18. prgm_opt = optimize(prgm)
  19. for insn in prgm_opt.insns:
  20. print(insn.pretty())