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.

52 lines
803 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. INCLUDE "hardware.inc"
  2. INCLUDE "png/map/intro.inc"
  3. SECTION "BG Data", WRAM0
  4. BG_COLLISION_DATA:: dw
  5. BG_MAP_WIDTH:: db
  6. SECTION "BG Code", ROM0
  7. MACRO update_map_info
  8. ld hl, BG_COLLISION_DATA
  9. ld a, HIGH(\1)
  10. ld [hli], a
  11. ld a, LOW(\1)
  12. ld [hli], a
  13. ld a, \2
  14. ld [hli], a
  15. ENDM
  16. BG_Init::
  17. ; copy map
  18. ld e, intro_HEIGHT
  19. ld bc, _SCRN0
  20. ld hl, intro_MAP
  21. .copy_map_row:
  22. ld d, intro_WIDTH
  23. call memcpy
  24. dec e
  25. jr z, .done
  26. ld d, 32 - intro_WIDTH
  27. .skip:
  28. ; skip over trailing part in vram
  29. inc c
  30. jr nz, .nocarry
  31. inc b
  32. .nocarry:
  33. dec d
  34. jr nz, .skip
  35. jr .copy_map_row
  36. .done:
  37. ; copy tiles
  38. ld hl, intro_TILES
  39. ld bc, _VRAM
  40. ld d, intro_NUM_TILES
  41. call memcpy
  42. update_map_info intro_COLLISION, intro_WIDTH
  43. ret