ATARI BASIC II* ®Microsoft BASIC II puts functions, and expressions the power of the most advanced Detailed information on graphics BASIC language in an easy-to-use, modes, player-missile graphics, quick-loading 16K ROM (Read-Only and controllers Memory) cartridge. When you in­ Appendices that cover sample sert the cartridge in your ATARI programs, ATASC ll and alternate and turn the com­ character sets, memory map, puter on, you' re ready to use a RS-232 information regarding the wide variety of Microsoft BASIC use of telephone communica­ programs. Add the Microsoft tions, an alphabetical listing of BASIC II Extension Diskette, and Microsoft BASIC II keywords, and you can tackle most any BASIC the error codes programming job-from the Conversion information to help simplest to the most complex. You you translate programs from can also convert Microsoft BASIC other Microsoft BASIC dialects programs written for other com­ and from ATARI BASIC into puters so that they run on your Microsoft BASIC II ATARI Home Computer. A whole In addition to the reference new world of creative program­ manual, there's also a handy ming awaits you! guide to Microsoft BASIC II: The THE SOLUTION A TARI Microsoft BASIC II Quick Reference Guide. Keep it by your ATARI Microsoft BASIC II can side while programming for quick solve the problems of your BASIC details on Microsoft BASIC II key­ programming universe quickly and words and their use, the ATASCll efficiently. As part of the package, character set, and explanations you get a thorough set of guide­ of errors. lines for its use, including a reference manual and a quick USING ACCESSORIES reference guide. You may use any number of The A TARI Microsoft BASIC II accessories with Microsoft BASIC Reference Manual includes: 11 , including printers, modems, up Complete loading instructions to four disk drives, and even digi­ Introduction to Microsoft BASIC II tizers and plotters. You ' ll find Explanations of Microsoft BASIC Microsoft BASIC II offers powerful 11 commands, commands to control your acces­ statements, sories quickly and conveniently.

• © 1982 MICROSOFT All rights reserved To use the ATARI Microsoft BASIC If you have a disk drive, follow II cartridge, you must have a these steps to load Microsoft minimum system that consists of BASIC II with the extension an ATARI Home Computer with diskette: 16K of RAM (Random Access Make sure the power switch on Memory) and a standard TV set or the right side of your ATARI monitor. If you want to load and Home Computer console is turned save Microsoft BASIC II programs OFF. on cassette or diskette, you also Pull the release lever toward need an ATARI 410™ Program you to open the cartridge door. Recorder or an ATARI 81 o™ Disk Insert the Microsoft BASIC II cartridge in the cartridge slot Drive. The Microsoft BASIC II Ex­ (the left cartridge slot in your tension Diskette requires an ATARI Home Computer) with 81 O Disk Drive and can only be the label facing you. Press down used with ATARI Disk Operating carefully and firmly. Close the System version 2.0S. cartridge door. LOADING MICROSOFT BASIC II Turn on disk drive 1. Wait until the red BUSY light goes off. If you do not have a disk drive, Insert the Microsoft BASIC II fol low these steps to load your Extension Diskette in the disk ATARI Microsoft BASIC II cartridge: drive. Make sure the label faces Turn on your ATARI Home up and to the right. Close the door Computer by pressing the of the disk drive. Turn the power power switch on the right side of switch on the right side of your the console to ON. computer console to ON. Pull the release lever toward you to open the cartridge door. (Whenever you do this, the com­ RUter automatically turns itself off.) Insert the ATARI Microsoft BASIC 11 cartridge in the car­ tridge slot (the left cartridge slot in your ATARI 800™ Home Computer) with the label facing you. Press the cartridge down carefully and firm­ ly. Close the cartridge door and Microsoft BASIC II then takes the computer turns on again. command and loads itself into your computer's memory automatically.

Microsoft BASIC II then takes command and loads itself into your computer's memory. You'll know Microsoft BASIC II has Follow these steps to prepare loaded properly when you see the your working copies of the following information on your TV Microsoft BASIC 11 Extension screen: Diskette: With the extension diskette in your disk drive, Microsoft BASIC II loaded, and the prompt ( >) showing, type DOS and press RETURN . Your TV screen displays the DOS menu when DOS is fin­ ished loading , which takes about 30 seconds. WITHOUT DISK DRIVE Remove the extension diskette from the disk drive. Insert the diskette to be for­ matted in your disk drive. Here's what the computer asks and how you respond: COMPUTER : SELECT ITEM OR RETURN FOR MENU WITH DISK DRIVE YOU TYPE: I RETURN (If you do not see one of the above COMPUTER: WHICH DRIVE TO screens, turn off your computer FORMAT? and repeat the steps outlined in YOU TYPE : 1 RETURN " LOADING MICROSOFT BASIC II.") COMPUTER: TYPE " Y" TO FORMAT DISK 1 C OPYING THE MICROSOFT YOU TYPE: Y RETURN BASIC II EXTENSION DISKETTE The disk drive whirs and clicks Your Microsoft BASIC II Extension for less than a minute. You ' ll Diskette contains several files that know the formatting process is add convenient commands and finished when the screen displays features to the cartridge program " SELECT ITEM OR RETURN FOR of Microsoft BASIC II. To prevent MENU " again. the overlaying and destroying of After your diskette has been for­ these important files , the extension matted, you ' re ready to duplicate diskette comes in a "write­ the extension diskette. Press protected" jacket, which means RETURN for the DOS menu. Next, that you cannot save programs on insert the extension diskette in the original diskette. For this your disk drive. reason, you need to make a copy of the extension diskette before you begin to write your own programs. Follow these steps to make a The process of duplicating the working copy: extension diskette requires you to in the disk YOU TYPE : J RETURN switch the diskettes drive twice. When the computer COMPUTER : DUP DISK-SOURCE, DEST DRIVES? displays "SELECT ITEM OR " copying is YOU TYPE : 1, 1 RETURN RETURN FOR MENU, COMPUTER: INSERT SOURCE completed. DISK, TYPE RETURN You can check the directories YOU TYPE: RETURN on both the original and copy of COMPUTER: TYPE "Y" IF OK TO the extension diskette to see if all USE PROGRAM is well. Type A and press AREA RETURN . Then type RETURN CAUTION: A " Y" IN­ again. A list of files appears on VALIDATES MEM .SAV your TV screen. Then do the same (MEM .SAV is a file that saves part thing with the other diskette in the of Microsoft BAS IC II and your pro­ drive. (For further information, see gram whenever you go to the DOS An Introduction to the Disk menu. Invalidating MEM.SAV frees or the A TARI memory for faster duplication of Disk Operating System II diskettes. But you ' II have to reload Reference Manual.) MEM .SAV later to return to When you invalidate the Microsoft BASIC II-see Step 6.) MEM.SAV file, your access to the extension diskette features is YOU TYPE : Y RETURN suspended. In order to restore the COMPUTER: INSERT DESTINA- use of these features, you must TION DISK, TYPE reload Microsoft BASIC II . With RETURN your working copy of the extension (At this point, remove the exten­ diskette in the drive, turn the sion diskette and insert your for­ power switch on the right side of matted diskette.) your computer console to OFF and YOU TYPE : RETURN then turn it to ON again. COMPUTER : INSERT SOURCE Whenever " SELECT ITEM OR DISK, TYPE RETURN RETURN FOR MENU " appears (Remove the formatted diskette on your TV screen, you may leave and insert the extension diskette.) the DOS menu and return to YOU TYPE : RETURN Microsoft BASIC II by typing B (the COMPUTER: INSERT DESTINA- " RUN CARTRIDGE" selection on TION DISK, TYPE the DOS menu) and pressing RETURN RETURN . After Microsoft BASIC II (Remove the extension diskette is re-entered, the prompt ( >) will and insert the formatted diskette appear. Microsoft BASIC II is now again.) ready to receive your commands. YOU TYPE : RETURN COMPUTER: SELECT ITEM OR RETURN FOR MENU ATARI Microsoft BASIC II has the again on the computer. The pro­ power to take on large tasks, yet gram recorder now begins to it's easy to use. You can enter record the program onto the tape. commands directly (without typing When it's finished , the recorder a line number) and execute them automatically stops. immediately. Or you can start with Now the program resides both a line number and defer the execu­ in your computer's memory and on tion of commands until you type the tape . You could begin a new RUN . For example: program at this point, but it's YOU TYPE : PRINT " Welcome to always wise to start with a " clean Microsoft BASIC II ." slate." Type NEW to clear the RETURN computer's memory, then type COMPUTER: Welcome to Microsoft LIST (for listing lines) to see if line BASIC II. 10 is still there. Gone? Good. Now use a line number: LOADING A PROGRAM FROM YOU TYPE : 10 PRINT "Welcome CASSETTE to Microsoft BASIC II. " RETURN Now try loading the program back Microsoft BASIC II thinks you have into memory from the recorder. typed the first line of a program; Follow these steps: nothing happens until you type Press REWIND to move the RUN and press RETURN . tape back to the beginning. YOU TYPE: RUN RETURN Press the counter button to reset it COMPUTER: Welcome to Microsoft to zero. BASIC II . Press ADVANCE to move the SAVING A PROGRAM ON tape ahead to 10 on the counter. CASSETTE Now type CLOAD and press If you have an ATARI 410 Program RETURN. You 'l l hear a beep Recorder, you can save your one­ from the computer to remind you line program on cassette by follow­ to press PLAY on the program ing these steps: recorder. Open the cover on your pro­ After pressing the PLAY button gram recorder by pressing on your program recorder, STOP/EJ . press the RETURN key again. The Insert a blank cassette and then begins to load press the REWIND button to into the computer's memory. make sure the tape is rewound to When the program recorder the beginning. stops, the Microsoft BASIC II Press the tape counter button ready prompt ( >) appears on your (on top of the program re­ TV screen. Type RUN to execute corder) to reset the counter to the program. zero. Then press ADVANCE and move the tape ahead to about 10. Close the cover. Next, type CSAVE and press RETURN. When you hear two beeps, press PLAY and REC on your program recorder, then press RETURN SAVING A PROGRAM ON Here's a look at some of the new keywords available with the DISKETTE ==== Microsoft BASIC II cartridge: If you have a disk drive, save your AFTER CLEAR program on diskette with these CLEAR ST ACK CLS steps: COMMON DEF (numerical) Insert a duplicate copy of the DE FD BL DEF INT extension diskette (or any disk­ DEFSNG DEFSTR ette formatted with DOS 2.0S) in ELSE EOF your disk drive. ERL ERR Display your program lines by ERROR INKEY$ typing LIST and pressing FILL INSTR RETURN. KILL LEFT$ Type SAVE "D:MYTEST.AMB" LINE INPUT LOCK and press RETURN . The pro­ MERGE MID$ gram in the computer's memory is MOVE ON ERROR now stored on diskette and as­ OPTION BASE OPTION CHR signed the file name, OPTION PLM OPTION RESERVE MYTEST.AMB. PLOT ... TO PRINT...AT PRINT ... SPC PRINT ... TAB LOADING A PROGRAM FROM RANDOMIZE RIGHT$ DISKETTE SCRN$ STACK TAN TIME To load MYTEST.AMB from TIME$ UNLOCK diskette into your computer's VERIFY VARPTR memory, follow these steps: WAIT XOR Insert your diskette with the The following new commands file MYTEST.AMB in your and statements are available only disk drive (if it's not in the drive with the extension diskette: already). AUTO DEL To clear your computer's DEF (strings) NAME memory, type NEW and press NOTE PRINT USING RETURN. Then type LIST and REN UM STRING$ press RETURN to make sure no TRON/TROFF program is there. The following added features Type LOAD "D:MYTEST.AMB" also reside on the extension and press RETURN . When diskette: the file has loaded, the Microsoft Long error messages BASIC 11 ready prompt ( >) returns Sign-on message to the TV screen. Try a few. To fill your TV screen ~ Type LIST and press RETURN with stars, for example, type in the to see the program lines. Type following program. After entering RUN to execute the program. each line, type RETURN. Then type RUN and press RETURN to Microsoft BASIC II gives you full execute the program. control over the amazing sound, 10 CLS color and graphics features of your 20 FOR I= 1 TO 100 ATARI Home Computer. 30 X = RND(37):Y = RND(20) The SOUND command lets you 40 PRINT AT(X,Y)"*"; include music and sound effects in 50 NEXT your programs. You can use up to 60 PRINT AT(2 ,21)"FINISHED"; four voices (think of them as Type NEW and press RETURN singers in a quartet). You also set to clear the memory for entering a the pitch and distortion levels­ new program. Then try the follow­ which allow any sound from a ing program-it lets you time your single-note whine to the multiple computer questions. octaves of a music synthesizer­ 10 CLS:AFTER (300) GOTO 70 and control the loudness and dura­ 20 PRINT "YOU HAVE 5 tion of each sound to play. SECONDS TO PRESS A Here's the format for the KEY," :PRINT "ANY KEY." SOUND command: 30 IF INKEY$ = "" THEN 30 SOUND 0,10,10,10,50 40 PRINT "THANK YOU" 50 CLEAR ST ACK 4 Voices I I 60 END Pitch 70 PRINT "TIME'S UP!"; Distortion 80 RESUME 50 Loudness Type NEW and press RETURN Duration to clear the memory for another program-this one produces a Try this example, using two secret word out of a larger word. voices. 10 SECRET$= " FUNDAMENTAL" Type in each line and press 20 PRINT"THE SECRET WORD JS "· RETURN : 30 PRINT LEFT$(SECRET$, 1); 10 FOR I= 60 TO 120 STEP 6 40 PRINT MID$(SECRET$,5,3) 20 SOUND 0,1,10,10,10 (Hint: Answer rhymes with 30 SOUND 1,120-1 ,10,10,10 "name.") 40 NEXT I 50 GOTO 10 To execute the program, type RUN and press RETURN . The Microsoft BASIC II com­ Advanced programmers will mands that control the color and appreciate the convenience of the graphics features of your ATARI OPTION commands, which reserve Home Computer provide the space in memory for special uses. "brushes" and the "paint" that OPTION PLM stores player-missile can satisfy all your artistic inclina­ graphics, OPTION CHR handles tions. custom-made character sets, and The COLOR and SETCOLOR OPTION RESERVE allows storage commands, for example, allow you of special assembly lan­ to use 128 colors. Try the program guage routines. below and you'll see how com­ mands like PLOT, PLOT...TO, FILL, and CLS help you draw and paint. 10 GRAPHICS 7 20 SETCOLOR 6,0,0 30 COLOR 1 40 PLOT 150, 15 TO 150,65 50 FILL 15,65 TO 15,15 60 FOR I = 15 TO 0 STEP -1 70 FOR J=O TO 15 80 SETCOLOR 4,J,I 90 FORK= 1 TO 100 100 NEXT K,J,I 120 END \ The BASIC programming language tween the two dialects. For in­ has a number of " dialects." ATARI stance, Microsoft BASIC II requires BASIC is the dialect originally spaces before and after keywords designed for ATARI 400™ and (commands and statements), while ATARI 800 Home Computers and ATARI BASIC ignores spaces to an is well respected for its ease of extent. If you want to enter a string use. ATARI Microsoft BASIC II is of variables that stand for a series similar to ATARI BASIC in struc­ of letters or numbers, Microsoft ture and has many of the same BASIC 11 does not require that you commands, but the Microsoft set aside space for them (with the BASIC 11 commands often give you DIM command) before you use more power than do similar com­ them , while ATARI BASIC does. mands in ATARI BASIC. And there Microsoft BASIC II also allows are some differences in the way multidimensional numerical and you need to format commands in string arrays. Microsoft BASIC II. Here's a look at some of the If you 're familiar with ATARI commands used for similar pur­ BASIC, you ' ll need to acquaint poses in the two dialects: yourself with the differences be-

MICROSOFT ATARI PURPOSE BASIC II BASIC CLEAR CLR Clear variables FILL XIO 18 Paint color on the screen MERGE ENTER Append programs ON ERROR TRAP Trap errors PLOT.. . TO DRAW TO Draw lines on the screen AT POSITION Position cursor before printing on screen SCRN$ LOCATE Retrieve information from screen VARPTR ADR Retrieve memory address of a variable Although most of us never ever HERE'S A LIST OF THEM: make mistakes, ATARI Microsoft BASIC II doesn't like to rub it in CODE EXPLANATION when we do. If a "bug" (that's 1 NEXT without FOR computer talk for an error) does 2 Syntax error creep into your program, Microsoft 3 RETURN without GOSUB BASIC 11 makes it easy to track 4 Out of DATA down with the TRON command. This command allows you to trace 5 Function call error your program instructions during 6 Overflow execution. As each instruction is 7 Out of Memory carried out, its line number is 8 Undefined line printed on the TV screen. When an 9 Subscript out of range error occurs, its line number is 10 Redefinition error shown. Press BREAK to stop the Division by zero program, turn off the TRON func­ 11 tion with TROFF, change the in­ 12 Illegal direct error struction, and rerun the program. 13 Type mismatch If you have trouble locating the 14 File input/output error error, Microsoft BASIC II offers fur­ 15 Quantity too big ther help. The ERR function tells 16 Formula too complex you the code number of the error 17 Can 't continue involved, while the ERL function points out its line number. But you 18 Undefined function may never need either one if you 19 No RESUME use the extension diskette, since 20 RESUME wi thout ERROR Microsoft BASIC II prints an ex­ 21 FOR without NEXT planation of most errors right on 22 LOCK error your TV screen-in English. 23 Time error For a complete explanation of these and other errors, see your A TARI Microsoft BASIC II Reference Manual. For an explana­ tion of DOS errors, see the A TARI Disk Operating System II Reference Manual.

Every effort has been made to ensure the ac­ curacy of the product documentation in this manual. However, because we are constantly improving and updating our software and hardware, Atari , Inc . is unable to guarantee the accuracy of printed material after the date of publication and disclaims liability for changes, errors, or om issions. No re production of this document or any po rtion of its contents is allowed without specific written per­ mission of Atari, Inc., Su nnyvale, CA 94086.

© 1982 Atari, Inc. All Rights Rese rved. JI\. ATARI® A Wainer Commun1cahons Company Cl

PRINTED IN US A C061251 REV A