diff --git a/applecorn.s b/applecorn.s index 80f0fc9..7b64663 100644 --- a/applecorn.s +++ b/applecorn.s @@ -280,6 +280,7 @@ MAINZP MAC PUT MAINMEM.ENSQ PUT MAINMEM.ENSQFREQ PUT MAINMEM.MOCK + PUT MAINMEM.MOCKFREQ * Automatically save the object file: SAV APLCORN.SYSTEM diff --git a/mainmem.audio.s b/mainmem.audio.s index b2592e9..5cd2105 100644 --- a/mainmem.audio.s +++ b/mainmem.audio.s @@ -477,9 +477,11 @@ NONOTE LDA CHANENV,X ; See if envelope is in effect CMP #$FF BNE :RELEASE ; If envelope -> start rel phase STZ CURRAMP,X ; Next env will start at zero vol + PHY ; NEEDED FOR MOCKINGBOARD (NOT SURE WHY) LDY #$00 ; Zero volume LDA #$00 ; Zero freq JSR AUDIONOTE ; Silence channel Y + PLY ; NEEDED FOR MOCKINGBOARD (NOT SURE WHY) RTS :RELEASE LDA #3 ; Phase 3 is release phase STA AMPSECT,X ; Force release phase @@ -512,24 +514,27 @@ CHECK4BYTES PHX * On entry: X - oscillator number 0-3 , A - frequency, Y - amplitude * Preserves all registers AUDIONOTE - JMP ENSQNOTE +* JMP ENSQNOTE * JMP MOCKNOTE + RTS * Adjust frequency of oscillator * On entry: X - oscillator number 0-3 , Y - frequency to set * Preserves X & Y AUDIOFREQ - JMP ENSQFREQ +* JMP ENSQFREQ * JMP MOCKFREQ + RTS * Adjust amplitude of oscillator * On entry: X - oscillator number 0-3 , Y - amplitude to set * Preserves X & Y AUDIOAMP - JMP ENSQAMP +* JMP ENSQAMP * JMP MOCKAMP + RTS * Handle envelope tick counter diff --git a/mainmem.ensqfreq.s b/mainmem.ensqfreq.s index 90d1c4d..cc3920f 100644 --- a/mainmem.ensqfreq.s +++ b/mainmem.ensqfreq.s @@ -2,7 +2,7 @@ * (c) Bobbi 2022 GPLv3 * * Table of frequency values for Ensoniq -* Generated by freq_table script +* Generated by ensq_freq_table script * FREQHIGH diff --git a/mainmem.init.s b/mainmem.init.s index d43ea49..bb05595 100644 --- a/mainmem.init.s +++ b/mainmem.init.s @@ -36,8 +36,8 @@ RESET TSX RESETHW SEC JSR IDROUTINE ; See if this is a GS BCS :NOTGS - JSR ENSQINIT ; Initialize Ensoniq +* JSR ENSQINIT ; Initialize Ensoniq :NOTGS -* JSR MOCKINIT ; Initialize Mockingboard (sl4) + JSR MOCKINIT ; Initialize Mockingboard (sl4) RTS diff --git a/mainmem.mock.s b/mainmem.mock.s index e922366..c3128b0 100644 --- a/mainmem.mock.s +++ b/mainmem.mock.s @@ -131,8 +131,8 @@ MOCKAMP PHX * Mockingboard interrupt service routine - just calls generic audio ISR MOCKISR CLD * TODO: Check whether interrupt is from Mockingboard or not - BIT MOCK_6522_T1CL ; Clear interrupt -* JSR AUDIOISR + BIT MOCK_6522_T1CL ; Clear interrupt + JSR AUDIOISR CLC ; CC indicates we serviced irq RTS diff --git a/mainmem.mockfreq.s b/mainmem.mockfreq.s new file mode 100644 index 0000000..0d06952 --- /dev/null +++ b/mainmem.mockfreq.s @@ -0,0 +1,522 @@ +* MAINMEM.MOCKFREQ.S +* (c) Bobbi 2022 GPLv3 +* +* Table of frequency values for Mockingboard +* Generated by mock_freq_table script +* + +MFREQHIGH + DB >1023 + DB >1008 + DB >993 + DB >979 + DB >965 + DB >951 + DB >937 + DB >923 + DB >910 + DB >896 + DB >883 + DB >870 + DB >858 + DB >845 + DB >833 + DB >821 + DB >809 + DB >797 + DB >785 + DB >774 + DB >762 + DB >751 + DB >740 + DB >729 + DB >719 + DB >708 + DB >698 + DB >687 + DB >677 + DB >667 + DB >658 + DB >648 + DB >638 + DB >629 + DB >620 + DB >611 + DB >602 + DB >593 + DB >584 + DB >576 + DB >567 + DB >559 + DB >550 + DB >542 + DB >534 + DB >526 + DB >519 + DB >511 + DB >503 + DB >496 + DB >489 + DB >481 + DB >474 + DB >467 + DB >460 + DB >454 + DB >447 + DB >440 + DB >434 + DB >427 + DB >421 + DB >415 + DB >408 + DB >402 + DB >396 + DB >390 + DB >385 + DB >379 + DB >373 + DB >368 + DB >362 + DB >357 + DB >351 + DB >346 + DB >341 + DB >336 + DB >331 + DB >326 + DB >321 + DB >316 + DB >311 + DB >307 + DB >302 + DB >297 + DB >293 + DB >288 + DB >284 + DB >280 + DB >276 + DB >271 + DB >267 + DB >263 + DB >259 + DB >255 + DB >251 + DB >247 + DB >244 + DB >240 + DB >236 + DB >233 + DB >229 + DB >226 + DB >222 + DB >219 + DB >215 + DB >212 + DB >209 + DB >206 + DB >202 + DB >199 + DB >196 + DB >193 + DB >190 + DB >187 + DB >184 + DB >181 + DB >179 + DB >176 + DB >173 + DB >170 + DB >168 + DB >165 + DB >162 + DB >160 + DB >157 + DB >155 + DB >152 + DB >150 + DB >148 + DB >145 + DB >143 + DB >141 + DB >138 + DB >136 + DB >134 + DB >132 + DB >130 + DB >128 + DB >126 + DB >124 + DB >122 + DB >120 + DB >118 + DB >116 + DB >114 + DB >112 + DB >110 + DB >108 + DB >107 + DB >105 + DB >103 + DB >101 + DB >100 + DB >98 + DB >96 + DB >95 + DB >93 + DB >92 + DB >90 + DB >89 + DB >87 + DB >86 + DB >84 + DB >83 + DB >81 + DB >80 + DB >79 + DB >77 + DB >76 + DB >75 + DB >73 + DB >72 + DB >71 + DB >69 + DB >68 + DB >67 + DB >66 + DB >65 + DB >63 + DB >62 + DB >61 + DB >60 + DB >59 + DB >58 + DB >57 + DB >56 + DB >55 + DB >54 + DB >53 + DB >52 + DB >51 + DB >50 + DB >49 + DB >48 + DB >47 + DB >46 + DB >45 + DB >44 + DB >44 + DB >43 + DB >42 + DB >41 + DB >40 + DB >39 + DB >39 + DB >38 + DB >37 + DB >36 + DB >36 + DB >35 + DB >34 + DB >33 + DB >33 + DB >32 + DB >31 + DB >31 + DB >30 + DB >29 + DB >29 + DB >28 + DB >27 + DB >27 + DB >26 + DB >25 + DB >25 + DB >24 + DB >24 + DB >23 + DB >23 + DB >22 + DB >22 + DB >21 + DB >20 + DB >20 + DB >19 + DB >19 + DB >18 + DB >18 + DB >17 + DB >17 + DB >16 + DB >16 + DB >16 + DB >15 + DB >15 + DB >14 + DB >14 + DB >13 + DB >13 + DB >13 + DB >12 + DB >12 + DB >11 + DB >11 + DB >11 + DB >10 + +MFREQLOW + DB <1023 + DB <1008 + DB <993 + DB <979 + DB <965 + DB <951 + DB <937 + DB <923 + DB <910 + DB <896 + DB <883 + DB <870 + DB <858 + DB <845 + DB <833 + DB <821 + DB <809 + DB <797 + DB <785 + DB <774 + DB <762 + DB <751 + DB <740 + DB <729 + DB <719 + DB <708 + DB <698 + DB <687 + DB <677 + DB <667 + DB <658 + DB <648 + DB <638 + DB <629 + DB <620 + DB <611 + DB <602 + DB <593 + DB <584 + DB <576 + DB <567 + DB <559 + DB <550 + DB <542 + DB <534 + DB <526 + DB <519 + DB <511 + DB <503 + DB <496 + DB <489 + DB <481 + DB <474 + DB <467 + DB <460 + DB <454 + DB <447 + DB <440 + DB <434 + DB <427 + DB <421 + DB <415 + DB <408 + DB <402 + DB <396 + DB <390 + DB <385 + DB <379 + DB <373 + DB <368 + DB <362 + DB <357 + DB <351 + DB <346 + DB <341 + DB <336 + DB <331 + DB <326 + DB <321 + DB <316 + DB <311 + DB <307 + DB <302 + DB <297 + DB <293 + DB <288 + DB <284 + DB <280 + DB <276 + DB <271 + DB <267 + DB <263 + DB <259 + DB <255 + DB <251 + DB <247 + DB <244 + DB <240 + DB <236 + DB <233 + DB <229 + DB <226 + DB <222 + DB <219 + DB <215 + DB <212 + DB <209 + DB <206 + DB <202 + DB <199 + DB <196 + DB <193 + DB <190 + DB <187 + DB <184 + DB <181 + DB <179 + DB <176 + DB <173 + DB <170 + DB <168 + DB <165 + DB <162 + DB <160 + DB <157 + DB <155 + DB <152 + DB <150 + DB <148 + DB <145 + DB <143 + DB <141 + DB <138 + DB <136 + DB <134 + DB <132 + DB <130 + DB <128 + DB <126 + DB <124 + DB <122 + DB <120 + DB <118 + DB <116 + DB <114 + DB <112 + DB <110 + DB <108 + DB <107 + DB <105 + DB <103 + DB <101 + DB <100 + DB <98 + DB <96 + DB <95 + DB <93 + DB <92 + DB <90 + DB <89 + DB <87 + DB <86 + DB <84 + DB <83 + DB <81 + DB <80 + DB <79 + DB <77 + DB <76 + DB <75 + DB <73 + DB <72 + DB <71 + DB <69 + DB <68 + DB <67 + DB <66 + DB <65 + DB <63 + DB <62 + DB <61 + DB <60 + DB <59 + DB <58 + DB <57 + DB <56 + DB <55 + DB <54 + DB <53 + DB <52 + DB <51 + DB <50 + DB <49 + DB <48 + DB <47 + DB <46 + DB <45 + DB <44 + DB <44 + DB <43 + DB <42 + DB <41 + DB <40 + DB <39 + DB <39 + DB <38 + DB <37 + DB <36 + DB <36 + DB <35 + DB <34 + DB <33 + DB <33 + DB <32 + DB <31 + DB <31 + DB <30 + DB <29 + DB <29 + DB <28 + DB <27 + DB <27 + DB <26 + DB <25 + DB <25 + DB <24 + DB <24 + DB <23 + DB <23 + DB <22 + DB <22 + DB <21 + DB <20 + DB <20 + DB <19 + DB <19 + DB <18 + DB <18 + DB <17 + DB <17 + DB <16 + DB <16 + DB <16 + DB <15 + DB <15 + DB <14 + DB <14 + DB <13 + DB <13 + DB <13 + DB <12 + DB <12 + DB <11 + DB <11 + DB <11 + DB <10 diff --git a/mock_freq_table b/mock_freq_table new file mode 100755 index 0000000..68ab9ca --- /dev/null +++ b/mock_freq_table @@ -0,0 +1,32 @@ +#!/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 +clk = 63216.64 # AY-3 clock +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): + divider[i] = clk / freqs[i] - 16 +# print(i, freqs[i], divider[i]) + +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]))