Skip to content

Bugs in "Refactoring" BASIC code #23

@thecloudexpanse

Description

@thecloudexpanse

@mdcramer
I attempted to replicate your program on my Apple //e as well as the "Mariani" emulator, given the BASIC source code presented on https://mdcramer.github.io/apple-2-blog/refactoring/ and with the understanding that this builds on the code from https://mdcramer.github.io/apple-2-blog/synthesizing-data/ where some lines could be renumbered. A few problems showed up.

On line 1250, there is a missing % character which causes data to be incorrectly plotted. Here's a diff for the fix:

- 1250 HPLOT X0%,X1% - 1 TO X0%,X1 + 1
+ 1250 HPLOT X0%,X1% - 1 TO X0%,X1% + 1

Second issue is that you are overwriting the index variable 'I' in the Generate Samples loop by calling a subroutine which clobbers it. Line 460 declares a loop in which I starts at 0 and should be incremented to NS-1. Inside the loop, line 580 calls a subroutine at line 1400. That leaves the value of I set to 12 on exit, and so the loop is stuck forever at that index. I fixed this by changing the index variable in the Irwin-Hall subroutine, so it doesn't re-use I:

- 1500 FOR I = 1 TO 12
+ 1500 FOR IH = 1 TO 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions