Skip to content

Commit

Permalink
Initial import of Rock N' Roll Racing MSU-1 Hack
Browse files Browse the repository at this point in the history
  • Loading branch information
mlarouche committed Dec 9, 2014
0 parents commit 16c0c99
Show file tree
Hide file tree
Showing 7 changed files with 428 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Rock n' Roll Racing MSU-1 hack
by DarkShock

This hack adds support for the MSU-1 chip invented by byuu that
supports CD quality audio and streaming 4Gb of data. This hack only uses the audio part of the
chip.

The hack is made for the 1.0 version of the game. Tested on SD2SNES.

=============
= Compiling =
=============
To compile the hack you need

* asar 1.36 (http://www.smwcentral.net/?p=section&a=details&id=6000)
* wav2msu (http://helmet.kafuka.org/thepile/Wav2msu)

The rom needs to be named rnrr_msu1.sfc.

For the name of the .wav files, look in the create_pcm.bat file.

===========
= Songs =
===========
00 = Highway Star
01 = Peter Gunn
02 = Born to be Wild
03 = Bad to the Bone
04 = Paranoid

========
= TODO =
========
* Stop the music when the game ask for it
* Duck (reduce) the volume when pausing the game in course
* Make the manifest file for bsnes and higan
9 changes: 9 additions & 0 deletions create_pcm.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@ECHO OFF

del *.pcm

wav2msu highway_star.wav rnrr_msu1-0.pcm
wav2msu bark_at_the_moon.wav rnrr_msu1-1.pcm
wav2msu born_to_be_wild.wav rnrr_msu1-2.pcm
wav2msu bad_to_the_bone.wav rnrr_msu1-3.pcm
wav2msu paranoid.wav rnrr_msu1-4.pcm
8 changes: 8 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@ECHO OFF

del rnrr_msu1.sfc

copy rnrr_original.smc rnrr_msu1.sfc
asar rnrr_msu1_music.asm rnrr_msu1.sfc

create_pcm.bat
Empty file added rnrr_msu1.msu
Empty file.
10 changes: 10 additions & 0 deletions rnrr_msu1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">
<msu1>
<map address="80-bf:2000-2007"/>
<mmio>
<map address="00-3f:2000-2007"/>
<map address="80-bf:2000-2007"/>
</mmio>
</msu1>
</cartridge>
116 changes: 116 additions & 0 deletions rnrr_msu1_music.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
lorom

; MSU memory map I/O
MSU_STATUS = $2000
MSU_ID = $2002
MSU_AUDIO_TRACK_LO = $2004
!MSU_AUDIO_TRACK_HI = $2005
!MSU_AUDIO_VOLUME = $2006
!MSU_AUDIO_CONTROL = $2007

; SPC communication ports
SPC_COMM_0 = $2140
SPC_COMM_1 = $2141
SPC_COMM_2 = $2142
SPC_COMM_3 = $2143

; MSU_STATUS possible values
MSU_STATUS_TRACK_MISSING = $8
MSU_STATUS_AUDIO_PLAYING = %00010000
MSU_STATUS_AUDIO_REPEAT = %00100000
MSU_STATUS_AUDIO_BUSY = $40
MSU_STATUS_DATA_BUSY = %10000000

; Constants
FULL_VOLUME = $FF

; Hijack transfert SPC music after incrementing which song to play
org $808129
jsr MSU_Main

; Hijack for stop music
org $808110
jsr MSU_Stop

; Hack code
org $80FF27
MSU_Main:
php
rep #$30
pha
phx
phy

sep #$30
; Check if MSU-1 is present
lda.w MSU_ID
cmp #'S'
bne .MSUNotFound

.MSUFound:
; Set track
sty.w MSU_AUDIO_TRACK_LO
stz.w !MSU_AUDIO_TRACK_HI

.CheckAudioStatus
lda.w MSU_STATUS

and.b #MSU_STATUS_AUDIO_BUSY
bne .CheckAudioStatus

; Check if track is missing
lda.w MSU_STATUS
and.b #MSU_STATUS_TRACK_MISSING
bne .MSUNotFound

; Always loop the song
lda #$03
sta !MSU_AUDIO_CONTROL

; Set volume
lda.b #FULL_VOLUME
sta.w !MSU_AUDIO_VOLUME

rep #$30
ply
plx
pla
plp
rts

; Call original routine if MSU-1 is not found
.MSUNotFound:
rep #$30
ply
plx
pla
plp

jsr $F904
rts

MSU_Stop:
php
rep #$30
pha

sep #$30
; Check if MSU-1 is present
lda.w MSU_ID
cmp #'S'
bne .MSUNotFound

lda #$00
sta !MSU_AUDIO_CONTROL

rep #$30
pla
plp
rts
.MSUNotFound:
rep #$30
pla
plp

;jsr $F986
rts
Loading

0 comments on commit 16c0c99

Please sign in to comment.