Advertisement
Guest User

gb_carillon

a guest
Nov 12th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. Player_Initialize equ $4000
  2. Player_MusicStart equ $4003
  3. Player_MusicStop equ $4006
  4. Player_SongSelect equ $400c
  5. Player_MusicUpdate equ $4100
  6. rROMB0 equ $2000
  7. rLY equ $FF44
  8. MusicBank equ 1
  9.  
  10. SongNumber equ 0 ; 0 - 7
  11.  
  12. SECTION "Example",HOME[$150]
  13.  
  14. FirstTime:
  15. ld a,MusicBank ; Switch to MusicBank
  16. ld [rROMB0],a
  17.  
  18. call Player_Initialize ; Initialize sound registers and
  19. ; player variables on startup
  20.  
  21. NewSong:
  22. ld a,MusicBank ; Switch to MusicBank
  23. ld [rROMB0],a
  24.  
  25. call Player_MusicStart ; Start music playing
  26.  
  27. ld a,SongNumber ; Call SongSelect AFTER MusicStart!
  28. call Player_SongSelect ; (Not needed if SongNumber = 0)
  29.  
  30.  
  31. FrameLoop:
  32. ld c,$10 ; Waiting
  33. call WaitLCDLine
  34.  
  35. ld a,MusicBank ; Switch to MusicBank
  36. ld [rROMB0],a
  37. call Player_MusicUpdate ; Call this once a frame
  38.  
  39. ;call YourProgram
  40.  
  41. ld c,$90 ; Wait for VBlank
  42. call WaitLCDLine
  43.  
  44. ; VBlank routines here
  45.  
  46. jr FrameLoop
  47.  
  48.  
  49.  
  50. StopExample:
  51. ld a,MusicBank ; Switch to MusicBank
  52. ld [rROMB0],a
  53. call Player_MusicStop ; Stops reading note data and cuts
  54. ; all music notes currently playing
  55. ret
  56.  
  57.  
  58.  
  59. WaitLCDLine:
  60. ld a,[rLY]
  61. cp c
  62. jr nz,WaitLCDLine
  63. ret
  64.  
  65.  
  66.  
  67. SECTION "Music",DATA[$4000],BANK[MusicBank]
  68.  
  69. INCBIN "fruitless.bin" ; player code and music data
  70.  
  71.  
  72.  
  73. SECTION "Reserved",BSS[$c7c0]
  74.  
  75. ds $30 ; $c7c0 - $c7ef for player variables
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement