It is currently Fri May 26, 2017 9:23 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Sep 02, 2016 10:10 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1576
Location: DIGDUG
I don't know if this is too simple to post, but maybe this will help somebody. It's a simple console calculator for converting DMC sample size and address. For python 3. Easily converted to python 2.

I have the length input in decimal, because this is commonly how famitracker reports the size of a dmc file.

Code:
#!/usr/bin/python3

# calculate the length and position of DMC file

length = ""
position = ""

length = input('enter length of file, in decimal : ')
position = input('enter position of file, in hex, without a 0x prefix : ')

a = int(length)
a = a >> 4
print ("DMC sample length = " + hex (a))

b = int(position, 16)
b = ((b-0xc000) >> 6)

print("DMC Sample address = " + hex(b))
print("\n")


Attachments:
DMC.png
DMC.png [ 12.48 KiB | Viewed 2168 times ]

_________________
nesdoug.com -- blog/tutorial on programming for the NES
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 7 hours


Who is online

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