• Mockingboard info?

    From Kent Dickey@21:1/5 to All on Sun Aug 16 13:38:28 2020
    I'm wondering if there are any Mockingboard/Phasor experts who can answer
    some very low-level questions. I've read the AY-8913 and AY-8910 datasheet,
    so I think I know what it says.

    1) How should noise and tones be mixed together? My interpretation of
    the mixer spec is that the tone is a simple square wave (of 0 and 1)
    and similarly for the noise. So for one channel, should I just "xor"
    them together, and then scale by the amplitude?

    2) Envelope reset. If the envelope is not repeating (HOLD=1 or CONTINUE=0),
    then what actions "reset" the envelope generator, so it can start
    fresh again?

    And these are lower priority:

    3) Idle. The documentation says a channel is running unless the amplitude
    control is set to 0. Does this mean the hidden counters counting
    tones stop when the amplitude register is 0? Does anything "reset"
    the internal tone counters? (The visible registers are the "reload"
    values, there must be internal counters counting separately, using
    the visible register as the "limit"). This only affects restarting
    a channel that was stopped when amplitude=0 and whether the "old"
    note finishing one period before using the new period.

    4) Manual amplitude control. If the tone and noise generators are disabled
    for a channel, what does the amplitude control do? Can software
    write a pattern like 0, 0xf, 0, 0xf, 0, etc to the amplitude
    control and create a manual waveform, even if the tone and noise
    generators are off in the mixer control register? Or is the
    effective tone/noise output==0, so there's nothing to amplify?

    Kent

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From TomCh@21:1/5 to Kent Dickey on Mon Aug 17 04:06:04 2020
    On Sunday, 16 August 2020 19:38:35 UTC+1, Kent Dickey wrote:
    I'm wondering if there are any Mockingboard/Phasor experts who can answer some very low-level questions. I've read the AY-8913 and AY-8910 datasheet, so I think I know what it says.

    1) How should noise and tones be mixed together? My interpretation of
    the mixer spec is that the tone is a simple square wave (of 0 and 1)
    and similarly for the noise. So for one channel, should I just "xor"
    them together, and then scale by the amplitude?

    2) Envelope reset. If the envelope is not repeating (HOLD=1 or CONTINUE=0),
    then what actions "reset" the envelope generator, so it can start
    fresh again?

    And these are lower priority:

    3) Idle. The documentation says a channel is running unless the amplitude
    control is set to 0. Does this mean the hidden counters counting
    tones stop when the amplitude register is 0? Does anything "reset"
    the internal tone counters? (The visible registers are the "reload"
    values, there must be internal counters counting separately, using
    the visible register as the "limit"). This only affects restarting
    a channel that was stopped when amplitude=0 and whether the "old"
    note finishing one period before using the new period.

    4) Manual amplitude control. If the tone and noise generators are disabled
    for a channel, what does the amplitude control do? Can software
    write a pattern like 0, 0xf, 0, 0xf, 0, etc to the amplitude
    control and create a manual waveform, even if the tone and noise
    generators are off in the mixer control register? Or is the
    effective tone/noise output==0, so there's nothing to amplify?

    Kent

    I can't really help answer your specific questions, as for AppleWin I just spliced in GPL open-source code from another project (Fuse, a Spectrum 128 emulator).

    You can inspect the code here (https://github.com/AppleWin/AppleWin/blob/master/source/AY8910.cpp), or alternatively the MAME code should be a good source (which Apple in PC uses - see: https://github.com/sosaria7/appleinpc).

    Brendan Roberts may be able to help, as (IIRC) he wrote his own AY8913 emulation code for Jace: https://github.com/badvision/jace

    Tom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Schmenk@21:1/5 to Kent Dickey on Fri Aug 28 10:12:27 2020
    On Sunday, 16 August 2020 at 11:38:35 UTC-7, Kent Dickey wrote:

    4) Manual amplitude control. If the tone and noise generators are disabled for a channel, what does the amplitude control do? Can software
    write a pattern like 0, 0xf, 0, 0xf, 0, etc to the amplitude
    control and create a manual waveform, even if the tone and noise
    generators are off in the mixer control register? Or is the
    effective tone/noise output==0, so there's nothing to amplify?

    Kent

    I believe demo writers on other platforms create a PCM waveform by using an ultrasonic tone and writing the PCM value to the amplitude register. Basically an AM signal as the ultrasonic tone should get filtered out by the audio circuit.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kent Dickey@21:1/5 to tomcharlesworth26@gmail.com on Sat Aug 29 11:06:15 2020
    In article <f5ee5a1e-e04e-481b-8f13-a75e205c85beo@googlegroups.com>,
    TomCh <tomcharlesworth26@gmail.com> wrote:
    On Sunday, 16 August 2020 19:38:35 UTC+1, Kent Dickey wrote:
    I'm wondering if there are any Mockingboard/Phasor experts who can answer
    some very low-level questions. I've read the AY-8913 and AY-8910 datasheet, >> so I think I know what it says.

    [ Moved my questions to later where I answer them]

    I can't really help answer your specific questions, as for AppleWin I
    just spliced in GPL open-source code from another project (Fuse, a
    Spectrum 128 emulator).

    You can inspect the code here >(https://github.com/AppleWin/AppleWin/blob/master/source/AY8910.cpp), or >alternatively the MAME code should be a good source (which Apple in PC
    uses - see: https://github.com/sosaria7/appleinpc).

    Brendan Roberts may be able to help, as (IIRC) he wrote his own AY8913 >emulation code for Jace: https://github.com/badvision/jace

    Tom

    Tom, your pointers were very helpful. I spent a bunch of time reading
    the Fuse source code at: http://fuse-emulator.sourceforge.net.
    From it, I can see MAME is considered the gold standard--the MAME code
    was based on measurements of real chips, as well as some reverse engineering from some decap photographs. The MAME code is at: https://github.com/mamedev/mame, and the AY8910 code is mostly in src/devices/sound/ay8910.cpp. (I'm not convinced of the reliability of
    some of this info, but some basic stuff seems reasonable). A lot was
    collected by volunteers, and they did not measure what I would like measured--I'd like measurements at the line output jack, or at the speaker
    if necessary, since all the circuitry after the chip can have a significant impact on the sound. Honestly, simple recordings of known sounds would be
    fine with me, as long as some effort was put into reducing noise.

    So here are the answers as I understand them:

    1) How should noise and tones be mixed together? My interpretation of
    the mixer spec is that the tone is a simple square wave (of 0 and 1)
    and similarly for the noise. So for one channel, should I just "xor" >> them together, and then scale by the amplitude?

    MAME and FUSE use this formula:
    out = (ToneOn | ToneDisable) & (NoiseOn | NoiseDisable);

    where out is the 1-bit output for this channel. So 'xor' is not correct.
    To my ear, listening to songs which have drums, 'xor' sounds much clearer,
    but I'll match what the AY8910 chip is thought to do.


    2) Envelope reset. If the envelope is not repeating (HOLD=1 or CONTINUE=0), >> then what actions "reset" the envelope generator, so it can start
    fresh again?

    MAME thinks the only thing that changes the envelope is a write to the
    envelope shape register, and then all it does is reset the hidden "hold" bit. The envelope will continue to walk through its steps as before. However,
    once the envelope is in a holding mode, the step is frozen, and so the
    write to the shape register starts a new envelope waveform right away. I was getting this very wrong (on any write to the envelope shape register, I was resetting the step), so I'll match this behavior.


    And these are lower priority:

    3) Idle. The documentation says a channel is running unless the amplitude >> control is set to 0. Does this mean the hidden counters counting
    tones stop when the amplitude register is 0? Does anything "reset"
    the internal tone counters? (The visible registers are the "reload"
    values, there must be internal counters counting separately, using
    the visible register as the "limit"). This only affects restarting
    a channel that was stopped when amplitude=0 and whether the "old"
    note finishing one period before using the new period.

    Based on MAME/FUSE, the counters all keep counting even if the channels
    are not enabled or have 0 amplitude. I'm deciding how important it is
    to model this behavior. It's difficult for me to see how anything could
    care or even detect this behavior, and it's a pain to get these cases
    right.


    4) Manual amplitude control. If the tone and noise generators are disabled >> for a channel, what does the amplitude control do? Can software
    write a pattern like 0, 0xf, 0, 0xf, 0, etc to the amplitude
    control and create a manual waveform, even if the tone and noise
    generators are off in the mixer control register? Or is the
    effective tone/noise output==0, so there's nothing to amplify?

    This is done by some ZX81 Spectrum code (on that system, it's much simpler
    for software to write to the AY8910 chip, so it can be faster). It's
    unclear if there is any Apple II software which does so. I'll punt on trying to emulate this until I have a way to test it.

    MAME has some very complex code to deal with mixing the 3 channels of
    sound together. There's not enough comments for me to figure out what they
    are trying to do. I'll probably stick with summing the sounds together
    for now, and decide if it's noticeable when running some examples.

    My current plan is to make KEGS match MAME on the French Touch Pure Noise
    Demo: http://fr3nch.t0uch.free.fr/PNO/PNO.html

    They have other demos, but they tend to not run on an Apple IIgs (their code checks for a IIgs and hangs). If anyone has some suggested "stress tests"
    for Mockingboard, I'm interested in them.

    Kent

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From qkumba@21:1/5 to All on Sat Aug 29 11:12:39 2020
    If anyone has some suggested "stress tests" for Mockingboard, I'm interested in them.

    Willy Byte, Lady Tut, Berzap.
    All three do different things that have caused us trouble in one way or another.
    The last two are part of Total Replay, if that's any help.
    We're still looking for a clean copy of Willy Byte, but it's the existing cracked version that shows the Mockingboard weirdness.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kent Dickey@21:1/5 to peter.ferrie@gmail.com on Mon Aug 31 00:09:17 2020
    In article <55cc4759-9c0d-49fe-b9f5-dfcd7db0db3dn@googlegroups.com>,
    qkumba <peter.ferrie@gmail.com> wrote:
    If anyone has some suggested "stress tests" for Mockingboard, I'm >interested in them.

    Willy Byte, Lady Tut, Berzap.
    All three do different things that have caused us trouble in one way or another.
    The last two are part of Total Replay, if that's any help.
    We're still looking for a clean copy of Willy Byte, but it's the
    existing cracked version that shows the Mockingboard weirdness.

    Thank you for the suggestions.

    I'm not planning on emulating the speech chip currently, and reading
    the AppleWin bug reports seem to indicate Willy Byte and Berzap had trouble with the speech chip. My big issue with the speech chip is I don't know where/how to get the phoneme samples. So I'm just emulating a Mockingboard A.

    In any case, although I didn't really play any of the games, they do seem to start and play Mockingboard music fine. I have a version of Berzap which crashes on booting, but I suspect it's a IIgs compatibility issue (since
    the cracked version works).

    Kent

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From TomCh@21:1/5 to Kent Dickey on Mon Aug 31 03:16:46 2020
    On Monday, 31 August 2020 06:09:23 UTC+1, Kent Dickey wrote:
    In article <55cc4759-9c0d-49fe-b9f5-dfcd7db0db3dn@googlegroups.com>,
    qkumba wrote:
    If anyone has some suggested "stress tests" for Mockingboard, I'm >interested in them.

    Willy Byte, Lady Tut, Berzap.
    All three do different things that have caused us trouble in one way or another.
    The last two are part of Total Replay, if that's any help.
    We're still looking for a clean copy of Willy Byte, but it's the
    existing cracked version that shows the Mockingboard weirdness.

    Thank you for the suggestions.

    I'm not planning on emulating the speech chip currently, and reading
    the AppleWin bug reports seem to indicate Willy Byte and Berzap had trouble with the speech chip. My big issue with the speech chip is I don't know where/how to get the phoneme samples. So I'm just emulating a Mockingboard A.

    In any case, although I didn't really play any of the games, they do seem to start and play Mockingboard music fine. I have a version of Berzap which crashes on booting, but I suspect it's a IIgs compatibility issue (since
    the cracked version works).

    Kent

    re. "stress tests" for Mockingboard

    You mentioned that other French Touch demos don't work on the IIgs. I don't know if these work or not (on the IIgs), but the following all do sample playback via the Mockingboard's AY8913:

    http://fr3nch.t0uch.free.fr/TLB1/TLB1.dsk http://fr3nch.t0uch.free.fr/FKF/FKF.dsk https://github.com/Fr3nchT0uch/digidream/releases/download/v0.6/DD.dsk

    These all work in AppleWin and MAME (apple2ee). The digi-drums (in DD.dsk) are too quiet in AppleWin (cf. MAME or real Apple II w/Mockingboard). This probably aligns with your comment that MAME's AY8910 emulation is considered the gold standard... since
    AppleWin is using FUSE's (not MAME's) AY8910 emu code.

    Tom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kent Dickey@21:1/5 to tomcharlesworth26@gmail.com on Mon Sep 21 23:34:51 2020
    In article <e2b80c07-df44-4818-af91-d9d55223b9b4o@googlegroups.com>,
    TomCh <tomcharlesworth26@gmail.com> wrote:

    re. "stress tests" for Mockingboard

    You mentioned that other French Touch demos don't work on the IIgs. I
    don't know if these work or not (on the IIgs), but the following all do >sample playback via the Mockingboard's AY8913:

    http://fr3nch.t0uch.free.fr/TLB1/TLB1.dsk >http://fr3nch.t0uch.free.fr/FKF/FKF.dsk >https://github.com/Fr3nchT0uch/digidream/releases/download/v0.6/DD.dsk

    These all work in AppleWin and MAME (apple2ee). The digi-drums (in
    DD.dsk) are too quiet in AppleWin (cf. MAME or real Apple II
    w/Mockingboard). This probably aligns with your comment that MAME's
    AY8910 emulation is considered the gold standard... since AppleWin is
    using FUSE's (not MAME's) AY8910 emu code.

    Tom

    Each of the three disks listed above does not work on a IIgs. So I quickly added an "Apple //e" mode to KEGS, and then each started at least. KEGS does not model the sample playback through the Mockingboard properly, so they do
    not sound right. But, it seems like there's little reason to put much effort into this for a IIgs emulator since there may not be any code that can be
    run on a IIgs that takes advantage of this type of Mockingboard abuse.
    I've got bigger problems to fix in KEGS first. I will get back to this eventually, and these examples are very helpful.

    Kent

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)