It is currently Sat Jan 20, 2018 8:10 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Dec 05, 2017 7:40 am 
Offline

Joined: Wed Mar 23, 2016 12:27 pm
Posts: 17
Hi,

Does anyone know what could cause the rom to lag when playing a PCM track?

Yesterday I hacked Zelda to play PCM tracks instead of spc tracks (It can fallback as well).

I ported the code over to Kyuuyaku MEGAMI tensei but the odd thing is the game lags before loading and playing the track.

I did exactly as I did on Zelda - find the address where music is set, jsl to unused space, validate MSU presence, play MSU and RTL (if msu exists) else play spc and RTL.

Worked perfectly for Zelda but there is nasty lag with Kyuuyaku before the PCM plays. Not sure why, maybe I chose a bad spot to put my msu code? Basically I found a bunch of free FFs around $4FDB60.

I dont think that's the issue though because I can JSL to that area, run the original code, RTL and there is no lag.

I don't have access to my PC now but do you think maybe there's too much of a big load on the cpu that's causing the lag? Maybe I could find the JSL prior to the real music code and instead JSL to my new area then fill it up?

I don't really understand how CPU cycles work but if it gets to high is this what causes lag or would it just break the game instead?

If anyone is wondering, the point of interest in kyuuyaku is

$01EC16

A5 FC
8D 40 21

This loads $00FC and stores it into $2140. Then the music goes off. This is the code that I changed to JSL to my new area at $4FDB60.


Top
 Profile  
 
PostPosted: Tue Dec 05, 2017 7:52 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19490
Location: NE Indiana, USA (NTSC)
The docs imply that when you write to $2004-$2005, the MSU1 needs time to seek to the desired track and spin up the decoder. It sets the "audio busy" flag (bit 6 of the status port at $2000) until seeking has finished. On hypothetical CD-based implementations of the MSU1, seeking might take a half second.


Top
 Profile  
 
PostPosted: Tue Dec 05, 2017 10:17 am 
Offline

Joined: Wed Mar 23, 2016 12:27 pm
Posts: 17
tepples wrote:
The docs imply that when you write to $2004-$2005, the MSU1 needs time to seek to the desired track and spin up the decoder. It sets the "audio busy" flag (bit 6 of the status port at $2000) until seeking has finished. On hypothetical CD-based implementations of the MSU1, seeking might take a half second.


lda #$FF
sta MSU_VOLUME
ldx #$0001
stx MSU_TRACK
lda #$01
sta MSU_CONTROL

Need to fix my code it seems. Above is from that doc, and below is what I have:

lda #$FF
sta MSU_VOLUME
lda #$01
sta MSU_TRACK

lda #$01
sta MSU_CONTROL

Though I doubt that would fix the lag I guess. I see what you are saying. This type of hack is clearly not practical for sound modding, but just music modding where although lag will always be present, at least it will be masked by the fade out screens (right)?

I have reduced some of my lag using JMPs instead, but there are a few sections where I music will change at the push of a button, and the lag is still noticeable.


I actually do not understand the below too much. Only the bottom, that seems to create those $2000-$2007 addresses for MSU. Maybe these values should be altered for Kyuuyaku Megami Tensei as well but I would not know what to change. It seems to work fine using the default xml file.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<cartridge region="NTSC">

   <!-- This part depends on the ROM -->
   <rom>
      <map mode="linear" address="00-7f:8000-ffff"/>
      <map mode="linear" address="80-ff:8000-ffff"/>
   </rom>

   <ram size="0x2000">
      <map mode="linear" address="20-3f:6000-7fff"/>
      <map mode="linear" address="a0-bf:6000-7fff"/>
      <map mode="linear" address="70-7f:0000-ffff"/>
      <map mode="linear" address="f0-ff:0000-ffff"/>
   </ram>

   <!-- This is the important bit -->
   <msu1>
      <map address="00-3f:2000-2007"/>
      <map address="80-bf:2000-2007"/>
   </msu1>

</cartridge>


Top
 Profile  
 
PostPosted: Tue Dec 05, 2017 7:07 pm 
Offline

Joined: Wed Mar 23, 2016 12:27 pm
Posts: 17
Turns out that the computer I was using this morning was slow af. I'm using it on my home PC and the lag nearly almost negligible. That was also after changing it around to use a JMP instead of a JSL.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: DRW and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group