Jump to content
IGNORED

Basic++, Os++ and a couple of updates


thorfdbg

Recommended Posts

Hi folks,

 

here's a small update to the Atari++ emulator in the form of a new operating system and (two) new basic interpreters. A new compiled version of the emulator itself with the new versions build in will follow:

 

basic++.zip

 

I'm providing it here so you can play with it until I find the time to rebild the emulator itself.

 

The operating system fixes one rather nasty bug in the editor handler that would have overwritten some memory when disabling the cursor (ough). That's the Os++ ROM dump in the ZIP file above. It's a 16K ROM for the XL machine.

 

Basic++ is present in two versions, each of which assembled in three variants. The variant without a file extension is a ROM dump, to be used for the emulator. Then there are two self-loading binaries per version. The versions without "a0" in the file name load into the lower memory region and keep the traditional cart space starting at $a000 free. This minimizes the RAM footprint, but causes some compatibility issues with Basic files that expect the ROM at $a000. This is what the "_a0" versions are for. They require about 1K additional memory, but run in the traditional cartridge area. Clearly, the ROM-dump is also for this area, but does not require additional RAM.

 

So what's new?

 

In release 1.07, I streamlined the interpreter a little bit further, especially "READ" got a little bit faster and shorter, providing a small advantage over the previous revision.

 

Release 1.08 is quite experimental, and I'm not sure whether I will keep the changes - so I let you try. The advantage is that it eliminiates one of the "hot spots" of Atari basic, namely the line number lookup. This was a linear search through a list, with a minor optimization to start from the current line if the target line number is larger than the current line. In 1.08, I'm trying the same trick as in Turbo Basic where I keep a "hash list" of lines of 128 entries, one entry per 256 possible line numbers. This makes GOTO and GOSUB quite noticably faster. Whether this is a substantial improvement depends on the program. Programs with many GOSUBs or GOTOs like the ABC basic compiler profit a lot. Linear programs or programs with FOR-NEXT loops do not profit (FOR-NEXT is already optimized).

 

Unfortunately, the hash list requires 256 bytes additional RAM, and more ROM space, so the title had to go.

 

Hence, please try and let me know how it goes.

 

Greetings, Thomas

  • Like 9
Link to comment
Share on other sites

Hi folks,

...

Release 1.08 is quite experimental, and I'm not sure whether I will keep the changes - so I let you try. The advantage is that it eliminiates one of the "hot spots" of Atari basic, namely the line number lookup. This was a linear search through a list, with a minor optimization to start from the current line if the target line number is larger than the current line. In 1.08, I'm trying the same trick as in Turbo Basic where I keep a "hash list" of lines of 128 entries, one entry per 256 possible line numbers. This makes GOTO and GOSUB quite noticably faster. Whether this is a substantial improvement depends on the program. Programs with many GOSUBs or GOTOs like the ABC basic compiler profit a lot. Linear programs or programs with FOR-NEXT loops do not profit (FOR-NEXT is already optimized).

 

Unfortunately, the hash list requires 256 bytes additional RAM, and more ROM space, so the title had to go.

 

Hence, please try and let me know how it goes.

 

Greetings, Thomas

I thought about using an LFU line number cache to speed up another interpreter.

I'm not sure it would be as fast as a hash but it doesn't require as much RAM to work.

 

Link to comment
Share on other sites

  • 1 month later...

Hi folks,

 

two new updates:. basic++1_08.zipbasic++1_08f.zip

 

The first is the 1.08 "regular" version. I still found a chance to streamline the string copy/string assignment and hence shape off a couple of bytes. This allowed to include again a (albeit shortened) title in the 1.08F version. This is the somewhat more experimental version that speeds up GOTO and GOSUB statements by using a line number hash table.

 

The trick is exactly the same as in TurboBasic: The basic interpreter reserves additional 256 bytes (here between the variable table and the execution stack) and places in the hash table entry n the address of the lowest line number larger or equal to 256*n. This minimizes the search time for GOTO, GOSUB, RESTORE and READ.

 

It usually does not make that much of a difference as FOR-NEXT already keeps absolute addresses in addition to line numbers, and GOSUB also pushes the line address in addition to the line number on the stack, so even the regular 1.08 version is faster than Atari Basic.

 

As far as the speedups are concerned, the only additional thing TurboBasic has are unrolled and optimized replacement functions of the math pack. There is not enough room in the original Os, so Os++ only optimizes some of them, though no changes there this time.

 

1.08F still requires some testing, I haven't found any bugs so far.


  • Like 5
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...