home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / cncd_editor.zip / fxhammer.zip / full-ex1.asm < prev    next >
Assembly Source File  |  2000-12-17  |  3KB  |  102 lines

  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.  
  7. SoundFX_Trig            equ     $4000
  8. SoundFX_Stop            equ     $4003
  9. SoundFX_Update          equ     $4006
  10.  
  11.  
  12. MusicBank               equ     1
  13. FXBank                  equ     3
  14.  
  15. SongNumber              equ     0       ; 0 - 7
  16.  
  17.  
  18.  
  19.         SECTION "Example",HOME[$150]
  20.  
  21. FirstTime:
  22.         ld      a,MusicBank             ; Switch to MusicBank
  23.         ld      [rROMB0],a
  24.  
  25.         call    Player_Initialize       ; Initialize sound registers and
  26.                                         ; player variables on startup
  27.  
  28. NewSong:
  29.         ld      a,MusicBank             ; Switch to MusicBank
  30.         ld      [rROMB0],a
  31.  
  32.         call    Player_MusicStart       ; Start music playing
  33.  
  34.         ld      a,SongNumber            ; Call SongSelect AFTER MusicStart!
  35.         call    Player_SongSelect       ; (Not needed if SongNumber = 0)
  36.  
  37.  
  38. FrameLoop:
  39.         ld      c,$10                   ; Waiting
  40.         call    WaitLCDLine
  41.  
  42.         ld      a,MusicBank             ; Switch to MusicBank
  43.         ld      [rROMB0],a
  44.         call    Player_MusicUpdate      ; Call this once a frame
  45.  
  46.         ld      a,FXBank                ; Switch to FXBank
  47.         ld      [rROMB0],a
  48.         call    SoundFX_Update          ; Call this once a frame too
  49.  
  50.  
  51.         ld      c,$90                   ; Waiting
  52.         call    WaitLCDLine
  53.  
  54.         jr      FrameLoop
  55.  
  56.  
  57.  
  58. StopExample:
  59.         ld      a,MusicBank             ; Switch to MusicBank
  60.         ld      [rROMB0],a
  61.         call    Player_MusicStop        ; Stops reading note data and cuts
  62.                                         ; all music notes currently playing
  63.  
  64.         ld      a,FxBank                ; Switch to FXBank
  65.         ld      [rROMB0],a
  66.         call    SoundFX_Stop            ; Stop any sound FX playing
  67.  
  68.         ret
  69.  
  70.  
  71. TrigSoundFXExample:
  72.         ld      a,FxBank                ; Switch to FXBank
  73.         ld      [rROMB0],a
  74.         ld      a,2
  75.         call    SoundFX_Trig            ; Trig sound FX number 2
  76.  
  77.         ret
  78.  
  79.  
  80. WaitLCDLine:
  81.         ld      a,[rLY]
  82.         cp      c
  83.         jr      nz,WaitLCDLine
  84.  
  85.         ret
  86.  
  87.  
  88.  
  89.         SECTION "Music",DATA[$4000],BANK[MusicBank]
  90.  
  91.         INCBIN "music.bin"              ; player code and music data
  92.  
  93.  
  94.         SECTION "FX",DATA[$4000],BANK[FXBank]
  95.  
  96.         INCBIN "fxbank.bin"
  97.  
  98.  
  99.         SECTION "Reserved",BSS[$c7c0]
  100.  
  101.         ds      $30                     ; $c7c0 - $c7ef for player variables
  102.