From f67069421c64c2b5db88e3aa7f9fe952587d5f17 Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Mon, 28 Nov 2022 19:59:19 -0500 Subject: [PATCH] Finished off noise channel for Mockingboard. --- applecorn.po | Bin 819200 -> 819200 bytes auxmem.init.s | 2 +- mainmem.mock.s | 29 ++++++++++++++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/applecorn.po b/applecorn.po index 432cc70e77c60128271accb608da94270750d9b4..9b6db1fdb214df213cc6adf34e697e72d13580dd 100644 GIT binary patch delta 228 zcmZo@FluNp+K|p7u-c2EM%P-Hq2V!u0*KLE&eC4a!U)7nK+FupAU-P)vjH(X5OV-A z=k{_It`CzKEw*P&=hC!i^w>V>8W%q+W5)DFx4Ddj3o{h@GEND6Uum(3U7;{zrHDe` z_UE^`I@+DD`AEv^NO7= z8J_>8Br^Ydd3h~j0~+`%;eP`I14uW2mqaG}su@5DFR=1OTo88OcK1`<-YnZUoZ}AI F2mrGqR-*s_ delta 202 zcmZo@FluNp+K|p7(Cfuet!pmI(D0Z+0mNu7XK62IVFY3(AZ7+)5T6x@*?^cGh&h0m zb9*@p*M~`r=G!x-b7|T$YHgo%jfn-V7l1D`64a44}4OV0r#7iA?rYGrWKR aBF6<`7i>>G#qG^9S%67y`-XGe0UH6=-$`l! diff --git a/auxmem.init.s b/auxmem.init.s index 335a664..ecc39bd 100644 --- a/auxmem.init.s +++ b/auxmem.init.s @@ -290,7 +290,7 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error RTS ; %000x1xxx host type, 'A'pple BYTE00A BRK DB $F7 -HELLO ASC 'Applecorn MOS 2022-11-27' +HELLO ASC 'Applecorn MOS 2022-11-28' DB $00 ; Unify MOS messages * TO DO: Move into RAM GSSPEED DB $00 ; $80 if GS is fast, $00 for slow diff --git a/mainmem.mock.s b/mainmem.mock.s index 4cca602..e89a1fe 100644 --- a/mainmem.mock.s +++ b/mainmem.mock.s @@ -2,8 +2,8 @@ * (c) Bobbi 2022 GPLv3 * * Mockingboard Driver. +* Simulates Hitachi SN76489 sound generator chip found in BBC Micro. * - * * I borrowed some ideas from Deater: * https://github.com/deater/dos33fsprogs/blob/master/music/pt3_lib/pt3_lib_mockingboard_setup.s @@ -124,9 +124,14 @@ MOCKNOTE PHA * On entry: X - oscillator number 0-3, Y - frequency to set * Preserves X & Y MOCKFREQ PHX - CPX #$00 ; Noise channel + CPX #$00 ; Oscillator 0 is noise channel BEQ :NOISE - TXA + CPX #$01 ; Oscillator 1 controls noise freq + BNE :S0 ; Not 1? Skip + CMP #$00 ; If frequency is zero .. + BEQ :S0 ; .. skip + STA :CH1NOTE ; Store frequency for noise gen +:S0 TXA DEC A ; Subtract 1 ASL ; Double to get fine register TAX @@ -137,11 +142,25 @@ MOCKFREQ PHX JSR MOCKWRT1 ; Write value to AY-3 register PLX RTS -:NOISE LDX #6 ; Noise period register - TYA ; TODO TEMPORARY HACK +:NOISE TYA ; Parameter P + AND #$03 ; Keep least significant 2 bits + TAY + LDA :NOISENOTE,Y ; Get value of note + EOR #$FF ; Negate + INC A + CLC ; Add 255 + ADC #$FF + LSR ; Convert 0..255 to 0..31 + LSR + LSR + LDX #6 ; Noise period register JSR MOCKWRT2 ; Write value to AY-3 register PLX RTS +:NOISENOTE DB $FF ; BBC Micro note P=0 or 4 + DB $80 ; BBC Micro note P=1 or 5 + DB $00 ; BBC Micro note P=2 or 6 +:CH1NOTE DB $00 ; Note on channel 1 * Adjust amplitude of note already playing