RosettaCodeData/Task/Musical-scale/Action-/musical-scale.action
2023-07-01 13:44:08 -04:00

46 lines
1,007 B
Text

DEFINE PTR="CARD"
PROC Wait(BYTE frames)
BYTE RTCLOK=$14
frames==+RTCLOK
WHILE frames#RTCLOK DO OD
RETURN
PROC Main()
BYTE AUDCTL=$D208,AUDF1=$D200,AUDC1=$D201,AUDF2=$D202,AUDC2=$D203
PTR ARRAY notes(8)
BYTE ARRAY pitch8=[60 53 47 45 40 35 31 30]
CARD ARRAY pitch16=[1703 1517 1350 1274 1134 1010 899 848]
BYTE i
CARD p
notes(0)="Do" notes(1)="Re" notes(2)="Mi" notes(3)="Fa"
notes(4)="Sol" notes(5)="La" notes(6)="Si" notes(7)="Do"
PrintE("8-bit precision pitch values:")
FOR i=0 TO 7
DO
PrintF("%S-%B ",notes(i),pitch8(i))
Sound(0,pitch8(i),10,10)
Wait(20)
OD
SndRst()
Wait(20)
PutE() PutE()
AUDCTL=$50 ;join channel 1 and 2 to get 16-bit
AUDC1=$A0 ;turn off channel 1
AUDC2=$AA ;turn on channel 2
PrintE("16-bit precision pitch values:")
FOR i=0 TO 7
DO
PrintF("%S-%U ",notes(i),pitch16(i))
p=pitch16(i)
AUDF2=p RSH 8
AUDF1=p&$FF
Wait(20)
OD
SndRst()
AUDCTL=$00 ;restore default configuration
Wait(20)
RETURN