Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIOS intro: bad sound #16

Closed
jsmolka opened this issue Feb 7, 2021 · 0 comments
Closed

BIOS intro: bad sound #16

jsmolka opened this issue Feb 7, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jsmolka
Copy link
Owner

jsmolka commented Feb 7, 2021

The last bleep in the BIOS intro sounds distorted / metallic. This can be fixed by splitting the long arm.run(960) into smaller 100 cycle chunks (see #14). The sound is provided by the FIFO so it's most likely a timer issue.


The bug is caused by the current layout of the tick function.

void Arm::tick(int cycles)
{
    this->cycles -= cycles;

    if (state & kStateTimer)
        timer.run(cycles);

    if (irq.delaying)
    {
        irq.delay -= cycles;

        if (irq.delay < 0)
            irq.delay = 0;
    }

    apu.run(cycles);
}

Running the timer first with large values skipped some samples and caused the metallic sound. Running 100 cycles max each step reduced that probability and mitigated the bug. Another way to do this is switching the timer.run and apu.run positions. I will solve this bug with the upcoming scheduler.

@jsmolka jsmolka self-assigned this Feb 7, 2021
@jsmolka jsmolka added the bug Something isn't working label Feb 7, 2021
jsmolka added a commit that referenced this issue Mar 9, 2021
@jsmolka jsmolka closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant