2022-11-19 03:43:24 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
#
|
|
|
|
# Make a table of Mockingboard wavelength values (high and low bytes)
|
|
|
|
# Corresponding to the frequency values used in BBC Micro
|
|
|
|
# SOUND statements.
|
|
|
|
#
|
|
|
|
|
|
|
|
d7 = 2349.32 # D7 is pitch value 253
|
2022-11-19 18:11:05 +00:00
|
|
|
clk = 63780.27 # AY-3 clock (1.023MHz / 16)
|
2022-11-19 03:43:24 +00:00
|
|
|
freqs = [0] * 256
|
|
|
|
divider = [0] * 256
|
|
|
|
|
|
|
|
freqs[253] = d7
|
|
|
|
|
|
|
|
for i in range(254,256):
|
|
|
|
freqs[i] = freqs[i-1] * (2 ** (1 / 48))
|
|
|
|
|
|
|
|
for i in range(252,-1,-1):
|
|
|
|
freqs[i] = freqs[i+1] / (2 ** (1 / 48))
|
|
|
|
|
|
|
|
for i in range(0,256):
|
2022-11-21 21:42:55 +00:00
|
|
|
divider[i] = int(round(clk / freqs[i]))
|
|
|
|
coarse = int(divider[i] / 256)
|
|
|
|
fine = int(divider[i] % 256)
|
|
|
|
# print("{:3d}: {:9.3f} {:5d} ({:2d} {:3d})".format(i, freqs[i], divider[i], coarse, fine))
|
2022-11-19 03:43:24 +00:00
|
|
|
|
|
|
|
print("\nMFREQHIGH");
|
|
|
|
for i in range(0,256):
|
|
|
|
print(" DB >{:.0f}".format(divider[i]))
|
|
|
|
|
|
|
|
print("\nMFREQLOW");
|
|
|
|
for i in range(0,256):
|
|
|
|
print(" DB <{:.0f}".format(divider[i]))
|