The Last Word 3.0 Reference Manual

One thing which has allowed LW to be crammed into such a small amount of code is the placing of almost all the program's variables in Page Zero RAM. The entire upper half of Page Zero is used by LW. This is made possible by the fact LW makes no calls to the OS's floating point arithmetic routines, which require $D4-$FF for themselves. In fact, LW doesn't even make any calls to CIO for screen output: it uses its own sophisticated formatted print routine. The screen editor device is abandoned when the program starts and only opened again upon exit to DOS. This use of page 0 instead of absolute addresses makes LW between twenty and thirty percent smaller than it might otherwise have been. It also means the program runs significantly faster than it would had it relied more heavily on absolute addresses.

There are other techniques which save on code space. LW uses many memory locations as flags, which are only ever on or off. These flags are tested using the 6502 "BIT" instruction, which means only bit 7 needs to be set or cleared. So instead of storing 0 in the flag to clear it and 128 to set it, to clear it I use:

LSR <address>which puts a 0 in bit 7 with only 2 bytes of code.

To set it, I have used:

SEC

ROR <address>

Which is only 3 bytes (providing <address> is on page 0). The other bits in the byte are of no significance, although occasionally more precision is required if both bits 6 and 7 of the byte are used. Bit 6 is also tested with the "BIT" command and will be transferred to the overflow flag. Branching is done with "BVC" and "BVS". These techniques don't really yield space savings when long strings of flags are being cleared: it's as easy to load a 0 and store it in the flags. But when widely dispersed flag sets/clears are necessary, the savings can soon mount up.

12.3 PROGRAM DESIGN

LW handles the text in memory in a special way in order to achieve its speed. While many word processors hold text contiguously in memory, LW uses a pointer system to ensure that the free memory in the buffer is always directly in front of the cursor. Therefore, when you type, there is no slowdown in the editor regardless of the size of the file. The text is moved through memory as you move the cursor through the it. When the screen refresh routine hits the location of the cursor, it jumps over the free memory in the buffer and displays the rest of the text, which is right at the top of the buffer.

Although LW is written in compact assembly language, it is still a modular program. Hardly any code is duplicated and – to save space – subroutines are used instead of in-line macro code. The reduction in code size achieved by using subroutines can be considerable. In spite of the fact LW 2.1 was thought to be a “finished” program in 2000, eight years later there were still significant space savings and efficiency gains to be had from continuous revision of the source code.

This 80 column version of LW copes some 20 years after my first experiments with the 8-bit Atari. I began programming in BASIC, then I moved on to C, and finally to Assembler. Having looked at CC65, Action!, PL65, and many other languages, I honestly think that machine code is still the best language to use when compactness is

12-72

Page 72
Image 72
Atari XL manual Program Design, Sec

XL specifications

The Atari XL series, launched in 1982, represented a significant evolution in home computing, building upon the foundation laid by the Atari 400 and 800 systems. This line of computers included popular models such as the Atari 600XL and 800XL, both of which combined affordability with robust capabilities, making them attractive options for home users, educators, and enthusiasts alike.

One of the standout features of the Atari XL series was its color display capabilities. The systems supported a resolution of 320x192 pixels with a vibrant palette of 128 colors, which enabled rich graphics for games and applications. This was complemented by the system's powerful Antic graphics chip that allowed for advanced video display modes, making the Atari XL series particularly popular for gaming and multimedia applications.

Another key technology driving the Atari XL series was its use of the 6502 processor, which delivered efficient performance and allowed for smooth multitasking. The systems typically came with 64KB of RAM, expandable to 128KB, providing ample memory for running multiple applications simultaneously, a notable feature in comparison to other microcomputers of the time.

The Atari XL series also introduced a new, user-friendly operating system known as Atari DOS. This improved disk management capabilities, making it easier for users to manage files and applications on floppy disks. The systems were equipped with built-in BASIC programming language, enabling users to dive into programming and coding, fostering a generation of hobbyists and developers.

Each model in the Atari XL series came with a distinctive keyboard design, offering both a chic and functional layout. The keyboards were known for their tactile feel, making them suitable for typing and coding over extended periods.

Additionally, the Atari XL computers were compatible with a wide range of peripherals, such as printers, modems, and disk drives, enhancing their versatility. Users could also take advantage of a rich library of software, including educational programs, productivity tools, and an ever-growing selection of games.

The Atari XL series not only boasted solid technology and capabilities but also garnered a devoted community. The systems contributed to a vibrant culture of gaming and computing in the early 1980s, which remains fondly remembered by enthusiasts today. With their combination of innovative technology, user-centric design, and a diverse software library, the Atari XL series played a crucial role in the evolution of home computing.