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.

61 lines
834 B

2 years ago
  1. INCLUDE "game.inc"
  2. INCLUDE "hardware.inc"
  3. INCLUDE "util.inc"
  4. SECTION "Header", ROM0[$100]
  5. _entry:
  6. di
  7. jp start
  8. rept $150 - _entry
  9. db 0
  10. endr
  11. SECTION "Game State", WRAM0
  12. frame:: db
  13. state:: db
  14. SECTION "VBlank", ROM0[$40]
  15. handle_vblank:
  16. reti
  17. SECTION "Code", ROM0
  18. start:
  19. ; init/disable lcd
  20. ld hl, rLCDC
  21. res 7, [hl]
  22. res 2, [hl]
  23. ; enable vblank
  24. ld hl, rIE
  25. ld [hl], IEF_VBLANK
  26. call OAM_Init
  27. call Keys_Init
  28. ; set palette
  29. ld a, %11100100
  30. ld hl, rOBP0
  31. ld [hl], a
  32. ld hl, rBGP
  33. ld [hl], a
  34. ld a, GAME_STATEF_TITLE
  35. ld [state], a
  36. .loop:
  37. ld a, [state]
  38. cp GAME_STATEF_TITLE
  39. jr nz, .check_game_state
  40. call Title_Start
  41. jr .loop
  42. ; only two states atm, no need to check anything yet
  43. .check_game_state:
  44. call Game_Start
  45. jr .loop