It is currently Fri Jan 18, 2019 9:31 am

 All times are UTC - 7 hours

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Wrote this very simple DMC calculatorPosted: Fri Sep 02, 2016 10:10 am

Joined: Fri May 08, 2015 7:17 pm
Posts: 2390
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 [ 12.48 KiB | Viewed 3064 times ]

_________________
nesdoug.com -- blog/tutorial on programming for the NES
Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 1 post ]

 All times are UTC - 7 hours

Who is online

Users browsing this forum: Google [Bot] and 4 guests

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

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki