Jump to content
  • entries
    45
  • comments
    10
  • views
    10,549

A Forth Bestiary, part 1, the Dealer Demo


Atari_Ace

532 views

I'm going to take a break from fixing disks images for now and instead talk about the language Forth.

Forth grew out of the programming work by Charles Moore in the late 1960s. By the late 1970s interest in it was such that a group of enthusiasts banded together to program it for the microcomputers that were then becoming available. They formed the Forth Interest Group (or FIG) and placed several implementations of the language in the public domain. The implementation for the 6502 was done primarily by William Ragsdale, and was complete in 1980, and it is from this implementation it seems all the various Atari versions derived. That 6502 fig-Forth listing can be found at https://archive.org/details/fig_FORTH_6502_Assembly_Source_Listing, and I've cleaned up the OCR to create a more readable listing at https://ksquiggle.neocities.org/ff6502.htm.

It was a significantly different language than the more commonly available BASIC, and due to its low cost and better performance it attracted many adherents. Since the code was available on such liberal terms (essentially public domain), many versions of it proliferated from user groups and some companies, and for a short time it was given modest coverage in the Atari-specific magazines such as Analog and Antic.

Forth is built around a small (~6k) kernel of core words which manipulate a pair of stacks and a handful of registers. The compiler converts the code to series of addresses which are interpreted by a tiny virtual machine, and the emphasis is placed on building up the code in small routines (called words). Almost all parts of the language can be rewritten if they are not to the programmer's liking, and a clever inline assembler that let's one rewrite timing critical routines.

Despite these strengths, the language failed to become especially popular. Large programs implemented using the fig-Forth model could consume all the memory available if care wasn't taken, and the language itself was typically more difficult to learn than the BASIC's of the day. Programmer's who wanted to escape the limitations of BASIC were encouraged to investigate assembler more frequently, or perhaps a BASIC compiler. This wasn't just a problem with Forth, all the languages for the Atari seemed to struggle to attract users.

The earliest version of Forth to appear on the Atari was almost certainly the Forth used to implement the Dealer Demo, most likely in 1980. Developed in-house at Atari, it was released to demonstrate the Atari computers capabilities. It later became the more sophisticated "Coin-Op" Forth. Antic Forth and the fig-Forth 1.4S distributed originally by SoftSide magazine all share this later kernel, but at the time the Dealer Demo was released, the Forth kernel in it was not significantly different than the original fig-Forth kernel, and with a copy of the demo disk you could construct a Forth kernel from it with a little bit of sector editing.

To show this, I'm going to decompile the Dealer Demo and extract its kernel for comparison with the original fig-Forth listing. That comparison is the goal, but I'm going to spend quite a bit of time developing the tooling to help do this, as we can leverage
those tools in the future to examine other programs. Rather than simply drop all the code at once, I'm going to develop it up again like I did with the atr patching tools, hopefully giving some motivation for the choices I made in the code, and giving readers enough context to adapt the code for other purposes.

  • Like 1

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   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...