Classic Computer Magazine Archive ANTIC VOL. 2, NO. 7 / OCTOBER 1983



salvage that data


Before I started programming in Forth, I had done a fair amount of work designing special character sets. I had also been using the VersaWriter from Versa Computing, Inc. All this work was stored away under Atari DOS format. One of my first tasks was to salvage this work for use in my Forth programs.

Atari DOS and Forth use a different scheme for numbering disk sectors. DOS begins numbering with one while Forth begins with zero. Forth also uses all128 bytes for data, while DOS uses the last three bytes for a file number identification, character count and the number of the next sector in the chain. The 128th byte of a DOS sector (byte 127) contains the number of bytes used in the sector. This is usually125 except in the case of a final short sector. Bytes 125 and 126 contain the file number I.D. (six bits) and the "forward sector pointer" (ten bits). The Forth words in the listings take care of these niinor complications and allow you to move DOS sectors to Forth sectors easily.

The code is valFORTH 1.1, which is an extended fig-Forth. One of their diskettes contain words to load and invoke special character sets. The same diskette contains a character editor and a sound editor as well as words for Player/Missile graphics.


The words MOVEIT, NEXTSECTOR and CHAIN on screens 5 and 6 of the listing contains two application examples.

CHAIN uses MOVEIT and NEXTSECTOR to follow the DOS sector links and stores the data at PAD.

NEXTSECTOR expects the current buffer address on the stack and leaves the next sector number.

MOVEIT gets the character count from the section-link byte, moves the proper number of characters, and increments the address at DEST.


GETFONT expects the source DOS sector number and the destination Forth screen number on the stack. The Forth screen number is multiplied by four to convert it to a BLOCK number and the DOS sector number is decremented to compensate for the difference in the way sectors are numbered in the two systems. It then uses CHAIN to read the DOS sectors. At lines 12 to 15 the data stored at PAD is moved to the BLOCK buffers, UPDATEd and FLUSHed to the disk.


VERSA@ expects the Atari Graphics Mode number and the starting DOS sector number on the stack. It then uses CHAIN to read the DOS formatted picture data. It uses the address of the display memory stored in location 88 by the ATARI OS. This address is decremented by 14 to provide space for the color information stored with the picture. This information is then used by the words GR8CLRS or GR7CLRS to set the proper colors.

BLANKSCREEN is optional, it just blanks the screen while the picture is being read in. If you want to see the picture being formed, you can omit this word. If you do omit it, your picture may not be in the correct colors until the set color words in lines 8 thru 12 are executed.


valFORTH 1.1

Valpar International
3801 E. 34th Street
Tuscon, AZ 85713
24K - Diskette

Reviewed by Bill Van Hassel

Being a full time programmer for IBM and DEC mainframes, my home ATARI was used mainly for game playing. I had programmed some BASIC and character sets and other graphics but didn't want to spend the time needed for Player/Missle graphics and display list formatting.

Then I bought Valpar International's implementation of Forth. Using their system, programs that I would not have attempted in BASIC have been finished in an afternoon. My first game program was unplayable until I put delay loops in to slow it down!
As a programming language, Forth is 15 to 20 times faster than BASIC and gives you control over the full capabilities of your computer. The Valpar implementation is the figForth model with many ATARI specific extensions.

The complete system comes on eight diskettes, but you can get started with valFORTH 1.1 which contains the Forth kernal, 6502 assembler and editors. In addition to these fundamentals, this first diskette also has sound and graphics, floating point, debugging aids, printer utilities and disk format and copy words.

The other seven diskettes extend your programming power to include Player/Missle graphics, character and sound editing, display list formatting and interrupts, text formatting, turtle graphics and more. Quite an impressive array!

The system core requirements will vary depending upon your choice of features. The kernal itself requires 24K RAM. My "working" system includes some sections from all but the valDOS diskettes and uses about 35K. This may sound like a lot of core, but applications link into this stored code and require little in additional core.

The documentation is good. Each diskette has its own tutorial that takes you through the material step by step. This section is followed by a glossary that describes the function of each of the words in the package. Source code listings are provided for all the extensions, and several demo programs are included to further explain the system.

I would recommend Forth and this particular implementation to anyone who really wants to control the ATARI.

Listing: DOSSECT.4TH Download / View