Misplaced Pages

Atari Assembler Editor

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

Atari Assembler Editor (sometimes written as Atari Assembler/Editor ) is a ROM cartridge -based development system released by Atari, Inc. in 1981. It is used to edit, assemble , and debug 6502 programs for Atari 8-bit computers without the need for additional tools. It was programmed by Kathleen O'Brien of Shepardson Microsystems , the company which wrote Atari BASIC , and Assembler Editor shares many design concepts with that language implementation.

#588411

103-526: Assembly times are slow, making the cartridge challenging to use for larger programs. In the manual, Atari recommended the Assembler Editor as a tool for writing subroutines to speed up Atari BASIC , which would be much smaller than full applications. The Atari Macro Assembler was offered as an alternative with better performance and more features, such as macros, but it is disk-based, copy-protected , and does not include an editor or debugger. Despite

206-507: A bonus clause in the contract, which led to the initial version being delivered in October. Atari took an 8K cartridge version to CES instead of Microsoft's. Atari Microsoft BASIC later became available as a separate product. The version Shepardson gave to Atari for the CES demo was not intended to be final, and Shepardson continued to fix bugs. Unknown to Shepardson, Atari had already sent

309-490: A time-sharing system. Cromemco BASIC included an extended floating point implementation using a 14-digit binary-coded decimal (BCD) format made possible using all 16 registers of the Zilog Z80 processor. As it converted all data to the internal format at edit time, small constants like "1" would use up a considerable amount of memory, and this could be a particular issue when storing arrays of numbers. To address this,

412-456: A 20 character string is reserved, and any characters in excess of the string length will be truncated. The maximum length of a string is 32,768 characters. There is no support for arrays of strings. A string is accessed using array indexing functions, or slicing . A$ (1,10) returns a string of the first 10 characters of A$ . The arrays are 1-indexed, so a string of length 10 starts at 1 and ends at 10. Slicing functions simply set pointers to

515-456: A 20 character string is reserved, and any characters in excess of the string length will be truncated. The maximum length of a string is 32,768 characters. There is no support for arrays of strings. A string is accessed using array indexing functions, or slicing . A$ (1,10) returns a string of the first 10 characters of A$ . The arrays are 1-indexed, so a string of length 10 starts at 1 and ends at 10. Slicing functions simply set pointers to

618-427: A File Manager System (later known as DOS 1.0). Atari's plans were to take an early 8K version of Microsoft BASIC to the 1979 CES, then switch to Atari BASIC for production. Development proceeded quickly, helped by a bonus clause in the contract, which led to the initial version being delivered in October. Atari took an 8K cartridge version to CES instead of Microsoft's. Atari Microsoft BASIC later became available as

721-458: A hash, like LDA #12 , which loads the accumulator with the decimal value 12. Hexadecimal is indicated with a dollar sign, LDA #$ 12 loads the accumulator with 12 hex, or 18 decimal. Indirect addressing is supported using parentheses; LDA ($ 600) uses the values in location $ 600,$ 601 to produce a 16-bit address, and then loads the accumulator with the value found at that location. Errors are reported with numeric codes that can be looked up in

824-425: A leading number, from 0 to 32767, is inserted in the current program or replaces an existing line. If there's no line number, the interpreter assigns it the number -1 (8000 16 ) and the commands are executed immediately, in "immediate mode". The RUN command executes the stored program from the lowest line number. Atari BASIC allows all commands to be executed in both modes. For example, LIST can be used inside

927-425: A number between 0 and 1; the parameter not being used. Atari BASIC copied the string-handling system of Hewlett-Packard BASIC , where the basic data type is a single character, and strings are arrays of characters. Internally, a string is represented by a pointer to the first character in the string and its length. To initialize a string, it must be DIMensioned with its maximum length. For example: In this program,

1030-425: A number between 0 and 1; the parameter not being used. Atari BASIC copied the string-handling system of Hewlett-Packard BASIC , where the basic data type is a single character, and strings are arrays of characters. Internally, a string is represented by a pointer to the first character in the string and its length. To initialize a string, it must be DIMensioned with its maximum length. For example: In this program,

1133-469: A number of common routines were incorporated into the Atari computer's operating system , including the floating point math functions. These were written by O'Brien, the first floating point math code she worked on. The low performance of key functions affected both Atari BASIC and the Assembler Editor and was a topic that Wilkinson often wrote about. The following is 6502 code for Hello World! written for

SECTION 10

#1732797678589

1236-402: A program, whereas in many interpreters this would be available in immediate mode only. During entry, keywords can be abbreviated using the pattern set by Palo Alto Tiny BASIC , by typing a period at any point in the word. So L. is expanded to LIST , as is LI. . Only enough letters have to be typed to make the abbreviation unique, so PLOT requires PL. because the single letter P

1339-408: A separate product. The version Shepardson gave to Atari for the CES demo was not intended to be final, and Shepardson continued to fix bugs. Unknown to Shepardson, Atari had already sent the CES version to manufacturing. This version was later known as Revision A . It contains a major bug in a routine that copies memory: deleting lines of code that are exactly 256 bytes long causes a lockup after

1442-516: A series of improved versions: BASIC A+ (1981), BASIC XL (1983), and BASIC XE (1985). The complete, annotated source code and design specifications of Atari BASIC were published as The Atari BASIC Source Book in 1983. The machines that would become the Atari 8-bit computers were originally developed as second-generation video game consoles intended to replace the Atari VCS . Ray Kassar ,

1545-461: A single-byte token (for example, PRINT is 20 16 ), each number to a six-byte floating point value, each variable name to an index into a table, and so on, until the line is fully turned into an easy to interpret format. The result is stored in an output buffer located at the first 256 bytes of the lowest available free memory, pointed to by the LOMEM pointer stored at 80, 81 16 . The output from

1648-457: A string is stored in a variable table. String addresses can be redirected to point to arbitrary areas of RAM. This allows the rapid memory-shifting routines underlying string and substring assignment can be applied from BASIC to the memory used for the screen or player/missile graphics. This is particularly useful for achieving rapid vertical movement of player/missile images directly from Atari BASIC. Numeric variables and expressions can be used as

1751-457: A string is stored in a variable table. String addresses can be redirected to point to arbitrary areas of RAM. This allows the rapid memory-shifting routines underlying string and substring assignment can be applied from BASIC to the memory used for the screen or player/missile graphics. This is particularly useful for achieving rapid vertical movement of player/missile images directly from Atari BASIC. Numeric variables and expressions can be used as

1854-415: A synonym, GO TO ; and LET has a synonym which is the empty string (so 10 LET A = 10 and 10 A = 10 mean the same thing). These are separate tokens, and so will remain as such in the program listing. MS BASICs also allowed ? as a short-form for PRINT , but this used the same token so it expanded back to PRINT when LIST ed, treating it as an abbreviation, not a synonym. When

1957-745: A variable needs only one byte to address its entry into the appropriate table. String variables have their own area (pointed to at STARP – 8C, 8D 16 ) as does the runtime stack (pointed to at RUNSTK – 8E, 8F 16 ) used to store the line numbers of looping statements ( FOR...NEXT ) and subroutines ( GOSUB...RETURN ). Finally, the end of BASIC memory usage is indicated by an address stored at MEMTOP – 90, 91 16 ) pointer. Atari BASIC includes three trigonometric functions: sine, cosine, and arc tangent. DEG and RAD set whether these functions use radians or degrees, defaulting to radians. Eight additional functions include rounding, logarithms, and square root. The random function, RND , generates

2060-492: A version of BASIC ready in time for the show. In September 1978, Shepardson Microsystems won the bid on completing BASIC. At the time they were finishing Cromemco 16K Structured BASIC for the Z80 -based Cromemco S-100 bus machines. Developers Kathleen O'Brien and Paul Laughton used Data General Business Basic , an integer-only implementation, as the inspiration for their BASIC, given Laughton's experience with Data General on

2163-661: Is a legal line number. The debugger , really a monitor , is entered with the BUG command. The X command returns to EDIT mode. The debugger allows the viewing and changing of registers and memory locations, code tracing, single-step and disassembly . Assembler Editor was written by Kathleen O'Brien of Shepardson Microsystems . The company had been hired by Atari to help fit Microsoft 6502 BASIC onto an 8KB ROM , something programmers at Atari were struggling with. Instead, Bill Wilkinson suggested designing an entirely new version of BASIC, which became Atari BASIC . While Atari BASIC

SECTION 20

#1732797678589

2266-510: Is available on cartridge" from Atari. The book provides a type-in program to patch Revision B to Revision C for those without the cartridge. Revision C eliminates the memory leaks in Revision B. It is built-in on later versions of the 800XL and all XE models including the XEGS. Revision C was also available as a cartridge. The version can be determined by typing PRINT PEEK(43234) at

2369-571: Is built-in on later versions of the 800XL and all XE models including the XEGS. Revision C was also available as a cartridge. The version can be determined by typing PRINT PEEK(43234) at the READY prompt. The result is 162 for Revision A, 96 for Revision B, and 234 for Revision C. Like most home computer BASICs, Atari BASIC is anchored around its line editor . Program lines can be up to three physical screen lines of 40 characters, 120 characters total. The cursor can be moved freely, with

2472-449: Is free," call the C: driver to prepare the device (this will set the cassette tape spools onto tension and advance the heads keeping the cassette tape player "paused"). The 4 means "read" (other codes are 8 for write and 12 = 8 + 4 for "read-and-write"). The third number is auxiliary information, set to 0 when not needed. The C:MYPROG.DAT is the name of the device and the filename;

2575-405: Is free," call the C: driver to prepare the device (this will set the cassette tape spools onto tension and advance the heads keeping the cassette tape player "paused"). The 4 means "read" (other codes are 8 for write and 12 = 8 + 4 for "read-and-write"). The third number is auxiliary information, set to 0 when not needed. The C:MYPROG.DAT is the name of the device and the filename;

2678-405: Is much more common than deleting old ones, so the change dramatically increased the number of crashes. Revision B also adds 16 bytes to a program every time it is SAVE d and LOAD ed, eventually causing the machine to run out of memory for even the smallest programs. Mapping the Atari described these as "awesome bugs" and advised Revision B owners "Don't fool around; get the new ROM, which

2781-426: Is not unique. To expand an abbreviation, the tokenizer searches through its list of reserved words to find the first that matches the portion supplied. More commonly used commands occur first in the list of reserved words, with REM at the beginning (it can be typed as . ). When the program is later LIST ed it will always write out the full words with three exceptions: PRINT has a synonym, ? ; GOTO has

2884-451: Is often used for this purpose. Machine code is invoked with the USR function. The first parameter is the address of the subroutine and the following values are parameters. If the code is stored in a string named ROUTINE$ it can be called with two parameters as ANSWER = USR ( ADR ( ROUTINE$ ), VAR1 , VAR2 ) . Parameters are pushed onto the hardware stack as 16-bit integers in

2987-405: Is often used for this purpose. Machine code is invoked with the USR function. The first parameter is the address of the subroutine and the following values are parameters. If the code is stored in a string named ROUTINE$ it can be called with two parameters as ANSWER = USR ( ADR ( ROUTINE$ ), VAR1 , VAR2 ) . Parameters are pushed onto the hardware stack as 16-bit integers in

3090-484: Is part of. For instance, if the cursor is currently positioned in line 30 and the user uses cursor-up into line 20, any editing from that point will be carried out on line 20. Atari BASIC's editor catches many errors that would not be noticed in MS-derived versions. If an error is found, the editor re-displays the line, highlighting the text near the error in inverse video . Errors are displayed as numeric codes, with

3193-435: Is stored in an output buffer located at the first 256 bytes of the lowest available free memory, pointed to by the LOMEM pointer stored at 80, 81 16 . The output from the tokenizer is then relocated. The program is stored as a parse tree . Shepardson referred to this complete-tokenizing concept as a "pre-compiling interpreter". The resulting tokenized code eliminates any parsing during runtime, making it run faster. It has

Atari Assembler Editor - Misplaced Pages Continue

3296-459: Is the case with Atari BASIC—to reduce the amount of work needed at assembly time. Assembler Editor continued to be available from Atari, and increased in popularity as the price dropped to US$ 10 or 5 in the latter half of the 1980s. Atari BASIC Atari BASIC is an interpreter for the BASIC programming language that shipped with Atari 8-bit computers . Unlike most American BASICs of

3399-636: Is useful when working with labels. Instructions are listed in the order they will be placed in memory. The starting point for instructions is specified with the *= directive, so, for instance, code intended to be placed in the special "page six" would be prefixed with the line *= $ 0600 . Variable names can be assigned to specific addresses, and this was often combined with an increment *= *+1 to directly encode offsets into tables. Values following instructions are normally interpreted as "the value at this memory address", but an actual numeric value can be provided as an "immediate operand" by appending it with

3502-632: The SOUND statement), graphics ( GRAPHICS, SETCOLOR, COLOR, PLOT, DRAWTO ), and controllers ( STICK, STRIG, PADDLE, PTRIG ). The SOUND statement sets one of hardware's 4 square-wave channels with parameters for volume, pitch and distortion. Advanced capabilities of the hardware such as higher pitch resolution, high-pass filters, digitised sound and waveforms, player/missile graphics ( sprites ), redefined character sets, scrolling, and custom graphics modes are not supported by BASIC; these will require machine language routines or PEEK/POKE statements. A few of

3605-583: The SOUND statement), graphics ( GRAPHICS, SETCOLOR, COLOR, PLOT, DRAWTO ), and controllers ( STICK, STRIG, PADDLE, PTRIG ). The SOUND statement sets one of hardware's 4 square-wave channels with parameters for volume, pitch and distortion. Advanced capabilities of the hardware such as higher pitch resolution, high-pass filters, digitised sound and waveforms, player/missile graphics ( sprites ), redefined character sets, scrolling, and custom graphics modes are not supported by BASIC; these will require machine language routines or PEEK/POKE statements. A few of

3708-412: The Atari 8-bit computers were originally developed as second-generation video game consoles intended to replace the Atari VCS . Ray Kassar , the new president of Atari, decided to challenge Apple Computer by building a home computer instead. This meant the designs needed to include the BASIC programming language, the standard for home computers. In early 1978, Atari licensed the source code to

3811-431: The BASIC programming language that shipped with Atari 8-bit computers . Unlike most American BASICs of the home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays. The language was distributed as an 8  KB ROM cartridge for use with the 1979 Atari 400 and 800 computers. Starting with

3914-455: The MOS 6502 version of Microsoft BASIC . It was offered in two versions: one using a 32-bit floating point format that was about 7800 bytes when compiled, and another using an extended 40-bit format that was close to 9 KB. Even the 32-bit version barely fit into the 8 KB size of the machine's ROM cartridge format. Atari also felt that they needed to expand the language to support

4017-438: The Z80 -based Cromemco S-100 bus machines. Developers Kathleen O'Brien and Paul Laughton used Data General Business Basic , an integer-only implementation, as the inspiration for their BASIC, given Laughton's experience with Data General on a time-sharing system. Cromemco BASIC included an extended floating point implementation using a 14-digit binary-coded decimal (BCD) format made possible using all 16 registers of

4120-426: The Zilog Z80 processor. As it converted all data to the internal format at edit time, small constants like "1" would use up a considerable amount of memory, and this could be a particular issue when storing arrays of numbers. To address this, the language also supported a 6-digit BCD format. It also included a separate 16-bit integer format for storing internal values like line numbers and similar system values. Even

4223-462: The variable name table (VNTP – 82, 83 16 ) and their values are stored in the variable value table (pointed to at VVTP – 86, 87 16 ). By indirecting the variable names in this way, a reference to a variable needs only one byte to address its entry into the appropriate table. String variables have their own area (pointed to at STARP – 8C, 8D 16 ) as does the runtime stack (pointed to at RUNSTK – 8E, 8F 16 ) used to store

Atari Assembler Editor - Misplaced Pages Continue

4326-490: The 17 basic character/graphics modes supported by the hardware cannot be simply accessed from BASIC on the Atari 400/800 as the OS ROMs do not support them. These include some multicolour character modes (ANTIC modes 4 & 5), descender character mode (ANTIC mode 3) and the highest resolution 2 and 4-color modes (ANTIC modes C & E, 160x192 pixels). The only way to access them is via PEEK/POKE or machine language, setting

4429-435: The 17 basic character/graphics modes supported by the hardware cannot be simply accessed from BASIC on the Atari 400/800 as the OS ROMs do not support them. These include some multicolour character modes (ANTIC modes 4 & 5), descender character mode (ANTIC mode 3) and the highest resolution 2 and 4-color modes (ANTIC modes C & E, 160x192 pixels). The only way to access them is via PEEK/POKE or machine language, setting

4532-470: The 6-digit format. Atari accepted the proposal, and when the specifications were finalized in October 1978, Laughton and O'Brien began work on the new language. The contract specified the delivery date on or before 6 April 1979 and this also included a File Manager System (later known as DOS 1.0). Atari's plans were to take an early 8K version of Microsoft BASIC to the 1979 CES, then switch to Atari BASIC for production. Development proceeded quickly, helped by

4635-533: The 600XL and 800XL in 1983, BASIC is built into the system. There are three primary versions of the software: the original cartridge-based "A", the built-in "B" for the 600XL/800XL, and the final "C" version in late-model XLs and the XE series. Despite the Atari 8-bit computers running at a higher speed than most of its contemporaries, several technical decisions placed Atari BASIC near the bottom in performance benchmarks. The original authors addressed most of these issues in

4738-631: The ANTIC registers and Display List manually. The OS ROMs on the XL/XE added support for these modes except for ANTIC mode 3, which requires a character set redefined in RAM to operate correctly. Bitmap modes in BASIC are normally set to have a text window occupying the last four rows at the bottom of the screen so the user may display prompts and enter data in a program. If a 16 is added to the mode number invoked via

4841-426: The ANTIC registers and Display List manually. The OS ROMs on the XL/XE added support for these modes except for ANTIC mode 3, which requires a character set redefined in RAM to operate correctly. Bitmap modes in BASIC are normally set to have a text window occupying the last four rows at the bottom of the screen so the user may display prompts and enter data in a program. If a 16 is added to the mode number invoked via

4944-524: The Assembler Editor: These commands can be interactively entered to assemble the code, enter the debugger, run the program, then exit the debugger when it is finished: Shortly after Shepardson delivered Assembler Editor and Atari BASIC to Atari, Bob Shepardson, the owner, decided to return to being a one-person company. O'Brien, Laughton, and Wilkinson formed their own company, Optimized Systems Software (OSS), to continue development of

5047-613: The Atari OS, and existing drivers could be supplanted or augmented by new ones. A replacement E: , for example could displace the one in ROM to provide an 80-column display, or to piggyback on it to generate a checksum whenever a line is returned (such as used to verify a type-in program listing). Atari BASIC supports CIO access with reserved words OPEN #, CLOSE #, PRINT #, INPUT #, GET #, PUT #, NOTE #, POINT # and XIO # . There are routines in

5150-508: The Atari OS, and existing drivers could be supplanted or augmented by new ones. A replacement E: , for example could displace the one in ROM to provide an 80-column display, or to piggyback on it to generate a checksum whenever a line is returned (such as used to verify a type-in program listing). Atari BASIC supports CIO access with reserved words OPEN #, CLOSE #, PRINT #, INPUT #, GET #, PUT #, NOTE #, POINT # and XIO # . There are routines in

5253-439: The Atari products. They licensed the original source code for BASIC, Assembler Editor, and Atari DOS , which they had collectively written. In 1981, OSS released an improved version of Assembler Editor, EASMD on floppy disk . EASMD was replaced by MAC/65 in 1982. MAC/65 was one of the fastest assemblers on the platform. Much of the improved performance of MAC/65 is the result of tokenizing lines of code as they're entered—at

SECTION 50

#1732797678589

5356-430: The CES version to manufacturing. This version was later known as Revision A . It contains a major bug in a routine that copies memory: deleting lines of code that are exactly 256 bytes long causes a lockup after the next command is entered. The Reset key does not fix it. Revision B attempted to fix the major bugs in Revision A and was released in 1983 as a built-in ROM in the 600XL and 800XL models. While fixing

5459-557: The GRAPHICS statement, the entire screen will be in bitmap mode (e.g. GRAPHICS 8+16). If bitmap mode in full screen is invoked Atari BASIC will gracefully switch back into text mode when program execution is terminated, avoiding leaving the user with an unresponsive screen that must be escaped by typing a blind command or resetting the computer. Bitmap coordinates are in the range of 0 to maximum row/column minus one, thus in Mode 6 (160x192),

5562-450: The GRAPHICS statement, the entire screen will be in bitmap mode (e.g. GRAPHICS 8+16). If bitmap mode in full screen is invoked Atari BASIC will gracefully switch back into text mode when program execution is terminated, avoiding leaving the user with an unresponsive screen that must be escaped by typing a blind command or resetting the computer. Bitmap coordinates are in the range of 0 to maximum row/column minus one, thus in Mode 6 (160x192),

5665-519: The OS for simple graphics drawing functions but not all are available as specific BASIC keywords. PLOT and DRAWTO for line drawing are supported while a command providing area fill for primitive linear geometric shapes is not. The fill feature can be used through the general CIO entry point, which is called using the BASIC command XIO . The BASIC statement OPEN # prepares a device for I/O access: Here, OPEN # means "ensure channel 1

5768-471: The OS for simple graphics drawing functions but not all are available as specific BASIC keywords. PLOT and DRAWTO for line drawing are supported while a command providing area fill for primitive linear geometric shapes is not. The fill feature can be used through the general CIO entry point, which is called using the BASIC command XIO . The BASIC statement OPEN # prepares a device for I/O access: Here, OPEN # means "ensure channel 1

5871-406: The READY prompt. The result is 162 for Revision A, 96 for Revision B, and 234 for Revision C. Like most home computer BASICs, Atari BASIC is anchored around its line editor . Program lines can be up to three physical screen lines of 40 characters, 120 characters total. The cursor can be moved freely, with the editor automatically tracking which BASIC program line the current screen line

5974-497: The code was pared down to almost fit in an 8 KB ROM, but Atari was facing a January 1979 deadline for the Consumer Electronics Show (CES) where the machines would be demonstrated. They decided to ask for help to get a version of BASIC ready in time for the show. In September 1978, Shepardson Microsystems won the bid on completing BASIC. At the time they were finishing Cromemco 16K Structured BASIC for

6077-462: The descriptions printed in the manual. Because of the way the line editor works, the user can immediately fix the error. In the example pictured above (with PRUNT ), the error can be fixed by moving the cursor over the U , typing I (the editor only has an overwrite mode), and hitting RETURN . A line entered with a leading number, from 0 to 32767, is inserted in the current program or replaces an existing line. If there's no line number,

6180-406: The disadvantage that small constants, like 0 or 1, are six bytes each, longer than the original text. A set of pointers (addresses) indicates various data: variable names are stored in the variable name table (VNTP – 82, 83 16 ) and their values are stored in the variable value table (pointed to at VVTP – 86, 87 16 ). By indirecting the variable names in this way, a reference to

6283-420: The editor automatically tracking which BASIC program line the current screen line is part of. For instance, if the cursor is currently positioned in line 30 and the user uses cursor-up into line 20, any editing from that point will be carried out on line 20. Atari BASIC's editor catches many errors that would not be noticed in MS-derived versions. If an error is found, the editor re-displays the line, highlighting

SECTION 60

#1732797678589

6386-402: The filename is ignored for the cassette driver. Physical devices can have numbers (mainly disks, printers and serial devices), so " P1: " might be the plotter and " P2: " the daisy-wheel printer, or " D1: " may be one disk drive and " D2: " and so on. If not present, 1 is assumed. The LPRINT statement sends a string to the printer. A is read by PEEK ing memory locations maintained by

6489-402: The filename is ignored for the cassette driver. Physical devices can have numbers (mainly disks, printers and serial devices), so " P1: " might be the plotter and " P2: " the daisy-wheel printer, or " D1: " may be one disk drive and " D2: " and so on. If not present, 1 is assumed. The LPRINT statement sends a string to the printer. A is read by PEEK ing memory locations maintained by

6592-497: The following example. The target string must be large enough to hold the combined string or an error will result: Values in DATA statements are comma-delimited and untyped. Consequently, strings in DATA statements are not typically enclosed by quote marks. As a result, it is not possible for data items to contain a comma but they can incorporate double-quotes. Numeric values in DATA statements are read as strings or as numbers according to

6695-446: The following example. The target string must be large enough to hold the combined string or an error will result: Values in DATA statements are comma-delimited and untyped. Consequently, strings in DATA statements are not typically enclosed by quote marks. As a result, it is not possible for data items to contain a comma but they can incorporate double-quotes. Numeric values in DATA statements are read as strings or as numbers according to

6798-517: The hardware features of their computers, similar to what Apple had done with Applesoft BASIC . This increased the size of Atari's version to around 11 KB; AppleSoft BASIC on the Apple II+ was 10,240 bytes long. After six months the code was pared down to almost fit in an 8 KB ROM, but Atari was facing a January 1979 deadline for the Consumer Electronics Show (CES) where the machines would be demonstrated. They decided to ask for help to get

6901-421: The home computer era, Atari BASIC is not a derivative of Microsoft BASIC and differs in significant ways. It includes keywords for Atari-specific features and lacks support for string arrays. The language was distributed as an 8  KB ROM cartridge for use with the 1979 Atari 400 and 800 computers. Starting with the 600XL and 800XL in 1983, BASIC is built into the system. There are three primary versions of

7004-435: The interpreter assigns it the number -1 (8000 16 ) and the commands are executed immediately, in "immediate mode". The RUN command executes the stored program from the lowest line number. Atari BASIC allows all commands to be executed in both modes. For example, LIST can be used inside a program, whereas in many interpreters this would be available in immediate mode only. During entry, keywords can be abbreviated using

7107-521: The keyboard driver or by opening it as a file (e.g. OPEN 1 , 4 , 0 , "K:" : GET # 1 , A$ ). The latter waits for a keypress. Typing DOS from BASIC exits to the Atari DOS command menu. Any unsaved programs are lost unless a memory-swapping file feature has been enabled on the current disk. There is no command to display a disk directory from within BASIC; this must be done by exiting to DOS. Atari BASIC supports sound, (via

7210-465: The keyboard driver or by opening it as a file (e.g. OPEN 1 , 4 , 0 , "K:" : GET # 1 , A$ ). The latter waits for a keypress. Typing DOS from BASIC exits to the Atari DOS command menu. Any unsaved programs are lost unless a memory-swapping file feature has been enabled on the current disk. There is no command to display a disk directory from within BASIC; this must be done by exiting to DOS. Atari BASIC supports sound, (via

7313-462: The language also supported a 6-digit BCD format. It also included a separate 16-bit integer format for storing internal values like line numbers and similar system values. Even the smallest BASICs on the 6502 generally used about 10K, for instance, Commodore BASIC used 9K but also relied on support from the KERNAL , while Applesoft BASIC used 10780 bytes. To meet the goal of fitting in an 8K ROM,

7416-501: The line numbers of looping statements ( FOR...NEXT ) and subroutines ( GOSUB...RETURN ). Finally, the end of BASIC memory usage is indicated by an address stored at MEMTOP – 90, 91 16 ) pointer. Atari BASIC includes three trigonometric functions: sine, cosine, and arc tangent. DEG and RAD set whether these functions use radians or degrees, defaulting to radians. Eight additional functions include rounding, logarithms, and square root. The random function, RND , generates

7519-432: The list of reserved words, with REM at the beginning (it can be typed as . ). When the program is later LIST ed it will always write out the full words with three exceptions: PRINT has a synonym, ? ; GOTO has a synonym, GO TO ; and LET has a synonym which is the empty string (so 10 LET A = 10 and 10 A = 10 mean the same thing). These are separate tokens, and so will remain as such in

7622-403: The machine to run out of memory for even the smallest programs. Mapping the Atari described these as "awesome bugs" and advised Revision B owners "Don't fool around; get the new ROM, which is available on cartridge" from Atari. The book provides a type-in program to patch Revision B to Revision C for those without the cartridge. Revision C eliminates the memory leaks in Revision B. It

7725-666: The manual. There are 19 assembler-specific codes and 16 additional codes for operating system input/output errors. Code is assembled by typing the ASM command into the editor. Assembler Editor was widely derided as the slowest assembler on the platform. Much of this is from sharing code with Atari BASIC, also written by Shepardson Microsystems. Atari BASIC uses slow routines used to convert numeric constants in code to an internal binary-coded decimal representation via operating system routines. All numbers, even line numbers, have to be converted to binary-coded decimal. It also means that 1E2

7828-447: The maximum coordinates for a pixel can be 159 and 191. If Atari BASIC attempts to plot beyond the allowed coordinates for the mode a runtime error occurs. Atari BASIC allows numeric variables and expressions to be used to supply line numbers to GOTO and GOSUB commands. For instance, a subroutine that clears the screen can be written as GOSUB CLEARSCREEN , which is easier to understand than GOSUB 10000 . The base addresses of

7931-447: The maximum coordinates for a pixel can be 159 and 191. If Atari BASIC attempts to plot beyond the allowed coordinates for the mode a runtime error occurs. Atari BASIC allows numeric variables and expressions to be used to supply line numbers to GOTO and GOSUB commands. For instance, a subroutine that clears the screen can be written as GOSUB CLEARSCREEN , which is easier to understand than GOSUB 10000 . The base addresses of

8034-420: The memory copying bug, the programmer noticed the same pattern of code in the section for inserting lines, and applied the same fix. This instead introduced the original bug into this code. Inserting new lines is much more common than deleting old ones, so the change dramatically increased the number of crashes. Revision B also adds 16 bytes to a program every time it is SAVE d and LOAD ed, eventually causing

8137-713: The need for manual error-checking. For example, when drawing graphics on the screen it is not necessary to check whether lines go beyond screen boundaries of the current graphics mode. This error state can be trapped, and the error handled if necessary. The ENTER command reads source code from a device and merges it into the current program, as if the user had typed it in. This allows programs to be saved out in sections via LIST , reading them in using ENTER to merge or replace existing code. By using blocks of line numbers that do not overlap, programmers can build libraries of subroutines and merge them into new programs as needed. The editor can be set-up to repeatedly read input from

8240-713: The need for manual error-checking. For example, when drawing graphics on the screen it is not necessary to check whether lines go beyond screen boundaries of the current graphics mode. This error state can be trapped, and the error handled if necessary. The ENTER command reads source code from a device and merges it into the current program, as if the user had typed it in. This allows programs to be saved out in sections via LIST , reading them in using ENTER to merge or replace existing code. By using blocks of line numbers that do not overlap, programmers can build libraries of subroutines and merge them into new programs as needed. The editor can be set-up to repeatedly read input from

8343-449: The new BASIC would be in two parts, the language itself on the cartridge, and a separate FP library using 2K in the system's 10K ROM. To fit within 2k, the floating-point system supported only the 6-digit format. Atari accepted the proposal, and when the specifications were finalized in October 1978, Laughton and O'Brien began work on the new language. The contract specified the delivery date on or before 6 April 1979 and this also included

8446-478: The new president of Atari, decided to challenge Apple Computer by building a home computer instead. This meant the designs needed to include the BASIC programming language, the standard for home computers. In early 1978, Atari licensed the source code to the MOS 6502 version of Microsoft BASIC . It was offered in two versions: one using a 32-bit floating point format that was about 7800 bytes when compiled, and another using an extended 40-bit format that

8549-424: The next command is entered. The Reset key does not fix it. Revision B attempted to fix the major bugs in Revision A and was released in 1983 as a built-in ROM in the 600XL and 800XL models. While fixing the memory copying bug, the programmer noticed the same pattern of code in the section for inserting lines, and applied the same fix. This instead introduced the original bug into this code. Inserting new lines

8652-448: The order specified in the USR call in low byte, high byte order. A final byte is pushed indicating the number of arguments. The machine language code must remove these values before returning via the RTS instruction. A 16-bit value can be returned to BASIC by placing it in addresses 212 10 and 213 10 (D4 16 and D5 16 ). Atari BASIC Atari BASIC is an interpreter for

8755-454: The parameter for the RESTORE statement, allowing DATA statements to be randomly accessed through code such as RESTORE ROOMBASE + ROOMNUMBER: READ DESCRIPTION$ , TREASURE$ , EXITS . This can also be used to emulate static string arrays: RESTORE STRBASE + INDEX: READ A$ : PRINT A$ . The TRAP statement jumps to a line number when an error occurs, and this reduces

8858-402: The parameter for the RESTORE statement, allowing DATA statements to be randomly accessed through code such as RESTORE ROOMBASE + ROOMNUMBER: READ DESCRIPTION$ , TREASURE$ , EXITS . This can also be used to emulate static string arrays: RESTORE STRBASE + INDEX: READ A$ : PRINT A$ . The TRAP statement jumps to a line number when an error occurs, and this reduces

8961-460: The pattern set by Palo Alto Tiny BASIC , by typing a period at any point in the word. So L. is expanded to LIST , as is LI. . Only enough letters have to be typed to make the abbreviation unique, so PLOT requires PL. because the single letter P is not unique. To expand an abbreviation, the tokenizer searches through its list of reserved words to find the first that matches the portion supplied. More commonly used commands occur first in

9064-501: The program listing. MS BASICs also allowed ? as a short-form for PRINT , but this used the same token so it expanded back to PRINT when LIST ed, treating it as an abbreviation, not a synonym. When the user presses RETURN while editing, the current line is copied into the BASIC Input Line Buffer in memory between 580 and 5FF 16 . Atari BASIC's tokenizer scans the text, converting each keyword to

9167-576: The recommendation, commercial software was written using the Assembler Editor, such as the games Eastern Front (1941) , Caverns of Mars , Galahad and the Holy Grail , and Kid Grid . The source code to the original Assembler Editor was licensed to Optimized Systems Software who shipped EASMD based on it. The Assembler Editor is a two-pass 6502 assembler in an 8 KB cartridge. Both source and object code can be in memory simultaneously, allowing repeated editing, assembly, and running of

9270-706: The resulting code without accessing a disk or tape drive. The cartridge starts in EDIT mode. The programmer enters lines of assembly source into the Atari BASIC -like editor . Source text must be prefixed with a line number or it is interpreted as a command. Like Atari BASIC, Assembler Editor includes an ENTER command that can be used to combine files together into a single larger program listing. Unlike Atari BASIC, Assembler Editor includes commands for automatically creating spaced-out line numbers, as well as renumbering lines and deleting them en masse . A FIND command

9373-518: The screen until an EOF is reached. This allows a program to write new program code followed by a CONT statement to the screen then, positioning the screen cursor at the start of the new code, STOP the running program, causing the new code to be read in then execution be continued by the CONT statement. Atari BASIC can call machine code subroutines stored in strings or POKE ed into memory. The 256 byte area starting at address 1536 10 (600 16 )

9476-470: The screen until an EOF is reached. This allows a program to write new program code followed by a CONT statement to the screen then, positioning the screen cursor at the start of the new code, STOP the running program, causing the new code to be read in then execution be continued by the CONT statement. Atari BASIC can call machine code subroutines stored in strings or POKE ed into memory. The 256 byte area starting at address 1536 10 (600 16 )

9579-424: The smallest BASICs on the 6502 generally used about 10K, for instance, Commodore BASIC used 9K but also relied on support from the KERNAL , while Applesoft BASIC used 10780 bytes. To meet the goal of fitting in an 8K ROM, the new BASIC would be in two parts, the language itself on the cartridge, and a separate FP library using 2K in the system's 10K ROM. To fit within 2k, the floating-point system supported only

9682-650: The software: the original cartridge-based "A", the built-in "B" for the 600XL/800XL, and the final "C" version in late-model XLs and the XE series. Despite the Atari 8-bit computers running at a higher speed than most of its contemporaries, several technical decisions placed Atari BASIC near the bottom in performance benchmarks. The original authors addressed most of these issues in a series of improved versions: BASIC A+ (1981), BASIC XL (1983), and BASIC XE (1985). The complete, annotated source code and design specifications of Atari BASIC were published as The Atari BASIC Source Book in 1983. The machines that would become

9785-408: The start and end points within the existing allocated memory. Arrays are not initialized, so a numeric array or string contains whatever data was in memory when it was allocated. The following trick allows fast string initialization, and it is also useful for clearing large areas of memory of unwanted garbage. Numeric arrays can only be cleared with a FOR...NEXT loop: String concatenation works as in

9888-408: The start and end points within the existing allocated memory. Arrays are not initialized, so a numeric array or string contains whatever data was in memory when it was allocated. The following trick allows fast string initialization, and it is also useful for clearing large areas of memory of unwanted garbage. Numeric arrays can only be cleared with a FOR...NEXT loop: String concatenation works as in

9991-422: The text near the error in inverse video . Errors are displayed as numeric codes, with the descriptions printed in the manual. Because of the way the line editor works, the user can immediately fix the error. In the example pictured above (with PRUNT ), the error can be fixed by moving the cursor over the U , typing I (the editor only has an overwrite mode), and hitting RETURN . A line entered with

10094-452: The tokenizer is then relocated. The program is stored as a parse tree . Shepardson referred to this complete-tokenizing concept as a "pre-compiling interpreter". The resulting tokenized code eliminates any parsing during runtime, making it run faster. It has the disadvantage that small constants, like 0 or 1, are six bytes each, longer than the original text. A set of pointers (addresses) indicates various data: variable names are stored in

10197-512: The type of the variable they are read into. The READ statement cannot be used with array variables. The Atari OS includes a subsystem for peripheral device input/output (I/O) known as CIO (Central Input/Output). Most programs can be written independently of what device they might use, as they all conform to a common interface; this was rare on home computers at the time. New device drivers could be written fairly easily that would automatically be available to Atari BASIC and any other program using

10300-512: The type of the variable they are read into. The READ statement cannot be used with array variables. The Atari OS includes a subsystem for peripheral device input/output (I/O) known as CIO (Central Input/Output). Most programs can be written independently of what device they might use, as they all conform to a common interface; this was rare on home computers at the time. New device drivers could be written fairly easily that would automatically be available to Atari BASIC and any other program using

10403-450: The user presses RETURN while editing, the current line is copied into the BASIC Input Line Buffer in memory between 580 and 5FF 16 . Atari BASIC's tokenizer scans the text, converting each keyword to a single-byte token (for example, PRINT is 20 16 ), each number to a six-byte floating point value, each variable name to an index into a table, and so on, until the line is fully turned into an easy to interpret format. The result

10506-416: Was being written, primarily by Paul Laughton, O'Brien's husband, O'Brien worked on the Assembler Editor. It was written by punching codes into a punch tape machine, running the tape through an EPROM burner, and then testing the resulting ROM in an Atari 800. The cartridge was completed before Atari BASIC, and O'Brien spent some time working on portions of that project as well. As part of Shepardson's work,

10609-431: Was close to 9 KB. Even the 32-bit version barely fit into the 8 KB size of the machine's ROM cartridge format. Atari also felt that they needed to expand the language to support the hardware features of their computers, similar to what Apple had done with Applesoft BASIC . This increased the size of Atari's version to around 11 KB; AppleSoft BASIC on the Apple II+ was 10,240 bytes long. After six months

#588411