[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is the IIgs beep generated?



Mitchell Spector <mitch2gs@hotmail.com> writes:

> Toinet <antoine.vignau@laposte.net> wrote:
>
>>On 27 nov, 17:40, "Jayson Smith"
>><ihatespamratguynospample...@insightbb.spamsucks.com> wrote:
>>> I'm interested in this too. Where is the code for generating the GS beep
>>> located? You're saying the "Bonk" heard at bootup is generated just by using
>>> $C030?
>>> Jayson
>>>
>>> "D Finnigan" <dog_...@macgui.com> wrote in message
>>>
>>> dog_cow-1258668824@macgui.com">news:dog_cow-1258668824@macgui.com...
>>>
>>> > Some discussion on the Wikipedia page got me wondering: how is the Apple
>>> > IIgs beep generated? Some say it is an algorithmically drawn waveform, fed
>>> > to the DOC, while others suppose that it is generated by the Ensoniq.
>>>
>>> > Anyone have the full details?
>>
>>There are several boing boing calls in the IIgs:
>>BELL at $FF3A
>>BELL1 at $FBDD
>>BELL1.2 at $FBE2
>>BELL2 at $FBE4
>>
>>And the one used is BELL. It is called during boot, switching to the
>>monitor, etc.
>
>     Here's a question, one I've been curious about the past twenty years:
> Can you reproduce the IIgs "beep" on a stock Apple IIe?

You could do something similar, but since the ROM modifies the volume
as part of its sound generator, it would not be quite the same.



On a ROM 01, the real code making the beep is at FF/A064:

FF/A064: 08                PHP
FF/A065: 78                SEI
FF/A066: A9 B0             LDA #B0
FF/A068: 20 A8 FC          JSR FCA8     ; ~80 ms delay
FF/A06B: AD 36 C0          LDA C036     ; slow mode:  1 MHz
FF/A06E: 48                PHA
FF/A06F: 29 7F             AND #7F
FF/A071: 8D 36 C0          STA C036
FF/A074: DA                PHA
FF/A075: 8B                PHB
FF/A076: 20 82 F8          JSR F882     ; data-bank = $E1
FF/A079: AD DF 02          LDA 02DF
FF/A07C: 49 0F             EOR #0F
FF/A07E: 8D 6D 01          STA 016D
FF/A081: 9C 6E 01          STZ 016E
FF/A084: C2 20             REP #20
FF/A086: A9 88 88          LDA #8888
FF/A089: 8D 69 01          STA 0169
FF/A08C: A9 00 20          LDA #2000
FF/A08F: 8D 6B 01          STA 016B
FF/A092: E2 30             SEP #30
FF/A094: AD CA 00          LDA 00CA     ; bell volume from BRAM
FF/A097: 8D 6F 01          STA 016F     ; working bell volume
FF/A09A: 48                PHA
FF/A09B: 18                CLC
FF/A09C: C2 30             REP #30
FF/A09E: AC 6D 01          LDY 016D
FF/A0A1: A2 50 02          LDX #0250

FF/A0A4: 88                DEY
FF/A0A5: D0 0B             BNE A0B2 {+0B}

FF/A0A7: AC 6D 01          LDY 016D
FF/A0AA: 2E 69 01          ROL 0169
FF/A0AD: 90 03             BCC A0B2 {+03}

FF/A0AF: AD 30 C0          LDA C030     ; click

FF/A0B2: CA                DEX
FF/A0B3: D0 18             BNE A0CD {+18}

FF/A0B5: A2 50 02          LDX #0250
FF/A0B8: E2 20             SEP #20
FF/A0BA: AD 6F 01          LDA 016F
FF/A0BD: F0 19             BEQ A0D8 {+19}
FF/A0BF: EA                DEC          ; drop volume one notch
FF/A0C0: 8D 6F 01          STA 016F
FF/A0C3: 8D CA 00          STA 00CA
FF/A0C6: 8D 3C C0          STA C03C     ; bits 3..0 are volume
FF/A0C9: C2 20             REP #20
FF/A0CB: 80 06             BRA A0D3 {+06}

FF/A0CD: A9 05 00          LDA #0005
FF/A0D0: 3A                DEC
FF/A0D1: D0 FD             BNE A0D0 {-03}

FF/A0D3: CE 6B 01          DEC 016B
FF/A0D6: D0 CC             BNE A0A4 {-34}

FF/A0D8: E2 30             SEP #30
FF/A0DA: 68                PLA
FF/A0DB: 8D CA 00          STA 00CA     ; restore system bell volume
FF/A0DE: 8D 3C C0          STA C03C
FF/A0E1: AB                PLB
FF/A0E2: FA                PLX
FF/A0E3: A0 00             LDY #00
FF/A0E5: 68                PLA
FF/A0E6: 8D 36 C0          STA C036     ; restore system speed
FF/A0E9: 28                PLP
FF/A0EA: 60                RTS


FF/F882: F4 E1 E1          PEA E1E1
FF/F885: AB                PLB
FF/F886: AB                PLB
FF/F887: 60                RTS

--
Jerry    awanderin at yahoo dot ca