Image Map Image Map
Results 1 to 3 of 3

Thread: Weirdness in Microsoft BASIC 6502 source code

  1. #1

    Default Weirdness in Microsoft BASIC 6502 source code

    Over the past few weeks I have been working a lot with the Microsoft 6502 BASIC from pagetable:

    https://www.pagetable.com/?p=46

    The KIM-1 version (kb9) works perfectly as-is, but as I started to expand the code, all sorts of weird things began happening and I’m wondering if anyone else has experienced similar things.

    In general, I found that adding more code seems to break some integer/floating point functionality. My first change was to add about 100 bytes to the SAVE/LOAD logic and then doing a LIST would show some line numbers as floating point rather than integers. The line numbers are stored as 16 bit integers, but doing a LIST would sometimes print weird line numbers like 9.97694 rather than 10.

    The other oddity is adding a new keyword broken things like interpretation of floating point numbers such as “FOR X=1 to 10 STEP .5” would always return X as the value 1.

    The “source code” has been reformatted quite a few times and isn’t the original Microsoft code. Even the “original” code has comments saying it has been reformatted. The intent of the code on pagetable is to reproduce the binary image of multiple versions of 6502 BASIC, which it does nicely. However, it’s not true source and seems to have errors that only appear if changes are made.

    Has anyone else looked into these problems are maybe solved some? I figured I’d ask before digging into the code more than I already have.

    Bob

  2. #2
    Join Date
    Sep 2006
    Location
    Silicon Valley
    Posts
    2,291

    Default

    Can you tell if they use the hack of code being used as constants, so that you can't move routines to other places in memory?

  3. #3

    Default

    I'm not sure where the actual problem is, but in one scenario integers are printed as floating point numbers, implying a slight change in the original value somewhere. I'm probably going to have to set breakpoints and single step through the logic to print integers and see where things fall apart. There are two main subroutines: one to convert an int to a FP number, followed by a subroutine to print a FP number. The print function has logic to recognize a non-fraction number and print is as an integer. The question is whether the int-to-FP subroutine is failing, or the print-an-FP subroutine is.

    Bob

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •