Atari XL manual Program Design, Sec

Page 72

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

Image 72
Contents Last Word Contents Configuring LW for Your Printer Configuring LWMacros LW Command Summary Print Formatting CommandsDOS Packages and LW Programmers Technical NotesIntroduction Overview of the Last WordAbout the Manual Starting LWLoading LW from Spartados Basic Operation Edit ScreenLW LETTER.TXT SHIFT+CTRL+WLast Word 3.0 Reference Manual Text Banks Saving and Loading TextSHIFT+CTRL+? Filename exists Overwrite / ?Last Word 3.0 Reference Manual Basic Configuration File SelectorLeaving the Program CTRL+XEditor Commands Cursor MovementText Entry Modes Inserting and Deleting Text Delete ord, ine, entence, aragraph?Moving and Copying with Text Blocks Finding and Replacing Text Hange, ll, To nd, kip?Searching with Wildcards FindTH SFind Change to Additional Editor Features Edited Text IndicatorCounting Words TabulationBookmarks Text and Document ModesCTRL+B User Options Editing Multiple FilesWildcards Y Handling Large Files LoadREPORT.DOC/CSave AsDREPORT.DOC/A 2DTHESIS.TXT2Disk Operations Disk Operations from the EditorDisk Menu CTRL+JPec IewOpy Ock OrmatVail Additional Commands Subdirectory FeaturesCTRL+H SHIFT+CTRL+ DownEditor Print Commands Printing with LWPreviewing Text Keeping Track of PaginationEmbedded Commands Stage 1 CommandsL20Return L20r60helloReturnLast Word 3.0 Reference Manual Set the left margin. The default is Left header/footer margin, default 10. This works like Stage 2 Commands Other Print Features Creating Hanging IndentsInternational Characters SHIFT+CTRL+SPACEConfiguring the Print Formatter Configuring LW for Your Printer Printer DriversCreating a Printer Driver Print Toggles Control StringsInit Code 1,129 International on 27,82,12 International OFF 27,82,0Style 1,27,45,8 Style 2,27,83,2 Last Word 3.0 Reference Manual Macros Loading MacrosRunning Macros Autorun MacrosSpecial Macro Commands Writing and Editing MacrosField. To actually get input from the user, you Must include Oad Ave OadRint Disabling the Screen from Macros Special CharactersEntering Other Commands from Macros Special Macro FontKeyboard Conventions for Macros Creating and Editing Macros Example Macros Font SetTranspose Characters Last Word 3.0 Reference Manual Configuring LW Configuration Options in the EditorCFG Configuration Files Default Drive Drive D1Configuration Using a Supported DOS LW.SYS FileBanks 1,2,3,4 Configuration Using Other DOS Packages Extpages ReserveBanked on Reserve ExtpagesSearch Path Banks 5,6,7,8,9,10,11,12Path D8D1LW Using Multipe Text Buffers Custom FontsKeyboard Buffer Customising the Keyboard Keyboard TableKEY n,n Invalid Remapping Commands Using Macros KEY 10,97KEY 150,3 3 1200 XL Keys DOS Packages and LW Memory RequirementsAtari DOS XE MemloDISK-BASED Spartados SpartadosLW files /Mc /Ppath /Q /X LW TEST.DOC /M% /PD1LWSpartados X Memory Configurations Spartados X Lwpath Environment VariableKEY OFF LW.EXE KEY on SET LWPATH=D8D1\LWLast Word 3.0 Reference Manual LW Command Summary Editor CommandsCommand Function Macro Equivalent See SET Command SHIFT+CTRL WInverse Ctrl W Ctrl YSpecial Keys KEY FunctionMacro Commands Command FunctionINV Ctrl INV CTRL+LPrint Formatting Commands Command Function Default ValueUP Arrow Down ArrowLeft Arrow Right ArrowAssembly Language ADD-INS Programmers Technical NotesMemory Usage Program Design SECDevelopment and Testing WHY LW Came Into Being12-74 12-75 Development Correspondence

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.