It is currently Sun Oct 20, 2019 1:37 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Jan 27, 2019 2:35 pm 
Offline

Joined: Sat Dec 01, 2018 10:45 am
Posts: 3
So I'm writing a program in python to convert NSF files into a more readable format, with the information about each sound channel at each audio frame displayed (similar to FamiTracker, but as a csv) but I ran into some issues with executing the program once it has been loaded into ram.

I've loaded the data from the file into my emulator correctly (as checked by NSFplay), and I setup all the registers according to the nsf documentation, but now I don't know how to execute the program properly. When I try, either nothing changes or it doesn't change correctly (depends on the nsf file).

I'm using py65emu, and I know it works because of this article.

What am I doing wrong? Code and test nsf linked.
Attachment:
File comment: The python script (save as .py)
nsf_reader.txt [6.04 KiB]
Downloaded 240 times

Attachment:
File comment: My test nsf. Just plays one note in the first pulse channel endlessly.
test1.nsf [5.77 KiB]
Downloaded 234 times


Top
 Profile  
 
PostPosted: Sun Jan 27, 2019 3:17 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7607
Location: Canada
If it helps as an example, here's an NSF analyzer I wrote using py65emu:
https://github.com/bbbradsmith/zensf/blob/master/nsfspider.py

Alternatively, you might try the old NSF Importer fork of Famitracker that breaks NSFs down into tracker data. You could then use the Famitracker text export to get a text file version of it. (Unfortunately the NSF Import fork was before the text export so there'd be an extra step to save and run the text exporter from a later version.)
http://rainwarrior.ca/projects/nes/nsfimport.html


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 8:13 pm 
Offline

Joined: Sat Dec 01, 2018 10:45 am
Posts: 3
rainwarrior wrote:
If it helps as an example, here's an NSF analyzer I wrote using py65emu:
https://github.com/bbbradsmith/zensf/blob/master/nsfspider.py

Alternatively, you might try the old NSF Importer fork of Famitracker that breaks NSFs down into tracker data. You could then use the Famitracker text export to get a text file version of it. (Unfortunately the NSF Import fork was before the text export so there'd be an extra step to save and run the text exporter from a later version.)
http://rainwarrior.ca/projects/nes/nsfimport.html


Thanks! You're code and work has been a huge help!
As for zensf, I had a about the code, why can't you read at addresses $4000 - $4013 in the ram? Aren't those the addresses for the sound channels?


Top
 Profile  
 
PostPosted: Mon Jan 28, 2019 8:19 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21640
Location: NE Indiana, USA (NTSC)
Most 2A03 APU ports are write-only. Only $4015 (length counter status) is readable.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Tue Jan 29, 2019 1:32 am 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 530
$0000-$07FF is RAM. The APU registers don't map to RAM.


Top
 Profile  
 
PostPosted: Tue Jan 29, 2019 9:08 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11416
Location: Rio de Janeiro - Brazil
StarCaptain524 wrote:
why can't you read at addresses $4000 - $4013 in the ram? Aren't those the addresses for the sound channels?

These addresses are not RAM, they're memory-mapped registers. The way these work is that the CPU intercepts accesses to certain special addresses and redirects them to the appropriate devices, and, in this case, the device is the APU. Read and write operations are treated separately for memory-mapped registers (e.g. the same register could even access completely different devices depending on whether you're writing or reading to/from that register), so even when reads are supported, that doesn't mean you'll get back what you wrote, you'll get whatever the device that's responding sends back.


Top
 Profile  
 
PostPosted: Sat Feb 09, 2019 5:40 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3189
Location: Brazil
StarCaptain524 wrote:
why can't you read at addresses $4000 - $4013 in the ram? Aren't those the addresses for the sound channels?

Why do you want a read from $4000-$4013 after all???


Top
 Profile  
 
PostPosted: Sat Feb 09, 2019 6:32 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21640
Location: NE Indiana, USA (NTSC)
If APU registers were readable (which they aren't), then reading $4003 or $4007 would allow a program to not trigger phase reset unnecessarily during vibrato or portamento without having to use a separate variable to keep track of the last written value.

_________________
Pin Eight | Twitter | GitHub | Patreon


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 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