Snippets

ScorpionIlluminati Song Structure Fetch Subroutine

Created by ScorpionIlluminati last modified
References
Old: http://www.sega-16.com/forum/showthread.php?32089-Lookup-Table-Help&p=772371&viewfull=1#post772371
New: Jorge@Plutiedev

; ************************************
; Song structure
; ************************************
song_struct                 rs.l 4
song_author_address    =    $0
song_title_address     =    $4
song_vgm_address       =    $8
song_beatmap_address   =    $C

; ==============================================================
; GetSongData
; d3 - index of song data to load
; ==============================================================
GetSongData:
      ; Get song address in table
      mulu #song_struct_size, d3                                               ; Index to offset
      lea SongList, a3                                                         ; Get song table address
      add.l	d3, a3                                                             ; Add offset
      move.l song_vgm_address(a3), a1                                          ; Get vgm ptr, to a1
      move.l song_beatmap_address(a3), a2                                      ; Get beatmap ptr, to a2
      rts
; ==============================================================
; GetSongMetaData
; d3 - 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	d3, a3                                                             ; Add offset
      move.l song_author_address(a3), a1                                       ; Get author name ptr, to a1
      move.l song_title_address(a3), a2                                        ; Get song title ptr, to a2
      rts

Comments (0)

HTTPS SSH

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