1,153

edits

Jump to navigation
Jump to search

Syntax highlighing

The actual frequency produced is the 10-bit frequency divisor given by F0 to F9 divided into 1/32 of the system clock frequency (3.579 MHz) which turns out to be 111,860 Hz. Keeping all this in mind, the following is the formula for calculating the frequency:

<syntax type="C++">

f = 111860 / (((Byte2 & 0x3F) << 4) + (Byte1 & 0x0F))

</syntax>

Note: The order of the bytes are reversed for AGI sound data.

My program reads in the duration as a 16 bit word. It then loads the two following bytes and calculates the frequency as follows:

<syntax type="C++">

f = 111860 / (((Byte2 & 0x3F) << 4) + (Byte3 & 0x0F))

</syntax>

The 111860 comes from the PCjr discussion above. Note that the bytes are in the opposite order from that mentioned in the PCjr information.

Retrieved from "https://wiki.scummvm.org/index.php?title=Special:MobileDiff/9700"