Re: Hello

From Chris Covell <xxxxxx@direct.ca>
Date
On 15-Aug-00, David Shadoff wrote:

> So how are those made ?
> Do you 'hack' an emulator to watch for registration of a PSG music tune ?
> Or do you search through the ROM looking for certain PSG-music features ?
> Is a 'NSF' more similar to the actual PSG music sequence, or more similar
> to a WAV file ?

Well, you can do it both ways.  Essentially what you're doing is searching
through the 6502 code to spot tell-tale writes to the sound registers, which
on the NES is $4000-$4013 and $4015.  You can do this either in a hex editor,
by disassembling the 6502 code from an NES ROM, or by tracing through the code
in an emulator (like NESticle.)

Almost all games play music by calling an initialization subroutine to start a
tune, and then each VBlank, calling a play routine to update the sound
registers.  Ripping music code involves finding the entry points for these
routines and extracting the relevant code to a file.

So, NSFs are basically 6502 code with a header attached (and with sample data
at the end of the file, if necessary).  C-64 SID songs are basically the same
format too.  The benefit of a ripped song (NSF, SID) versus a dumped song
(SPC, GYM) is a compact filesize, and all the tunes in a game stored in one
file.  To read more about ripping NES music, you can visit the videogames
section of my homepage for my NSF ripping guide.

> @>Unfortunately, I don't know 6820 assembly or the
> @>PCE's memory map, so I can't start with this right now.

> The PCE is more similar to the NES than you expect.  6280 assembler is
> essentially 6592 with a couple of extra instructions.  The memory map may
> be different from NES, but the segmented model is basically the same - it's
> just more regular (imagine not worrying about 200 mappers).

That is both good and bad.  NES games usually keep their music code in memory
all the time, and the game code is switched in/out in a different bank.  I'm
just speculating, but a TG game might have its music code spread over several
banks.

> Well certainly discussing file formats can't be all that harmful.  Or even
> techniques for finding PSG code.

Well, I haven't boned up on the TG registers, but usually it involves finding
in code the writes to the sound registers.  Most "good" programmers just write
directly, but I have seen in my ripping travels "bad" programmers who use
zero-page indirect addresssing to write to the sound regs, which is harder to
trace.  Anyway, somebody already has done what I've mentioned and ripped the
music from Galaga '90 into a PCE ROM (which I've seen floating around).  Now
all we need is the same thing done to the other great games.  :-)
-- 
Chris Covell (xxxxxx@direct.ca)
http://www.zyx.com/ccovell/
Solar Wars (NES) Homepage!


--- TGHack List Information -------------------------------------------
This has been a message from the TGHack List.  To subscribe/unsubscribe,
send a message to xxxxxx@joyce.eng.yale.edu, to send a
message to the list, send email to xxxxxx@joyce.eng.yale.edu.
-----------------------------------------------------------------------