Snippets

ScorpionIlluminati Song Structure Fetch Subroutine

You are viewing an old version of this snippet. View the current version.
Revised by ScorpionIlluminati 0a0be09
; ************************************
; Song structure
; ************************************
song_struct                 rs.l 4
song_author_address    =    $0
song_title_address     =    $4
song_vgm_address       =    $8
song_beatmap_address   =    $C

; ==============================================================
; GetSongData
; d0 - index of song data to load
; ==============================================================
GetSongData:
      ; Get song address in table
      mulu #song_struct_size, d0                                               ; Index to offset
      lea SongList, a0                                                         ; Get song table address
      add.l	d0, a0                                                             ; Add offset
      move.l song_vgm_address(a0), a4                                          ; Get vgm ptr, to a4
      move.l song_beatmap_address(a0), a5                                      ; Get beatmap ptr, to a5
      rts
; ==============================================================
; GetSongMetaData
; d0 - index of song data to load
; ==============================================================
GetSongMetaData:
      ; Get song address in table
      mulu #song_struct_size, d3                                               ; Index to offset
      lea SongList, a3                                                         ; Get song table address
      add.l	d0, a3                                                             ; Add offset
      move.l song_author_address(a3), a1                                       ; Get author name ptr, to a4
      move.l song_title_address(a3), a2                                        ; Get song title ptr, to a5
      rts
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.