30-04-2017 (2480 ) | Categoria: Articles |
Apple II Reference Manual January 1978 APPLE n Reference Manual January 1978 APPLE Computer Inc. 10260 Bandley Dr. Cupertino, CA 95014 APPLE n Reference Manual TABLE OF CONTENTS A. GETTING STARTED WITH YOUR APPLE II 1 1. Unpacking 1 2. Warranty Registration Card 1 3. Check for Shipping Damage 2 4. Power Up 2 5. APPLE II Speaks Several Languages . 3 6. APPLE Integer BASIC 3 7. Running Your First and Second Programs 3 8. Running 16K Startrek 3 9. Loading a Program Tape 4 10. Breakout and Color Demos Tapes . . 6 11. Breakout and Color Demos Program Listings 12 12. How to Play Startrek 14 13. Loading HIRES Demo Tape 15 B. APPLE II INTEGER BASIC 17 1. BASIC Commands 18 2. BASIC Operators 19 3. BASIC Functions 22 4. BASIC Statements 23 5. Special Control and Editing 28 6. Table A — Graphics Colors 29 7. Special Controls and Features 30 8. BASIC Error Messages 32 9. Simplified Memory Map 33 10. Data Read/Save Subroutines 34 11. Simple Tone Subroutines 43 12. High Resolution Graphics Subroutines and Listings 46 13. Additional BASIC Program Examples 55 a. Rod's Color Pattern (4K) 55 b. Pong <4K) 56 c. Color Sketch (4K) 57 d. Mastermind (8K) 59 e. Biorhythm (4K) 61 f. Dragon Maze (4K) 63 C. APPLE II FIRMWARE 67 1. System Monitor Commands 68 2. Control and Editing Characters 72 3. Special Controls and Features 74 4. Annotated Monitor and Dis-assembler Listing 76 5. Binary Floating Point Package 94 6. Sweet 16 Interpreter Listing 96 7. 6502 Op Codes 100 D. APPLE II HARDWARE 106 1. Getting Started with Your APPLE II Board 107 2. APPLE II Switching Power Supply. 110 3. Interfacing with the Home TV 112 4. Simple Serial Output 114 5. Interfacing the APPLE — Signals, Loading, Pin Connections 1 22 6. Memory — Options, Expansion, Map, Address 133 7. System Timing 140 8. Schematics 141 GETTING STARTED WITH YOUR APPLE II Unpacking Don't throw away the packing material . Save it for the unlikely event that you may need to return your Apple II for warrantee repair. If you bought an Apple II Board only, see hardware section in this manual on how to get started. You should have received the following! 1. Apple II system including mother printed circuit board with specified amount of RAM memory and 8K of ROM memory, switching power supply, keyboard, and case assembly. 2. Accessories Box including the following: a. This manual including warranty card . b. Pair of Game Paddles c. A.C. Power Cord d. Cassette tape with "Breakouf'on one side and "Color Demos" on the other side. e. Cassette recorder interface cable (miniature phone jack type) 3. If you purchased a 16K or larger system, your accessory box should also contain: a. 16K Startrek game cassette with High Resolution Graphics Demo ("HIRES") on the flipside. b. Applesoft Floating Point Basic Language Cassette with an example program on the other side. c. Applesoft reference manual 4. In addition other items such as a vinyl carrying case or hobby board peripherial may have been included if specifically ordered as "extras". Notify your dealer or Apple Computer, Inc. immediately if you are missing any items. Warranty Registration Card Fill this card out immediately and completely and mail to Apple in order to register for one year warranty and to be placed on owners club mailing list. Your Apple IPs serial number is located on the bottom near the rear edge. You model number is: A2SJ0OMMX MM is the amount of memory you purchased. For Example: A2S0008X is an 8K Byte Apple II system. Check for Damage Inspect the outside case of your Apple for shipping damage. Gently lift up on the top rear of the lid of the case to release the lid snaps and remove the lid. Inspect the inside. Nothing should be loose and rattling around. Gently press down on each integrated circuit to make sure that each is still firmly seated in its socket. Plug in your game paddles into the Apple II board at the socket marked "GAME I/O" at location J14. See hardware section of this manual for additional detail. The white dot on the connector should be face forward. Be careful as this connector is fragile. Replace the lid and press on the back top of it to re-snap it into place. Power Up First, make sure that the power ON/OFF switch on the rear power supply panel on your Apple II is in the "OFF" position. Connect the A.C. power cord to the Apple and to a 3 wire 120 volt A.C. outlet. Make sure that you connect the third wire to ground if you have only a two conductor house wiring system. This ground is for your safety if there is an internal failure in the Apple power supply, minimizes the chance of static damage to the Apple, and minimizes RFI problems. Connect a cable from the video output jack on the back of the Apple to a TV set with a direct video input jack. This type of set is commonly called a "Monitor". If your set does not have a direct video input, it is possible to modify your existing set. Write for Apple's Application note on this. Optionally you may connect the Apple to the antenna terminals of your TV if you use a modulator. See additional details in the hardware section of this manual under "Interfacing with the Home TV". Now turn on the power switch on the back of the Apple. The indicator light (it's not a switch) on the keyboard should now be ON. If not, check A.C. connections. Press and release the "Reset" button on the keyboard. The following should happen: the Apple's internal speaker should beep, an asterisk ("*") prompt character should appear at the lower left hand corner of your TV, and a flashing white square should appear just to the right of the asterisk. The rest of the TV screen will be made up of radom text characters (typically question marks) If the Apple beeps and garbage appears but you cannot see an "*" and the cursor, the horizontal or vertical height settings on the TV need to be adjusted. Now depress and release the "ESC" key, then hold down the "SHIFT" key while depressing and releasing the P key. This should clear your TV screen to all black. Now depress and release the "RESET" key again. The "*" prompt character and the cursor should return to the lower left of your TV screen. Apple Speaks Several Languages The prompt character indicates which language your Apple is currently in. The current prompt character, an asterisk ("*"), indicates that you are in the "Monitor" language, a powerful machine level language for advanced programmers. Details of this language are in the "Firmware" section of this manual. Apple Integer BASIC Apple also contains a high level English oriented language called Integer BASIC, permanently in its ROM memory. To switch to this language hold down the "CTRL" key while depressing and releasing the "B" key. This is called a control-B function and is similiar to the use of the shift key in that it indicates a different function to the Apple. Control key functions are not displayed on your TV screen but the Apple still gets the message. Now depress and release the "RETURN" key to tell Apple that you have finished typing a line on the keyboard. A right facing arrow (">") called a caret will now appear as the prompt character to indicate that Apple is now in its Interger BASIC language mode. Running Your First and Second Program Read through the next three sections that include: 1. Loading a BASIC program Tape 2. Breakout Game Tape 3. Color Demo Tape Then load and run each program tape. Additional information on Apple II's interger BASIC is in the next section of this manual. Running 16K Startrek If you have 16K Bytes or larger memory in your Apple, you will also receive a "STARTREK" game tape. Load this program just as you did the previous two, but before you "RUN" it, type in "HIMEM: 16384" to set exactly where in memory this program is to run. LOADING A PROGRAM TAPE INTRODUCTION This section describes a procedure for loading BASIC programs successfully into the Apple II. The process of loading a program is divided into three section; System Checkout, Loading a Tape and What to do when you have Loading Problems. They are discussed below. When loading a tape, the Apple II needs a signal of about 2 1/2 to 5 volts peak-to-peak. Commonly, this signal is obtained from the "Monitor" or "earphone" output jack on the tape recorder. Inside most tape recorders, this signal is derived from the tape recorder's speaker. One can take advantage of this fact when setting the volume levels. Using an Apple Computer pre-recorded tape, and with all cables disconnected, play the tape and adjust the volume to a loud but un-distorted level. You will find that this volume setting will be quite close to the optimum setting. Some tape recorders (mostly those intended for use with hi-fi sets) do not have an "earphone" or high-level "monitor" output* These machines have outputs labeled "line output" for connection to the power amplifier. The signal levels at these outputs are too low for the Apple II in most cases. Cassette tape recorders in the $40 - $50 range generally have ALC (Automatic Level Control) for recording from the microphone input. This feature is useful since the user doesn't have to set any volume controls to obtain a good recording. If you are using a recorder which must be adjusted, it will have a level meter or a little light to warn of excessive recording levels. Set the recording level to just below the level meter 1 s maximum, or to just a dim indication on the level lamp. Listen to the recorded tape after you've saved a program to ensure that the recording is "loud and clear". Apple Computer has found that an occasional tape recorder will not function properly when both Input and Output cables are plugged in at the same time. This problem has been traced to a ground loop in the tape recorder itself which prevents making a good recording when saving a program. The easiest solution is to unplug the "monitor" output when recording. This ground loop does not influence the system when loading a pre-recorded tape. Tape recorder head alignment is the most common source of tape recorder problems. If the playback head is skewed, then high frequency information on pre-recorded tapes is lost and all sorts of errors will result. To confirm that head alignment is the problem, write a short program in BASIC. >10 END is sufficient. Then save this program. And then rewind and load the program. If you can accomplish this easily but cannot load pre-recorded tapes, then head alignment problems are indicated. Apple Computer pre-recorded tapes are made on the highest quality professional duplicating machines, and these tapes may be used by the service technician to align the tape recorder's heads. The frequency response of the tape recorder should be fairly good; the 6 KHz tone should be not more than 3 db down from a 1 KHz tone, and a 9 KHz tone should be no more than 9 db down. Note that recordings you have made yourself with mis-aligned heads may not not play properly with the heads properly aligned. If you made a recording with a skewed record head, then the tiny magnetic fields on the tape will be skewed as well, thus playing back properly only when the skew on the tape exactly matches the skew of the tape recorder's heads. If you have saved valuable programs with a skewed tape recorder, then borrow another tape recorder, load the programs with the old tape recorder into the Apple, then save them on the borrowed machine. Then have your tape recorder properly aligned. Listening to the tape can help solve other problems as well. Flaws in the tape, excessive speed variations, and distortion can be detected this way. Saving a program several times in a row is good insurance against tape flaws. One thing to listen for is a good clean tone lasting for at least 3 1/2 seconds is needed by the computer to "set up" for proper loading. The Apple puts out this tone for anout 10 seconds when saving a program, so you normally have 6 1/2 seconds of leeway. If the playback volume is too high, you may pick up tape noise before getting to the set-up tone. Try a lower playback volume. SYSTEM CHECKOUT A quick check of the Apple II computer system will help you spot any problems that might be due to improperly placed or missing connections between the Apple II, the cassette interface, the Video display, and the game paddles. This checkout procedure takes just a few seconds to perform and is a good way of insuring that everything is properly connected before the power is turned on. 1. POWER TO APPLE - check that the AC power cord is plugged into an appropriate wall socket, which includes a "true" ground and is connected to the Apple II. 2. CASSETTE INTERFACE - check that at least one cassette cable double ended with miniature phone tip jacks is connected between the Apple II cassette Input port and the tape recorder's MONITOR plug socket. 3. VIDEO DISPLAY INTERFACE - a) for a video monitor - check that a cable connects the monitor to the Apple's video output port, b) for a standard television - check that an adapter (RF modulator) is plugged into the Apple II (either in the video output (K 14) or the video auxiliary socket (J148), and that a cable runs between the television and the Adapter's output socket. 4. GAME PADDLE INTERFACE - if paddles are to be used, check that they are connected into the Game I/O connector (J14) on the right-hand side of the Apple II mainboard. 5. POWER ON - flip on the power switch in back of the Apple II, the "power" indicator on the keyboard will light. Also make sure the video monitor (or TV set) is turned on. After the Apple II system has been powered up and the video display presents a random matrix of question marks or other text characters the following procedure can be followed to load a BASIC program tape: 1. Hit the RESET key. An asterick, "*", should appear on the lefthand side of the screen below the random text pattern. A flashing white cursor will appear to the right of the asterick. 2. Hold down the CTRL key, depress and release the B key, then depress the "RETURN" key and release the "CTRL" key. A right facing arrow should appear on the lefthand side of the screen with a flashing cursor next to it. If it doesn't, repeat steps 1 and 2. 3. Type in the word "LOAD" on the keyboard. You should see the word in between the right facing arrow and the flashing cursor. Do not depress the "RETURN" key yet . 4. Insert the program cassette into the tape recorder and rewind it. 5. If not already set, adjust the Volume control to 50-70% maximum. If present, adjust the Tone control to 80 maximum. 6. Start the tape recorder in "PLAY" mode and now depress the "RETURN" key on the Apple II. 7. The cursor will disappear and Apple II will beep in a few seconds when it finds the beginning of the program. If an error message is flashed on the screen, proceed through the steps listed in the Tape Problem section of this paper. 8. A second beep will sound and the flashing cursor will reappear after the program has been successfully loaded into the computer. 9. Stop the tape recorder. You may want to rewind the program tape at this time. 10. Type in the word "RUN" and depress the "RETURN" key. The steps in loading a program have been completed and if everying has gone satisfactorily the program will be operating now. LOADING PROBLEMS Occasionally, while attempting to load a BASIC program Apple II beeps and a memory full error is written on the screen. At this time you might wonder what is wrong with the computer, with the program tape, or with the cassette recorder. Stop. This is the time when you need to take a moment and checkout the system rather than haphazardly attempt- ing to resolve the loading problem. Thoughtful action taken here will speed in a program's entry. If you were able to successfully turn on the computer, reset it, and place it into BASIC then the Apple II is probably operating correctly. Before describing a procedure for resolving this loading problem, a discussion of what a memory full error is in order. The memory full error displayed upon loading a program indicates that not enough (RAM) memory workspace is available to contain the incoming data. How does the computer know this? Information contained in the beginning of the program tape declares the record length of the program. The computer reads this data first and checks it with the amount of free memory. If adequate workspace is available program loading continues. If not, the computer beeps to indicate a problem, displays a memory full error statement stops the loading procedure, and returns command of the system to the key- board. Several reasons emerge as the cause of this problem. Memory Size too Small Attempting to load a 16K program into a 4K Apple II will generate this kind of error message. It is called loading too large of a program. The solution is straight forward: only load appropriately sized programs into suitably sized systems. Another possible reason for an error message is that the memory pointers which indicate the bounds of available memory have been preset to a smaller capacity. This could have happened through previous usage of the "HIMEN:" and "LOMEN:" statements. The solution is to reset the pointers by B c (CTRL B) command. Hold the CTRL key down, depress and release the B key, then depress the RETURN key and release the CTRL key. This will reset the system to max- imum capacity. Cassette Recorder Inadjustment If the Volume and Tone controls on the cassette recorder are not properly set a memory full error can occur. The solution is to adjust the Volume to 50-70% maximum and the Tone (if it exists) to 80-100% maximum.* A second common recorder problem is skewed head azimuth. When the tape head is not exactly perpendicular to the edges of the magnetic tape some of the high frequency data on tape can be skipped. This causes missing bits in the data sent to the computer. Since the first data read is record length an error here could cause a memory full error to be generated because the length of the record is inaccurate. The solution: adjust tape head azimuth. It is recommended that a competent technician at a local stereo shop perform this operation. Often times new cassette recorders will not need this adjustment. *Apple Computer Inc. has tested many types of cassette recorders and so far the Panasonic RQ-309 DS (less than $40.00) has an excellent track record for program loading. 8 Tape Problems A memory full error can result from unintentional noise existing in a program tape. This can be the result of a program tape starting on its header which sometimes causes a glitch going from a nonmagnetic to magnetic recording surface and is interpreted by the computer as the record length. Or, the program tape can be defective due to false erasure, imperfections in the tape, or physical damage. The solution is to take a moment and listen to the tape. If any imperfections are heard then replacement of the tape is called for. Listening to the tape assures that you know what a "good" program tape sounds like. If you have any questions about this please contact your local dealer or Apple for assistance. If noise or a glitch is heard at the beginning of a tape advance the tape to the start of the program and re-Load the tape. Dealing with the Loading Problem With the understanding of what a memory full error is an efficient way of dealing with program tape loading problems is to perform the following procedure: 1. Check the program tape for its memory requirements. Be sure that you have a large enough system. 2. Before loading a program reset the memory pointers with the B c (control B) command. 3. In special cases have the tape head azimuth checked and adjusted. 4. Check the program tape by listening to it. a) Replace it if it is defective, or b) start it at the beginning of the program. 5. Then re-LOAD the program tape into the Apple II. In most cases if the preceeding is followed a good tape load will result. UNSOLVED PROBLEMS If you are having any unsolved loading problems, contact your nearest local dealer or Apple Computer Inc. BREAKOUT GAME TAPE PROGRAM DESCRIPTION Breakout is a color graphics game for the Apple II computer. The object of the game is to "knock-out* all 160 colored bricks from the playing field by hitting them with the bouncing ball. You direct the ball by hitting it with a paddle on the left side of the screen. You control the paddle with one of the Apple's Game Paddle controllers. But watch out: you can only miss the ball five times! There are eight columns of bricks. As you penetrate through the wall the point value of the bricks increases. A perfect game is 72(1 points; after five balls have been played the computer will display your score and a rating such as "Very Good". N Terrible'. etc. After ten hits of the ball, its speed with double, making the game more difficult. If you break through to the back wall, the ball will rebound back and forth, racking up points. Breakout is a challenging game that tests your concentration, dexterity, and skill . REQUIREMENTS This program will fit into a 4K or greater system. BASIC is the programming language used. PLAYING BREAKOUT 1. Load Breakout game following instructions in the "Loading a BASIC Program from Tape" section of this manual. 2. Enter your name and depress RETURN key. 3. If you want standard BREAKOUT colors type in Y or Yes and hit RETURN. The game will then begin. 4. If the answer to the previous questions was N or No then the available colors will be displayed. The player will be asked to choose colors, represented by a number from to 15, for background, even bricks, odd bricks, paddle and ball colors. After these have been chosen the game will begin. 10 At the end of the game you will be asked if they want to play again. A Y or Yes response will start another game. A N or No will exit from the program NOTE: A game paddle (150k ohm potentiometer) must be connected to PDL (0) of the Game I/O connector for this game. COLOR DEMO TAPE PROGRAM DESCRIPTION COLOR DEMO demonstrates some of the Apple II video graphics capabilities. In it are ten examples: Lines, Cross, Weaving, Tunnel, Circle, Spiral, Tones, Spring, Hyperbola, and Color Bars. These examples produce various combinations of visual patterns in fifteen colors on a monitor or television screen. For example, Spiral combines colorgraphics with tones to produce some amusing patterns. Tones illustrates various sounds that you can produce with the two inch Apple speaker. These examples also demonstrate how the paddle inputs (PDL(X)) can be used to control the audio and visual displays. Ideas from this program can be incorporated into other programs with a little modification. REQUIREMENTS 4K or greater Apple II system, color monitor or television, and paddles are needed to use this program. BASIC is the pro- gramming language used. 11 BREAKOUT GAME PROGRAM LISTING PROGRAM LISTING -•J T : _it: ■■H.--1 i-j-i =.". = : i_U= * -.'J-^-JU ■J-J-J .- = 3*i_f ■•„".: i ■-. t'l- ■: J-JT: iiWJ l:LT: UH! :*_ i:i-?= i ■" :: .-" U^j^-J _-•_= -J i '-' -■»: i : i : iif; - is ;~v= uii ■'_= uv ;--.;-. i: •*.■■-•_:- iiii.;i s--j~ s uuuu- ~2]= IUL= JK-b I; IrULuK* *t-r ™ EHS.5: :-.i i :=.? -i-Js ^~ ■Li-fi i-J-J-Jv 12 COLOR DEMO PROGRAM LISTING PROGRAM LISTING 0,1001 fvfvr. rii£^ . svs i v:vi» ;_-_- £.-•_• H= HHINI :: 4K UULuR DlHOS"' PR X N1 '-:liL= — 1 4-1 * Tz • sfif: OOii = Cf:D T — 1 "-"-"--■v ■-■- t s ■_■-i trvL"' i-t- ! i: : !T 1~ Z •pi ; r-:if= /if .=. .™; : Hi- s * i ii-i isi.-"-. * l; ntin h:L hi Ls YL In NjL Hi K; HLXI jri= hySUK IHHMn- GO 1 8?^ P-H-fi-rliV-n/lsn: ffM nP=i?= ^0^1! 46 PRIHT ;; 4 TUNHEL" * P R 1 II I ^5 CIRC i = uv?_?-ju ut^ = -JU = U -JL-J r-i 5JlT i l"fir?i KlvjjiJ "HI! HNY i.?i rW. Nrkl UrFJlT * 7z£i i! n : DT;.=T : T=JD!;T Hliiirii nr=lfi Ji- *.' = = L.i:*: ■i:;iUi =?::i^:: i/=_ni? f sir =irl ! II" 1/S Hrti-- lll THEH GOTO 188*1: GOTO 38 TkiDUT ZUW-PU f^r^n nr-::: r-. ^r : j; ; t-.-t inrv= ^-iii/if e/LHU ?L=:JL[/ >UU LINl i: T. r~i . " r * ~ ! ifi T ■' ■" ■" Turn »x: UK I ir 1 riND K^ itllrl GOTO 188*1; GOTO 3^ T-ii? sf;f- "0- ?- T -" J x^^v. t --fi i - I £ i ■ivi" ! -■i •-' - i i 1 /O .•• j^"-. 5 7 -i-lh GOSUB £868; GOSUB 18888 'j-n run i isv t:i i: U ! , ! _". ! D C :1 tv; P:L:": I li ~ ": " : : ~: -. t" :" "j ;! . ~ i" T ■"• •" " -"• h4H K-|f ;';|_~K siKlriTlC^hT?^:! z'227fj S'J 7 J i i "- I iVJif l-Jl rU^ I ~ r J iU -J? t FLU! nsT; HLf^l fisil UUJiUi; viu ^^itj fjiji; ^^; L- U L U K — -J -' si = VLIN 8,39 RT 3tj: VTBB EinJ/c) HOD "" : i TQD Oils TC T £!":*■- ": TMri; r ; r:-i:T !.-■-.. r:": - "™ -■«.-..--.-. .-.-•!-.-. rfurn ^^cii uu^ud id^^di uU!U tj=39-li GObljH 2Mm GOSUB .y-."_* iri-Lyp- r-i-iL' i =_-.-( «•■_ a« = 07 Hi ' POKE -16368 J; POP ; GOTO 13 APPLE II STARTREK VERSION THIS IS A SHORT DESCRIPTION OK HOW TO PLAY STARTREK ON THE APPLE COMPUTER. THE UNIVERSE IS MADE UP OF 64 QUADRANTS IN AN 8 BY 8 MATRIX. THE QUADRANT IN WHICH YOU 'THE ENTERPRISE ■ARE* IS IN WHITEr AND A BLOW UP OF THAT QUADRANT IS FOUND IN THE LOWER LEFT CORNER. YOUR SPACE SHIP STATUS IS FOUND IN A TABLE TO THE RIGHT SIDE OF THE QUADRANT BLOW UP. THIS IS A SEARCH AND DESTROY MISSION. THE OBJECT IS TO LONG-RANGE SENSE FOR INFORMATION AS TO WHERE KLINGONS <K> ARE r MOVE TO THAT QUADRANT, AND DESTROY. NUMBERS DISPLAYED FOR EACH QUADRANT DENOTE t * OF STARS IN THE ONES PLACE * OF BASES IN THE TENS PLACE * OF KLINGONS IN THE HUNDREDS PLACE AT ANY TIME DURING THE GAME r FOR INSTANCE BEFORE ONE TOTALLY RUNS OUT OF ENERGY, OR NEEDS TO REGENERATE ALL SYSTEMS, ONE MOVES TO A QUADRANT WHICH INCLUDES A BASE, IONS NEXT TO THAT BASE (B) AT WHICH TIME THE BASE SELF-DESTRUCTS AND THE ENTERPRISE (E) HAS ALL SYSTEMS "GO' AGAIN. TO play: 1* THE COMMANDS CAN BE OBTAINED BY TYPING THEY ARE! (ZERO) AND RETURN. REGENERATE PHASERS GALAXY RECORD PROBE PROPULSION LONG RANGE SENSORS PHOTON TORPEDOES COMPUTER SHIELD ENERGY 11. LOAD PHOTON TORPEDOES THE COMANDS ARE INVOKED BY TYPING THE NUMBER REFERING TO THEM FOLLOWED BY A 'RETURN". A. IF RESPONSE IS 1 THE COMPUTER EXPECTS »W IF ONE WANTS BETWEEN QUADRANTS AND AN INTERNAL QUADRANT TRAVEL- DURATION OR WARP FACTOR IS THE NUMBER OF SPACES OR QUADRANTS THE ENTERPRISE WILL MOVE. COURSE IS COMPASS READING IN DEGREES FOR THE DESI- RED DESTINATION. B. A 2 REGENERATES THE ENERGY AT THE EXPENSE OF TIME. C. A 3 GIVES THE CONTENTS OF THE IMMEDIATE ADJACENT QUADRANTS. THE GALAXY IS WRAP-AROUND IN ALL DIRECTIONS. B. 4 FIRES PHASERS AT THE EXPENSE OF AVAILABLE ENERGY. 10. DAMAGE REPORT WILL ASK WARP OR TO TRAVEL IN THE ION AND GALAXY IF ONE WANTS ONLY F. 6 G. H. E. 5 INITIATES A SET OF QUESTIONS FOR TORPEDO FIRING. THEY CAN BE FIRED AUTOMATICALLY IF THEY HAVE BEEN LOCKED ON TARGET WHILE IN THE COMPUTER MODE, OR MAY BE FIRED MANUALLY IF THE TRAGECTORY ANGLE IS KNOWN. 8 AND 10 ALL GIVE INFORMATION ABOUT THE STATUS OF THE' SHIP AND ITS ENVIRONMENT. 9 SETS THE SHIELD ENERGY/AVAILABLE ENERGY RATIO. 11 ASKS FOR INFORMATION ON LOADING AND UNLOADING OF PHOTON TORPEDOES AT THE ESPENSE OF AVAILABLE ENERGY. THE ANSWER SHOULD BE A SIGNED NUMBER. FOR EXAMPLE +5 OR -2. I. 7 ENTERS A COMPUTER WHICH WILL RESPOND TO THE FOLLOWING INSTRUCTIONS: 1. COMPUTE COURSE 3. LOCK PHOTON TORPEDOES 4. LOCK COURSE 5, 6. STATUS 7, IN THE FIRST FIVE ONE WILL HAVE TO GIVE COORDINATES. COORDINATES ARE GIVEN IN MATHMATICAL NOTATION WITH THE EXCEPTION THAT THE "Y' VALUE IS GIVEN FIRST. AN EXAMPLE WOULD BE "YrX' 2, LOCK PHASERS COMPUTE TREJECTORY RETURN TO COMAND MODE COURSE OR trajectory; 270- 90 180 THIS EXPLANATION WAS WRITTEN BY ELWOOD WOT RESPONSIBLE FOR ERRORS 14 LOADING THE HI-RES DEMO TAPE PROCEDURE 1. Power up system - turn the AC power switch in the back of the Apple II on. You should see a random matrix of question marks and other text characters. If you don't, consult the operator's manual for system checkout pro- cedures. 2. Hit the RESET key. On the left hand side of the screen you should see an asterisk and a flashing cursor next to it below the text matrix. 3. Insert the HI-RES demo tape into the cassette and rewind it. Check Volume (50-70%) and Tone (8p-lpp%) settings. 4. Type in "C00.FFFR" on the Apple II keyboard. This is the address range of the high resolution machine language sub- program. It extends from $C00 to $FFF. The R tells the computer to read in the data. Do not depress the "RETURN" key yet. 5. Start the tape recorder in playback mode and depress the "RETURN" key. The flashing cursor disappears. 6. A beep will sound after the program has been read in. STOP the tape recorder. Do not rewind the program tape yet 7. Hold down the "CTRL" key, depress and release the B key, then depress the "RETURN" key and release the "CTRL" key. You should see a right facing arrow and a flashing cursor. The B c command places the Apple into BASIC initializing the memory pointers. 8. Type in "LOAD", restart the tape recorder in playback mode and hit the "RETURN" key. The flashing cursor disappears. This begins the loading of the BASIC subprogram of the HI -RES demo tape. 9. A beep will sound to indicate the program is being loaded. 15 10. A second beep will sound, and the right facing arrow will reappear with the flashing cursor. STOP the tape recorder. Rewind the tape. 11. Type in "HIMEM:8192" and hit the "RETURN" key. This sets up memory for high resolution graphics. 12. Type in "RUN" and hit the "RETURN" key. The screen should clear and momentarily a HI -RES demo menu table should appear. The loading sequence is now completed SUMMARY OF HI-RES DEMO TAPE LOADING 1 . RESET 2. Type in C00.FFFR 3. Start tape recorder, hit RETURN 4. Asterick or flashing cursor reappear B c (CTRL B) into BASIC 5. Type in "LOAD", hit RETURN 6. BASIC prompt (7) and flashing cursor reappear. Type in "HIMEN:8192" , hit RETURN 7. Type in "RUN", hit RETURN 8. STOP tape recorder, rewind tape. 16 APPLE II INTEGER BASIC 1. BASIC Commands 2. BASIC Operators 3. BASIC Functions 4. BASIC Statements 5. Special Control and Editing 6. Table A — Graphics Colors 7. Special Controls and Features 8. BASIC Error Messages 9. Simplified Memory Map 10. Data Read/Save Subroutines 11. Simple Tone Subroutines 12. High Resolution Graphics 13. Additional BASIC Program Examples BASIC COMMANDS Commands are executed immediately; they do not require line numbers. Most Statements (see Basic Statements Section) may also be used as commands. Remember to press Return key after each command so that Apple knows that you have finished that line. Multiple commands (as opposed to statements) on same line separated by a M : " are NOT allowed. COMMAND NAME AUTO num AUTO numl, > num2 CLR CON ■DEL numl DEL numl, num2 DSP var HIMEM expr GOTO expr GR Sets automatic line numbering mode. Starts at line number num and increments line numbers by 10. To exit AUTO mode, type a control X*, then type the letters "MAN" and press the return key. Same as above execpt increments line numbers by number num2« Clears current BASIC variables; undimensions arrays. Program is unchanged. Continues program execution after a stop from a control C*. Does not change variables. Deletes line number numl. Deletes program from line numbemuml through line number num2. Sets debug mode that will display variable var every- time that it is changed along with the line number that caused the change. (NOTE: RUN command clears DSP mode so that DSP command is effective only if program is continued by a CON or GOTO command.) Sets highest memory location for use by BASIC at location specified by expression exp^in decimal . HIMEM: may not be increased without destroying program. HIMEM: is automatically set at maximum RAM memory when BASIC is entered by a control B*. Causes immediate jump to line number specified by expression expr. Sets mixed color graphics display mode. Clears screen to black. Resets scrolling window. Displays 40x40 squares in 15 colors on top of screen and 4 lines of text at bottom. LIST LIST numl LIST numl, num2 Lists entire program on screen. Lists program line number numl. Lists program line numberm^ through line number num2. 18 LOAD expr, LOMEM : expv MAN NEW NO DSP var NO TRACE RUN RUN expv SAVE TEXT TRACE Reads (Loads) a BASIC program from cassette tape. Start tape recorder before hitting return key. Two beeps and a " > M indicate a good load, "ERR" or "MEM" FULL ERR" message indicates a bad tape or poor recorder performance. Similar to HIMEM: except sets lowest memory location available to BASIC. Automatically set at 2048 when BASIC is entered with a control B*. Moving LOMEM: destroys current variable values. Clears AUTO line numbering mode to all manual line numbering after a control C* or control X*. Clears (Scratches) current BASIC program. Clears DSP mode for variablet?ar>. Clears TRACE mode. Clears variables to zero, undimensions all arrays and executes program starting at lowest statement line number. Clears variables and executes program starting at line number specified by expression expr. Stores (saves) a BASIC program on a cassette tape. Start tape recorder in record mode prior to hitting return key. Sets all text mode. Screen is formated to display alpha-numeric characters on 24 lines of 40 characters each. TEXT resets scrolling window to maximum. Sets debug mode that displays line number of each statement as it is executed. Control characters such as control X or control C are typed by holding down the CTRL key while typing the specified letter. This is similiar to how one holds down the shift key to type capital letters. Control characters are NOT displayed on the screen but are accepted by the computer. For example, type several control G's. We will also use a superscript C to indicate a control character as in X c . 19 BASIC Operators Symbol Sample Statement Prefix Operators ( ) 10 X= 4*(5 + X) + 20 X= 1+4*5 30 ALPHA = -(BETA +2) NOT 40 IF A NOT B THEN 200 Explanation Expressions within parenthesis ( ) are always evaluated first. Optional; +1 times following expression Negation of following expression. Logical Negation of following expression; if expression is true (non-zero), 1 if expression is false (zero). Arithmetic Operators + 66 Y = X+3 7J0 LET D0TS=A*B*N2 Exponentiate as in X' shifted letter N. NOTE + is Multiplication. NOTE: Implied multi- plication such as (2 + 3) (4) is not allowed thus N2 in example is a variable not N * 2. / 80 PRINT GAMMA/S Divide MOD 90 X = 12 MOD 7 100 X = X M0D(Y+2) Modulo: first exp + 110 P = L + G Add _ 120 XY4 = H-D Substract 130 HEIGHT=15 140 LET SIZE=7*5 150 A(8) = 2 155 ALPHA$ = "PLEASE" Modulo: Remainder after division of first expression by second expression Assignment operator; assigns a value to a variable. LET is optional 20 Relational and Logical Operators The numeric values used in logical evaluation are "true" if non-zero, "false" if zero. Symbol Sample Statement Explanation 16? IF D = E THEN 500 Expression "equals" expression 17? IF A$(l,l) "Y" THEN 500 # or < > 180 IF ALPHA #X*Y THEN 500 # 190 IF A$ # "NO" THEN 500 > 200 IF A>B THEN GO TO 50 < 210 IF A+l<B-5 THEN 100 >= 220 IF A>=B THEN 100 <= 230 IF A+l<=B-6 THEN 200 AND 240 IF A>B AND C<D THEN 200 OR 250 IF ALPHA OR BETA+1 THEN 200 String variable "equals?' string variable Expression "does not equal" expression. String variable "does not equal" string variable. NOTE: If strings are not the same length, they are considered un-equal . < > not allowed with strings Expression "is greater than" expression Expression "is less than" expression. Expression "is greater than or equal to" expression. Expression "is less than or equal to" expression. Expression 1 "and" expression 2 must both be "true" for statements to be true If either expression 1 or expression 2 is "true", statement is "true". 21 BASIC FUNCTIONS Functions return a numeric result. They may be used as expressions or as part of expressions. PRINT is used for examples only* other statements may be used. Expressions following function name must be enclosed between two parenthesis signs. FUNCTION NAME ABS (expr) 300 PRINT ABS(X) ASC (str$) 31Qf PRINT ASC("BACK M ) 320 PRINT ASC(B$) 330 PRINT ASC(B$(4,4)) 335 PRINT ASC(B$(Y)) LEN (str$) 340 PRINT LEN(B$) PDL (expr) 350 print PDL(X) PEEK (expr) 360 PRINT PEEK(X) RND (expr) 370 PRINT RND(X) Gives absolute value of the expression expr. Gives decimal ASCII value of designated string variable str$ . If more than one character is in designated string or sub-string, it gives decimal ASCII value of first character, Gives current length of designated string variable etr$i.e. 9 number of characters. Gives number between and 255 corres- ponding to paddle position on game paddle number designated by expression expr and must be legal paddle (0,1,2, or 3) or else 255 is returned. Gives the decimal value of number stored of decimal memory location specified by expression expr. For MEMORY locations above 32676, use negative number; i.e., HEX location FFFGf is -16 Gives random number between and (expression expr -1) if expression expr is positive; if minus, it gives random number between and (expression expr +1). Sm(exprl, 380 PRINT SCRN (XI, Yl) Gives color (number between and 15) of expr2) screen at horizontal location designated by expression exprl and vertical location designated by expression expr2 Range of expression exprl is to 39. Range of expression expr2 is to 39 if in standan mixed colorgraphics display mode as set by GR command or p to 47 if in all color mode set by POKE -163J04 ,jD: POKE - 16302,0. SGN (expr) 39/) PRINT SGN(X) Gives siqn (not sine) of expression expr i.e., -1 if expression expr is negative, zero zero and +1 if expr is positive. 22 BASIC STATEMENTS Each BASIC statement must have a names must start with an alpha c numeric characters up to iffl. of the following words: AND, AT, not begin with the letters END, with a $ (dollar sign). Multipl if separated by a : (colon) as 1 (including spaces) is less than Most statements may also be used by RUN or GOTO commands. line number between and 32767. Variable haracter and may be any number of alpha- Variable names may not contain buried any MOD, OR, STEP, or THEN. Variable names may LET, or REM. String variables names must end e statements may appear under the same line number ong as the total number of characters in the line approximately 150 characters as commands. BASIC statements are executed NAME CALL expv 10 CALL-936 C0L0R=5xpr 30 C0L0R=12 DIM vavl (expvl) stv$ (expv2) Vav2 (expv 3) DSP VOV 50 DIM A(20),B(10) 60 DIM B$(30) 70 DIM C (Z) Illeqal: 80 DIM A(30) Leqal : 85 DIM C(1000) Leqal : 90 DSP AX: DSP L Illeqal: 100 DSP AX,B 102 DSP AB$ 104 DSP A(5) Legal : 105 A=A(5): DSP A Causes execution of a machine level language subroutine at decimal memory location specified by expression expv Locations above 32767 are specified using negative numbers; i.e., location in example 10 is hexidecimal number $FC53 In standard resolution color (GR) graphics mode, this command sets screen TV color to value in expression expv in the range to 15 as described in Table A. Actually expression expv may be in the range to 255 without error message since it is implemented as if it were expression expv MOD 16. The DIM statement causes APPLE II to reserve memory for the specified variables. For number arrays APPLE reserves approximately 2 times expv bytes of memory limited by available memory. For string arrays -stv$-(expv) must be in the range of 1 to 255. Last defined variable may be redimensioned at any time; thus, example in line is illegal but 85 is allowed. Sets debug mode that DSP variable vav each time it changes and the line number where the change occured. 23 NAME END EXAMPLE DESCRIPTION 110 END Stops program execution. Sends carriage return and "> " BASIC prompt) to screen. Begins FOR... NEXT loop, initializes variable var to value of expression exprl then increments it by amount in expression expr 3 each time the corresponding "NEXT" statement is encountered, until value of expression expr 2}$ reached. If STEP exprZ is omitted, a STEP of +1 is assumed. Negative numbers are allowed. FOR var= 110 FOR L=0 to 39 exprl J0expr2 120 FOR X=Y1 TO Y3 S7tPexpr3 130 FOR 1=39 TO 1 150 GOSUB 100 *J2 GOSUB expr 140 GOSUB 500 GOTO expr GR 160 GOTO 200 170 GOTO ALPHA+100 180 GR 190 GR POKE -16302,0 HLIN exprl > expr2Mexpr3 Note Causes branch to BASIC subroutine starting at legal line number specified by expression expr Subroutines may be nested up to 16 levels. Causes immediate jump to legal line number specified by expression expr. Sets mixed standard resolution color graphics mode. Initializes COLOR = (Black) for top 40x40 of screen and sets scrolling window to lines 21 through 24 by 40 characters for four lines of text at bottom of screen. Example 190 sets all color mode (40x48 field) with no text at bottom of screen. In standard resolution color graphics mode, this command draws a horizontal line of a predefined color (set by C0L0R=) starting at horizontal position defined by expression exprl and ending at position expr2 at vertical position defined by expression exprd .exprl ar)dexpr2 must be in the range of to 39 and exprl < = expr2 • exprZ be in the range of to 39 (or to 47 if not in mixed mode). HLIN 0, 19 AT is a horizontal line at the top of the screen extending from left corner to center of screen and HLIN 20,39 AT 39 is a horizontal line at the bottom of the screen extending from center to right corner. 200 HLIN 0,39 AT 20 210 HLIN Z,Z+6 AT I 24 IF_ expression 220 IF A> B THEN THEN statement PRINT A 230 IF X=0 THEN C=l 240 IF A#10 THEN GOSUB 200 250 IF A$(l,l)# "Y" THEN 100 Illegal: 260 IF L> 5 THEN 50: ELSE 60 Legal : 270 IF L> 5 THEN 50 GO TO 60 If expression is true (non-zero) then execute statement-, if false do not execute statement I f statement is an expression, then a GOTO expr type of statement is assumed to be implied. The "ELSE 11 in example 260 is illegal but may be implemented as shown in example 270. INPUT varU 280 INPUT X,Y,Z(3) var2 3 str$ 290 INPUT "AMT", DLLR 300 INPUT "Y or N? A$ IN# expr 310 IN# 6 320 IN# Y+2 330 IN# LET 340 LET X=5 LIST nurnl, 350 IF X > 6 THEN num2 LIST 50 NEXT varl 3 360 NEXT I var2 370 NEXT J,K Enters data into memory from I/O device. If number input is expected, APPLE wil output "?"; if string inout is expected no "?" will be outputed. Multiple numeric inputs to same statement may be separated by a comma or a carriage return. String inputs must be separated by a carriage return only. One pair of " " may be used immediately after INPUT to output prompting text enclosed within the quotation marks to the screen. Transfers source of data for subsequent INPUT statements to peripheral I/O slot (1-7) as specified as by expression expr. Slot is not addressable from BASIC. IN#0 (Example 330) is used to return data source from peripheral I/O to keyboard connector. Assignment operator. "LET" is optional Causes program from line number nvml through line number num2 to be displayed on screen. Increments corresponding "FOR" variable and loops back to statement following "FOR" until variable exceeds limit. NO DSP var 380 NO DSP I NO TRACE 390 NO TRACE Turns-off DSP debug mode for variable Turns-off TRACE debug mode 25 PLOT expvl, expv2 400 PLOT 15, 25 400 PLT XV, YV POKE expvl , expr2 420 POKE 20, 40 430 POKE 7*256, XM0D255 POP 440 POP In standard resolution color graphics, this command plots a small square of a predefined color (set by C0L0R=) at horizontal location specified by expression expvl in range to 39 and vertical location specified by express i on expr 2 in range to 39 (or to 47 if in all graphics mode) NOTE: PLOT is upper left and PLOT 39, 39 (or PLOT 39, 47) is lower right corner. Stores decimal number defined by expression expv2 in range of 255 at decimal memory location specified by expression expvl Locations above 32767 are specified by negative numbers. "POPS" nested GOSUB return stack address by one. PRINT varl> vav 3 stv$ i i REM £ expr RETURN 450 PRINT LI 460 PRINT LI, X2 470 PRINT "AMT= M ;DX 480 PRINT A$;B$; 490 PRINT 492 PRINT "HELLO" 494 PRINT 2+3 500 PR# 7 510 REM REMARK 520 RETURN 530 IFX= 5 THEN RETURN Outputs data specified by variable vav or string variable stv$ starting at current cursor location. If there is not trailing \" or ";" (Ex 450) a carriage return will be generated. Commas (Ex. 460) outputs data in 5 left justified columns. Semi-colon (Ex. 470) inhibits print of any spaces Text imbedded in " " will be printed and may appear multiple times. Like IN#, transfers output to I/O slot defined by expression expr is video output not I/O slot 0. PR# No action. All characters after REM are treated as a remark until terminated by a carriage return. Causes branch to statement following last GOSUB; i.e., RETURN ends a subroutine. Do not confuse "RETURN" statement with Return ke^ on keyboard. 26 TAB expr 530 TAB 24 540 TAB 1+24 550 IF A#B THEN TAB 20 TEXT 550 TEXT 560 TEXT CALL-936 Moves cursor to absolute horizontal position specified by expression expr in the range of 1 to 40. Position is left to right Sets all text mode. Resets scrolling window to 24 lines by 40 characters. Example 560 also clears screen and homes cursor to upper left corner TRACE 570 TRACE 580 IFN> 32000 THEN TRACE Sets debug mode that displays each line number as it is executed. VLIN exprl 3 expr 2 AT expr 3 VTAB expr 590 VLIN 0, 39AT15 600 VLIN Z,Z+6ATY 610 VTAB 18 620 VTAB Z+2 Similar to HLIN except draws vertical line starting at exprl and ending at expr2 at horizontal position expr3. Similar to TAB. Moves cursor to absolute vertical position specified by expression expr in the range 1 to 24. VTAB 1 is top line on screen; VTAB24 is bottom. 27 SPECIAL CONTROL AND EDITING CHARACTERS "Control" characters are indicated by a super-scripted "C" such as G . They are obtained by holding down the CTRL key while typing the specified letter. Control characters are NOT disolaved on the TV screen. B and C must be followed by a carriage return. Screen editing characters are indicated by a sub-scripted "E" such as D^. They are obtained by pressing and releasing the ESC key then typing specified letter. Edit characters send information only to display screen and does not send data to memory. For example, U c moves to cursor to right and copies text while &£ moves cursor to right but does not copy text. CHARACTER RESET key DESCRIPTION OF ACTION Immediately interrupts any program execution and resets computer. Also sets all text mode with scrolling window at maximum. Control is transfered to System Monitor and Apple prompts with a "*" (asterisk) and a bell. Hitting RESET key does NOT destroy existing BASIC or machine language program. Control B If in System Monitor (as indicated by a "*"), a control B and a carriage return will transfer control to BASIC, scratching (killing) any existing BASIC program and set HIMEM: to maximum installed user memory and LOMEM: to 2048. Control C If in BASIC, halts program and displays line number where stop occurred*. Program may be continued with a CON command. If in System Monitor, (as indicated by "*") control C and a carraige return will enter BASIC without killing current program. Control G Control H Control J Control V Sounds bell (beeps speaker) Backspaces cursor and deletes any overwritten characters from computer but not from screen. Apply supplied keyboards have special key "«-" on right side of keyboard that provides this functions without using control button Issues line feed only r Compliment to H . Forward spaces cursor and copies over written characters. Apple keyboards have "+" key on right side which also performs this function. Control X Immediately deletes current line * If BASIC program is expecting keyboard input, you will have to hit carriage return key after typing control C. 28 CHARACTER DESCRIPTION OF ACTION Move cursor to right Move cursor to left Move cursor down Move cursor up Clear text from cursor to end of line Clear text from cursor to end of page Home cursor to top of page, clear text to end of page. Table A: APPLE II COLORS AS SET BY COLOR = Note: Colors may vary depending on TV tint (hue) setting and may also be changed by adjusting trimmer capacitor C3 on APPLE II P.C. Board Of = Black 1 - Magenta 2 = Dark Blue 3 = Light Purple 4 = Dark Green 5 = Grey 6 = Medium Blue 7 = Light Blue 8 9 10 11 12 13 14 15 Brown Orange Grey Pink Green Yellow Blue/Green White 29 Special Controls and Features Hex BASIC Example Display 1 fade Controls C05O C051 C052 C053 C054 10 POKE -16304,0 20 POKE -16303,0 30 POKE -16302,0 40 POKE -16301,0 50 POKE -16300,0 C055 C056 C057 60 POKE -16299,0 70 POKE -16298,0 80 POKE -16297,0 TEXT Mode Controls 0020 90 POKE 32, LI 0021 100 POKE 33, Wl 0022 110 POKE 34, Tl 0023 120 POKE 35, Bl 0024 130 CH=PEEK(36) 140 POKE 36, CH 150 TAB(CH+1) 0025 160 CV=PEEK(37) 170 POKE 37, CV 180 VTAB(CV+1) 0032 190 POKE 50,127 200 POKE 50,255 FC58 210 CALL -936 FC42 220 CALL -958 Description Set color graphics mode Set text mode Clear mixed graphics Set mixed graphics (4 lines text) Clear display Page 2 (BASIC commands use Page 1 only) Set display to Page 2 (alternate) Clear HIRES graphics mode Set HIRES graphics mode Set left side of scrolling window to location specified by LI in range of to 39. Set window width to amount specified by Wl. L1+W1<40. W1>0 Set window top to line specified by Tl in range of to 23 Set window bottom to line specified by Bl in the range of to 23. B1>T1 Read/set cusor horizontal position in the range of to 39. If using TAB, you must add H l" to cusor position read value; Ex. 140 and 150 perform identical function. Similar to above. Read/set cusor vertical position in the range to 23. Set inverse flag if 127 (Ex. 190) Set normal flag if 255(Ex. 200) (@e) Home cusor, clear screen (Fe) Clear from cusor to end of page 30 Hex BASIC Example FC9C 230 CALL -868 FC66 240 CALL -922 FC70 250 CALL -912 Description (Eg) Clear from cusor to end of line (J C ) Line feed Scroll up text one line Miscellaneous C030 C000 C010 C061 C062 C063 C058 C059 C05A C05B C05C C05D C05E C05F 360 X=PEEK(-16336) 365 POKE -16336,0 370 X=PEEK(-16384) 380 POKE -16368,0 390 X=PEEK(16287) 400 X=PEEK(-16286) 410 X=PEEK(-16285) 420 POKE -16296,0 430 POKE -16295,0 440 POKE -16294,0 450 POKE -16293,0 460 POKE -16292,0 470 POKE -16291,0 480 POKE -16290,0 490 POKE -16289,0 Toggle speaker Read keyboard; if X>1 27 then key was pressed. Clear keyboard strobe - always after reading keyboard. Read PDL(0) push button switch. If X>127 then switch is "on". Read PDL(l) push button switch. Read PDL(2) push button switch. Clear Game I/O AN0 output Set Game I/O AN0 output Clear Game I/O AN1 output Set Game I/O AN1 output Clear Game I/O AN2 output Set Game I/O AN2 output Clear Game I/O AN3 output Set Game I/O AN3 output 31 APPLE II BASIC ERROR MESSAGES *** SYNTAX ERR *** > 32767 ERR *** > 255 ERR *** BAD BRANCH ERR *** BAD RETURN ERR *** BAD NEXT ERR *** 16 GOSUBS ERR *** 16 FORS ERR *** NO END ERR *** MEM FULL ERR *** TOO LONG ERR *** DIM ERR Results from a syntactic or typing error. A value entered or calculated was less than -32767 or greater than 32767. A value restricted to the range to 255 was outside that range. Results from an attempt to branch to a non- existant line number. Results from an attempt to execute more RETURNS than previously executed GOSUBs. Results from an attempt to execute a NEXT state ment for which there was not a corresponding FOR statement. Results from more than 16 nested GOSUBs. Results from more than 16 nested FOR loops. The last statement executed was not an END. The memory needed for the program has exceeded the memory size allotted. Results from more than 12 nested parentheses or more than 128 characters in input line. Results from an attempt to DIMension a string array which has been previously dimensioned. *** RANGE ERR An array was larger than the DIMensioned value or smaller than 1 or HLIN,VLIN, PLOT, TAB, or VTAB arguments are out of range. *** STR OVFL ERR *** STRING ERR RETYPE LINE The number of characters assigned to a string exceeded the DIMensioned value for that string. Results from an attempt to execute an illegal string operation. Results from illegal data being typed in response to an INPUT statement. This message also requests that the illegal item be retyped. 32 Simplified Memory Map FFFF E000 C000 XX 7FF 64K 56K Monitor and BASIC Routines in ROM Future enhancement or user supplied PROMS 52K 48K Peripheral I/O XX (HIMEM:) » User specified RAM memory size User Workspace (LOMEM:) 2K IK Screen Memory Internal Workspace 33 READ/SAVE DATA SUBROUTINE INTRODUCTION Valuable data can be generated on the Apple II computer and sometimes it is useful to have a software routine that will allow making a permanent record of this information. This paper discusses a simple subroutine that serves this purpose. Before discussing the Read/Save routines a rudimentary knowledge of how variables are mapped into memory is needed. Numeric variables are mapped into memory with four attributes. Appearing in order sequentually are the Variable Name, the Display Byte, the Next Variable Address, and the Data of the Variable. Diagramatically this is represented as: VN DSP NVA DATA ( (?) DATA(l) DATA(N) h n+l VARIABLE NAME - up to 100 characters represented in memory as ASCII equi- valents with the high order bit set. DSP (DISPLAY) BYTE - set to 01 when DSP set in BASIC initiates a process that displays this variable with the line number every time it is changed within a program. NVA (NEXT VARIABLE ADDRESS) - two bytes (first low order, the second high order) indicating the memory location of the next variable. DATA - hexadecimal equivalent of numeric information, represented in pairs of bytes, low order byte first. 34 String variables are formatted a bit differently than numeric ones. These variables have one extra attribute - a string terminator which desig- nates the end of a string. A string variable is formatted as follows: VN DSP NVA DATA(Q0 DATA(l) DATA(n) ST 1 hi h 2 h n+l VARIABLE NAME - up to 100 characters represented in memory as ASCII equi- valents with the high order bit set. DSP (DISPLAY) BYTE - set to 01 when DSP set in BASIC, initiates a process that displays this variable with the line number every time it is changed within a program. NVA (NEXT VARIABLE ADDRESS) - two bytes (first low order, the second high order) indicating the memory location of the next variable. DATA - ASCII equivalents with high order bit set. STRING TERMINATOR (ST) - none high order bit set character indicating END of string. There are two parts of any BASIC program represented in memory. One is the location of the variables used for the program, and the other is the actual BASIC program statements. As it turns out, the mapping of these within memory is a straightforward process. Program statements are placed into memory starting at the top of RAM memory* unless manually shifted by the "HIMEM:." command, and are pushed down as each new (numerically larger) line numbered statement is entered into the system. Figure la illustrates this process diagramatically. Variables on the other hand are mapped into memory starting at the lowest position of RAM memory - hex $800 (2048) unless manually shifted by the "LOMEM :" command. They are laid down from there (see Figure lb) and continue until all the variables have been mapped into memory or until they collide with the program statements. In the event of the latter case a memory full error will be generated *Top of RAM memory is a function of the amount of memory. 16384 will be the value of "HIMEM:" for a 16K system. 35 The computer keeps track of the amount of memory used for the variable table and program statements. By placing the end memory location of each into $CC-CD(204-205) and $CA-CB(203-204) , respectively. These are the BASIC memory program pointers and their values can be found by using the statements in Figure 2. CM defined in Figure 1 as the location of the end of the variable tape is equal to the number resulting from statement a of Figure 2. PP, the program pointer, is equal to the value resulting from statement 2b. These statements (Figure 2) can then be used on any Apple II computer to find the limits of the program and variable table. FINDING THE VARIABLE TABLE FROM BASIC First, power up the Apple II, reset it, and use the CTRL B (control B) command to place the system into BASIC initializing the memory pointers. Using the statements from Figure 2 it is found that for a 16K Apple II CM is equal to 2048 and PP is equal to 16384. These also happen to be the values of LOMEN and HIMEN: But this is expected because upon using the B c command both memory pointers are initialized indicating no program statements and no variables. To illustrate what a variable table looks like in Apple II memory suppose we want to assign the numeric variable A ($C1 is the ASCII equivalent of a with the high order bit set) the value of -1 (FF FF in hex) and then examine the memory contents. The steps in this process are outlined in example I. Variable A is defined as equal to -1 (step 1). Then for convenience another variable - B - is defined as equal to (step 2). Now that the variable table has been defined use of statement 2a indicates that CM is equal to 2060 (step 3). LOMEN has not been readjusted so it is equal to 2048. Therefore the variable table resides in memory from 2048 ($800 hex) to 2060 ($8JBC). Depressing the "RESET" key places the Apple II into the monitor mode (step 4). We are now ready to examine the memory contents of the variable table. Since the variable table resides from $800 hex to $80C hex typing in "800. 80C" and then depressing the "RETURN" key (step 5) will list the memory contents of this range. Figure 3 lists the contents with each memory location labelled. Examining these contents we see that CI is equal to the variable name and is the memory equivalent of "A" and that FF FF is the equivalent of -1. From this, since the variable name is at the beginning of the table and the data is at the end, the variable table representation of A extends from $800 to $805. We have then found 36 the memory range of where the variable A is mapped into memory. The reason for this will become clear in the next section. READ/SAVE ROUTINE The READ/SAVE subroutine has three parts. The first section (lines 0-10) defines variable A and transfers control to the main program. Lines 20 through 26 represents the Write data to tape routine and lines 30-38 represent the Read data from tape subroutine. Both READ and SAVE routines are executable by the BASIC "GOSUB X" (where X is 20 for write and 30 is for read) command. And as listed these routines can be directly incorporated into almost any BASIC program for read and saving a variable table. The limitation of these routines is that the whole part of a variable table is processed so it is necessary to maintain exactly the dimension statements for the variables used. The variables used in this subroutine are defined as follows: A = record length, must be the first variable defined CM= the value obtained from statement a of figure 2 LM= is equal to the value of "LOMEM:" Nominally 2048 SAVING A DATA TABLE The first step in a hard copy routine is to place the desired data onto tape. This is accomplished by determining the length of the variable table and setting A equal to it. Next within the main program when it is time to write the data a GOSUB20 statement will execute the write to tape process. Record length, variable A, is written to tape first (line 22) followed by the desired data (line 24). When this process is completed control is returned to the main program, READING A DATA TABLE The second step is to read the data from tape. When it is time a GOSUB30 statement will initiate the read process. First, the record length is read in and checked to see if enough memory is available (line 32-34). If exactly the same dimension statements are used it is almost guaranteed that there will be enough memory available. After this the variable table is read in (line 34) and control is then returned to the main program (line 36). If not enough memory is available then an error is generated and control is returned to the main pro- gram (line 38) 37 EXAMPLE OF READ/SAVE USAGE The Read/Save routines may be incorporated directly into a main program. To illustrate this a test program is listed in example 2. This program dimensions a variable array of twenty by one, fills the array with numbers, writes the data table to tape, and then reads the data from tape listing the data on the video display. To get a feeling for how to use these routines enter this program and explore how the Read/Save routines work. CONCLUSION Reading and Saving data in the format of a variable table is a relatively straight forward process with the Read/Save subroutine listed in figure 4. This routine will increase the flexibility of the Apple II by providing a permanent record of the data generated within a program. This program can be reprocessed. The Read/Save routines are a valuable addition to any data processing program. 38 Var Var2 t LOMEN $800 V^. Var, Unused Memory Pi p 3 ••• Pn-2 / t CM End of 'PP beginning Variable of Table D Program Pn-1 HIMEM Max System Size Variable Data BASIC Program Figure 1 a) PRINT PEEK(204) + PEEK(205)*256 -»■PP b) PRINT PEEK(202) + PEEK(203)*256 -* CM Figure 2 800 801 802 803 804 805 806 807 808 809 80A 80B 80C CI 00 06 08 FF FF C2 00 0C 08 00 00 00 VAR DSP NAM L H NVA I L H DATA VAR DSP NAM -* 1 L H NVA I DATA i Figure 3 $800. 80C rewritten with labelling 39 FIGURE 4b READ/SAVE PROGRAM % A=0 10 GOTO 100 20 PRINT "REWIND TAPE THEN START TAPE RECORDER" : INPUT "THEN HIT RETURN" COMMENTS This must be the first statement in the program. It is initially 0, but if data is to be saved, it will equal the length of the data base. This statement moves command to the main program. Lines 20-26 are the write data to tape subroutine. 22 A=CM-LM: POKE 60,4: POKE 61,8: POKE 62,5: POKE 63,8: CALL -307 24 POKE 60, LM MOD 256: POKE 61, LM/256: POKE 62, CM MOD 256: POKE 63, CM/256: CALL -307 26 PRINT "DATA TABLE SAVED": RETURN 30 PRINT "REWIND THE TAPE THEN START TAPE RECORDER" : INPUT "AND HIT RETURN", BS 32 POKE 60,4: POKE 61,8: POKE 62,5: POKE 63,8: CALL -259 34 IF A<0 THEN 38: P=LM+A: IF P>HM THEN 38: CM=P: POKE 60, LM MOD 256: POKE 61, LM/256: POKE 62, CM MOD 256: POKE 63, CM/256 CALL -259 36 PRINT "DATA READ IN": RETURN 38 PRINT "***TOO MUCH DATA BASE***": RETURN Writing data table to tape Returning control to main program. Lines 30-38 are the READ data from tape subroutine. Checking the record length (A) for memory requirements if everything is satisfactory the data is READ in. Returning control to main program NOTE: CM, LM and A must be defined within the main program 40 1 >A=1 > 2 >B=0 > 3 >PRINT PEEK (204) + PEEK (205) * 256 computer responds with= 2060 5 *800.80C Define variable A=-l , then hit RETURN Define variable B=0, then hit RETURN Use statement 2a to find the end of the VARIABLE TABLE Hit the RESET key, Apple moves into Monitor mode. Type in VARIABLE TABLE RANGE and HIT the RETURN KEY. Computer responds with: 0800- CI 00 86 08 FF FF C2 00 0808 0C 08 00 00 00 Example 1 41 Example 2 >LIST 8 fi=8 18 GOTO 188 d6 REM wait uhir iu mrt Kuuuiit 22 R=CH-LH: POKE 66,4: POKE 61 ,8s POKE 62,5: POKE 63 f 8: CfiLL -307 l4 ru!L b^iLH nliU £3be i"Ur-.L bl frttb: PUKE b£,Ln flUI/ cOb : POKE 63 5 Crf/?56; CRLL -38? 118 PRINT 3 26 NuHBtRS GtHERRlLL iHL DHIfl"; PRINT H yNLN YOU fiRE R COtW C7QD7 ~ur nr :-■!-{-»■,-]-: tl- n"" L.JUM JiiiFit lili_ ■£. , _-'JiL-*Li''. ii'i £L'--"_'it D HODE nil KL1UKM' ijb bhLL "ooi rKi.Nl "Os sKillHU Drt Tfi TO WUi GOSOB 28 2b RETURN -iu PF* prDfi RpTfl- CnDprsliTIMr Oc r>Li3 Ri.fiL- fcTui! juuP.uUi tii=_ 32 POKE §3,4: POKE 6!, 8; POKE o4 if Hb sHlN oo;t"-LftTn; ir r/ HH THEN 38:CH=Pj POKE 68.LH HOD ,CH HOD 256; POKE 63,011/256 : COLL -259 36 RETURN 38 PRINT **** TOO iiCH DHTH 8RSE *# * H : EHD 188&IHMCt) f H28> 185 FOR 1=1 T0 28:X(I)=I: HEKT T i 188 LH=2848:Ci?=2l8b:B=58;HH=i6383 int ^.cb; ihbLt nWJ Ktni> lilt L'fl Tft FRGH TRPE" i-jfj sub i-i :!= i-w.rA iy-bl sKini B K(*;I; 5 )= s ja(I)e NEXT I J IHrui nnu ihLn nil r,Llu?.n M iC-. DD?'.!7 ='G £ Q i'-'-J j ii:J! it sfl J -i .-. .- n. .— : : p. .». .-. 198 FOR 1=1 TO 28; PRIHT "K< re 1 1 j 195 PRIHT 'THIS IS THE EHD 8 288 EHD 42 A SIMPLE TONE SUBROUTINE INTRODUCTION Computers can perform marvelous feats of mathematical computation at well beyond the speed capable of most human minds. They are fast, cold and accurate; man on the other hand is slower, has emotion, and makes errors. These differences create problems when the two interact with one another. So to reduce this problem humanizing of the computer is needed. Humanizing means incorporating within the computer procedures that aid in a program's usage. One such technique is the addition of a tone subroutine. This paper discusses the incorporation and usage of a tone subroutine within the Apple II computer. Tone Generation To generate tones in a computer three things are needed: a speaker, a circuit to drive the speaker, and a means of triggering the circuit. As it happens the Apple II computer was designed with a two-inch speaker and an efficient speaker driving circuit. Control of the speaker is accomplished through software. Toggling the speaker is a simple process, a mere PEEK - 16336 ($C030) in BASIC statement will perform this operation. This does not, however, produce tones, it only emits clicks. Generation of tones is the goal, so describing frequency and duration is needed. This is accomplished by toggling the speaker at regular intervals for a fixed period of time. Figure 1 lists a machine language routine that satisfies these requirements. Machine Language Program This machine language program resides in page of memory from $02 (2) to $14 (20). $00 (00) is used to store the relative period (P) between toggling of the speaker and $01 (01) is used as the memory location for the value of relative duration (D). Both P and D can range in value from $00 (0) to $FF (255). After the values for frequency and duration are placed into memory a CALL2 statement from BASIC will activate this routine. The speaker is toggled with the machine language statement residing at $02 and then a 43 delay in time equal to the value in $00 occurs. This process is repeated until the tone has lasted a relative period of time equal to the duration (value in $01) and then this program is exited (statement $14). Basic Program The purpose of the machine language routine is to generate tones controllable from BASIC as the program dictates. Figure 2 lists the appropriate statement that will deposit the machine language routine into memory. They are in the form of a subroutine and can be activated by a GOSUB 32000 statement. It is only necessary to use this statement once at the beginning of a program. After that the machine language program will remain in memory unless a later part of the main program modifies the first 20 locations of page 0. After the GOSUB 32000 has placed the machine language program into memory it may be activated by the statement in Figure 3. This statement is also in the form of a GOSUB because it can be used repetitively in a program. Once the fre- quency and duration have been defined by setting P and D equal to a value between and 255 a GOSUB 25 statement is used to initiate the generation of a tone. The values of P and D are placed into $00 and $01 and the CALL2 command activates the machine language program that toggles the speaker. After the tone has ended control is returned to the main program. The statements in Figures 2 and 3 can be directly incorporated into BASIC programs to provide for the generation of tones. Once added to a program an infinite variety of tone combinations can be produced. For example, tones can be used to prompt, indicate an error in entering or answering questions, and supplement video displays on the Apple II computer system. Since the computer operates at a faster rate than man does, prompting can be used to indicate when the computer expects data to be entered. Tones can be generated at just about any time for any reason in a program. The programmer's imagination can guide the placement of these tones. CONCLUSION The incorporation of tones through the routines discussed in this paper will aid in the humanizing of software used in the Apple computer. These routines can also help in transforming a dull program into a lively one. They are relatively easy to use and are a valuable addition to any program. 44 8 8 8 S - FF 8891- FF 8082 — RD 30 6885 — o o d C-s & £ _ r —* *LJ ^_' =_ : D8 84 @ 8 S 8 — Cb 81 Ca d M Q i..* kj kj n 88 888C- Cfi 088D- D8 F6 088F- fib 88 0011- 4C 8£ 8014- 68 l:h LuR $C838 hh DEY BHE ^80H1J L.-* L_ =_- -Sr-Ts i BEQ £ 8 8 1 4 DEa a- 1 ' 1 L_ ^pjfjfi^ LDf : : £ 6 8 T M O ■ir i~~ C-i Ci o •*■' *-.= r _= *J L... R TC FIGURE 1. Machine Language Program adapted from a program by P. Lutas. ottoc r^ht LfUJl rm. 6 t *6l rUKL 9,1: POKE i§,?46 poke ie.pj f £8,96: RETURN . } K!T:i- lU*i,t rUFsL i7sUs K'f-L FIGURE 2. BASIC "POKES" ca riat ftjf; rmt i,us U1LI RETURN FIGURE 3. GOSUB 45 High- Resolution Operating Subroutines These subroutines were created to make programming for High-Resolution Graphics easier, for both BASIC and machine language programs. These subroutines occupy 757 bytes of memory and are available on either cassette tape or Read-Only Memory (ROM). This note describes use and care of these subroutines. There are seven subroutines in this package. With these, a programmer can initialize High-Resolution mode, clear the screen, plot a point, draw a line, or draw and animate a predefined shape, on the screen. There are also some other general-purpose subroutines to shorten and simplify programming. BASIC programs scan access these subroutines by use of , the CALL statement, and can pass information by using the POKE state- Bent. There are special entry points for most of the subroutines that will perform the same functions as the original subroutines without modifying any BASIC pointers or registers. For machine language programming, a JSR to the appropriate subroutine address will perform the same function as a BASIC CALL. In the following subroutine descriptions, all addresses given will be in decimal. The hexadecimal substitutes will be preceded by a dollar sign ($) . All entry points given are for the cassette tape subroutines, which load into addresses C00 to FFF (hex). Equivalent addresses for the ROM subroutines will be in italic type face. 46 High- Resolution Operating Subroutines INIT Initializes High-Resolution Graphics mode From BASIC: CALL 3072 (or CALL -12288) From machine language: JSR $C00 (or JSR $DfT{T0) This subroutine sets High-Resolution Graphics mode with a 280 x 16? matrix of dots in the top portion of the screen and four lines of text in the bottom portion of the screen. INIT also clears the screen. CLEAR Clears the screen. From BASIC: CALL 3B86 (or CALL -12274) From machine language: JSR $C0E (or JSR $Djf0E) This subroutine clears the High-Res61ution screen without resetting the High-Resdlution Graphics mode. PLOT Plots a point on the screen. From BASIC: CALL 378JBT (or CALL -1158&) From machine language: JSR $C7C (or JSR $D07C) This subroutine plots a single point on the screen. The X and Y coodinates of the point are passed in locations 800, 801, and 802 from BASIC, or in the A, X, and Y registers from machine language. The Y (vertical) coordinate can be from 47 High-Rcsloution Operating Subroutines PLOT (continued) (top of screen) to 159 (bottom of screen) and is passed in location 802 or the A-register; but the X (horizontal) coordinate can range from (left side of screen) to 279 (right side of screen) and must be split between locations 800 (X MOD 256) and 801 (X/256).or, from machine language, between registers X (X LO) and Y (X HI). The color of the point to be plotted must be set in location 812 ($32C). Four colors are possible: is BLACK, 85 ($55) is GREEN, 170 ($AA) is VIOLET, and 255 ($FF) is WHITE. POSN Positions a point on the screen. From BASIC: CALL 3761 (or CALL -11S99J From machine language: JSR $C26 (or JSR $D(f26) This subroutine does all calculations for a PLOT, but does not plot a point .(** leaves the screen unchanged). This is useful when used in conjumction with LINE or SHAPE (described later). To use this subroutine, set up the X and Y coordinates just the r. saae as for PLOT. The color in location 812 ($32C) is ignored. LINE Draw a line on the screen. 48 High-Resolution Operating Routines LINE Draws a line on the screen. From BASIC: CALL 3786 (or CALL -US74) Fron machine language: JSR $C95 (or JSR $t>(?9S) This subroutine draws a line from the last point PLOTted or POSN»ed to the point specified. One endpoint is the last point PLOTted or POSN'ed; the other endpoint is passed in the sane manner as for a PLOT or POSN. The color of the line is set in location 812 ($32C). After the line is drawn, the new endpoint becomes the base endpoint for the next line drawn. SHAPE Draws a predefined shape on the screen. From BASIC: CALL 3805 (or CALL -11555) From machine language: JSR $DBC (or JSB $D1BC) This subroutine draws a predefined shape on the screen at the point previously PLOTted or POSN'ed. The shape is defined by a table.. of vectors in memory. (How to create a vector table will be described later). The starting address of this table should be passed in locations 804 and 805 from BASIC .or in':the Y and X registers from machine language. The color of the shape should be passed in location 28 ($1C). There are two special variables that are used only with shapes: the scaling factor and the rotation factor . The scaling factor determines the relative size of the shape. A scaling factor of 49 Hi gh-Resolution Operatin g Subroutines SHAPE (continued) 1 will cause the shape to be drawn true sire, while a scaling factor of 2 will draw the shape double size, etc. The scaling factor is passed in location 806 from BASIC or $32F from machine language. The rotation factor specifies one of 64 possible angles of rotation f.r the shape. A rotation factor of will cause the shape to be drawn right-side up. where a rotation factor if 16 will draw the shape rotated 90° clockwise, etc. The rotation factor is passed in location 807 foom BASIC of in the A-register fron machine language. The table of vectors which defines the shape to be drawn is a series of bytes stored in memory. Each byte is divided into three sections, and each section specifies whether or not to plot a point and also a direction to move (up, down, left, or right). The SHAPE subroutine steps through the vector table byte by byte, and then through each byte section by section. When it reaches a 00 byte, it is finished. The three sections are arranged in a byte like this: In I i 14 !»)*!» ! £ I i * OiOPD *' 00 ! itf>" > I 1 4: »rr A : ~T » •• <r Each bit^ir'DD^ptcifies a* direction to move, and the two bits P specify whether or not to plot a point before moving. Notice that the last section (most significant bits) does not have a P field, so it can only be a move without plotting. IThe SHAPE 50 High-Resolution Operating Subroutines SHAPE (continued) subroutine processes the sections from right to left (least significant bit to most significant bit). IF THE REMAINING SECTIONS OF THE BYTE ARE ZERO, THEN THEY ARE IGNORED. Thus, the byte cannot end with sections of 00 (move up without plotting). Here is an example of how to create a vector table: Suppose we want to draw a shape like this First, draw it on graph paper, one dot per square. Then decide where to start drawing the shape. Let's start this one in the center. Next, we must draw a path through each point in the shape, using only 90 angles on the turns.! Next, re-draw the shape as a series of vectors, each one moving one place up, down, left, or right, and distin guish the vectors that plot a point before moving: Now "unwrap* 1 those vectors and write *them in a straight line. Now draw a table like the one in Figure 1. For each vector in the line, figure the bit code and place it in the next available section in the table. If it will not fit or is a 00 at. the end of a byte, then skip that section and go on to the next. When you have finished 51 Hi gh-Resolution Operating Subr outines SHAPE (continued) coding all vectors, check your work to make sure it is accurate. Then make another table (as in figure 2) and re-copy the coded vectors from the first table. Then decode the vector information int o a series of hexadecimal bytes, using the hexidecimal code table in figure 3. This series of hexidecimal bytes is your shape definition table, which you can now put into the Apple H's memory and use to draw that shape on the screen. 52 5 V, *.p v e c t~ «> r 5 O^^^^itf -7 *">»-* *7^^*<* <0 I Z 3 1 S c 7 8 o i <s5 i i o o O I oo o I o 1 o oi I OO o • o boo t_ A C s A o <S5 * * 1 1 1 «*<• OO O ti I o o ^t* o I ^ » O I ^-* I o ^i 1 1 o <r& 1 I «• o o o ■5tf»cT CooCS *J <- E~t|»4- t ; 05 i a a> i i I i © l I I I 1 1 J t-rV o /- c or * *A»^e. Op L^) 1 2 3F Z <f> 64 2 O I 5 3 (, <8 7 F i o o olopo o oi r t. O oo o -} o O © O V -* i o e> t o "7 t. o o i -* 3 i o o -7> ^ o i o I -} J O I V O -7 ° I I ~7 1 o o o -^ -7 7 B I o I o O O -^ C I I O 1 -y t> I 1 I ft -7 E II II "* F 53 . • « = • -06^ Cs vLL"?.-0yOG; rU3n-0; O: , : ■■••" a-. : i -J -I s 3 if &«£/ wv^Kl I lt£.=1 j^'Ur.L CO — ¥DIR» Y=— Ys- IF Y<8 IHEH Y-Vt 7£Q : ~i~ pnii'T 5£& id.^* PfWF :":« = elB . XU )=( n( I )-?! )*9/18fV; V( I )=( 8b IfiLL iNi!:X= KHD ^4)*!^ f RHD (3)*85*85; GGSUB 2888 s bHLL ruUi ■IU II- k'HD (1888K1 IHEH 388= IF Lfi."^„ ■■-"• i •: s_L.if : :-: : lI 1. ~:i"_^:! _■■•• bO^s LULL bHHfxi; fiLhl Kl bUbUu 3888: GOTO fel8 ru-r-. .-• •- -. i -LLic. rr ■Ji/ck nn •=?=/ js iJ*iJl if AivS UK tl)u? OR ¥I<8 OR YDI59 JHEH -I'-i* K — K I = I — T 1 1 bUbUt? coBH; UiLL •_in-_ s uvj'.«= jy-j-j s yysy yi» 'His UUiUS IssSb ^UKL c'liis KHU * '.; :jUKiv^: i"Lj: ; Lf: :";T rijf.c nn« ■■L' "i.'vH- 1 L"_ •■=_*:: : •_• _ : ■-J: "• 1 :.- " . i i-:i -j --»» :=i. t i J -j -_ : _ : '_■L ! ~ L ! %.' "■: «J '_ : J V U : J'.=u OfJi_L =_-i r:/T , -0-_:~Q.j: e— £f?L- : : -. 0/~C T r.l riifL? c50i ruKi Fi|i":.-L-Jvt i l?p.s_ yyL|i'i;J t-iiLL '& )v'j>' 1 o;?Vintoi^AU>-£: HtX! I bUo UHLL IHiiz HIIKt HHH,Hj CBLL :i:- : ::: : ! : v-t-i. i.i ; ^.r t. :-••_■• -•-■i^. - ■". . - rr - -. = lOIV- f:~-7- i si I- \ i *; UUjUD l.uuus "LiUKfl £m$ I^U^t bl^vsA HUD c^n; FijKt HHi ■JHHH |h PttK ~lbou4)ur8 THEN RETURN b : Hr f Y= tHLL LiNtz HUKL b ! yy? (279-K) HOD ?5£' POKE 881 5 K( POKE 888,23; POKE 881 ^ 1= POKE OC:^ i=-ii_v: rot I I TMT l-:^^ ■• l_ij: ; r- ^|:KJ- Hrjkr Z ri)l ^^K= Kl't?!- >=il -v J '_':-.^ «y«jn ;s-_-L- j.-_-_*a 1 -jr-.i. v v i fA/C-J-Js fUr-.L OSCe-vJ L-llLL Lifit! K-K^k : DIR^B: IF K/-8 HNO n : <388 L s "* ill. 1 ; L -J"-. L. , ; » i7i_j": : is !V- ! ! J!£! 54 ROD'S COLOR PATTERN PROGRAM DESCRIPTION ROD'S COLOR PATTERN is a simple but eloquent program. It generates a continuous flow of colored mosaic-like patterns in a 40 high by 40 wide block matrix. Many of the patterns generated by this program are pleasing to the eye and will dazzle the mind for minutes at a time. REQUIREMENTS 4K or greater Apple II system with a color video display. BASIC is the programming language used. PROGRAM LISTING V& 1-Uk y=3 iO i8 1 !-'t :; i s : i L : i :: :Vi. DIP" i:~- ■• Au T <~.: .-.- ■.. ^ - _ • - Jr Tj '.'«' 5 s- : -'i i»~ f J r.= i 55 PROGRAM LISTING: PONG ■:t-i/Ui_ -Ji^i. i« i.v. it i-iJJ L.v If Hi : -J J s vis: ;:: ■?'-. i"i. uLl-;---J: ••L.i-': • : -J-J ::■« s • SL. i « -/t;-?-t -V -IH i.iH Uk"=K: H :i; a-I.-Y f a-« lilLn t I U~ f=Dj ? / H.i n-.*t~~n; [}-.-:■Uliil? C=-i intf ITnTSi NL^I ■v.* i =!!_!! _'«-_'?■. eJ3 ir H ifttn «D5m/=U rui { i!M UULUk=b= VLIN P(l>,rI^j Hi ■■I7I i|j:i -lir^S 1 \' r Ft i j :-Kt* '-: i J'^S)- }iV6) IHLH VLIN PiI;tSt|.^4 RT39sP(3)=p{i) is If s Ss :*ni HD-U: Tl DfSWOs'O'i TiirB VLIN u=riy)~I Hi B* ih riJ) {'Pf:-'"i TMfii Uj IM p="gUs4-f ^Q III V UULUk = »= ih H(U)>Flu) ! HEN : _ l : i ii Li j. ! : :.■: ;_: ii : G: IT 0:' Ci V TLi-1 U«*V/ i i:i « a ii JV/ TCf i OCr- VLili P-.** /i" Z- "=" is -j^ s-Ti, -nr^ r-.i: ;.;■: r- X-ZiH j™ '^rr-:7; ■Hr ."i ."h,™ ?v i v?"-. :~i ii,' i^sij- i L.L.: *■, iUw^ ! . •■j i- •• •:=-■/ :_-.*". ; !■==_■■i-j-j ■;v/; ii :"-'_' iiti.n : : ~S '-. i !hui v-i-s i- i"ii : l- •■■s-n ■™;: i -:/ :+i 56 COLOR SKETCH PROGRAM DESCRIPTION Color Sketch is a little program that transforms the Apple II into an artist's easel, the screen into a sketch pad. The user as an artist has a 40 high by 40 wide (1600 blocks) sketching pad to fill with a rainbow of fifteen colors. Placement of colors is determined by controlling paddle inputs; one for the horizontal and the other for the vertical. Colors are selected by depressing a letter from A through P^ on the keyboard. An enormous number of distinct pictures can be drawn on the sketch pad and this program will provide many hours of visual entertainment. REQUIREMENTS This program will fit into a 4K system in the BASIC mode. 57 PROGRAM LISTING: COLOR SKETCH z. pfigT :- ! f?Q* Df-iT jiQt pfii-T « fui_- *_.,_; 0. !'_»%_, -Jj'iQ. rUM. Tiijfi-i rUf-.L -J. s iC-J« fUKL Ds« s PfiiT 7 *"'-'= pHiT i£0. DfssT e « >jFii. ; «-js_* fur-.E- i-^i-wi t ur-X •/,i_-^ ; Tui-.L _UrlO-j s fUM. ii ,1: POKE i£ f £88; POKE 13,4 " ig pf.iT- *--- iOO B DsItT iK OA* Dfi.T iGjCto; ru?-.L _;=;). fUf-L lo'j xttL-, ! v'Iil i7.ii ! iff-.*. L-Vii'.'i POKE 21,2: POKE 22,8: *POKE 23,96- j^ f-Ts 3e/i{S i. ■T_"v7 ; i"_H e _00^ iv _-*<t L** VTC'/i ii_r=! ■'.-Hi.-. J.JM C-J H- LLHDt/; i UK _>i iy ill Uu^Uu hV PRINT Ptf? 7^" MrzT ? : ■~:lT H J- _ s -""■•"• : ~*~ .— :.-r--9-. - .; : is nr-irt ST-.: : AQ Dt-f=rnDvD1T;UT ilDO; ~ rHMDIItrD iG7 45 B$="TH1S PROGRfiH fiLLOyS VOU TO s POKE UOH HOD £56: POKE £4 f i ! _M:- Lt ,: J : ii E L'Pii. L ! $r-."-. i l _-i-_._- W.GOSUB 38: GOSUB £5; PRIHT : OSUB 38; GOSUE £5 DD S-. itnCiiD .48. f ■•L' -Jt •iUJ'Jl? "J i '. _->■-' TiT: ? LET uOSOB 25= PRINT « GGSUB 58 uu.'Ud c-Ji rr. ins i GGSUB £5= PRIHT i :-.ni: i i ;-.i)ii i « '.- J U" iJ S V Jt *j1S '_■t ~ ::.:-!-!: rir^riv SETT rirT:i-i:!l fji- i Tup 7*0 a". a pDTUT D-t: ; 7if 7i 1« 14b C£= SCRK(X f Y):C3=15: IF C£= 15 THEN C3=5, C0LuK=C3f PLOT Etnin «o^ IF PEEK (-16384 )#1d@ THEH 15: iP-Gst-5: piiVV _i£0£0 Q; DfivT 39: CRLL -936 QDTliT « D-t-_«|- -;"— -lee j— Af} rr-j-g : VTRB £4; GGSUB £5: IHPUT u r -* / ? D* = if b* I j, i /- L- THEH 118; PRINT 5 END"; END ; UKt -I636S.8: GOTO l£b 58 B$ = ~SkETCH COLORED F IuUREh W 05 i;^-' : LUy KLbULU ! llliH bkHPHllb Hi i H PQnoi re** opTiipM <_*-_= r-.r-.-iu. iuEi-i'.'s -vjj'jw l'-.'s r-.i_s-.T-.il 7S k$z- : &: tE^y-Hti: Ce"eCeeD GRi^iV-O-i 75 KK=£B;T0H-£6^ GOSUB 35; RETURN HOi rLBG THlN I3j; COLOk-C :iE*j-j^:4- i.nLEii- -J-.t Ul i U-Jii 58 MASTERMIND PROGRAM PROGRAM DESCRIPTION MASTERMIND is a game of strategy that matches your wits against Apple's* The object of the game is to choose correctly which 5 colored bars have been secretly chosen by the computer. Eight different colors are possible for each bar - Red (R), Yellow (Y), Violet (V), Orange (0), White (W), and Black (B). A color may be used more than once. Guesses for a turn are made by selecting a color for each of the five hidden bars. After hitting the RETURN key Apple will indicate the correctness of the turn. Each white square to the right of your turn indicates a correctly colored and positioned bar. Each grey square acknowledges a correctly colored but improperly posi- tioned bar. No squares indicate you're way off. Test your skill and challenge the Apple II to a game of MASTERMIND. REQUIREMENTS 8K or greater Apple II computer system. BASIC is the programming language. 59 PROGRAM LISTING: MASTERMIND J. WW ! :P.t'L i:-JL- -uw 'is : tl. ! : fv : • I w / si."'. -J .-' ;;":■. w , s AV. .- : ~-Ji A-?~ L : =ij ; ? -jfe& 8; HUH 8*39 RT V;FlHSH=h FOR Pi - 1 I U -J I m =1 ,- - ; uU jUD 1 ub« = NEKT H*H=1 0££ pf;p yDTT = - TO. iiki'vTS-- Dfri'' www :L-i-, 3?;ti : i ■-_• iVji-Li" * US. P. XMijR P;[N fiRLL ~^S4 ^FT^ INV^i^F -IF) s.-i.-. rtr-i; jww* KLh P0KE~lb368 CLRS KBD STROBE ww tw fit-i: w: ::„=_ _*ww w=-UE*_; -Jw?:i.i-j- »i»l/ hl iu ifiL UH11L Ur nniiLKni"!/! uu?, iiDOLwi i j iu uULio D wULU niriun HUllHLi Oh uULbbtbs iHlK r ddt rirrur r:?L~~Q~!a7 c-r-.i adc "= i- iit-.u ^iwiii ^i--^ti_i;= vw=_w:_= iw *_• n u 1= l r ft u n s - uUUL?"b ^K!Hi " is :U ii li l~l iv w* ii i-.j- ■■/ :•_}•.-"■. ss-r"- i .' ) 1HLN NLK! 1; ir I z ^ THEN j~iiwr HLXI yni i ; hLHHH = I ~FlR5H= 4MM wULUk^Id^H^w! ["UK I = i !& h' i: ii •!-■_! is: ti? Owe. wULUK : I >U j; NiSf ;; ir mu IHLK fe HrtU iKKiw Itttfi t-'K 1 h I 'liUOU 4HHH Ktr_f| S = nIS 16 - 58 INTRO £;i "::.-: wi. M CTbsTC ": -i is _ "• : Q k-ETU CT^IIw -wiw ai_u ji-iij iww ii'j nL?? 3L = UT 'iwCb rlLli blPlI Cww HLs UUL^b 4838 REH STMTS 388-318 USER INPUT AaA& pfis C7=? ^^^ r;-rrr n-rt- iSiLii DCis CMDO i&&& vCil HD • TsiT :www :-i_SE _»Ji.Ti *www WUu.w"-. LiiTi- om m n rKlHi u s: : : : :i: iiil ii::i Pii. ! iw LJL-Jin :L::I ivv wHLL ""OOO; If rtC! ™ib^ST/ 16L :HLN 1ww= FUKt ~lbwbSj Lis HP - pDTMT : ChD T-i Tn wi w:-. t )!i!1i 3 ■Vi i~i !=_: Q^r^T^- vUh /OU'r rrii !">.«• u=wi-- v-.-vt- u-=i, wULUi-fi i)= iillN I*4*c«I*4 BT 39* PRIHT ;:":•? i ^ i / a s : ti_n ! i t i f- T~! ! _ ! _ji- nri T:! ~ r.r.r:^ s ;__-.__ ii^ iivi-n: hfe in; : Thin! " LLIILK KEYS FOR COLOR CHflNGE"i PRIHT HKKU= Rty^i I" UK nUVrinCL fiW Wd Zk" i PRIHT 3 HIT RETURN TO RCC H BVLKfiGE 5 |i Ir 1 RV>I4 iHEn -384;' IBB 5i PRIHT £ HIT mi KEY iw r^_;:- iiw-ii:; s •>*_» i 'J IVV J. www 11" N~o it1t.:1 KL I UfiN s w'JLL'K" K(H(H))*FLrlSHi HLIH N*4-£,H* £888 IF H(IK>P<3} THEH RETORH ; £i-«i- = Dl hT Oiii-U" V= DDTUT 5J-H T ir !!_»_'! L.1 • I! ' i> j ! * !iil!? ?•-!— r i::".: ' ; : HU >-B; L«. -i i=55 st i UKN 60 BIORHYTHM PROGRAM PROGRAM DESCRIPTION This program plots three Biorhythm functions: Physical (P), Emotional (E), and Mental (M) or intellectual. All three functions are plotted in the color graphics display mode, Biorhythm theory states that aspects of the mind run in cycles. A brief description of the three cycles follows: Physical The Physical Biorhythm takes 23 days to complete and is an indirect indicator of the physical state of the individual. It covers physical well-being, basic bodily functions, strength, coordination, and resistance to disease. Emotional The Emotional Biorhythm takes 28 days to complete. It indirectly indicates the level of sensitivity, mental health, mood, and creativity. Mental The mental cycle takes 33 days to complete and indirectly indicates the level of alertness, logic and analytic functions of the individual, and mental recep- tivity. Bio rhythms Biorhythms are thought to affect behavior. When they cross a "baseline" the functions change phase - become unstable - and this causes Critical Days. These days are, according to the theory, our weakest and most vulnerable times. Acci- dents, catching colds, and bodily harm may occur on physically critical days. Depression, quarrels, and frustration are most likely on emotionally critical days. Finally, slowness of the mind, resistance to new situations and unclear thinking are likely on mentally critical days. REQUIREMENTS This program fits into a 4K or greater system. BASIC is the programming language used. 61 PROGRAM LISTING: BIORHYTHM uiWt 170 = DsWl 0. £0. Dftfr™ 4«I^i* HUKL t)j 16^?; HUKL b>« e DH-T 7 00* DHVr iiOs DfliT * i -*r-.s_ >,«*.* i v:l y f *.*«-'« ■lt-.j- » Ok0 = Dni^L iQ i£n = Dfii/r i: s s i. : Mi-'L t "J "_ : L'£L?s afiisL i'j £ I '-;'-. L. iTji.'vi t ! «?F>.L. i-_'ti_ :i t UF-.i. 198* POKE 19 f h POKE £8 =76= UU 1 U oD tt_-!. --j-Hri "j. nr-jiriL: « 'j ; =_ ! rv.i_ issR iivL' i_-js= t yr-.i. i_- f a DlTMDU ,H,DjYii = Y , KY(I88}*I988 7_3/H_V*: J s!Yj'ti.tja TC 11/ Li TUlU i Ii' v -J* 1 , ii/i. .' 'L-r U !«■-.« ISii.it Ji-U-iOiOSO. Dr?=iQk: ft— -1 ! LsLvL: F>.i_ • Ut:l ^ HIN MtfjR^ Rl^ "'!) RC"'*-': Pi' '-:'": L? j v .-" i ii i :"vTJ t LA S_ .- ~ S-*jy » I POKE 34»2§; GOSUB 28: GOSUB J=I: bk I rUKt y't.c.j. "Uf, n- 18 TO cB: COLORE: HLIH 8,31 QT vi LOT Vt Lll Til 1 QT Mi r ; . nuA! fit SfUill ifv M! Hi E: ?TBB 21 Vj; IF Y<18 THEH PRIHT a ~i I rKiHi ii sii-ni T; FRIHT 1E9 ¥TBB £3, PRINT "DfiVS LIVED s ,i:. rr-.u ?- in Os ffiinD-ii^ Jn; ruK i~i fJ .■-?■^jLurri-. I=lHb*(i=£HS*(I=3)s ?LIN '- '"0 ST OOiT + Ts UTGD 0.4 SfOJ HI OO'i + i, 7JMU E-T iilj l"UK n = ^ IU ^i^r-ln nuy d?m/ +K) HOD BV(D. GOSUB 56; FLO! tD s KtiUKN -■-' i -Ji': 1 - i s i Ui ■HUE/ Lv ! Jj : U:i_ L.T ;0H/£5&ti= POKE SrKK= CRL .; : i ;y r : f : In" /;A i ;;••■% r - ?* rlrl^ "; inb 13; mH! DDTJJT HDTDTU n S5 rnciiD 7k TiHD LLl ihQ Cli ^fLi^! Diiin 138 PRINT i IHPUT "HHOTHER PLOi CY/H i S-svs TUCi itB i /' i5=j/ Lj — -44-: J-'jS * rlrr I- -litii : ; "; ":iki "41-! - :' : i- : s i rid '":.;. :-■-•■T • -. .• t n-Fi .!.-;.• : '•- -■i r^ -. E H-3S*( rl)39 )^fi^( fi(48 )i RETURN .05 PRINT "FORlCHST ~i; GOSUB 75 . t ii ;r-.»_= iifLSi «i~it l t_ *•_■-«■_ ' Vlhb CjI |Hn ib" e KKlnl TUKLtu ST DhTE a ;fi; H , s ;Dr f E jY: ¥THB t=. vi/_7 t Ts-:£ s cnCUD 7S* pCTiipU ■_ s _ : r-.F-. - - a tl: _ i«* U-J^IUU !Ut t\"_ s UF-.i" 62 DRAGON MAZE PROGRAM PROGRAM DESCRIPTION DRAGON MAZE is a game that will test your skill and memory. A maze is constructed on the video screen. You watch carefully as it is completed. After it is finished the maze is hidden as if the lights were turned out. The object of the game is to get out of the maze before the dragon eats you. A reddish-brown square indicates your position and a purple square represents the dragon's!* You move by hitting a letter on the keyboard; U for up, D for down, R for right, and L for left. As you advance so does the dragon. The scent of humans drives the dragon crazy; when he is enraged he breaks through walls to get at you. DRAGON MAZE is not a game for the weak at heart. Try it if you dare to attempt out-smarting the dragon. REQUIREMENTS 8K or greater Apple II computer system. BASIC is the programming language. Color tints may vary depending upon video monitor or television adjustments 63 PROGRAM LISTING: DRAGON MAZE 2 PRIHT 5 yELC8Ht TO THE DRhGOH'S rf hLl.1 3 PRIHT- s tOU Mi iRTCB HHILE I BUI i nn"i|T ■sn-rr nyrn i~r rri»ni rrr r f hKini DL?= SslUs ii 5 LUhfLLtLj 1 ; LL ERRSE 5 •J i Rifii iiiu !*.*_•< UKi_x ii iL.it iiib l.i_ UfiLT itt nl milt* ru ^UU bUflr 1 FT. ini id e!Uvl.;-IUO Hi I i flfo RIGHT." 7 DpTUT 3E s 3 ■? CHD ilTT MM tHD MD i s tit?s l. i ur-. ■_!_! it y i yr-. «j; • HHiT ; DDTMT «Jri' CfiD iSHiikl ?•& M^T UT T iQ DDTkIT =TUr flBTpPT, TC Lug vHH f?U t bKLtn »0T b [1 PRINT 2 Tp G'M T^ TuV nnn^ HM w li : tii:!: ; 'j -Js- i I -_• t s ts- :,• '•.•-«.':■. ■-■:! 5 Hi- nt ^H.T -JTi-fS IS PRIHT H BEF0RE THE DRflGOH (THE RE Cb ^rUilt I3 f L?Lh ttLrifat iUb LHtl J) Et ii, b? L.i rriiFit tilt Hi'.-i ndl. JnC i-KsiauH CBH'T GEP cc PRINT "THROUGH IT! ) s 8S Din H$(3) ,; ihrui n* l68 OR C0L0R-15 -r,-.r. -' r.r- : T-r,f~-T =.-.-.r-.tr r — i .;.-.:: j! Ihb' d) "Kin! uHKl ^, jHhn HOH s i i -j mn v t jj Hi il HLIH y,^7 Hi il HtK! T I3S i u£"£ 1881 I - UK. 1- i i y i ? ; ~i 1 i- i i r nt A i 1898 Q=R+D+Ltl) 1180 IF (0(3 RHD RHD (IB He) OR *£-'*} INlH iii'u III» l/R = KH& 4; 1128 GOTO IISB-WDR f 1 * Y~^tl iiuv ?t_iti -J-»"i L. f g^! i Hi -J-*"-.:" i .- i i'j-j ±*j S li i ■Juif i 1 .4 D TC UHT ft TiirU 1 t iS= rs^i/ ~%i V Tl8;Y=¥*i ii-iK L-i T LI 0~v_0 QiV_1 ST 0~/v_i I 146 GOTO 1835 : unt i nu > L 1155 ¥LIH 3*Y-2 f 3*i-l nT m, i i -JD UU i L= i & 'J-J iiyc ir nU! u InlN iiiS;au-i^; : llb3 HLiH ^X-c,3¥K-l HI '6*U bUI U 183; 14 PRIH 1 " BEiRRE! !!!!!;!! SOHtllHtS CRH'T GO OVER* ):S(K)=- BBS (H(K));C=C-i t l w • •■;= turn i «£ s t o-M; j/i. • • 8 IF Y=13 THEN 1878;H1M3> 11% 1=^1= bUiu iH3b ■jQzk rnCiiD ^5ii|5s ppTMT ; =TUl M07C T- ALL"- 1 UvJUU vvvit fr.iin t^i- Hi-i-L. A. EflDY" 1285 GR i C0L0R=I5 u i r%ih Hin!= iUU L-tiii v~ it-ii ILL mMl n sHLL" ■si ■~ zzi ir R=i ihLR i83Ba=riU-W/S iSoo ir i=I irttli ig7b;U=nu-ij;/ 'ftl HLiii H,X> Hi o: HLiH H, OQ OT -7Q •j j tit -j/ 1 CCS A- i ; i - Shy i-j Jt i ; LULUr -0 « 64 DRAGON MAZE cont. 1516 c$m £828 £116 UY= RHD (13)4-1 "■ft: r-n_^. ••: :•* -(j.!!-..! -*": -':^i:U i IrULUS— £ij ?i,in O'hsM ~c^ 0*3? ~i fiT 39 C y — * j i C V — y V K~ Till--. K-'lQ-itfitl tr *Aliib !t1t_rt 1568 Q8=K; GGSUB 7888; K=QS IF 5X=X m SY=Y THEN 8888 II" R= ICmA"K'J InLn C&jv ir i.-'_ £■-{-/ e-'« ■•. r-iry ":r;A3 ir ?,- rtoU U i intfi oM IF K= BSC( S D 3 ) THEN 3588 r.j : i r. it. .-, yft=i:uf=B 4888 FK=3*K-£iFY=3*Y-c; FOR 1=1 TO FX=FX+DX:FY=FY+DY hUR K=s III I hUR L=b !U I; D: AT Ur'i.V Livi.ii UtVT i ifs.. rf'i AD- 1; PLOT FM, Fitl; NEKT L,K: NEXT I - : ■-. ¥-Yii:V: V-V iijV ilih it £=io mv 'i-m irttN bti*Jtf £128 GOTO 1588 £518 IF H(X+i3*(Y-i"M> HOD 18 THEN 2588 GOTO 2828 3588 DK=8:DY=1 3518 It H(X+13*<Y-1)>/18 THEN 438b 4818 4828 4838 . ,: .'Lu» Ii 1 GOTO 1588 .'0 ul>j<ju >j*jQv 4138 GOTO 1588 4288 bOSUB 5888 4218 C0L0R-15 *fj_i-Q !!!_in iJ^'ift 1 / f -J*-!, iii ui", I i 4H3& 4388 4318 4338 5B88 GOTO 1588 GOSUB 5888 C0L8R=15 HLIH3*(HU*XflT3*Y GOTO 1588 S=S-1: FOR 1-1 TO 28: B= PEEK ^-loJ-Jb^ Ptth ■■.-i&o'jb.rt rtU (-16336)+ PEEK (-16336): HEKT 6888 6828 6838 I i RETURN "LIT «1 •.-;?* *» KKiHi "Hid «iN5' GOSUB 5888; GOSUB 5888: G0S1 5888 PRINT s SC0RE= n ;St3 END ih a/3a ihe.fi fodj; it* i/3i ihtH 7858 TC vYCv TUrLi 7' £3= TC t - , -"-~y TLJl« ii iijn irtLn /ioel 1^ ij( ifitn IF SX=I3 THEN 7858; IF KSX* 13*tSY-l)»9THEH7B18s IF H(SX*13*(SY-i» HDD 18 THEN DX=i:DY=8 7 SOp 7822 KX=3?SX-£; RY=3*SY-£ ■"•*C¥.i : i.ry 7823 FOR 1=1 TO 3sRX=RX*DX:RY=RY+ L- : > 7824 C0LOR=8 7825 FOR K=8 TO 1: FOR 1=8 TO h PLOT QX+K,QY+L: NEXT L f K: COLORE RD: FOR K=8 TO 1: FOR 1=8 TO ■Is PLOT RX+K,RY+L: HEKT ill QK=RK;SY=RY 7po» urvT r 7835 SK=SKtDK:SY=SYtDY 7848 T(SX+13*(SY-1))=T(SX+13*(SY- DH1 7845 RETURN iuib ir ji-lo inch fidb; it" Hiftt -13*(SY-1)»9 THEN 7868i IF fhi^-ij^Hin-l/^ id tntn fide 7868 DX=8:DY=1: GOTO 782& 7188 lFSX=MHEH7t5B'fIFT{SX+ 13*(SY-1»>9 THEN 7118: IF IKSX+13«SY-I)-i) H0D.i8 TIEH 7158 65 DRAGON MAZE cont i lib i*ri-~~ il'01-ul Ul'ib tSCb •;:r.-, :r .-:; s Tjtr-Et -r-.r.r ■■■■rr X. - ."is- Hjs ir M=l IhtH imjl It KiAt i o*j" cy _ i *• *vj Turu 7 1 £ s * t c i v"Jv iYV-5: :-i~j-*j rnrnn csss. *"ii~nj) z~*iiii- ~f""IID Q555? UU3UD- JuCuJ UUjUu -JOb^ uloUb 5688 ; GOSuB 5888; PRINT 5 THE DRR 66 APPLE II FIRMWARE 1. System Monitor Commands 2. Control and Editing Characters 3. Special Controls and Features 4. Annotated Monitor and Dis-assembler Listing 5. Binary Floating Point Package 6. Sweet 16 Interpreter Listing 7. 6502 Op Codes 67 System Monitor Commands Apple II contains a powerful machine level monitor for use by the advanced programmer. To enter the monitor either press RESET button on keyboard or CALL-151 (Hex FF65) from Basic. Apple II will respond with an "*" (asterisk) prompt character on the TV display. This action will not kill current BASIC program which may be re-entered by a C c (control C). NOTE: "adrs" is a four digit hexidecimal number and "data" is a two digit hexidecimal number. Remember to press "return" button at the end of each line. Command Format Example Description Examine Memory adrs *C0F2 adrsl.adrs2 (return) adrs2 *1024.1048 * (return) *.4096 Examines (displays) single memory location of (adrs) Examines (displays) range of memory from (adrsl) thru (adrs2) Examines (displays) next 8 memory locations. Examines (displays) memory from current location through location (adrs2) Change Memory adrsrdata data data *A256:EF 20 43 :data data data *:F0 A2 12 Move Memory adrsl<adrs2. adrs3M *100<B010.B410M Verify Memory adrsl<adrs2. adrs3V *100<B010.B410V Deposits data into memory starting at location (adrs). Deposits data into memory starting after (adrs) last used for deposits. Copy the data now in the memory range from (adrs2) to (adrs3) into memory locations starting at (adrsl). Verify that block of data in memory range from (adrs2) to (adrs3) exactly matches data block starting at memory location (adrsl) and displays differences if any. 68 Command Format Example Description Cassette I/O adrsl.adrs2R adrsl .adrs2W *300.4FFR *800.9FFW Reads cassette data into specified memory (adrs) range. Record length must be same as memory range or an error will occur. Writes onto cassette data from speci fied memory (adrs) range. Display I N *I *N Set inverse video on white backgroun Set normal video mode on black background) de. (Black characters (White characters Dis-assembler adrsL *C800L Decodes 20 instructions starting at memory (adrs) into 6502 assembly nmenonic code. Decodes next 20 instructions starting at current memory address. Mini -assembler (Turn-on) $(monitor command) adrs: (6502 MNEMONIC instruction) *F666G $C800L !C010:STA 23FF Turns-on mini-assembler. Prompt character point). is now a (exclamation Executes any monitor command from mini- assembler then returns control to mini- assembler. Note that many monitor commands change current memory address reference so that it is good practice to retype desired address reference upon return to mini-assembler. Assembles a mnemonic 6502 instruction into machine codes. If error, machine will refuse instruction, sound bell, and reprint line with up arrow under error. 69 Command Format (space) (6502 mnemonic instruction) (TURN-OFF) Example ! STA JQ1FF I (Reset Button) Description Assembles instruction into next available memory location. (Note space between "!" and instruction) Exits mini-assembler and returns to system monitor. Monitor Program Execution and Debugging adrsG adrsT adrsS (Control E) (Control Y) *300G *800T *C050S *rC •y 1 Runs machine level program starting at memory (adrs). Traces a program starting at memory location (adrs) and continues trace until hitting a breakpoint. Break occurs on instruction 00 (BRK), and returns control to system monitor. Opens 6502 status registers (see note 1) Single steps through program beginning at memory location (adrs). Type a letter S for each additional step that you want displayed. Opens 6502 status registers (see Note 1). Displays 6502 status registers and opens them for modification (see Note 1) Executes user specified machine language subroutine starting at memory location (3F8). Note 1: 6502 status registers are open if they are last line displayed on screen To change them type ":" then "data" for each register. Example: A = 3C X = FF Y = 00 P = 32 S = F2 *: FF Changes A register only *:FF 00 33 Changes A, X, and Y registers To change S register, you must first retype data for A, X, Y and P. Hexidecimal Arithmetic datal+data2 datal-data2 *78+34 *AE-34 Performs hexidecimal sum of datal plus data2. Performs hexidecimal difference of datal minus data2. 70 Command Format Example Description Set Input/Output Ports (X) (Control P) •5P 1 (X) (Control K) *2K l Sets printer output to I/O slot number (X). (see Note 2 below) Sets keyboard input to I/O slot number (X). (see Note 2 below) Note 2: Only slots 1 through 7 are addressable in this mode. Address (Ex: 0P C or 0K C ) resets ports to internal video display and keyboard. These commands will not work unless Apple II interfaces are plugged into specif iced I/O slot. Multiple Commands *100L 400G AFFT Multiple monitor commands may be given on same line if separated by a "space" 1LLL Single letter commands may be repeated without spaces. 71 SPECIAL CONTROL AND EDITING CHARACTERS "Control" characters are indicated by a super-scripted "C" such as G . They are obtained by holding down the CTRL key while typing the specified letter. Control characters are NOT disolaved on the TV screen. B and C must be followed by a carriage return. Screen editing characters are indicated by a sub-scripted "E" such as Dp. They are obtained by pressing and releasing the ESC key then typing specified letter. Edit characters send information only to display screen and does not send data to memory. For example, U c moves to cursor to right and copies text while A^ moves cursor to right but does not copy text. CHARACTER DESCRIPTION OF ACTION RESET key Control B Immediately interrupts any program execution and resets computer. Also sets all text mode with scrolling window at maximum. Control is transfered to System Monitor and Apple prompts with a "*" (asterisk) and a bell. Hitting RESET key does NOT destroy existing BASIC or machine language program. If in System Monitor (as indicated by a "*"), a control B and a carriage return will transfer control to BASIC, scratching (killing) any existing BASIC program and set HIMEM: to maximum installed user memory and LOMEM: to 2048. Control C Control G Control H Control J Control V Control X If in BASIC, halts program and displays line number where stop occurred*. Program may be continued with a CON command. If in System Monitor, (as indicated by "*"), control C and a carraige return will enter BASIC without killing current program. Sounds bell (beeps speaker) Backspaces cursor and deletes any overwritten characters from computer but not from screen. Apply supplied keyboards have special key "<-" on right side of keyboard that provides this functions without using control button. Issues line feed only r Compliment to H . Forward spaces cursor and copies over written characters. Apple keyboards have "-►" key on right side which also performs this function. Immediately deletes current line. * If BASIC program is expecting keyboard input, you will have to hit carriage return key after typing control C. 72 SPECIAL CONTROL AND EDITING CHARACTERS (continued) CHARACTER DESCRIPTION OF ACTION A F Move cursor to right B F Move cursor to left C r Move cursor down Dp Move cursor up E F Clear text from cursor to end of line F Clear text from cursor to end of page @ r Home cursor to top of page, clear text to end of page. 73 Special Controls and Features Hex BASIC Example Display Mode Controls C05O C051 C052 C053 C054 10 POKE -16304,0 20 POKE -16303,0 30 POKE -16302,0 40 POKE -16301,0 50 POKE -16300,0 C055 C056 C057 60 POKE -16299,0 70 POKE -16298,0 80 POKE -16297,0 TEXT Mode Controls 0020 90 POKE 32, LI 0021 100 POKE 33, Wl 0022 110 POKE 34, Tl 0023 120 POKE 35,81 0024 130 CH=PEEK(36) 140 POKE 36, CH 150 TAB(CH+1) 0025 160 CV=PEEK(37) 170 POKE 37, CV 180 VTAB(CV+1) 0032 190 POKE 50,127 200 POKE 50,255 FC58 210 CALL -936 FC42 220 CALL -958 Description Set color graphics mode Set text mode Clear mixed graphics Set mixed graphics (4 lines text) Clear display Page 2 (BASIC commands use Page 1 only) Set display to Page 2 (alternate) Clear HIRES graphics mode Set HIRES graphics mode Set left side of scrolling window to location specified by LI in range of to 39. Set window width to amount specified byWl. L1+W1<40. W1>0 Set window top to line specified by Tl in range of to 23 Set window bottom to line specified by Bl in the range of to 23. B1>T1 Read/set cusor horizontal position in the range of to 39. If using TAB, you must add "1" to cusor position read value; Ex. 140 and 150 perform identical function. Similar to above. Read/set cusor vertical position in the range to 23. Set* inverse flag if 127 (Ex. 190) Set normal flag if 255(Ex. 200) ([:) Home cusor, clear screen (Fj:) Clear from cusor to end of page 74 Hex BASIC Example FC9C 230 CALL -868 FC66 240 CALL -922 FC70 250 CALL -912 Description (Eg) Clear from cusor to end of line (J C ) Line feed Scroll up text one line Miscellaneous C030 C000 C010 C061 C062 C063 C058 C059 C05A C05B C05C C05D C05E C05F 360 X=PEEK(-16336) 365 POKE -16336,0 370 X=PEEK(-16384 380 POKE -16368,0 390 X=PEEK( 16287) 400 X=PEEK(-16286) 410 X=PEEK(-16285 420 POKE -16296,0 430 POKE -16295,0 440 POKE -16294,0 450 POKE -16293,0 460 POKE -16292,0 470 POKE -16291,0 480 POKE -16290,0 490 POKE -16289,0 Toggle speaker Read keyboard; if X>127 then key was pressed. Clear keyboard strobe - always after reading keyboard. Read PDL(0) push button switch. If X>127 then switch is "on". Read PDL(l) push button switch. Read PDL(2) push button switch. Clear Game I/O AN0 output Set Game I/O AN0 output Clear Game I/O AN1 output Set Game I/O AM output Clear Game I/O AN2 output Set Game I/O AN2 output Clear Game I/O AN3 output Set Game I/O AN3 output 75 *************************** * * * APPLE II * * SYSTEM MONITOR * * * * COPYRIGHT 197? BY * * APPLE COMPUTER, INC. * * * * ALL RIGHTS RESERVED * * S. WOZNIAK * * A. BAUM ****************** TITLE LOCO EPZ $00 LOCI EPZ $01 WNDLFT EPZ $20 WNDWDTH EPZ $21 WNDTOP EPZ $22 WND3TM EPZ $23 CH EPZ $24 CV EPZ $25 GBASL EPZ $26 GBASH EPZ $27 BASL EPZ $28 BASH EPZ $29 BAS2L EPZ S2A BAS2H EPZ $2B H2 EPZ $2C LMNEM EPZ $2C RTNL EPZ $2C V2 EPZ $2D RMNEM EPZ $2D RTNH EPZ $2D MASK EPZ $2E CHKSUM EPZ $2E FORMAT EPZ $2E LASTIN EPZ $2F LENGTH EPZ $2F SIGN EPZ $2F COLOR EPZ $30 MODE EPZ $31 INVFLG EPZ $32 PROMPT EPZ $33 YSAV EPZ $34 YSAV1 EPZ $35 CSWL EPZ $36 CSWH EPZ $37 KSWL EPZ $38 KSWH EPZ $39 PCL EPZ $3A PCH EPZ $3P XQT EPZ $3C AIL EP? $3C A1H EPZ $3D A2L EPZ S3E A2H EPZ S3F A3L EPZ S40 A3H EPZ $41 A4L EPZ $42 A4H EPZ $43 A5L EPZ $44 ASH EPZ $45 APPLE II SYSTFV. MONITOR 76 F800 F801 F802 F805 F806 F808 F80A F80C F80E F810 F812 F814 F816 F818 F819 F81C F81E F820 F821 F824 F826 F828 F829 F82C F82D: F82F F831 F832 F834 F836 F838 F83A: F83C F83E; F840: F843: F844: F846 F847 F848 F849 F84B F84D: F84F: F850 F852 F854 F656 4A 08 20 47 F8 28 A9 OF 90 02 -69 EO 85 2E Bl 26 45 30 25 2E 51 26 91 26 60 20 00 F8 C4 2C BO 11 C8 20 OE F8 90 F6 69 01 48 20 00 F8 68 C5 2D 90 F5 60 AO 2F DO 02 AO 27 84 2D AO 27 A9 00 85 30 20 28 88 10 F6 60 46 4A 29 03 09 04 85 27 68 29 18 90 02 69 7F 85 26 F6 ACC XP.EG YREG STATUS SPNT RWDL PNDH ACL ACH XTrfOL XT'W AUXL AUXH PICK IN USK.ADR IK9L0C ICADR KRDSTRP TAPE OUT SPKR TXTCLR T/TSET M IXC LP MIXSET LOW5CR HISCR LOPES HIRES TAPEIN PADDLO PTRIG BASIC BASIC2 PLOT RT*4AS PLOT1 HLINE HLINE1 VLINEZ VLINE RTS1 CLRSCR CLRTOP CLRSC2 CLP.SC3 G6ASCALC GBCALC EFZ EPZ EPZ EPZ EPS EPZ EPZ EPZ FP7 EPZ RPZ EPZ EPZ EPZ ECU EQU EOU ECU EOU EQU EQU ECU ECU ECU EOU ECU ECU EOU ECU EOU ecu ECU EOU ECU EOU EOU ORG LSR PHP JSP PLP LDA BCC ADC 3TA LDA EOR AND EOR STA RTS ■JSP CPY BCS INY J3R BCC ADC PHA JSP PLA CMP BCC RTS LDY PNE LDY STY FOP LDY LDA STA JSP DEY *PL RTS PHA r,SR AND OPA STA PLA AMD see ADC STA $45 $46 $47 $48 $49 $4F $^F $50 $51 $52 $53 $54 $55 $95 $0200 S03F8 $03FB S03FF SCCOO $C0OO SC010 $C020 SC0-30 $C050 SC051 $C052 $C053 SC054 $C055 $C056 $C057 $C060 $C064 $C070 SE000 $E003 $F800 ROM START ADDRESS A Y-COOFD/2 SAVE LSB IN CARRY GBASCALC CALC BASE ADP IN GBASL,H RESTORE LSB FROM CARRY MASK $0F IF EVEN MASK $F0 IF ODD #$0F RTMASK #$E0 .<1A5K (GBASL) ,'l DATA COLOR XOR COLOR MASK AND i*ASK (GPASL) r Y XOR DATA (GBASL) ,Y TO DATA PLOT PLOT SOUARE H2 DOME? RTS1 YES, RETURN MO, I NCR INDEX (X-COORD) PLOT1 PLOT NEXT SOUARE HLIME1 ALWAYS TAKEN #$01 NEXT Y-COORD SAVE ON 1 STACK PLOT SOUARE PLOT V2 VLINE Z #$2F CLRSC2 #$27 V2 VLINE #$?7 *$0 COLOR VLINE CLRSC3 DONE? NO, LOOP. ^AX Y, FULL SCRN CLR ALWAYS TAKEM WAX Y, TOP SCRN CLR STORF AS BOTTOM COORD CALLS RIGHTMOST X-COORD (COLUMN) TOP COOPO FOR VLINE CALLS CLEAR COLOR (BLACK) rRAK VLIN'E NEXT LEFTMOST X-COORD LOOP UNTIL DONE. A + $03 #$04 GESASrf *$18 G3CALC #$7F GFASL FOR INPUT nOODFFGH GFVJERATE GBASH=00C001FC M)D G^ASL-HOEOFOOO 77 F858: F859: F85A: F85C: F85E: F85F: F8 61: F862: F864: F866: F868: F8 69: F86A: F86B: F86C: F86E: F870: F871: F872: F873: F87 6: F878: F879: F8 73: F87C: F87D: F87E: F87F: F881: F882: F884: F886: F889: F68C: F88E: F88F: F89U: F892: F893: F695: F897: F899: F893: F89C: F89D: F8A0: F8A3: F8A5: F8A7: F8A9: F8AA: F8AD: F8AF: F8B1 F8B3 F834 F8B6 F8S7 F8B8 F8BA F8BC F8BE F8BF; F8C1: F8C2. F8C3 F8C5 F8C6 F8C8 F8C9 F8CA F8CC F8CD: F8D0 F8D3 F8D4 F8D6 F8D9 F8DB F8DE F8E0 F8E1 F8E3 F8E5 F8 OA OA 05 26 85 26 60 A5 30 13 69 03 29 OF 65 30 OA OA OA OA 05 30 85 30 60 4A 08 20 47 81 26 28 90 04 4A 4A 4A 4A 29 OF 60 A6 3A A4 38 2P 9 6 FD 20 48 F9 Al 3A A8 4A 90 09 6> BO 10 C9 A 2 FO OC 29 87 4 A AA bo 20 NIXTCOL 3ETC0L SCFN SCRN2 RTi^SKZ I MS OS 1 IN3DS2 6 2 F9 79 Ffe DO 04 AO 80 A9 00 AA BD A6 F9 85 2E 29 03 85 2F 93 29 8F AA 98 AO 03 EO 8A FO OB 4A 90 08 4A 4A 09 20 88 DO FA C8 88 DO F2 60 FF FF FF 20 82 F8 48 Bl 3A 20 DA FD A2 01 20 4A F9 C4 2F C8 90 Fl A2 03 CO 04 I EVE RP GETFjVT KNNDXl MNNDX2 MNNDX3 INSTDSP PRNTOP PRNTBL ASL ASF, ORA STA RTS LDA CLC ADC AMC STA ASL ASL ASL ASL OPA STA RTS LSR PHP JSR LDA PLP RCC LSR LSR LS R LSR ANTE RTS LDX LDY JSP JSR LDA TAY LSR BCC ROP 3CS C^P FEO AND LSR TAX LDA JSP .■?NE LDY LDA TAX LDA STA AND STA TYA AND TAX TYA LDY CPX 3E0 LSR BCC LSR LSP ORA DEY BNE INY DEY BNE RTS DFB JSR PHA LDA JSR LDX JSR CPY INY BCC LDX CPY IMCPEr.ErtT COLOR BY 3 SETS COLOR=17*A MOD 16 FOTrt HALF PYTES OF COLO^ EQUAL A A GBASL GPASL COLOR SS0 3 t-*0? COLOR A A A A COLOR COLOR A READ SCREEN Y-COORD/2 SAVE LSB (CARRY) GE-ASCALC CALC BASF ADDRESS (GE-A3L) ,Y GET PYTE RESTORE LSP FROM CAR*Y KTi-'iSK? IF EVEN, USE LO H A A A A fc$0F PCL PCK PRYX2 PUP-Lmk SHIFT HIGH HALF BYTE DO^N MASK 4-BITS PRINT pcl,h FOLLOWED 3Y A BLANK (PCL,X) GET OF CODE A IFVFN A ERP i ? * 2 r. F K *$B7 A FMT1,X SCRW2 GETFJ-T #?8C tso EVE* /ODD TFST BIT 1 TEST XXXXXXll INVALID OP OPCODE ^9 INVALID ■!ASK r-ITS LSR IN 7 TO CARRY FOR L/P TEST GET FOR.'-" AT INDEX 8YTE R/L H-HYTE ON! CARRY SU?STITUTE $80 FOR INVALID OP: SET PRINT FOPYAT INDEX TO INDEX INTO PPINT FORMAT TABLE SAVE FOR ADR FIELD FORMATTING MASK FOR 2-BIT LENGTH (P=l BYTE, 1=2 BYTE, 2=3 BYTE) LENGTH OPCODE MASK FOR 1XXX1010 TEST SAVF IT OPCODE TO A AGAIN F;-1T2,X FORMAT #$BF *$03 #S8A MNNDX3 A F1NNDX3 A A #$20 MNNDX2 MNWDXl FORM INDEX INTO MNEMONIC TABLE 1) 1XXX1010=>00101XXX 2) XXXYYY01*>00111XXX 3) XXXYYY10=>00110XXX 4) XXXYY100=*>00100XXX 5) XXXXX000=>000XXXXX $FF,$FF,$FF INSDS1 GEN FMT, LEN BYTES SAVE MNEMONIC TABLE INDEX (PCL) ,Y PRBYTE #$01 PRBL2 LENGTH PRNTOP #$03 #$04 PRINT 2 BLANKS PRINT INST (1-3 BYTES) IN A 12 CHR FIELD CHAR COUNT FOR MNEMONIC PRINT 78 F8E7 : 90 F2 BCC PRNTBL F8E9 : 68 PLA RECOVER MNEMONIC INDEX F8EA : A8 TAY F8EB : B9 CO F9 LDA MNEML,Y F8EE : 85 2C STA LMNEM FETCH 3-CHAR MNEMONIC F8F0 : B9 00 FA LDA MNEMF,Y (PACKED IN 2-BYTES) F8F3 : 85 2D STA RMNEM F8F5 : A9 00 PRMNl LDA #$00 F8F7 : A0 05 LDY #$05 F8F9 : 06 2D PRMN2 ASL RMNEM SHIFT 5 BITS OF F8FB : 26 2C ROL LMNEM CHARACTER INTO A F8FD : 2A ROL A (CLEARS CARRY) F8FE : 88 DEY F8FF : DO F8 BNE PRMN2 F901 i 69 BF ADC #$BF ADD "?" OFFSET F903 : 20 ED FD JSR COUT OUTPUT A CHAR OF MNEM F906 : CA DEX F907 : DO EC BNE PRMNl F909 : 20 48 F9 JSR PRBLNK OUTPUT 3 BLANKS F90C : A4 2F LDY LENGTH F90E : A2 06 LDX #$06 CNT FOR 6 FORMAT BITS F910 : EO 03 PRADR1 CPX #$03 F912 : FO 1C BEQ PRADR5 IF X=3 THEN ADDR. F914 : 06 2E PRADR2 ASL FORMAT F916 : 90 OE BCC PRADR3 F918 : BD B3 F9 LDA CHAR1-1, X F91B : 20 ED FD JSR COUT F91E : BD B9 F9 LDA CHAR2-1, X F921 : FO 03 BEQ PRADR3 F923 : 20 ED FD JSR COUT F926 : CA PRADR3 DEX F927 : DO E7 BNE PRADR1 F929 : 60 RTS F92A : 88 PRADR4 DEY F92B : 30 E7 BMI PRADR2 F92D: 20 DA FD JSR PRBYTE F930: A5 2E PRADR5 LDA FORMAT F932: C9 E& CMP #$E8 HANDLE REL ADR MODE F934: Bl 3A LDA (PCL) ,Y SPECIAL (PRINT TARGET, F936: 90 F2 BCC PRADR4 MOT OFFSET) F938: 20 56 F9 RELADR JSP PCADJ 3 F93B: AA TAX PCL,PCH+OFFSET+l TO A,Y F93C: E8 INX F93D: DO 01 BNE PRNTYX +1 TO Y,X F93F: C8 INY F940: 98 PRNTYX TYA F941: 20 DA FD PRNTAX JSR PPBYTE OUTPUT TARGET ADR F944J 8A PRNTX TXA OF BRANCH AND RETURN F945: 4C DA FD JMP PPBYTE F948: A2 03 PPBLNK LDX #$03 BLANK COUNT F94A: A9 AO PR3L2 LDA #$A0 LOAD A SPACE F94C: 20 ED FD PPBL3 JSR COUT OfTPUT A BLANK F94F: CA DEX F950: DO F8 BNE PRBL2 LOOP UNTIL COUNT=0 F952: 60 RTS F953: 38 PCADJ SEC 0=1-3YTE,1=2-BYTE, F954: A5 2F PCADJ2 LDA LENGTH 2=3-BYTE F956: A4 3B PCADJ3 LDY PCH F958: AA TAX TEST DISPLACEMENT SIGN F959: 10 01 BPL PCADJ4 (FOR REL BRANCH) F95B: 88 DEY EXTEND NEG BY DECR PCH F95C: 65 3A PCADJ4 ADC PCL F95E: 90 01 BCC RTS 2 PCL+LENGTH(OR DISPL) +1 TO A F960: C8 INY CARRY INTO Y (PCH) F961: 60 RTS2 RTS • FMT1 BYTES: XXXXXXY0 INSTRS * IF Y=0 THEN LEFT HALF BYTE * IF Y=l THEN RIGHT HALF BYTE * (X=INDEX) F962: 04 20 54 F965: 30 OD F967: 80 04 90 F96A: 03 22 F96C: 54 33 OD F96F: 80 04 F971: 90 04 20 F974: 54 33 F976: 0D 80 04 F979: 90 04 F97B: 20 54 3B F97E: 0D 80 F980: 04 90 00 F983: 22 44 F985: 33 OD C8 F988: 44 00 FMT1 DFB $04,$20,$54,$30,$0D DFB $80,$04,$90,$03,$22 DFB $54, $33, $0D,$80,$04 DFB $90, $04, $20, $54, $33 DFB $0D,$80,$'H,$90,$04 DFB $2O,$54,$3B,$0D,$80 DFB $04,$90,$0,0 r $22,$44 DFB $3 3,$0D,$C8,$4 4, $00 79 F98A F98D F98F F992 F994 F997 F999 F99C F99E F9A1 F9A2 F9A5 F9A6 F9A7 F9A8 F9A9 F9AA F9AB F9AC F9AD F9AE F9AF F9B0 F9B1 F9B2 F9B3 F9B4 F9BA: F9BD: F9C0; F9C3: F9C6: F9C9: F9CC: F9CF: F9D2 F9D5 F9D8 F9DB F9DE: F9E0: F9E3 F9E6 F9E8 F9EB F9EE F9F0 F9F3 F9F6 F9F8 F9FB: F9FE FAOO FA03 FA06: FA09 FAOC FAOF FA12 FA15 FA18 FAlB FA1E FA20 FA23 FA26 FA28 FA2B FA2E FA30 FA33 FA36 FA38 FA3B FA3E 11 22 44 33 OD C8 44 A9 01 22 44 33 OD 80 04 90 01 22 44 33 OD 80 04 90 26 31 87 9A 00 21 81 82 00 00 59 4D 91 92 86 4A 85 9D AC A9 AC A3 A8 A4 D9 00 D8 A4 A4 00 1C 8A 23 5D IB Al 8A ID 9D 8B Al 00 19 AE A8 19 24 53 23 24 19 Al 00 1A 5B A5 24 24 AE AE AD 29 7C 00 15 9C 9C A5 29 53 84 13 11 A5 23 AO D8 62 48 26 94 88 44 C8 68 44 94 00 08 84 B4 28 74 F4 4A 72 A4 8A 00 AA A2 74 74 72 44 68 32 B2 22 00 1A 1A 26 72 88 C8 C4 CA 48 44 A2 C8 DFB $11,S22,$44,$33,$0D DFB $C8,$44,$A9,S01,$22 DFB $44,$33,$OD,$80,$04 DFB $90, $01,$22,$44,$33 DFB $0D,$80, $04, $90 FMT2 CHAR1 CHAR2 *CHAR2 * * 1C 8B MNEML 9D 23 ID 29 69 23 IB 53 5B 69 A8 00 6D 69 34 69 5A 62 MNEMR 54 54 E8 B4 74 6E CC F2 A2 74 B2 00 26 72 26 44 DFB $26, $31 ,$P7,$9A ZZXX DFB $00 ERF DFB $21 I MM DFB $81 Z-PAGE DFB $82 ABS DFB $00 IMPLIED DFB $00 ACCUMULATOR DFB $59 (ZPAG,X) DFB $4D ( Z PAG ) , Y DFB $91 ZPAG,X DFB $92 ABS,X DFB $86 ABS,Y DFB $4A (ABS) DFB $85 ZPAG,Y DFB ASC $9D ",),#($' RELATIVE DFB $D9,$00,$D8,$A4,$A4,$00 "Y%0/'X$$",0 MNEML IS OF FORM: (A) XXXXX000 (B) XXXYY100 (C) 1XXX1010 (D) XXXYYY10 (E) XXXYYY01 (X=INDEX) DFB $1C,S8A,$1C,$2 3,$5D,$8B DFB $1B,$A1,$9D,S8A,$1D,$23 DFB $9D,$8B,$1D,$A1,$00,$29 DFB $19,$AE,$69,$A8,$19,$23 DFB $24, $53, $1B, $23, $24, $53 DFB $19,$A1 (A) FORMAT ABOVE DFB $00,$1A,$5B,$5B,$A5,S69 DFB $24, $24 (B) FORMAT DFB $AE,$AE,$A8,$AD,$29,$00 DFB $7C,$00 (C) FORMAT DFB $15,$9C,$6D,$9C,$A5,$69 DFB $29, $53 (D) FORMAT DFB $84,$13,$3 4,$11,$A5,$69 DFB $23,$A0 (E) FORMAT DFB $D8,$62,$5A,$4 8,$26,$62 DFB $94,$88,$54,$4 4,$C8,$54 DFB $68,$4 4,$E8,$94,$00,$B4 DFB $08,$84,$74,$B4,$28,$6E DFB S74,$F4,$CC,$4A,$72,$F2 DFB $A4,$8A (A) FORMAT DFB $00,$AA,$A2,$A2,$74 r $74 DFR $74, $72 (B) FORMAT DFB $4 4,S68,$E2,$3 2,$B2,S0O DFB $22, $00 <C) FORMAT DFB S1A,$1A,$26,$26,$72,$72 DFB $86,$C8 (D) FORMAT DFB $C4,$CA,$2 6,S4e,$44,S44 DFB SA2,$C8 <E) FORMAT 80 FA40 : FF FF FF DFB $FF,$FF r $FF FA43 : 20 DO F8 STEP JSR INSTDSP DISASSEMBLE ONE INST FA46 : 68 PLA AT <PCL,H) FA47 : 85 2C STA RTNL ADJUST TO USER FA49 : 68 PLA STACK. SAVE FA 4 A : 85 2D STA PTNH RTN ADR. FA4C : A2 08 LDX #$08 FA4E : BD 10 FB XQINIT LDA INITBL- 1,X INIT XEO AREA FA51 : 95 3C STA XQT,X FA53 : CA DEX FA54 : DO F8 BNE XOI NIT FA56 : Al 3A LDA (PCL,X) USER OPCODE BYTE FA 5 8 : FO 42 BEO XBRK SPECIAL IF BREAK FA5A : A4 2F LDY LENGTH LEN FROM DISASSEMBLY FA5G : C9 20 CMP #$20 FA5E : FO 59 PEG XJSP HANDLE JSR, PTS , JMP, FA60 : C9 60 CMP *$60 JMP ( ) , RTI SPECIAL FA62 : FO 45 BEQ XRTS FA64 : C9 4C CMP #$4C FA66 : FO 5C 3E0 xjm-p FA68 : C9 6C CMP #$6C FA6A : FO 59 BEQ XJMFAT FA6C : C9 40 CMP #?40 FA6E : FO 35 3E0 XRTI FA70 : 29 IF AND #$1F FA72 : 49 14 EOR #$14 FA74 : C9 04 CMP #$04 COPY USER INST TO XEO AREA FA76 : FO 02 BEQ XQ2 WITH TRAILING NOPS FA78 : Bl 3A xoi LDA (PCL),Y CHANGE REL BRANCH FA 7 A : 99 3C 00 XQ2 STA XQTNZ,Y DISP TO 4 FOR FA7D : 88 DEY JMP TO BRANCH OR FA7E : 10 F8 BPL XQ1 NBRANCH FROM XEQ. FA80 : 20 3F FF JSR RESTORE RESTORE USER REG CONTENTS. FA83 : 4C 3C 00 JMP XQTNZ XEQ USER OP FROM RAM FA66 : 85 45 IRQ STA ACC (RETURN TO NBRANCH) FA88 : 68 PLA FA89 : 48 PHA **IRQ HANDLER FA8A : OA ASL A FA8B : OA ASL A FA8C : OA ASL A FA8D : 30 03 BMI BREAK TEST FOR BREAK FA8F : 6C FE 03 JMP (IROLOC) USER ROUTINE VECTOR IN RAM FA92 : 28 BREAK PLP FA93 : 20 4C FF JSR SAV1 SAVE REG'S ON BREAK FA96 : 68 PLA INCLUDING PC FA97 : 85 3A STA PCL FA99 : 68 PLA FA9A : 85 3B STA PCH FA9C : 20 82 F8 XBRK JSR INSDS1 PRINT USER PC. FA9F : 20 DA FA JSR RGDSP1 AND REG'S FAA2 : 4C 65 FF JMP MON GO TO MONITOR FAA5 ! 18 XRTI CLC FA A 6 • 68 PLA SIMULATE RTI BY EXPECTING FAA7 85 48 STA STATUS STATUS FROM STACK, THEN I FAA9i 68 XRTS PLA PTS SIMULATION FAAAi 85 3A STA PCL EXTRACT PC FROM STACK FAAC: 68 PLA AND UPDATE PC BY 1 (LEN*0) FAAD: 85 3B PCINC2 STA PCH FAAF: A5 2F PCINC3 LDA LENGTH UPDATE PC BY LEN FAB1: 20 56 F9 JSR PCADJ3 FAB 4: 84 3B STY PCH FAB6: 18 CLC FAB7: 90 14 BCC NEWPCL FAB9: 18 XJSR CLC FABA: 20 54 F9 JSR PCADJ2 UPDATE PC AND PUSH FABD: AA TAX ONTO STACK FOR FABE: 98 TYA JSR SIMULATE FABF: 48 PHA FACO: 8A TXA FAC1: 48 PHA FAC2: AO 02 LDY #$02 FAC4: 18 XJMP CLC FAC5: Bl 3A XJMPAT LDA (PCL),Y FAC7: AA TAX LOAD PC FOR JMP, FAC8: 88 DEY (JMP) SIMULATE. FAC9: Bl 3A LDA (PCL),Y FACB: 86 3B STX PCH FACD: 85 3A NEWPCL STA PCL FACF: BO F3 BCS XJMP FAD1: A5 2D RTWJMP LDA RTNH FAD3: 46 PHA FAD 4: A5 2C LDA RTNL FAD6: 48 PHA FAD7: 20 8E FD REGDSP JSR CROUT DISPLAY USER REG FADA: A9 4 5 RGDSP1 LDA #ACC CONTENTS WITH FA DC: 65 40 STA A3L 81 LABELS FADE: A9 00 LDA #ACC/256 FAEO: 85 41 STA A3H FAE2i A2 FB LDX #$FB FAE4: A9 AO RDSP1 LDA #$A0 FAE6: 20 ED FD JSR COUT FAE9: BD IE FA LDA RTBL-$FB ,x FAEC: 20 ED FD JSR COUT FAEF: A9 BD LDA #$3D FAF1: 20 ED FD JSR COUT FAF4: B5 4A LDA ACC+5,X FAF6: 20 DA FD JSR PRBYTE FAF9: E8 INX FAFA: 30 E8 3MI RDSP1 FAFCj 60 RTS FAFD: 18 BRANCH CLC BRANCH TAKEN, FAFE: AO 01 LDY #$01 ADD LEN+2 TO PC FBOOi Bl 3A LDA (PCL) f Y FB02: 20 56 F9 JSR PCADJ3 FB05: 85 3A STA PCL FB07: 98 TYA FB08: 38 SEC FB09: BO A2 3CS PCINC2 FBOB: 20 4A FF NBPNCH JSR SAVE NORMAL RETURN AFTER FBOE: 38 SEC XEO USER OF FBOF: BO 9E PCS PCINC3 GO UPDATE PC FB11: EA INITBL NOP FB12I EA NOP DUMMY FILL FOR FB13: 4C OB FB JMP MBRNCH XEO AREA FB16: 4C FD FA JMP BRANCH FB19: CI RTBL DFB SCI FB1A: D8 DFB $D8 FB1B! D9 DFB $D9 FB1C: DO DFB $D0 FB1D: D3 DFB $D3 FBlE: AD 70 CO PREAD LDA PTPIG TRIGGER PADDLES FB21J AO 00 LDY #$00 INIT COUNT FB23: EA NOP COMPENSATE FOR 1ST COUNT FB24- EA NOP FB25: BD 64 CO PREAD2 LDA PADDL0,X COUNT Y-PEG EVERY FB28' 10 04 BPL RTS2D 12 USEC FB2A: C8 INY FB2B: DO F8 BNE PREAD2 EXIT AT 255 MAX FB2D! 88 DEY FB2E 60 RTS2D RTS FB2F A9 00 INIT LDA #$00 CLR STATUS FOR DEBUG FB31 : 85 48 STA STATUS SOFTWARE FB33 i AD 56 CO LDA LORES FB36 • AD 54 CO LDA LOWSCR INIT VIDEO MODE FB39 : AD 51 CO SETTXT LDA TXTSET SET FOR TEXT MODE FB3C A9 00 LDA #$00 FULL SCREEN WINDOW FB3E • FO OB BEQ SETWND FB40 AD 50 CO SETGR LDA TXTCLR SET FOP GRAPHICS MODE FB43 AD 53 CO LDA WIXSET LOWER 4 LINES AS FB46 20 36 F8 JSR CLPTOP TEXT WINDOW FB49 • A9 14 LDA #$14 FB4B . 85 22 SETWND STA WMDTOP SET FOP 4 COL WINDOW FB4D: A9 00 LDA #$00 TOP IN A-PEG, FB4F : 85 20 STA WNDLFT BTTM AT LINE 24 FB51 : A9 28 LDA #$28 FB53 : 85 21 STA WNDWDTH FB55 i A9 18 LDA #$1S FB57 i 85 23 STA WNDBTM VTAE TO ROW 23 FB59 : A9 17 LDA #$17 FB5B . 85 25 TABV STA CV VTABS TO ROW IN A-REG FB5D: 4C 22 FC JMP VTA P. FB60 i 20 A4 FB MULP* JSP UD1 A3S VAL OF AC AUX FB63 AO 10 MUL LDY #$10 INDEX FOP 16 BITS FB65 A5 50 MUX 2 LDA ACL ACX « AUX + XTND FB67 4A LSR A TO AC, XTND FB68: 90 oc BCC MUL4 IF MO CARRY, FB6A: ie CLC NO PARTIAL PPOD. F66B; A2 FE LDX #$FE FB6D: B5 54 MUL3 LDA. XTNDL+2, X-ADD MPLCND (AUX) FB6F- 75 56 ADC AUXL+2,X TO PARTIAL PROD FB71 95 54 STA XTiJDL+2,X (XTND) . FB73 EH INX FB74 DO F7 BlMF ^UL3 FB76 A2 03 MUL4 LDX #$03 FB76 76 MUL 5 DFB #$76 F379 50 DFB #$50 FS7A CA DEX FP7B 10 FE 3 PL MUL 5 FB7D: 88 DEY FB7E< DO E5 BNE MUL2 FB80 60 RTS 82 FB81: 20 A 4 FB DIVPM J-SR MD1 ^HS VAL OF AC, ^UX. FB84: AO 10 DIV LDY mo INDEX FOR 16 BITS FB86: 06 50 DIV2 ASL ACL FB88: 26 51 ROL ACH FB8A: 26 52 ROL XTNDL XTND/AUX FB8C: 26 53 ROL XTNDH TO AC. FB8E: 38 SEC FB8F: A5 52 LDA XTNDL FB91: E5 54 sec AUXL MOD TO XTNO. FB93: AA TAX FB94: A5 53 LDA XlTOtf F396: E5 55 sbc AUXK FB98: 90 06 BCC DIV3 FB9A: 86 52 STX XTNDL F39C: 85 53 STA XTMDH FB9E: E6 50 INC ACL FBAO: 88 DIV3 DEY FBAl: DO E3 BNE DIV2 FBA3: 60 RTS FBA4: AO 00 MD1 LDY *$00 JBS VAL OF AC, AUX FBA6: 84 2F STY SIGN WITH RESULT SIGN FBA8: A2 54 LDX #AUXL IN LSB OF SIGN. FBAA: 20 AF FE JSR MD2 FBAD: A2 50 LDX #ACL FBAF: B5 01 MD2 LDA LOCl r X X SPECIFIES AC OR AUX FBB1: 10 OD BPL MDRTS FBB3: 38 SEC FBB4: 98 MD3 TYA FBB5: F5 00 SBC LOC0,X COMPL SPECIFIED REG FBB7: 95 00 STA LOC0,X IF NEG. FBB9: 98 TYA FBBA: F5 01 SBC LOC 1 , X FBBC: 95 01 STA L0C1,X FBBE: E6 2F INC SIGN FBCO: 60 MDRTS RTS FBC1: 48 BASCALC PHA CALC BASE ADR IN BASL,H FBC2: 4A LSR A FOR GIVEN LINE NO. FBC3: 29 03 AND #S03 ONLINE NO.<=$17 FBC5: 09 04 OPA #$04 APG^OOOABCDE, GENERATE FBC7: 85 29 STA BASH BASH^OOOOOICD FBC9: 68 PLA AND FBCA: 29 18 AND #$1B BA3L=EABAB000 FBCC: 90 02 BCC 6SCLC2 FBCE: 69 7F ADC #$7F FBDO: 85 28 3SCLC2 STA BASL FBD2: OA ASL A FBD3: OA ASL A FBD4: 05 28 ORA BASL FBD6: 85 28 STA BASL FBD8: 60 RTS FBD9: C9 87 BELLI CMP #$87 BELL CHAR? (CNTRL-G) FBDB: DO 12 3NE RTS2B NO, RETURN FBDD: A9 40 LDA #$40 DELAY .01 SECONDS F6DF: 20 A8 FC JSP WMT FEE2: AO CO LDY #SC0 FBE4: A9 OC BELL2 LDA $$0C TOGGLE SPEAKER AT FBE6: 20 A 8 FC JSR WAIT 1 KHZ FOR .1 SEC. FBE9: AD 30 CO LDA SPKR FBEC: 88 DEY FBED: DO F5 BNE EELL2 F3EF: 60 RTS 2* RTS FBFO: A4 24 STOADV LDY CH CURSER H INDEX TO Y-REG FBF2: 91 28 STA (BASL) ,Y STOP CHAR IN LINE FBF4: E6 24 ADVANCE IMC CH INCREMENT CURSER H INDEX FBF6: A5 24 LDA CM (MOVE RIGHT) F8F8: C5 21 CUP WNDWDTH BEYOND WINDOW WIDTH? FBFA: BO 66 ECS CR YES ^ TO WFXT LINE FBFC: 60 RTS3 RTS MO, RETURN FBFD: C9 AO VIDOUT CMP #$A0 CONTROL CHAP? FBFF: BO EF BCS STOADV NO, OUTPUT IT. FCOl: A8 TAY INVERSE VIDEO? FC02: 10 EC BPL 3TOADV YES, OUTPUT IT. FC04: C9 8D CMP #$8D CR? FC06: FO 5A 3E0 CR YES. FC08: C9 SA CMP #$8A LINE FEED? FCOA: FO 5A BEQ LF IF SO, DO IT. FCOC: C9 88 CMP #$S8 BACK SPACE? (CNTRL-H) FCOE: DO C9 8ME BELLI MO, CHECK FOR BELL. FCIO: C6 24 B3 DEC CH DECREMENT CURSER H INDEX FC12: 10 E8 BPL RTS 3 IF POS, OK. ELSE MOVE UP FC14: A5 21 LDA WNDWDTH SET CH TO WNDWDTH-1 FC16: 85 24 STA CH FC18: C6 24 DEC CH (RIGHTMOST SCREEN POS) FC1A: A5 22 UP LDA WNDTOP CURSER V INDEX FC1C: C5 25 CMP CV 83 FC1E : BO OB 8CS STS4 IF TOP LINE THEN PETLJRN FC20 : C6 25 DEC CV DFCR CURSER V-INDEX FC22 : A5 25 VTAE LDA CV GET CURSER V-INDEX FC24 : 20 CI FB VTABZ JSP PASCALC GENERATE BASE ADDR FC27 : 65 20 ADC WHDLFT ADD WINDOW LEFT INDEX FC29 : 85 28 STA BASL TO BASL FC2B : 60 RTS4 PTS FC2C : 49 CO ESC1 EOR #$C0 ESC? FC2E : FO 28 BFQ HOME IF SO, DO HOi*E AMD CLEAR FC30 : 69 FD ADC *$FD ESC-A OP B CHECK FC32 : 90 CO BCC ADVAMCF A, ADVANCE FC34 : FO DA BEO BS B, BACKSPACE FC36 : 69 FD ADC #SFD ESC-C OR D CHFCK FC38 : 90 2C 3CC LF C , DOWN FC3A : FO DE BEQ UP D, GO UP FC3C : 69 FD ADC #$FD ESC-E OP F CHECK FC3E : 90 5C BCC CLREOL E, CLEAR TO END OF LINE FC40 : DO E9 3NE *?TS4 NOT F, RETURN FC42 : A4 24 CLREOP LDY CH CURSOR H TO Y INDEX FC44 : A5 25 LDA CV CURSOR V TO A-REGISTER FC46 : 48 CLE0P1 PHA SAVE CURRENT LINE ON STK FC47 : 20 24 FC JSP VTARZ CALC RASE ADDRFSS FC4A : 20 9E FC JSP CLBOL7 CLEAR TO EOL, SET CARRY FC4D : AO 00 LDY #$00 CLEAR F^Otf H INDEX=0 FOR PES1 FC4F : 68 PLA INCREMENT CURRENT LINE FC50 : 69 00 ADC #$00 (CARRY IS SET) FC52 : C5 23 CMP tfNDBTM DONE TO BOTTOM OF WINDOW? FC54 : 90 FO BCC CLEOP1 NC, KEEP CLFAPING LINES FC56 : BO CA PCS VTAB YES, TAB TO CURRENT LINE FC58 : A5 22 HOME LDA VlNDTOP INIT CURSOR V FC5A : 85 25 STA CV AND H-INDICES FC5C : AO 00 LDY #$00 FC5E : 84 24 STY CH THEN CLEAR TO END OF PAGE FC60 : FO E4 a eg C LEO PI FC62 : A9 00 CR LDA #$00 CURSOR TO LEFT OF INDEX FC64 : 85 24 STA CH (PET CURSOR H=0) FC66 : E6 25 LF INC CV INCR CURSOR V(DOWN 1 LINE) FC68 : A5 25 LDA CV FC6A : C5 23 CMP ■■-JNDPTM OFF SCREFN? FC6C : 90 B6 BCC VTABZ WO, SET BASE ADDR FC6E : C6 25 DEC CV DECP CURSOR V(BACK TO BOTTOM FC70 A5 22 SCROLL LDA WMDTOP START AT TOP OF SCRL WNDW FC72- 48 PHA FC73: 20 24 FC JSR VTAFZ GENERATE BASE ADDRESS FC76: A5 28 SCRL1 LDA BASL COPY BASL,H FC78: 85 2A STA BAS2L TO BAS2L,H FC7AJ A5 29 LDA BASH FC7C: 85 2B STA BAS2H FC7E: A4 21 LDY WNDWDTH INIT Y TO RIGHTMOST INDEX FC80: 88 DEY OF SCROLLING WINDOW FC81: 68 FLA FC82: 69 01 ADC #$01 INCR LINE NUMBER FC84: C5 23 CMP WNDBTM DONE? FC86: BO OD BCS SCRL3 YES, FINISH FC88: 48 PHA FC89: 20 24 FC JSP VTABZ FORM BASL,H (BASE ADDR) FC8C: Bl 28 SCRL2 LDA (BASL) ,Y MOVE A CHR UP ON LINE FC8E: 91 2A STA (BAS2L) , Y FC90: 88 DEY NEXT CHAP OF LINE FC91: 10 F9 BPL SCFL2 FC93: 30 El RMI SCRL1 NEXT LINE FC95: AO 00 SCRL3 LDY #$00 CLEAR BOTTOM LINE FC97: 20 9E FC JSR CLEOLZ GET BASE ADDR FOR BOTTOM LINE FC9A: BO 86 3CS VTAP CARRY IS SET FC9C: A4 24 CLREOL LDY CH CURSOR H INDEX FC9E: A9 AO CLEOLZ LDA #$A0 FCAO: 91 28 CLE0L2 STA (PASL) ,Y STORE BLANKS FROM 'HERE' FCA2: C8 I NY TO END OF LINES (tfNDWDTH) FCA3: C4 21 CPY WNDWDTR FCA5: 90 F9 PCC CLEOL2 FCA7: 60 PTS FCA8: 38 WAIT- SEC FCA9: 48 WAIT 2 PHA FCAA: E9 01 WAIT3 3 PC #501 FCAC: DO FC PNE WVIT3 1.0204 U3EC FCAE: 68 PLA (13+2712*A+512*A*A) FCAF: E9 01 SBC #501 FCB1: DO F6 BNE WAIT 2 FCB3: 60 PTS FCB4: Eb 42 NXTA4 INC A4L INCR 2-FYTE A4 FCB6: DO 02 PME NXTAl AND Al FCB8: E6 43 INC A4H FC6A: A5 3C NXTA1 LDA AIL INCP 2-BYTF Al. FCBC: C5 3E CMP A2L FC6E: A5 3D LDA A1H AND COMPARE TO A 2 84 FCCO t E5 3F SBC A2h FCC2 : E6 3C INC ML (CARPY SET IF >=) FCC 4 : DO 02 BNE RTS4R FCC6 : E6 3D INC A1H FCC 8 : 6 RTS 4 8 RTS FCC9 : AO 43 headr LDY ?$4* WRITE A* 2 56 'LONG 1' FCC8 : 20 DB FC JSP ZFFPLY HALF CYCLES FCCE : DO F9 SNE HEAD^ (6 50 USEC EACH ) FCDO : 69 FE ADC #$FE FCD2 : BO F5 *CS HE ADR THEN A 'SHORT 0' FCD4 : AO 21 LDY *$21 (400 USEC) FCD6 : 20 DB FC WRBIT JSR ZERDLY WRITE TWO HALF CYCLES FCD9 : C8 INY OF 250 USEC ('0') FCDA : C8 I NY OR 500 USEC { '0') FCDB : 88 ZEPDLY DEY FCDC : DO FD BNE ZEROLY FCDE : 90 05 RCC WRTAPE Y IS COUNT FOR FCEO : AO 32 LDY #$32 TIMING LOOP FCE2 : 88 ONEDLY DEY FCE3 : DO FD BNE ONEDLY FCE5 : AC 20 CO - WRTAPE LDY TAPEOUT FCE8 : AO 2C LDY #$2C FCEA : CA DEX FCEB : 60 RTS FCEC : A2 08 RDRYTE LDX #$08 8 BITS TO READ FCEE : 48 PDBYT2 PHA READ TWO TRANSITIONS FCEF : 20 FA FC JSP RD2BIT (FIND EDGE) FCF2 : 68 PLA FCF3 : 2A POL A NEXT BIT FCF4 : AO 3A LDY *$3A COUNT FOR SAMPLES FCF6 : CA DEX FCF7 : DO F5 BNE ROBYT2 FCF9 : 60 RTS FCFA : 20 FD FC RD2BIT JSR RD3IT FCFD : 88 ■RDPIT DEY DECR Y UNTIL FCFE : AD 60 CO LDA TAPE IN TAPE TRANSITION FDOl : 45 2F EOR LA ST IN FD03 : 10 F8 BPL RDBIT FD05 : 45 2F EOR LA ST IN FD07 : 85 2F STA LA ST IN FD09 : CO 80 CPY #S80 SET CARRY ON Y-REG. FDOB : 60 PTS FDOC : A4 24 RDKEY LDY CH FDOE : Bl 28 LDA (PASL) ,Y SET SCREEN TO FLASH FDIO : 48 PHA FD11 : 29 3F AND *S3F FD13 : 09 40 ORA #$40 FD15 : 91 28 STA (FASL) ,Y FD17 : 68 PLA FD18 : 6C 38 00 J.wp (KSV.'L) GO TO USER KEY-IN FD1B : E6 4E KEYIN INC P.NDL FD1D DO 02 BNE KRYIM2 INCR RND NUMBER FD1F E6 4F IMC RNDH FD21 2C 00 CO KEYIN2 BIT KBD KEY DOWN? FD24 10 F5 EPL KFYIH LOOP FD26 91 28 STA (3ASL) ,Y REPLACE FLASHING SCREEN FD28: AD 00 CO LDA K?D CET KEYCODE FD2B: 2C 10 CO BIT KBDSTPB CLR KEY STROBE FD2E: 60 RTS FD2F: 20 OC FD ESC JSR PDKf.Y GET KFYCODE FD32: 20 2C FC JSR ESC1 HANDLE ESC FUWC. FD35: 20 OC FD P DC HAP JSP PDKEY READ KEY FD38: C9 93 CMP #$93 ESC? FD3A: FO F3 BEO ESC YES, DON'T RETURN FD3C: 60 RTS FD3D: A5 32 NOTCR LDA INVFLG FD3F: 48 PHA FD40: A9 FF LDA #$FF FD42: 85 32 STA INVFLG ECHO USER LLNE FD44: BD 00 02 LDA IN,X NON INVERSE FD4 7: 20 ED FD JSR COUT FD4A: 68 PLA FD4B: 85 32 STA INVFLG FD4D: BD 00 02 LDA IN,X FD50: C9 88 CMP #$88 CHECK FOR EDIT KEYS FD52: FO ID PEG BCK5PC BS, CTRL-X. FD54: C9 98 C«P #$98 FD56: FO OA BEO CANCEL FD58: EO F8 CPX #$F8 MARGIN? FD5A: 90 03 BCC NOTCR 1 FD5C: 20 3A FF JSR BELL YES, SOUND PELL FD5F: E8 NOTCR 1 INX ADVANCE INPUT INDEX FD60: DO 13 BNE NXTCHAR FD62: A9 DC CANCEL LDA #$DC BACKSLASH AFTER CANCELL? FD64: 20 ED FD JSR COUT 85 FD67 : 20 8E FD GETLNZ JSR CPOUT OUTPUT CP FD6A : A5 33 GETLN LDA PROMPT FD6C : 20 ED FD JSR COUT OUTPUT PROMPT CHAP FD6F : A2 01 LDX #501 INIT INPUT INDEX FD71 : 8A BCKSPC TXA WILL BACKSPACE TO FD72 : FO F3 EEQ GETliNZ FD74 : CA DEX FD75 : 20 35 FD NXTCilAF JSP PDCHAP FD78 : C9 95 CMP #PIC;< USE SCREEN CHAR FD7A : DO 02 BNE CAPTST FOP CTRL-U FD7C : Bl 28 LDA (BASL) , Y FD7E : C9 EO CAPTST CMP #SE0 FD80 : 90 02 3CC ADDIMP CONVERT TO CAPS FD82 : 29 DF AND #SDF FD84 : 9D 00 02 ADDIMP STA IM,X ADD TO IK PUT 3UF FD87 : C9 8D CMP *$8D FD89 : DO B2 BNE NOTCR FD8B : 20 9C FC JSP CLPEOL CLR TO FOL IF CR FD8E : A9 8D CROUT LDA ftS8D FD90 : DO 5B BNE COUT FD92 : A4 3D PPA1 LDY A1H PRINT CP ,Al IN 7 HEX FD94 : A6 3C LDX AIL FD96 : 20 8E FD PEYX2 JSR CPOUT FD99 : 20 40 F9 JSP PR.JTYX FD9C : AO 00 LDY #$00 FD9E : A9 AD LDA #$AD PRItfT '-' FDAO : 4C ED FD j:ip COUT FDA 3 : A5 3C XAM 8 LDA AIL FDA 5 : 09 07 ORA *$07 SET TO FINISH AT FDA7 : 85 3E STA A2L MOD P = 7 FDA 9 : A5 3D LDA A1H FDAB : 85 3F STA A2H FDAD : A5 3C M0C8CHK LDA AIL FDAF : 29 07 AND #$07 FDB1 : DO 03 BNE DAT A OUT FDB3 : 20 92 FD XAM JSP PRA1 FDB6 : A9 AO DATA OUT LDA #$A0 FDB8 : 20 FD FD JSP COUT OUTPUT BLANK FDBB : Bl 3C LDA (A1L),Y FDBD : 20 DA FD JSP PRBYTE OUTPUT BYTE IN HEX FDCO : 20 BA FC JSR WXTA1 FDC3 : 90 E8 BCC MOD3CHK CHECK IF TIME TO, FDC5 : 60 RTS4C PTS PRINT ADDP FDC6 : 4A XAMPM LSR A DETERMINE IF MOW FDC7 : 90 EA see XAM MODE IS XAM FDC9 : 4A LSR A ADD, OR SUB FDCA : 4A LSR A FDCB : A5 3E LDA A2L FDCD : 90 02 BCC ADD FDCF : 49 FF EOR 4SFF SU?: FORM 2'S COMPLEMENT FDD1 : 65 3C ADD ADC AIL FDD3 : 48 PHA FDD4 : A9 BD LDA *t$3D FDD6 : 20 ED FD JSR COUT PRINT '** , THEN RESULT FDD9 : 68 PLA FDDA i 48 PRBYTE PHA TRINT BYTE AS 2 HEX FDDB . 4A LSR A DIGITS, DESTROYS A-REG FDDC 4 A LSR A FDDD- 4A LSP A FDDEi 4A LSR A FDDF: 20 E5 FD JSR PRHEXZ FDE2: 68 PL* FDE3: 29 OF PRHEX AND #S0F PRINT HEX DIG IN A-REG FDE5! 09 BO PRHEXZ ORA #SB0 LSB ' S FDE7: C9 3A CMP #$BA FDE9: 90 02 BCC COUT FDEB: 69 06 ADC #$06 FDED: 6C 36 00 COUT JMP (CSFL) VECTOR TO USER OUTPUT ROUTI FDFO: C9 AO C0UT1 CMP #$A0 FDF2: 90 02 BCC COUTZ DON'T OUTPUT CTRL' S INVERSE FDF4: 25 32 AND INVFLG MASK WITH INVERSE FLAG FDF6: 84 35 COUTZ STY YSAV1 SAV Y-REG FDF8: 48 PHA SAV A-FEG FDF9: 20 FD FB JSR VIDOUT OUTPUT A-REG AS ASCII FDFC: 68 PLA RESTORE A-REG FDFD: A4 35 LDY YSAV1 AND Y-RFG FDFF: 60 RTS THEN RETURN FEOO: C6 34 BL1 DEC YSAV FE02: FO 9F BEO XAM8 FE04: CA BLANK DEX BLANK TO MON FE05: DO 16 BNE SETMDZ AFTER BLANK FE07: C9 BA CMP #$BA DATA STORE MODE? FE09: DO BB BNE XAMPM NO, XAM, ADD OR SUB FEOB: 85 31 STOP STA MODE KEEP IN STORE MODE FEOD: A5 3E LDA A2L 86 FEOF: FE11 FE13 FE15 FE17 FE18 FE1A FE1D: FElF FE20 FE22 FE24 FE26 FE28 FE29 FE2B FE2C FE2E FE30 FE33 FE35 FE36 FE38 FE3A FE3C FE3F FE41 FE44 FE46 FE49 FE4B FE4E FE50 FE53 FE55 FE58 FE5B FE5D: FE5E FE61 FE63 FE64 FE67 FE6A FE6C FE6E FE6F FE70 FE72 FE74 FE75 FE76 FE78 FE7A FE7C FE7D FE7F FE80 FE32 FE84 FE86 FE88 FE89 FE8B FE8D: FE8F FE91 FE93 FE95 FE97 FE99 FE9B FE9D: FE9F FEA1 FEA3 FEA5 FEA7 FEA9 FEAB FEAD: FEAE: FEAF: FEBO: FEB3: 75 FE 14 91 40 E6 40 DO 02 E6 41 60 A4 34 B9 FF 01 85 31 60 A2 01 B5 3E 95 4 2 95 44 CA 10 F7 60 Bl 3C 91 42 20 B4 FC 90 F7 60 Bl 3C Dl 42 FO 1C 20 92 FD El 3C 20 DA FD A9 AO 20 ED FD A9 A3 20 ED FD Bl 42 20 DA FD A9 A9 20 ED FD 20 B4 FC 90 D9 60 20 A9 48 20 DO F8 20 53 F9 85 3A 84 3B 68 38 E9 01 DO EF 60 8A FO 07 B5 3C 9 5 3A CA 10 F9 60 AO 3F DO 02 AO FF 84 32 60 A9 00 85 3E A2 36 AO IB DO 08 A9 00 85 3E A2 36 AO FO A5 3E 29 OF FO 06 09 CO AO 00 FO 02 A9 FD 94 00 95 01 60 EA EA 4C 00 EO 4C 03 EO RTS 5 SFTMODE SETMDZ LI' LT2 MOV! VFY VFYOK LIST LIST2 A1PC A IPC LP A1PCRTS SE'TINV SET WORM SETIFLG SETKBD IMPORT INPRT SETVID OUTPORT OUXPRT IOPRT IOPRT1 IOPRT2 XPASIC B A SCO NT STA INC BNE INC RTS LDY LDA STA RTS LDX LDA STA STA DEX BPL RTS LDA STA JSR BCC RTS LDA CMP BEO JSP LDA JSR LDA JSR LDA JSR LDA J3F. LDA JSR JSP BCC RTS JSP LDA PHA JSR JSP STA STY PLA SEC SBC BNE RTS TXA BEQ LDA STA DEX FPL RTS LDY BNE LDY STY RTS LDA STA LDX LDY BNE LDA STA LDX LDY LDA AND BEO ORA LDY BEQ LDA STY STA RTS rtOF NOP JiP J MP (A3L) ,Y STORE AS LOW BYTE AS (A3) A3L RTS5 INCR A3, RETURN A3H YSAV IN-1,Y '40DF *$01 A2L,X A4L,X A5L,X SAVE CONVERTED • : ' , '+ •-' ■. • AS MODE. COPY A2 (2 8YTES) TO A 4 AND A5 LT2 (AIL) ,Y MOVE (Al TO A2) TO (A4L),Y (A4) NXTA4 MOVE (ML) ,Y (A4L) ,Y VFYOK PRA1 (AIL) ,Y PR3YTE #$AG COUT #SA8 COUT <A4L) ,Y PR BYTE <f$A9 COUT MXTA4 VFY A1PC #$14 INSTDSP PC AC J PCL PCB #$01 LIST2 A IPC RTS AlL r X PCL,X A IPC LP VERIFY (Al TO A2) WITH (A4) T ^VE Al (2 BYTES) TO PC IF SPFJC'D AND DISSEMBLE 20 INSTRS ADJUST PC EACH INSTR NEXT OF 2 INSTRS IF USER SPEC'D ADR COPY FROM Al TO PC #$3F SET FOR INVERSE VID SETIFLG VIA COUT1 #$FF SET FOR NORMAL VID INVFLG #$00 A2L #KSWL #KEYIN IOPRT #$00 A2L #CSWL tCOUTl A2L #$0F IOPRT1 #IOADR/2 56 #$00 ICPRT2 #COUTl/256 LOC0,X LOCl,X SIMULATE PORT #0 INPUT SPECIFIED (KEYIN ROUTINE; SIMULATE PORT #0 OUTPUT SPECIFIED (COUT1 ROUTINE; SET RAM IN/OUT VECTORS BASIC BASIC 2 TO *ASIC WITH SCRATCH CONTINUE BASIC 87 FEB6: 20 75 FE GO JSR A IPC FEB9: 20 3F FF ■JSP RESTORE FEBC: 6C 3A 00 J MP (PCL) FEBF: 4C D7 FA RFGZ jwp REGDSP FEC2: C6 34 TPACF DEC YSAV FEC4: 20 75 FE STEPZ JSP A IPC FEC7: 4C 43 FA JMP STEP FECA: 4C F8 03 USP J MP USRADR FECD: A9 40 WRITE LDA #S4 FECF: 20 C9 FC JSR HE ADR FED2: A0 27 LDY #$27 FED4: A2 00 WR 1 LDX *$00 FED6: 41 3C EOF (A1L,X) FED8: 48 PHA FED9: Al 3C LDA (A1L,X) FEDB: 20 ED FE JSR tfPPYTE FEDE: 20 BA FC JSR NXTU FEE1: AO ID LDY #$1D FEE3: 68 FLA FEE4: 90 HE ECC tfRl FEE6: AO 22 LDY #$22 FEE 6: 20 ED FE JSR WRBYTE FEEB: FO 40 BEC P. ELL FEED: A2 10 WRBYTE LDX #$10 FEEF: OA WRBYT2 ASL A FEFO: 20 D6 FC JSR WRBIT FEF3: DO FA BNE WR3YT2 FEF5: 60 RTS FEF6: 20 00 FE CRM.CW JSR BL1 FEF9: 68 PLA PEFA: 68 PLA FEFB: DO 6C BNE MONZ FEFD: 20 FA FC READ JSR RD2BIT FFOO: A9 16 LDA #$16 FF02: 20 C9 FC JSR HEADR FF05: 85 2E STA CHKSUM FF07: 20 FA FC JSR RD2BIT FFOA: AO 24 RD2 LDY #$24 FFOC: 20 FD FC JSR PDBIT FFOF: BO F9 BCS RD2 FFllt 20 FD FC JSR PDBIT FF14: AO 3B LDY #$3B FF16: 20 EC FC RD3 JSR RDBYTE FF19: 81 3C STA (AlL,X) FF1B: 45 2E EOR CHKSUM FF1D: 85 2E STA CHKSU W FF1F: 20 3A FC JSR N'XTAl FF22: AO 35 LDY #$35 FF24: 90 FO BCC RD3 FF26: 20 EC FC JSR RDDYTE FF29: C5 2E CMP CHKSUM FF2B: FO OD BEO BELL FF2D: A9 C5 PRERR LDA #$C5 FF2F: 20 ED FD JSR COUT FF32: A9 D2 LDA 4SD2 FF34: 20 ED FD JSR COOT FF37: 20 ED FD JSR COUT FF3A: A9 87 BELL LDA #So7 FF3C: 4C ED FD JrlP COUT FF3F: A5 48 RESTORE LDA STATUS FF41: 48 PHA FF42: A5 45 LDA ACC FF44: A6 46 RESTRl LDX XREG FF46: A4 47 LDY YREG FF48: 28 PLP FF49: 60 RTS FF4A: 85 45 SAVE STA ACC FF4C: 86 46 SAV1 STX XREG FF4E: 84 47 STY YR EC- FF50: 08 PHP FF51: 68 PLA FF52: 85 48 STA STATUS FF54: BA TSX FF55: 86 49 STY. 5PNT FF57: D8 CLD FF58: 60 PTS FF59: 20 84 FE RESET JSR SETNORy FF5C: 20 2F FB JSR I NIT FF5F: 20 93 FE JSR SETVID FF62: 20 69 FE JSR SETKBD FF65: D8 MOW CLD FF66: 20 3A FF JSR BELL FF6 9: A9 AA MOW 2 LDA #SAA FF6B: 85 33 STA PROMPT FF6D: 20 67 FD JSR GETLNZ ADR TO PC IF SPEC'D RESTORE META REGS GO TO USFP SUBR TO REG DISPLAY ADR TO PC IF SPEC'D TAKE ONE STEP TO USP SUB 9 AT USRADR WRITE 10-SPC HEADER HANDLE CR AS PLANK THEN POP STACK AND RTN TO MON FIND TAPEIN EDGE DKTAY 3.5 SECONDS INIT CHKSUM»$FF FIND TAPEIN EDGE LOOK FOR SYNC ?IT (SHORT 0) LOOP UNTIL FOUND SKIP SECOND SYNC B-CYCLE INDEX FOP 0/1 TEST READ A BYTE STORE AT (Al) UPDATE RUNNING CHKSUM INCP Al f COMPARE TO A2 COMPENSATE 0/1 INDEX LOOP UNTIL DONE READ CHXSU'" BYTE GOOD, SOUND BELL AND RETURN PRINT "ERR" , THEN BE LI, OUTPUT BELL AND RETURN RESTORE 6 50 2 PEG CONTENTS US SO BY DEfHIG SOFTWAPE SAVE 65C2 REG CONTENTS SET SCREEN 10DE AND INIT KBD/SCREEN AS I/O DEV'S MUST SET HEX MODE! ** ' PROMPT FOR MON READ A LINE 88 FF70 FF73 FF76 FF78 FF7A FF7B FF7D: FF80 FF82 FF85: FF87 FF8A FF8C FF8D; FF8E FF8F FF90: FF91: FF93 FF95; FF96 FF98 FF9A FF9C FF9E FFAO FFA2 FFA3 FFA5 FFA7 FFA9 FFAB FFAD: FFi30: FFB1 FFB3: FFB5: FFB7: FFB9: FFBB FFBD: FFBE FFCO FFC1 FFC4 FFC5 FFC7 FFC9 FFCB FFCC FFCO: FFCE FFCF: FF'DO FFD1 FF02: FFD3 FFD4 FFD5 FFD6 FFD7 FFD8 FFD9 FFDA FFDB FFDC FFDD FFDE FFDF FFEO; FFE1: FFE2: FFE3 FFE4 FFE5 FFE6 FFE7 FFE8: FFE9 FFFA FFEB FFEC FFED: FFEE FFEF 20 C7 FF 20 A7 FF 84 34 AO 17 88 30 E8 D9 CC FF DO F8 20 BE FF A4 34 4C 73 FF A2 03 OA OA OA OA OA 26 3E 26 3F CA 10 F8 A5 31 DO 06 B5 3F 95 3D 95 41 E8 FO F3 DO 06 A2 00 86 3E 86 3F B9 00 02 C8 49 30 C9 OA 90 D3 69 88 C9 FA BO CD 60 A9 FE 48 B9 E3 FF 48 A5 31 AO 00 cJ4 31 60 BC B2 BE LD EF C4 EC A9 KB A6 A4 Ub 95 07 02 05 FO 00 EB 93 A7 C6 99 B2 C9 BE CI 35 8C C3 9b AF 17 17 2B IF NXTITM CHRSRCR DIC NXTBIT NX TEAS NX TBS 2 GETWUV WfCHP TOSUi Z'-iODE CHRTPL SURTFL JSR JSK STY LDY DFY rv"i CMP BNE JSR LDY JMP LDX ASL ASL ASL ASL ASL ROL POL DEX BPL LDA FNE LDA STA ST A INX 'iEQ 3NF LDX STX STX LDA IKY FOR CMP ?cc adc CtfP 3C? RTS LDA PHA LDA PHA LDA LDY STY RTS DFP DFP DFB DFB DFP DFP. DF»* DFB OF!5 DFe DFB DF£ DFa ofb DFP DFB DFP DFB DFB DFB DFP DFe DFB DFB DFB DFfc DFB DFB DFP DFB DFv? DFB DFB DFB DFB PF3 Z^ODE CLEAR "ON MODE, SCAN IDX GETNtW GET ITEM, NON-HEX YSAV CHAR IN A-REG #$17 X-REG=0 IF NO HEX INPUT MOW NOT FOUND, GO TO MON CHRTBL,Y FIND CMND CHAR IN TEL CBRS'RCH T05UB FOUMD, CALL CORRESPONDING YSAV SUBROUTINE UXTITI* #$03 A A A A A A2L A2K NXTBIT MODE NXTBS2 A2B,X A1H,X A 3 H , X 'JXTBAS rtXTCHW asoc A2L A 21; I V , Y #S30 #50 A DIG iSFA DIG iiCO/256 «U Q TFL,Y MODE *S0(! *ODE $3C $B2 $3E $ u ;d $RF SC4 SFC $A9 if^B $A6 SA4 SOb $9 5 $07 $02 $05 $F0 $00 SFB $93 $A7 $C6 $99 4BASCONT- *USft-l #*FGZ-1 #TFACE-1 #VFY-1 #INPRT-1 #STEPZ-1 *OUTPRT-l *XPASIC-1 #SETMODE- #3ETMODE- #MOVE-l #LT-1 GOT HEX DIC, SHIFT INTO A 2 LEAVE X=$FF IF DIG IF '-10DF IS 7.3RO THEN COPY A 2 TO Al A*C A3 CLEAR A2 GET CHAR IF HEX DIG, THEM PUSM rtlGH-OFDER SUPP ADR ON 1 STK PUS'* LO* ORDER SUb*'. ADR ON STK CLP iAQOF , OLD MODE TO A-REG GO TO SUBR VIA PTS F ("CTRL-C") F("CTRL-Y") FPCTRL-F'*) F("T") P{" V") FfCTFL-K") F("3") F( rt CTPL-P") FC'CTBL-B") P(--") F (" + ■•) FC'M") <F=EX-OP $B0 + $89' F ("<") FC'N") F("I") F<"L") F("W") F("0") F("R") F(" :") F<".") F("CR") F (BLANK) 1 89 FFFO : 83 FFF1 : 7F FFF2 : 5D FFF3 : CC FFF4 : fb FFF5 : FC FFF6 : 17 FFF7 : 17 FFF8 : F5 FFF9 i 03 FFFA F8 FFFB 03 FFFC 59 FFFDi FF FFFB j SO FFFF: FA XOTfl OFB #3ETUCRM-1 DFB 4SETINV-1 DFB #LIST-1 DFB #WRITE-1 DFB #GO-l DFe #PEAQ-1 DFB #SETMODE-l DFB #SFTMODE-l OFB #CRMON-l DFB &BLANK-1 DFB #NMI NMI VECTOR DFB *NMI/256 DFB #RESET RESET VECTOR DFB #FESET/256 DFB #IRC IRO VICTOR DFB *IR0/256 ECU $3C 90 ********************** F500: E4 dl F502: Ah F503: DO 14 F505: A4 3F F507: A6 3E F509: DO 01 F503: 88 F50C: CA F50D: 8A F50E: 18 F50F: E5 3A F511: 85 3E F513: 10 01 F515: C8 F516: 98 * APPLE- II * * MINI-ASSEi VI3LFR * * * * COPYRIGHT : 1977 FY * * APPLE CCK4PUTFP INC. * * * * ALL RIGHTS RESERVED * * * * S . WOZSIAK * * A. 3AUM * * * *********************** TITLE "APPLE- ■II H INI -ASS EM 3 FORMAT EPZ $2E LENGTH EPZ S2F MODE EPZ 531 PROMPT EPZ $33 YSAV EPZ $34 L EPZ $35 PCL EPZ $3A PCH EPZ S3* AlH EPZ S3P ^2L EPZ $3E A2E EPZ 53F A4L EPZ $42 A4M EPZ $43 F*!T EPZ $44 IN EOU $200 IMSDS2 EOU SF8SE INST03F EOU SF8O0 PR3L2 EOU SF94A PC AD J EOU SF953 CHAR1 EOU SF934 CHAR 2 EO.U $F9:-A :-i^Lr-tL EOU SF9C0 mheap ECU $FA00 CUF.SU P c.QU SFC1A GETLNZ EOU >FD67 COUT ECU SFOED 3L1 EOU SFE00 A1FCLP EOU SFE76 BELL EOU ?FF3A GETNUM EOU $FF^7 TOSU?. EOU $FFP? Z/'OOE EOU $FFC7 CHRTSL EOU $FFCC ORG SF50 REL SEC * S 2 1 IS F; ESP a .;ith D^r ERR 3 40 LOY A 2,: LEX »2L Y.iQViX BWE REL2 DEY REL2 DEX TXA CLC SBC PCL FORM STA A2L 6PL PEL 3 I MY REL3 TYA V COMPATIBLE RELATIVE -'ODE? LF dec reject ADDR-PC-2 91 F517: E5 33 SBC PCH F519: DO 6B ERR3 BNE ERR ERROR IF >1-BYTE BRANCH F51B: A4 2F FINDOP LDY LENGTH F51D: B9 3D 00 FND0P2 LDA A1H,Y MOVE INST TO (PC) F520: 91 3A STA (PCL) ,Y F522: 88 DEY F523: 10 F8 BPL FND0P2 F525: 20 1A FC JSR CURSUP F528: 20 1A FC JSP CURSUP RESTORE CURSOR F52B: 20 DO F8 JSR INSTDSP TYPE FORMATTED LINE F52E: 20 53 F9 JSR PCADJ UPDATE PC F531: 84 3B STY PCH F533: 85 3A STA PCL F535: 4C 95 F5 J*!P NXTLINE GET NEXT LINE F538: 20 BE FF FAKEM0N3 JSR TOSUB GO TO DELIM HANDLER F53B: A4 34 LDY YSAV RESTORE Y-INDEX F53D: 20 A7 FF FAKEMON JSR GETNUM READ PARAM F540: 84 34 STY YSAV SAVE Y-INDEX F542: AO 17 LDY #$17 INIT DELIMITER INDEX F544: 88 FAKEM0N2 DEY CHECK NEXT DELIM F545: 30 4B BMI RESETZ ERR IF UNRECOGNIZED DELIM F547: D9 CC FF CMP CHRTBL,Y COMPARE WITH DELIM TABLE F54A: DO F8 BME FAKEMON2 NO MATCH F54C: CO 15 CPY #S15 MATCH, IS IT CR? F54E: DO E8 BNE FAKEMON3 NO, HANDLE IT IN MONITOR F550: A5 31 LDA MODE F552: AO 00 LDY #$0 F554: C6 34 DEC YSAV F556: 20 00 FE JSR BL1 HANDLE CR OUTSIDE MONITOR F559: 4C 95 F5 JMP NXTLINE F55C: A5 3D TRYNEXT LDA A1H GET TRIAL OPCODE F55E: 20 8E F8 JSR INSDS2 GET FMT+LENGTH FOR OPCODE F561: AA TAX F562: BD 00 FA LDA MNEMR,X GET LOWER MNEMONIC BYTE F565: C5 42 CMP A4L MATCH? F567: DO 13 BNE NEXTOP NO, TRY NEXT OPCODE F569: BD CO F9 LDA MNEML,X GET UPPER MNEMONIC BYTE F56C: C5 43 CMP A4H MATCH? F56E: DO OC BNE NEXTOP NO, TRY NEXT OPCODE. F570: A5 44 LDA FMT F572: A4 2E LDY FORMAT GET TRIAL FORMAT F574: CO 9D CPY #$9D TRIAL FORMAT RELATIVE? F576: FO 88 BEQ REL YES. F578: C5 2E NREL CMP FORMAT SAME FORMAT? F57A: FO 9F BEQ FINDOP YES. F57C: C6 3D NEXTOP DEC A1H NO, TRY NEXT OPCODE F57E: DO DC BNE TRYNEXT F580: E6 44 INC FMT NO MORE, TRY WITH LEN=2 F582: C6 35 DEC L WAS L=2 ALREADY? F584: FO D6 BEQ TRYNEXT NO. F586: A4 34 ERR LDY YSAV YES, UNRECOGNIZED INST. F588: 98 ERR2 TYA F589: AA TAX F58A: 20 4A F9 JSR PRBL2 PRINT " UNDER LAST READ F58D: A9 DE LDA #$DE CHAR TO INDICATE ERROR F58F: 20 ED FD JSR COUT POSITION. F592: 20 3A FF RESETZ JSR BELL F595: A9 Al NXTLINE LDA #$A1 M ' F597: 85 33 STA PROMPT INITIALIZE PROMPT F599: 20 67 FD JSR GETLNZ GET LINE. F59C: 20 C7 FF JSR ZMODE INIT SCREEN STUFF F59F: AD 00 02 LDA IN GET CHAR F5A2: C9 AO CMP #$A0 ASCII BLANK? F5A4: FO 13 • BEO SPACE YES F5A6: C8 INY F5A7: C9 A4 CMP #$A4 ASCII '$' IN COL 1? F5A9: FO 92 BEO FAKEMOM YES, SIMULATE MONITOR F5AB: 88 DEY NO, BACKUP A CHAR F5AC: 20 A7 FF JSP GETNUM GET A NUMBER F5AF: C9 93 CMP #$93 ' : ' TERMINATOR? F5B1: DO D5 ERR4 BMJ' EIRR2 NO, ERR. F5B3: 8A TXA F5B4: FO D2 BEQ ERR2 NO ADR PRECEDING COLON. F5B6: 20 78 FE JSR A1PCLP MOVE A DP TO PCL, PCH. F5B9: A9 03 SPACE LDA *$3 COUNT OF CHARS IN MNEMONIC F5BB: 85 3D STA A1H F5BD: 20 34 F6 NXTMN JSR GETNSP CET FIRST MNEM CHAR. F5C0: OA NXTM A3L A F5C1: E9 BE SEC #$BE SUBTRACT OFFSET F5C3: C9 C2 CMP #$C2 LEGAL CHAR? F5C5: 90 CI BCC ERR2 NO. F5C7: OA ASL A COMPRESS-LEFT JUSTIFY F5C8: OA ASL A F5C9: A2 04 LDX #$4 ■F5CB: OA NXTM2 ASL A DO 5 TRIPLE WORD SHIFTS 92 F5CC : 26 42 ROL A4L F5CE : 26 "4 3 ROL A4H F5D0 : CA DEX F5D1 : 10 F8 SPL NXTM2 F5D3 : C6 3D DEC A1H F5D5 : F0 F4 BEQ NXTM2 F5D7 : 10 E4 BPL NXTMN F5D9 : A2 05 F0PM1 LDX #$5 F5DB : 20 34 F6 F0Rrf2 JSP GETMSP F5DE : 84 34 STY YSAV F5E0 : DD 34 F9 CMP CHAR1,X F5E3 : DO 13 BNE FORM 3 F5E5 : 20 34 F6 JSR GETMSP F5E8 : DD 3A F9 CMP CH*R2,X F5EB FO OD B?9 "0R^5 F5ED: BD 3A F9 L-DA C«iA-'2,X F5F0 FO 07 BEO FORK 4 F5F2 C9 A4 CMP #$A4 F5F4 FO 03 BEO FORM 4 F5F6: A4 34 Ley YSAV F5F8: 18 FORK 3 CLC F5F9' 88 FORM 4 DEY F5FA- 26 44 FORM 5 ROL FtfT F5FC- EO 03 CPX #S3 F5FE: DO OD ■BNE FOR?* 7 F600: 20 A7 FF JSP GETNU* F603: A5 3F LDA A2H F605: FO 01 BEQ FORM 6 F607: E» I NX F608: 86 35 F0RW6 STX L F60A: A2 03 LDX #S3 F60C: 88 DEY F60D: 86 3D FOK.4 7 STX A 1 H F60F: CA DEX F610: 10 C9 BPL FORM 2 F612: A5 44 LDA F«T F614! OA ASL A F615: OA ASL A F616: 05 35 ORA L F618: C9 20 CMP *$20 F61A: BO 06 PCS FOR?18 F61C: A6 35 LDX L F61E: FO 02 BEO FORM 8 F620: 09 80 ORA #$80 F622: 85 44 FORMS 3TA FKT F624: 84 34 STY YSAV F626: B9 00 02 LDA IN,Y F629: C9 BB CMP #$B3 F62B: FO 04 BEO FORM9 F62D: C9 8D CMP #$8D F62F: DO 80 BNE ERF4 F631: 4C 5C F5 FORM 9 JMP TRYNEXT F634: B9 00 02 GFTNSP LDA IN,Y F637: C8 INY F638: C9 AO CMP #$A0 F63A: FO F8 BEO GETNSP F63C: 60 RTS ORG $F666 F666: 4C 92 F5 MINASM JMP RESETZ DONE WITH 3 CHARS? YES, BUT DO 1 MORE SHIFT NO 5 CHAPS IN ADDR MOPE GFT FIRST CHAR OF ADDR FIRST CHAR MATCH PATTERN!? NO YES, GET SECOND CHAR BATCHES SECOND HALF? YES NO, 13 SECOND HALF ZERO? yes. NO, SECOND HALF OPTIONAL? VES. CLEAR 3IT-KO MATCH RACK UP 1 CHAR FORW FORMAT BYTE TIME TO CHECK FOR ADDR. NO YES HIGH-ORDER 3YTE ZERO NO, INCP FOR 2-BYTE STORF LENGTH RELOAD FORMAT INDEX PACKUP A CHAR SAVE INDEX DONE WITH FORMAT CHECK? NO. YFS, PUT LENGTH IN LOW BITS ADD '$' IF NONZERO LENGTH AND DON'T ALREADY HAVE IT GET NEXT N0N3LANK ' ; ' START OF COMMENT? YES CARRIAGE RETURN? NO, ERR. GET NEXT NON BLANK CHAR 93 *********************** * * * * * * * mPVPTCHT 1Q?7 nv * APPLE-I1 FLOATING POINT ROUTINES COPYRIGHT 197' APPLE COMPUTER ' BY I NC . ALL RIGHTS RESERVED 3. WOZNIAK F425: F426: F428: F42A: F42C: F42E: F42F: F431: F432: F434: F437: F439: F43B: F4 3E: F440: F441: F443: F445: F447: F4 49: F44B: F44D: F44E: F450: F451: F453: F455: F457: F4 59: F45B: F450: F45F: F461: F463: F465: F467: F468: F46B: F46E: F470: F472: F474: F477: F479: 18 A2 02 B5 F9 75 F5 9 5 F9 CA 10 F7 60 06 F3 20 37 F4 24 F9 10 05 20 A4 E6 F3 36 A2 04 94 FB B5 F7 34 F3 9 4 F7 95 F3 CA DO F3 60 A9 be F4 85 F8 A5 F9 C9 CO 30 0C C6 F8 06 FB 26 FA 26 F9 A5 F8 DO EE 60 20 A4 F4 20 7B F' A5 F4 C5 F8 DO F7 20 25 F4 50 EA 70 05 SIGN X2 M2 XI Ml E OVLOC ADD ADUl MD1 ABSrtAP ADS, 'API SWAP SWA PI **********************! TITLE "FLOATING POINT EPZ SF3 EPZ EPZ FPZ EPZ EPZ EOU ORG CLC r.Dx LDA ADC 5TA DKY BPL RTS A3L JSR BIT BPL JSR INC SEC LDX STY LDA LDY STY ST A DFX BMF. RTS LDA STA LDA CMP BrtI DEC ASL ROL ROL LDA BNE RTS JSR JSR LDA CMP BNE JSR BVC BVS ROUTINES' FLOAT k JORMl NORM RTS1 FSUB SWPALGM FACD ADDEND $F4 $F5 $F8 ?F9 SFC S3F5 $F425 H-2 K 2 , X *Q,X ADD1 SIGN A-RS/'AP •*1 ABSWAPl FCOi-iPL SIGN E-1,X X1-1,X *2-l,X X1-1,X X2-1,X SW^Pl #SBE XI #sco RTS1 XI Ml + 2 «1 + 1 Ml XI NORMl FCOtfPL ALGNSU'P X2 X 1 SWPALGN ADD NOR '4 RTLOG CLEAR CARRY. INDEX FOR 3-BYTF ADD. ADD A '3YTE OF *IANT2 TO MAMTl. INDEX TO NEXT MORE SIGNIF. BYTE. LOOP UNTIL DONE. RETURN CLEAR LSB OF SIGN. A*3 VAL OF MI, THEN SWAP WITH M2 MANT1 NEGATIVE? MO, S'.'AP tflTH MA NT 2 AMD RETURN. YES, COMPLEMENT IT. INC'- 1 SIGN, COMPLEMENTING LSB. SET CARRY FOR RETURN TO MUL/DIV. INDEX FOR 4-BYTF SWAP. SWAP A BYTE OF EXP/MANT1 WITH EXP/MANT2 AND LEAVE A COPY OF "ANT1 IN E (3 BYTES). E+3 USED ADVANCE INDEX TO M3XT BYTE. LOOP UNTIL DONE. RETURN I NIT F/Pl TO 14, TKEN WORWALIZE TO FLOAT. BIG ^-ORDER MANT1 BYTE. UPPER TV T PITS UNEOUAL? YES, RETURN WITH :"ANT1 NORMALIZED DECREMENT EX PI. SHIFT ^ANTl {3 BYTES) LEFT. EXP1 ZERO? NO, CONTINUE. NORMALIZING. RETURN. CMPL VANTl, CLEARS CARRY UNLESS RIGHT SHIFT MANT1 OR SWAP WITH COMPARE EXPl WITH EXP2. IF #,SWAP ADDENDS OP ALIGN MANTS. ADC ALIGNED KANTISSAS. NO OVERFLOW, NORMALIZE RESULT. OV: SHIFT Ml RIGHT, CARRY INTO SIGt* 94 F47B: 90 C4 ALGMSViP BCC S^AP * ELSE SHIFT RIG F47D: A5 F9 RTAP LDA >U F47F: 0A ASL A F480: E6 F8 RTLOG INC XI F462: FO 75 PEC OVFL F484: A2 FA RTL0G1 LDX #$FA F486: 76 FF R0P1 ROR E + 3,X F488: E8 INX F489: DO FB BNE ROR1 F48B: 60 FTS F48C: 20 32 F4 Fnuh JSP tfDl F48F: 65 F8 AOC XI F491: 20 E2 F4 JSR V D2 F494: 18 CLC F495: 20 84 F4 -HJL1 JSK RTLOG 1 F498: 90 03 3CC fUL2 F49A: 20 25 F4 JSP ADO F49D: 88 MUL2 DEY F49E: 10 F5 PPL WUL1 F4A0: 46 F3 NiDFND LSR SIGN F4A2: 90 CF MOP MX pec >.4C py F4A4: 38 FCOMPL SEC F4A5: A2 03 LDX #$3 F4A7: A9 00 CCMPL1 LDA #$0 F4A9: F5 F8 SSC XI, X F4AB: 95 F8 STA XI, X F4AD: CA DEX. F4AE: DO F7 BNS COMPL1 F4B0: FO C5 BEQ ADDEND F4B2: 20 32 F4 FDIV J3R «D1 F4B5: F5 F8 SBC XI F4B7: 20 E2 F4 J3R r -lD2 F4BA: 38 DIV1 SEC F4BB: A2 02 LDX #$2 F4BD: B5 F5 DIV2 LDA N2,X F43F: F5 FC SBC E,X F4C1: 48 PHA F4C2: CA DEX F4C3: 10 F8 BPL PIV2 F4C5: A2 FD LDX i$FD F4C7: 68 DIV3 PLA F4C8: 90 02 BCC DIV4 F4CA: 95 F8 STA M2+3,X F4CC: E8 DIV4 I NX F4CD: DO F8 BNE DIV3 F4CF: 26 FB ROL Ml + 2 F4D1: 26 FA ROL Ml + 1 F4D3: 26 F9 ROL Ml F4D5: 06 F7 ASL Ni2 + 2 F4D7: 26 F6 ROL V.2+1 F4D9: 26 F5 ROL M2 F4DB: BO 1C BCS OVFL F4DD: 88 DEY F4DE: DO DA BNE DIV1 F4E0: FO BE BEG MDFND F4E2: 86 FB MD2 STX Ml + 2 F4E4: 86 FA STX Ml + 1 F4E6: 86 F9 STX Ml F4E8: BO OD BCS OVCHK F4EA: 30 04 BMI MD3 F4EC: 68 PLA F4ED: 68 PLA F4EE: 90 B2 BCC NORi*X F4F0: 49 80 MD3 EOR #$80 F4F2: 85 F8 STA XI F4F4: AO 17 LDY *$17 F4F6: 60 RTS F4F7: 10 F7 OVCHK BPL MD3 F4F9: 4C F5 03 OVFL J -VIP QJIG OVLOC $F63D F63D: 20 7D F4 FIX1 JSP RTAR F640: A5 F8 FIX LDA XI F642: 10 13 BPL UMDFL F644: C9 8E CMP #$85 F646: DO F5 DMF FIX1 F648: 24 F9 BIT Wl F64A: 10 OA BPL FIXPTS F64C: A5 FB LDA Ml + 2 F64E: FO 06 BFO FIXRTS F650: E6 FA INC Ml + 1 F652: DO 02 bne; FIXRTS F654: E6 F9 INC Kl F656: 60 FIXRTS RTS F657: A9 00 UMDFL LDA #$0 F659: 85 F9 STA Ml F658: 85 FA STA "il + l F65D: 60 FTS SWAP IF CARRY CLEAR, HT ARITH. SIGN OF MANT1 INTO CARRY FOR RIGHT ARITH SHIFT. I NCR XI TO ADJUST FOR RIGHT SHIFT EXPl OUT OF RANGE. INDEX FOR 6:RYTE RIGHT SHIFT. NEXT BYTE OF SHIFT. LOOP UNTIL DONS. RETURN. ABS VAL OF KANT1, HANT2. ADD FXP1 TO EXP2 FOR PRODUCT EXP CHECK PROD. EXP AND PREP. FOR MUL CLEAR CARRY FOR FIRST BIT. Ml AND E RIGHT (PROD AND MPLIEP) IF CARRY CLEAR, SKIP PARTIAL PROD ADC MULTIPLICAND TO PRODUCT. NEXT wrjL ITERATION. LOOP UNTIL DONE. TEST SIGN LSB. IF EVEN, NORMALIZE PROD, ELSE COMP SET CARRY FOR SUBTRACT. INDEX FOR 3- BYTE SUBTRACT. CLEAR A. SUBTRACT BYTE OF EXPl. RESTORE IT. NEXT :40RE SIGNIFICANT BYTE. LOOP UNTIL DONE. NORMALIZE (OR SHIFT RT IF OVFL). TAKE ABS VAL OF MANT1 , MANT2. SUBTRACT EXPl FRO^ EXP2. SAVE AS OUOTIENT EXP. SET CARRY FOR SUBTRACT. IMDEX FOR 3-PYTF SUBTRACTION. SUBTRACT A BYTE OF E FROM MANT2.- SAVE ON STACK. NEXT KORF SIGNIFICANT BYTE. LOOP UNTIL DONE. INDEX FOR 3-BYTE CONDITIONAL MOVE PULL BYTE OF DIFFERENCE OFF STACK IF M2<E THEN DON'T RESTORE M2. NEXT LESS SIGNIFICANT BYTE. LOOP UNTIL DONE. ROLL OUOTIENT LEFT, CARRY INTO LSB SHIFT DIVIDEND LEFT. OVFL IS DUE TO UNNORMED DIVISOR NEXT DIVIDE ITERATION. LOOP UNTIL DONE 23 ITERATIONS. NORM. QUOTIENT AND CORRECT SIGN. CLEAR MANT1 (3 BYTES) FOR MUL/DIV. IF CALC. SET CARRY, CHECK FOR OVFL IF NTFG THEN MO UNDERFLOW. POP ONE RETURN LEVEL. CLFAF XI AND RETURN. COMPLEMENT SIGN SIT OF EXPONENT. STORE IT. COUNT 24 VUL/2 3 OIV ITERATIONS RETURN. IF POSITIVE EXP THEN MO OVFL. 95 *********************** APPLE-II PSEUDO MACHINE INTERPRETER COPYRIGHT 1977 APPLE COMPUTER IMC ALL RIGHTS RESERVED S. WOZNIAK *********************** TITLE -SWEET16 INTERPRETER F689: F68C: F68D: F68F: F690: F692: F695: F698: F69A: F69C: F69E: F6A0: F6A1: F6A3: F6A5: F6A7: F6A8: F6A9: F6AA: F6AC: F6AE: F6B0: F6B1: F6B2: F633: F684: F6B7: F6B8: F6B9: F6BB: F63D: F6BF: F6C2: F6C3: F6C5: F6C6: F6C7: F6C8: F6C9: F6CC: F6CF: 20 4A FF 68 85 IE 68 85 IF 20 98 F6 4C 92 F6 E6 IE DO G2 E6 IF A9 F7 48 A0 00 81 IE 29 OF OA AA 4A 51 IE FO OB 66 ID 4A 4A 4A A8 E9 El F6 48 60 E6 IE DO 02 E6 IF fcD F4 F6 48 A5 ID 4A 60 68 68 20 3F FF 6C IE 00 Bl IF ROL ROM R14H R15L R15H S 16 PAG SAVE RESTORE Sv/16 SW 16 8 SW1GC S*U6D T03P TC:*K2 RTWZ SETZ EPZ EPZ EPZ EPZ EPZ EQU EQU EQU ORG J3R PLA STA PLA STA JSP J MP INC BNE INC LDA PHA LDY LDA AND ASL TAX LSR EOR ?EO STX LSR LSR LSR TAY LDA PHA P.TS INC :w; inc LDA PHA LDA LSR PTS PLA PLA JSR Jf,P LDA $0 $1 510 S1E : IF SF7 SFF4A $FF3F $F689 SAVE R15L F15H SVJ16C SW16F R15L SW16D R15H *S16PAG #S0 (R15L) r Y #$F A A (P15L) ,Y TOBP P14" A A A TO Y-^EC FOP INDEXING CPTBL-2,Y LOlv-ORDFR ADR "YTE ONTO STACK GOTO REG-OP ROUTINE PRESERVE 6 50 2 REG CONTENTS I NIT SWEET 16 PC FROM RETURN ADDPESS IN'TF-RPRET AMD EXECUTE OHE 3WEET16 INSTR. INCP S'?EET16 PC FOR FETCH PUSH On STACK FOR PTS FETCH INSTR MASK PEG SPECIFICATION DOUBLE FOP 2-RYTE REGISTERS TO X-PEG FOR I^DEYING NOW HAVE OPCODE IF ZERO THEN NON-REG OP INDICATE' PRIOR RESULT PEG' OPCOPE*2 TO LSP'S R.15L L'OMR2 R15H PPTPL ?.1*H PES TO RE (P15L) (R15L) ,Y IfvCP. PC LOW -ORDER ADR LYTF ONTO STACK FOR NON-RFG OP 'PRIOR RESULT PEG' INDEX PREPARE CARRY FOR PC, BNC. GOTO NON-PEG OP ROUTINE PO D RETURN ADORESS RESTORF 6502 REG CONTENTS RETURN TO 6 502 CODE VIA PC HIGH-ORDER BYTE OF CONSTANT 96 F6D1: F-6D3: P6D4: F6D6: F6D8: F6D9: F6DA: F6DC: F6DE: F6E0: F6E2: F6E3: 6E4: F6E5: F6E6: F6E7: F6E8: F6E9: F6EA: F6EB: F6EC: F6ED: F6EE: F6EF: F6F0: F6F1: F6F2: F6F3: F6F4: F6F5: F6F6: F6F7: F6F8: F6F9: F6FA: F6FB: F6FC: F6FD: F6FE: F6FF: F700: F701: F702: F703: F705: F707 F709 F70B F70D: F70E F710 F712 F714 F716 F717 F719 F71B F71D: F71F! F721: F723 F725 F726 F728 F72A: F72C: F72E F730 F732 F734 F737; F739: F73A; F73D: F73F F741 F743 F745: F747 F748 F74B F74D: F74F: F752: 95 01 88 Bl IE 95 00 98 38 65 IE 85 IE 90 02 E6 IF 60 02 F9 04 90 0D 9E 25 AF 16 B2 47 B9 51 CO 2F C9 5B D2 85 DD 6E 05 33 E8 70 93 IE E7 65 E7 E7 E7 10 CA B5 00 85 00 B5 01 85 01 60 A5 00 95 00 A5 01 95 01 60 A5 00 81 00 AO 00 84 ID F6 00 DO 02 F6 01 60 Al 00 85 00 AO 00 84 01 FO ED AO 00 FO 06 20 66 F7 Al 00 A8 20 66 F7 Al 00 85 00 84 01 AO 00 84 ID 60 20 26 F7 Al 00 85 01 4C IF F7 20 17 F7 SPT2 OPTBL BR TBI. SET LD BK ST STAT STAT 2 STAT3 INR INF2 LDAT POP POPD POP2 PO?3 LDDAT STDAT STA DF.Y LDA STA TYA SEC ADC STA BCC INC RTS DFB DFE DFB DFE DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFP DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB BPL LDA EQU STA LDA STA RTS LDA STA LDA STA RTS LDA STA LDY STY INC 3NE INC RTS LDA STA LDY STY BEO LDY BEO JSR LDA TflY JSR LDA STA STY LDY STY RTS JSR LDA STA J-MP JSR R0H,X (R15L) ,Y LOW-ORDER BYTE OF CONSTANT R L , X Y-REG CONTAINS 1 tH5L *15L SET 2 P15H SET-1 RTN-1 LD-1 £R-1 ST-1 BMC-1 LDAT-1 RC-1 STAT-1 8P-1 LDDAT-1 BM-1 STDAT-1 bz-1 POP-1 3NZ-1 ST PAT- 1 BM1-1 ADD-1 8N*1-1 SU3-1 BK-1 PCPD-1 PS-1 CPR-1 3S-1 INR-1 NUL-1 DCR-1 NUL-1 NUL-1 NUL-s-1 SETZ R0L,X *-l ROL R0H,X ROH ROL R0L,X ROH R0H,X POL (P0L,X) #$0 R14H R0L,X INR2 R0H,X (R0L,X) POL #$0 ROH STAT 3 #$0 POP2 DCR <R0L,X) DCP (R0L,X) ROL ROH *$0 R14H LDAT (R0L,X) R0 r -T INR STAT ADD 2 TO PC (IX) (0) (2X) (1) (3X) (2) (4X) (3) (5X) (4) (6X) (5) (7X) (6) (8X) (7) (9X) (8) (AX) (9) (BX) (A) (CX) (B) <DX) (C) (EX) (D) (FX) (E) (UNUSED) (F) ALWAYS TAKEN MOVE RX TO RO MOVE RO TO RX STORE BYTE INDIRECT INDICATE RO IS RESULT REG INCR RX LOAD INDIRFCT (RX) 10 RO ZERO HIGH-ORDER PO BYTE ALWAYS TAKEN HIGH ORDER BYTE * ALWAYS TAKEN DECR RX POP HIGH-ORDER BYTE (3RX SAVE IN Y-REG DECR RX LOW-ORDER BYTE TO RO INDICATE RO AS LAST RSLT REG LOW-ORDER BYTE TO R0 f INCR RX HIGH-ORDER BYTE TO RO I NCR RX STORE INDIRFCT LOW-ORDER 97 F755 P757 F759 F75C F75F F761 F763 F766 F768 F76A F76C F76E F76F F771 F772 F774 F776 F779 F77B F77D F780 F781 F783 F785 F786 F788: F78A: F78C F78E F790 F792 F794 F796 F799 F79B F79E F79F F7A1 F7A3 F7A5 F7A6 F7A8 F7AA F7AB F7AD F7AF F7E0 F7B2 F7B3 F7B4 F7B5 F737 F7B9 F7BA F7BS F7BC F7BE F7C0 F7C1 F7CZ F7C3 F7C5 F7C7 F7C9 F7CA F7C8 F7CC F7CE F7D0 F7D2 F7D3 F7D4 F7D5 F7D7 F7D9 F7DB F7DD F7DE F7DF F7E0 F7E2 F7E4 F7E6 F7E8 F7E9 A5 01 81 00 4C IF F7 20 6b F7 A5 00 81 00 4C 43 F7 B5 00 DO 02 D6 01 D6 00 60 AO 00 38 A5 00 F5 00 99 00 A5 01 F5 01 99 01 98 69 00 85 ID 60 A5 00 75 00 85 00 A5 01 75 01 AO 00 FO E9 A5 IE 20 19 A5 IF 20 19 18 BO OE Bl IE 10 01 88 65 IE 85 IE 98 65 IF 85 IF 60 BO EC 60 OA AA B5 01 10 E8 60 OA A A B5 01 30 El 60 OA AA B5 00 15 01 FO D8 60 OA AA B5 00 15 01 DO CF 60 OA AA B5 00 35 01 49 FF FO C4 60 OA AA B5 00 35 01 49 FF DO B9 60 A2 18 1TPA' F7 OCP DCR2 sen CPR 00 00 SU62 ADD BS BR BNC BR1 SR2 3NC2 3C BP 3M BZ PrtZ BM1 BNM1 NUL RS LDA STA JMP JSP LOA STA JMP LDA BNE DEC DEC RTS LDY SEC LDA SBC STA LDA SBC STA TYA ADC STA RTS LDA ADC STA LDA ADC LDY BEO LDA JSP LDA JSP CLC BCS LDA 3PL DEY ADC STA TYA ADC STA RTS BCS RTS ASL TAX LDA BPL PTS ASL TAX LDA BMI PTS ASL TAX IDA OF.A DEO PTS ASL TAX LDA ORA BNE PTS ASL TAX LDA AND EOP BEO RTS ASL TAX LOA AND EOR BNE PTS LDX ROH BYTE AND INCR PX. THEN (R0L,X) STORE HIGH-ORDER BYTE. INR I NCR