This action might not be possible to undo. Are you sure you want to continue?
This recreation of the 1978 Apple ][ Redbook is courtesy of Gerry Doire. email@example.com for any comments or suggestions. If you wish to donate monetary or computer hardware for the continuation of this project email: firstname.lastname@example.org
Current Donators to this project are: Dan Chisarick, David Schmidt
10260 Brandley Dr.APPLE II Reference Manual January 1978 APPLE Computer Inc. CA 95014 . Cupertino.
Loading. Simplified Memory Map 10. Power Up 5. Mastermind (8K) e. BASIC Functions 4.Graphics Colors 7. GETTING STARTED WITH YOUR APPLE II 1. Interfacing the APPLE Signals. Dragon Maze (4K) C. Breakout and Color Demos Tapes 11. APPLE II INTEGER BASIC 1. Breakout and Color Demos Program Listings 12. System Monitor Commands 2. Pin Connections 6. Annotated Monitor and Dis-assembler Listing 5. Additional BASIC Program Examples a. Special Controls and Features 8. Rod’s Color Pattern (4K) b. Interfacing with the Home TV 4. Pong (4K) c. Running Your First and Second Programs 8. Loading a Program Tape 10. BASIC Commands 2. Simple Serial Output 5. Expansion.APPLE Reference Manual TABLE OF CONTENTS A. Warranty Registration Card 3. Memory Options. How to Play Startrek 13. Map. Sweet 16 Interpreter Listing 7. Simple Tone Subroutines 12. Check for Shipping Damage 4. Getting Started with Your APPLE II Board 2. Biorhythm (4K) f. Special Controls and Features 4. APPLE II Switching Power Supply 3. Special Control and Editing 6. Table A. APPLE II HARDWARE 1. Schematics 55 55 56 57 59 61 63 67 68 72 74 76 94 96 100 106 107 110 112 114 122 133 140 141 . Running 16K Startrek 9. APPLE II FIRMWARE 1. Binary Floating Point Package 6. High Resolution Graphics Subroutines and Listings 12 14 15 17 18 19 22 23 28 29 30 32 33 34 43 46 3 3 4 6 1 1 1 2 2 2 3 13. 6502 Op Codes D. Address 7. APPLE II Speaks Several Languages 6. APPLE Integer BASIC 7. Loading HIRES Demo Tape B. System Timing 8. BASIC Operators 3. BASIC Error Messages 9. BASIC Statements 5. Color Sketch (4K) d. Unpacking 2. Data Read/Save Subroutines 11. Control and Editing Characters 3.
2. Save it for the unlikely event that you may need to return your Apple II for warrantee repair. Pair of Game Paddles c. Applesoft reference manual 4. see hardware section in this manual on how to get started. Notify your dealer or Apple Computer. Apple II system including mother printed circuit board with specified amount of RAM memory and 8K of ROM memory. Your Apple II's serial number is located on the bottom near the rear edge. You should have received the following: 1. e. b. A.C. Applesoft Floating Point Basic Language Cassette with an example program on the other side. switching power supply. Inc. If you purchased a 16K or larger system. For Example: A2SØØØ8X is an 8K Byte Apple II system. Cassette recorder interface cable (miniature phone jack type) 3. Accessories Box including the following: a. c. 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. and case assembly.GETTING STARTED WITH YOUR APPLE II Unpacking Don't throw away the packing material. 1 . immediately if you are missing any items. You model number is: A2SØØMMX MM is the amount of memory you purchased. Cassette tape with "Breakout"on one side and "Color Demos" on the other side. 16K Startrek game cassette with High Resolution Graphics Demo ("HIRES") on the flipside. keyboard. In addition other items such as a vinyl carrying case or hobby board peripherial may have been included if specifically ordered as "extras". If you bought an Apple II Board only. your accessory box should also contain: a. This manual including warranty card. b. Power Cord d.
The following should happen: the Apple's internal speaker should beep. Now depress and release the "RESET" key again. Be careful as this connector is fragile. This should clear your TV screen to all black. The indicator light (it's not a switch) on the keyboard should now be ON. and a flashing white square should appear just to the right of the asterisk. then hold down the "SHIFT" key while depressing and releasing the P key. Plug in your game paddles into the Apple II board at the socket marked "GAME I/O" at location J14. Inspect the inside. This type of set is commonly called a "Monitor".C. Connect the A. outlet. Replace the lid and press on the back top of it to re-snap it into place.C. Optionally you may connect the Apple to the antenna terminals of your TV if you use a modulator. If not. an asterisk ("*") prompt character should appear at the lower left hand corner of your TV. Press and release the "Reset" button on the keyboard. If the Apple beeps and garbage appears but you cannot see an "*" and the cursor. and minimizes RFI problems. This ground is for your safety if there is an internal failure in the Apple power supply. The white dot on the connector should be face forward. it is possible to modify your existing set. Now turn on the power switch on the back of the Apple. See additional details in the hardware section of this manual under "Interfacing with the Home TV". Gently lift up on the top rear of the lid of the case to release the lid snaps and remove the lid. Connect a cable from the video output jack on the back of the Apple to a TV set with a direct video input jack.Check for Damage Inspect the outside case of your Apple for shipping damage. See hardware section of this manual for additional detail. Gently press down on each integrated circuit to make sure that each is still firmly seated in its socket. Power Up First. the horizontal or vertical height settings on the TV need to be adjusted. connections. Make sure that you connect the third wire to ground if you have only a two conductor house wiring system. Write for Apple's Application note on this. check A. make sure that the power ON/OFF switch on the rear power supply panel on your Apple II is in the "OFF" position. The "*" prompt character and the cursor should return to the lower left of your TV screen. The rest of the TV screen will be made up of radom text characters (typically question marks). Now depress and release the "ESC" key.C. minimizes the chance of static damage to the Apple. Nothing should be loose and rattling around. If your set does not have a direct video input. power cord to the Apple and to a 3 wire 12Ø volt A. 2 .
3. an you are in the "Monitor" language. 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. Load this program just as you did the previous two. but before you "RUN" it. Now depress and release the "RETURN" key to tell Apple that you have finished typing a line on the keyboard. a for advanced programmers. Control key functions are not displayed on your TV screen but the Apple still gets the message. you will also receive a "STARTREK" game tape. To switch to this language hold down the "CTRL" key while depressing and releasing the "B" key. Apple Integer BASIC Apple also contains a high level English oriented language called Integer BASIC.Apple Speaks Several Languages The prompt character indicates which in. Additional information on Apple II's interger BASIC is in the next section of this manual. Loading a BASIC program Tape Breakout Game Tape Color Demo Tape language your Apple is currently asterisk ("*"). permanently in its ROM memory. 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. Running Your First and Second Program Read through the next three sections that include: 1. 3 . Details of "Firmware" section of this manual. type in "HIMEM: 16384" to set exactly where in memory this program is to run. The current prompt character. 2.indicates that powerful machine level language this language are in the Then load and run each program tape. Running 16K Startrek If you have 16K Bytes or larger memory in your Apple.
$5Ø range generally have ALC (Automatic Level Control) for recording from the microphone input. This ground loop does not influence the system when loading a pre-recorded tape. If you are using a recorder which must be adjusted. Commonly. When loading a tape. Using an Apple Computer pre-recorded tape. Loading a Tape and What to do when you have Loading Problems. System Checkout. this signal is obtained from the "Monitor" or "earphone" output jack on the tape recorder. Listen to the recorded tape after you've saved a program to ensure that the recording is "loud and clear". You will find that this volume setting will be quite close to the optimum setting.LOADING A PROGRAM TAPE INTRODUCTION This section describes a procedure for loading BASIC programs successfully into the Apple II. Cassette tape recorders in the $4Ø . Set the recording level to just below the level meter's maximum. it will have a level meter or a little light to warn of excessive recording levels. Some tape recorders (mostly those intended for use with hi-fi sets) do not have an "earphone" or high-level "monitor" output. Inside most tape recorders. This problem has been traced to a ground loop in the tape recorder itself which prevents making a good recording when saving a program. 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. The signal levels at these outputs are too low for the Apple II in most cases. 4 . or to just a dim indication on the level lamp. this signal is derived from the tape recorder's speaker. This feature is useful since the user doesn't have to set any volume controls to obtain a good recording. the Apple II needs a signal of about 2 l/2 to 5 volts peak-to-peak. play the tape and adjust the volume to a loud but un-distorted level. These machines have outputs labeled"line output" for connection to the power amplifier. One can take advantage of this fact when setting the volume levels. and with all cables disconnected. The easiest solution is to unplug the "monitor" output when recording. They are discussed below. The process of loading a program is divided into three section.
the 6 KHz tone should be not more than 3 db down from a 1 KHz tone. And then rewind and load the program. you may pick up tape noise before getting to the set-up tone. then borrow another tape recorder. the Video display. The frequency response of the tape recorder should be fairly good. then the tiny magnetic fields on the tape will be skewed as well. Apple Computer pre-recorded tapes are made on the highest quality professional duplicating machines. and the game paddles.Tape recorder head alignment is the most common source of tape recorder problems. Then save this program. Try a lower playback volume. Flaws in the tape. Then have your tape recorder properly aligned. and distortion can be detected this way. To confirm that head alignment is the problem. and these tapes may be used by the service technician to align the tape recorder's heads. write a short program in BASIC. 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. Listening to the tape can help solve other problems as well. The Apple puts out this tone for anout 1Ø seconds when saving a program. 5 . excessive speed variations. >10 END is sufficient. Note that recordings you have made yourself with mis-aligned heads may not not play properly with the heads properly aligned. 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. If you made a recording with a skewed record head. and a 9 KHz tone should be no more than 9 db down. If you have saved valuable programs with a skewed tape recorder. thus playing back properly only when the skew on the tape exactly matches the skew of the tape recorder's heads. then high frequency information on pre-recorded tapes is lost and all sorts of errors will result. If you can accomplish this easily but cannot load pre-recorded tapes. then save them on the borrowed machine. then head alignment problems are indicated. so you normally have 6 1/2 seconds of leeway. load the programs with the old tape recorder into the Apple. 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 cassette interface. Saving a program several times in a row is good insurance against tape flaws. If the playback head is skewed. If the playback volume is too high.
"*". adjust the Tone control to 8Ø-1ØØ% maximum. A right facing arrow should appear on the lefthand side of the screen with a flashing cursor next to it. If present. 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.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). 4.check that the AC power cord is plugged into an appropriate wall socket. VIDEO DISPLAY INTERFACE a) for a video monitor . 5. adjust the Volume control to 5Ø-7Ø% maximum. b) for a standard television . POWER TO APPLE . If not already set.1.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. check that they are connected into the Game I/O connector (J14) on the right-hand side of the Apple II mainboard. Do not depress the "RETURN" key yet. Hold down the CTRL key. 6 . POWER ON . If it doesn't. A flashing white cursor will appear to the right of the asterick. GAME PADDLE INTERFACE . 2.should appear on the lefthand side of the screen below the random text pattern. then depress the "RETURN" key and release the "CTRL" key. depress and release the B key. and that a cable runs between the television and the Adapter's output socket. Hit the RESET key. 2. repeat steps 1 and 2. 3. 3. Type in the word "LOAD" on the keyboard. Insert the program cassette into the tape recorder and rewind it. the "power" indicator on the keyboard will light. Also make sure the video monitor (or TV set) is turned on.if paddles are to be used. An asterick. CASSETTE INTERFACE . which includes a "true" ground and is connected to the Apple II. You should see the word in between the right facing arrow and the flashing cursor.flip on the power switch in back of the Apple II.check that a cable connects the monitor to the Apple's video output port. 4. 5.
If not. a discussion of what a memory full error is in order. The computer reads this data first and checks it with the amount of free memory. LOADING PROBLEMS Occasionally. The cursor will disappear and Apple II will beep in a few seconds when it finds the beginning of the program. and place it into BASIC then the Apple II is probably operating correctly. How does the computer know this? Information contained in the beginning of the program tape declares the record length of the program. Before describing a procedure for resolving this loading problem. 7 .6. 9. A second beep will sound and the flashing cursor will reappear after the program has been successfully loaded into the computer. with the program tape. Thoughtful action taken here will speed in a program's entry. and returns command of the system to the keyboard. You may want to rewind the program tape at this time. stops the loading procedure. If you were able to successfully turn on the computer. 10. reset it. Stop. 8. Stop the tape recorder. while attempting to load a BASIC program Apple II beeps and a memory full error is written on the screen. 7. displays a memory full error statement. At this time you might wonder what is wrong with the computer. Type in the word "RUN" and depress the "RETURN" key. If adequate workspace is available program loading continues. Several reasons emerge as the cause of this problem. If an error message is flashed on the screen. The steps in loading a program have been completed and if everying has gone satisfactorily the program will be operating now. The memory full error displayed upon loading a program indicates that not enough (RAM) memory workspace is available to contain the incoming data. This is the time when you need to take a moment and checkout the system rather than haphazardly attempting to resolve the loading problem. Start the tape recorder in "PLAY" mode and now depress the "RETURN" key on the Apple II. the computer beeps to indicate a problem. proceed through the steps listed in the Tape Problem section of this paper. or with the cassette recorder.
It is called loading too large of a program. 8 .Memory Size too Small Attempting to load a 16K program into a 4K Apple II will generate this kind of error message. The solution is to adjust the Volume to 5Ø-7Ø% maximum and the Tone (if it exists) to 8Ø-1ØØ% maximum. 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 is straight forward: only load appropriately sized programs into suitably sized systems. *Apple Computer Inc. 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. Often times new cassette recorders will not need this adjustment.* 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. Hold the CTRL key down. It is recommended that a competent technician at a local stereo shop perform this operation.ØØ) has an excellent track record for program loading. This will reset the system to maximum capacity. The solution is to reset the pointers by BC (CTRL B) command. The solution: adjust tape head azimuth. then depress the RETURN key and release the CTRL key. has tested many types of cassette recorders and so far the Panasonic RQ-3Ø9 DS (less than $4Ø. depress and release the B key. Cassette Recorder Inadjustment If the Volume and Tone controls on the cassette recorder are not properly set a memory full error can occur. This causes missing bits in the data sent to the computer.
Before loading a program reset the memory pointers with the Bc (control B) command. contact your nearest local dealer or Apple Computer Inc. Or. Be sure that you have a large enough system. or physical damage. Listening to the tape assures that you know what a "good" program tape sounds like. In most cases if the preceeding is followed a good tape load will result. 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: l. 9 .Tape Problems A memory full error can result from unintentional noise existing in a program tape. or b) start it at the beginning of the program. imperfections in the tape. 5. 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. Check the program tape for its memory requirements. The solution is to take a moment and listen to the tape. If you have any questions about this please contact your local dealer or Apple for assistance. If any imperfections are heard then replacement of the tape is called for. In special cases have the tape head azimuth checked and adjusted. 4. UNSOLVED PROBLEMS If you are having any unsolved loading problems. the program tape can be defective due to false erasure. 3. Then re-LOAD the program tape into the Apple II. Check the program tape by listening to it. 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. 2. a) Replace it if it is defective.
As you penetrate through the wall the point value of the bricks increases. even bricks. racking up points. 4. You direct the ball by hitting it with a paddle on the left side of the screen. the ball will rebound back and forth. 2. etc.BREAKOUT GAME TAPE PROGRAM DESCRIPTION Breakout is a color graphics game for the Apple II computer. If the answer to the previous questions was N or No then the available colors will be displayed. After these have been chosen the game will begin. represented by a number from Ø to 15. The object of the game is to "knock-out' all 16Ø colored bricks from the playing field by hitting them with the bouncing ball. Load Breakout game following instructions in the "Loading a BASIC Program from Tape" section of this manual. and skill. Breakout is a challenging game that tests your concentration. After ten hits of the ball. The player will be asked to choose colors. But watch out: you can only miss the ball five times: There are eight columns of bricks. PLAYING BREAKOUT 1. making the game more difficult. If you want standard BREAKOUT colors type in Y or Yes and hit RETURN. If you break through to the back wall. 3. its speed with double. BASIC is the programming language used. The game will then begin. for background. 10 . A perfect game is 72Ø points. dexterity. REQUIREMENTS This program will fit into a 4K or greater system. after five balls have been played the computer will display your score and a rating such as "Very Good". Enter your name and depress RETURN key. paddle and ball colors. "Terrible!". You control the paddle with one of the Apple's Game Paddle controllers. odd bricks.
5. BASIC is the programming language used. A N or No will exit from the program. and Color Bars. 11 . color monitor or television. Spiral. Tones. Hyperbola. These examples also demonstrate how the paddle inputs (PDL(X)) can be used to control the audio and visual displays. and paddles are needed to use this program. NOTE: A game paddle (15Øk ohm potentiometer) must be connected to PDL (Ø) of the Game I/O connector for this game. Weaving. Circle. Ideas from this program can be incorporated into other programs with a little modification. REQUIREMENTS 4K or greater Apple II system. Tones illustrates various sounds that you can produce with the two inch Apple speaker. Cross. In it are ten examples: Lines. Tunnel. At the end of the game you will be asked if they want to play again. These examples produce various combinations of visual patterns in fifteen colors on a monitor or television screen. COLOR DEMO TAPE PROGRAM DESCRIPTION COLOR DEMO demonstrates some of the Apple II video graphics capabilities. Spiral combines colorgraphics with tones to produce some amusing patterns. Spring. For example. A Y or Yes response will start another game.
:GOSUB 95:B=E: PRINT “ODD BRIC K”.PEEK (-16336 )+ PEEK (-16336).” (Y/N) “.A$ .Q+5 AT 0: COLOR=A: IF P>Q THEN 175: IF Q THEN VLIN 0.J+1 AT I: NEXT J.B$(10):A=1:B=13: C=9:D=6:E=15: TEXT : CALL 936: VTAB 4: TAB 10: PRINT “*** BREAKOUT ***”:PRINT 20 PRINT “ OBJECT IS TO DESTROY ALL BRICKS”: PRINT : INPUT “HI. 95 INPUT “ COLOR (0 TO 15)”.1)#”N” THEN 40 : FOR I=0 TO 39: COLOR=I/2* (I(32): VLIN 0.”: GOTO 165 “FAIR.: NEXT I: POKE 34.”: GOTO 165 155 PRINT “EXCELLENT. ”.PEEK (-16336 )+ PEEK (-16336).” IS “ . WHAT’S YOUR NAME? ”. REENTER”.39 AT 0:P=Q: RETURN 180 FOR I=1 TO 80:Q= PEEK (-16336 ): NEXT I: GOTO 50 12 .20: COLOR=A: FOR I= 0 TO 39: VLIN 0. I: TAB 5: PRINT “SCORE=0”:PRINT : PRINT : POKE 34.Y/3:X=19:Y= RND (120):V=-1:W= RND (5)2:L=L-1: IF L<1 THEN 120: TAB 6: IF L>1 THEN PRINT L. K:X=I:Y=J: GOTO 60 90 PRINT “INVALID.: GOSUB 95:C=E: PRINT “PADDLE ”.K)=A THEN 85: IF I THEN 100:N=N+1:V=( N>5)+1:W=(K-P)*2-5:M=1 70 Z= PEEK (-16336)-PEEK (-16336 )+ PEEK (-16336).: INPUT A$: IF A$(1.”: GOTO 165 160 PRINT “NEARLY PERFECT.”: GOTO 165 “GOOD.:GOSUB 95 40 POKE 34.PEEK (-16336 )+ PEEK (-16336).A$: PRINT : FOR I=1 TO 100 : GOSUB 10: NEXT I:M=1:N=0 60 J=Y+W: IF J>=0 AND J<120 THEN 65:W=-W:J=Y: FOR I-1 TO 6:K= PEEK (-16336): NEXT I 65 I=X+V: IF I<0 THEN 180: GOSUB 170: COLOR=A:K=J/3: IF I>39 THEN 75: IF SCRN(I.S.20: PRINT : PRINT : PRINT : FOR I=0 TO 15: VTAB 21+I MOD 2: TAB I+ I+1: PRINT I.” 165 PRINT “ANOTHER GAME ”. ” .: GOTO 125+(S/100)*5 125 PRINT ”TERRIBLE!”: GOTO 165 130 135 140 145 150 PRINT PRINT PRINT PRINT PRINT “LOUSY.39 AT I 30 NEXT I: POKE 34.A$.Y/3: COLOR=E: PLOT I.: INPUT “Y/N? ”.PEEK (-16336 )+ PEEK (-16336).A$ .21:S=0:P= S:L=S:X=19:Y=19:L=6 50 COLOR=A: PLOT X.: GOSUB 95:D=E: PRINT “BALL” .”BALLS L EFT” 55 IF L=1 THEN PRINT “LAST BALL.1)=”Y” THEN 25: TEXT : CALL -936: VTAB 10: TAB 10: PRINT “GAME OV ER”: END 170 Q=( PDL (0)-20)/6: IF Q<0 THEN Q=0: IF Q>=34 THEN Q=34: COLOR= D: VLIN Q. 35 GOSUB 95:A=E: PRINT “EVEN BRICK” .B$: GR: CALL -936: IF B$(1.22: YTAB 24: PRINT : PRINT “BACKGROUND”.PEEK (-16336 )+ PEEK (-16336): GOTO 85 75 FOR I=1 TO 6:M= PEEK (-16336 ): NEXT I:I=X:M=0 80 V=-V 85 PLOT X.PEEK (-16336 )+ PEEK (-16336).”: GOTO 165 “VERY GOOD.Q-1 AT 0:P=Q: RETURN 175 IF P=Q THEN RETURN : IF Q#34 THEN VLIN Q+6.Q-1 AT 0:P=Q:RETURN 15 DIM A$(15).A$ 25 PRINT “STANDARD COLORS ”.PEEK (-16336 ) 110 IF S<720 THEN 80 115 PRINT “CONGRATULATONS.39 AT I: COLOR=C: FOR J=I MOD 4 TO 39 STEP 4 45 VLIN J.BREAKOUT GAME PROGRAM LISTING PROGRAM LISTING 5 GOTO 15 10 Q=( PDL (0)-20)/6: IF Q<0 THEN Q=0: IF Q>=34 THEN Q=34: COLOR= D: VLIN Q.E: IF E<0 OR E>15 THEN 90: RETURN 100 IF M THEN V= ABS (V): VLIN K/2*2.39 AT I: NEXT I: FOR I=20 TO 34 STEP 2: TAB I+1: PRINT I/2-9.K/2*2+1 AT I:S=S+I/29: VTAB 21: TAB 13: PRINT S 105 Q= PEEK (-16336).Q+5 AT 0: COLOR=A: IF P>Q THEN 175: IF Q THEN VLIN 0.”: GOTO 165 “POOR.” YOU WIN!”: GOTO 165 120 PRINT “YOUR SCORE OF ”.: COLOR=B: VLIN 0.
AN EXAMPLE WOULD BE 'Y. LONG RANGE SENSORS 5. IF RESPONSE IS 1 THE COMPUTER WILL ASK WARP OR ION AND EXPECTS 'W' IF ONE WANTS TO TRAVEL IN THE GALAXY BETWEEN QUADRANTS AND AN 'I' IF ONE WANTS ONLY INTERNAL QUADRANT TRAVEL. AND A BLOW UP OF THAT QUADRANT IS FOUND IN THE LOWER LEFT CORNER.-.-. COMPUTE COURSE 2. B. LOCK COURSE 6.-. 11 ASKS FOR INFORMATION ON LOADING AND UNLOADING OF PHOTON TORPEDOES AT THE ESPENSE OF AVAILABLE ENERGY. THE OBJECT IS TO LONG-RANGE SENSE FOR INFORMATION AS TO WHERE KLINGONS (K) ARE MOVE TO THAT QUADRANT. NUMBERS DISPLAYED FOR EACH QUADRANT DENOTE: * OF STARS IN THE ONES PLACE * OF BASES IN THE TENS PLACE * OF KLINGONS IN THE HUNDREDS PLACE AT ANY TIME DURING THE GAME.DAMAGE REPORT 9.-.-. LOCK PHOTON TORPEDOES 5. PHASERS 3. ADJACENT QUADRANTS. THE ANSWER SHOULD BE A SIGNED NUMBER.-.-. COMPUTE TREJECTORY 4. A 3 GIVES THE CONTENTS OF THE IMMEDIATE.-.-.-.-. 6. DURATION OF WARP FACTOR IS THE NUMBER OF SPACES OR QUADRANTS THE ENTERPRISE WILL MOVE.-. COURSE IS COMPASS READING IN DEGREES FOR THE DESIRED DESTINATION.90 180 -.-. 8 AND 10 ALL GIVE INFORMATION ABOUT THE STATUS OF THE SHIP AND ITS ENVIRONMENT.-. E.STATUS 7.-.-. TO PLAY: 1.- THIS EXPLANATION WAS WRITTEN BY NOT RESPONSIBLE FOR ERRORS ELWOOD -. RETURN TO COMAND MODE IN THE FIRST FIVE ONE WILL HAVE TO GIVE COORDINATES.LOAD PHOTON TORPEDOES 2.-. YOUR SPACE SHIP STATUS IS FOUND IN A TABLE TO THE RIGHT SIDE OF THE QUADRANT BLOW UP. OR MAY BE FIRED MANUALLY IF THE TRAGECTORY ANGLE IS KNOWN. THEY CAN BE FIRED AUTOMATICALLY IF THEY HAVE BEEN LOCKED ON TARGET WHILE IN THE COMPUTER MODE. PROBE 7.-. C. I. FOR INSTANCE BEFORE ONE TOTALLY RUNS OUT OF ENERGY. LOCK PHASERS 3. 4 FIRES PHASERS AT THE EXPENSE OF AVAILABLE ENERGY. A. THE GALAXY IS WRAP-AROUND IN ALL DIRECTIONS. 7 ENTERS A COMPUTER WHICH WILL RESPOND TO THE FOLLOWING INSTRUCTIONS: 1.- 14 . FOR EXAMPLE +5 OR -2.-. APPLE SHORT II STARTREK VERSION OF HOW TO -.-. IS IN WHITE.X' COURSE OR TRAJECTORY: 0 --------- 270 --------------------------. COORDINATES ARE GIVEN IN MATHMATICAL NOTATION WITH THE EXCEPTION THAT THE 'Y' VALUE IS GIVEN FIRST.-. H. A 2 REGENERATES THE ENERGY AT 1HE EXPENSE OF TIME.-.PLAY STARTREK ON THE DESCRIPTION APPLE THE UNIVERSE IS MADE UP OF 64 QUADRANTS IN AN 8 BY 8 MATRIX.THIS IS A COMPUTER. 5 INITIATES A SET OF QUESTIONS FOR TORPEDO FIRING.-. D. GALAXY RECORD 8.-. THE COMMANDS CAN BE OBTAINED BY TYPING A '0' (ZERO) AND RETURN. G. SHIELD ENERGY 11. THE QUADRANT IN WHICH YOU THE ENTERPRISE ' ARE.-. IONS NEXT TO THAT BASE (B) AT WHICH TIME THE BASE SELF-DESTRUCTS AND THE ENTERPRISE (E) HAS ALL SYSTEMS 'GO' AGAIN.-. COMPUTER 10. 9 SETS THE SHIELD ENERGY/AVAILABLE ENERGY RATIO. REGENERATE 4.-. THIS IS A SEARCH AND DESTROY MISSION. THE COMANDS ARE INVOKED BY TYPING 1HE NUMBER REFERING TO THEM FOLLOWED BY A 'RETURN'. ONE MOVES TO A QUADRANT WHICH INCLUDES A BASE.-. F. PROPULSION 2.-. PHOTON TORPEDOES 6. THEY ARE: 1.-.-. AND DESTROY. OR NEEDS TO REGENERATE ALL SYSTEMS.
Type in "CØØ. A beep will sound to indicate the program is being loaded. On the left hand side of the screen you should see an asterisk and a flashing cursor next to it below the text matrix. Check Volume (5Ø-7Ø%) and Tone (8Ø-1ØØ%) settings. Do not rewind the program tape yet. You should see a right facing arrow and a flashing cursor. Hit the RESET key. Power up system . consult the operator's manual for system checkout procedures. The flashing cursor disappears. 2. The R tells the computer to read in the data.LOADING THE HI-RES DEMO TAPE PROCEDURE l. then depress the "RETURN" key and release the "CTRL" key. You should see a random matrix of question marks and other text characters. depress and release the B key. 3. 4. Start the tape recorder in playback mode and depress the "RETURN" key. 6. 9. The Bc command places the Apple into BASIC initializing the memory pointers. Type in "LOAD". This begins the loading of the BASIC subprogram of the HI-RES demo tape. A beep will sound after the program has been read in. Hold down the "CTRL" key.turn the AC power switch in the back of the Apple II on. 5. 8. If you don't. Insert the HI-RES demo tape into the cassette and rewind it. 7. Do not depress the "RETURN" key yet. It extends from $CØØ to $FFF. The flashing cursor disappears. restart the tape recorder in playback mode and hit the "RETURN" key. 15 .FFFR" on the Apple II keyboard. This is the address range of the high resolution machine language subprogram. STOP the tape recorder.
hit RETURN BASIC prompt (7) and flashing cursor reappear. SUMMARY OF HI-RES DEMO TAPE LOADING l. STOP the tape recorder. 4. 6. Type in "RUN". and the right facing arrow will reappear with the flashing cursor. The loading sequence is now completed. RESET Type in CØØ. Rewind the tape. hit RETURN 8. A second beep will sound. rewind tape. hit RETURN 7. 16 . Type in "RUN" and hit the "RETURN" key. Type in "HIMEM:8l92" and hit the "RETURN" key.l0. ll. hit RETURN Asterick or flashing cursor reappear Bc (CTRL B) into BASIC Type in "LOAD". STOP tape recorder. The screen should clear and momentarily a HI-RES demo menu table should appear. 2. Type in "HIMEN:8192". l2. 3. 5. This sets up memory for high resolution graphics.FFFR Start tape recorder.
BASIC Commands BASIC Operators BASIC Functions BASIC Statements Special Control and Editing Table A — Graphics Colors Special Controls and Features BASIC Error Messages Simpfilied Memory Map Data Read Save Subroutines Simple Tone Subroutires High Resolution Graphics Additional BASIC Program Examples . 12. 8. 9. 11. 10. 7. 4. 13.APPLE II INTEGER BASIC 1. 6. 5. 3. 2.
Displays 4Øx4Ø squares in 15 colors on top of screen and 4 lines of text at bottom. Program is unchanged. Lists program line number num1. then type the letters "MAN" and press the return key. Lists program line number num1 through line number num2. HIMEM: may not be increased without destroying program. they do not require line numbers. type a control X*.Most Statements (see Basic Statements Section) may also be used as commands.BASIC COMMANDS Commands are executed immediately. Deletes program from line number num1 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. To exit AUTO mode. Resets scrolling window. COMMAND NAME AUTO num Sets automatic line numbering mode. Starts at line number num and increments line numbers by 10. Continues program execution after a stop from a control C*. DEL num1. (NOTE: RUN command clears DSP mode so that DSP command is effective only if program is continued by a CON or GOTO command. Clears current BASIC variables.) Sets highest memory location for use by BASIC at location specified by expression expr in decimal. undimensions arrays. Deletes line number num1. Sets mixed color graphics display mode. Lists entire program on screen. num2 CLR CON DEL num1. Same as above execpt increments line numbers by number num2. Multiple commands (as opposed to statements) on same line separated by a " : " are NOT allowed. num2 18 . Remember to press Return key after each command so that Apple knows that you have finished that line. Does not change variables. AUTO num1. HIMEM: is automatically set at maximum RAM memory when BASIC is entered by a control B*. num2 DSP var HIMEM expr GOTO expr GR LIST LIST num1 LIST num1. Causes immediate jump to line number specified by expression expr. Clears screen to black.
"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. Clears variables and executes program starting at line number specified by expression expr. Clears (Scratches) current BASIC program. Start tape recorder before hitting return key. We will also use a superscript C to indicate a control character as in Xc. Moving LOMEM: destroys current variable values. Clears DSP mode for variable var. Clears variables to zero. Two beeps and a " > " indicate a good load. Automatically set at 2Ø48 when BASIC is entered with a control B*.LOAD expr. Screen is formated to display alpha-numeric characters on 24 lines of 4Ø characters each. Start tape recorder in record mode prior to hitting return key. Sets all text mode. Sets debug mode that displays line number of each statement as it is executed. TEXT resets scrolling window to maximum. * Control characters such as control X or control C are typed by holding down the CTRL key while typing the specified letter. Clears TRACE mode. Control characters are NOT displayed on the screen but are accepted by the computer. This is similiar to how one holds down the shift key to type capital letters. For example. undimensions all arrays and executes program starting at lowest statement line number. type several control G's. LOMEM: expr MAN NEW NO DSP var NO TRACE RUN RUN expr SAVE TEXT TRACE 19 . Stores (saves) a BASIC program on a cassette tape. Clears AUTO line numbering mode to all manual line numbering after a control C* or control X*. Reads (Loads) a BASIC program from cassette tape.
Divide Modulo: Remainder after division of first expression by second expression. assigns a value to a variable. LET is optional / MOD + = 8Ø PRINT GAMMA/S 9Ø X = 12 MOD 7 lØØ X = X MOD(Y+2) llØ P = L + G l2Ø XY4 = H-D l3Ø l4Ø l5Ø l55 HEIGHT=15 LET SIZE=7*5 A(8) = 2 ALPHA$ = "PLEASE" 20 . Add Substract Assignment operator. NOTE: shifted letter N. Optional. Ø if expression is true (non-zero). Negation of following expression. NOTE: Implied multiplication such as (2 + 3)(4) is not allowed thus N2 in example is a variable not N * 2. is Multiplication. l if expression is false (zero). Prefix Operators ( ) lØ X= 4*(5 + X) + NOT 2Ø X= 1+4*5 3Ø ALPHA = -(BETA +2) 4Ø IF A NOT B THEN 2ØØ Arithmetic Operators 6Ø Y = X 3 * 7Ø LET DOTS=A*B*N2 Exponentiate as in X3 . Logical Negation of following expression. +l times following expression.BASIC Operators Symbol Sample Statement Explanation Expressions within parenthesis ( ) are always evaluated first.
Expression l "and" expression 2 must both be "true" for statements to be true. Expression "is greater than or equal to" expression. statement is "true". NOTE: If strings are not the same length. they are considered un-equal. If either expression l or expression 2 is "true". Expression "is less than" expression. String variable "equal'string variable. Expression "is greater than" expression. Expression "is less than or equal to" expression.Relational and Logical Operators The numeric values used in logical evaluation are "true" if non-zero. < > not allowed with strings. l8Ø IF ALPHA #X*Y THEN 5ØØ l9Ø IF A$ # "NO" THEN 5ØØ > < >= <= AND OR 2ØØ IF A>B THEN GO TO 5Ø 2lØ IF A+l<B-5 THEN 1ØØ 22Ø IF A>=B THEN 1ØØ 23Ø IF A+l<=B-6 THEN 2ØØ 24Ø IF A>B AND C<D THEN 2ØØ 25Ø IF ALPHA OR BETA+1 THEN 2ØØ 21 . "false" if zero. String variable "does not equal" string variable.l)= "Y" THEN 500 Explanation Expression "equals" expression. Expression "does not equal" expression. Symbol = = # or < > # Sample Statement l6Ø IF D = E THEN 5ØØ l7Ø IF A$(l.
2.e. Expressions following function name must be enclosed between two parenthesis signs. They may be used as expressions or as part of expressions. HEX location FFFØ is -16 Gives random number between V and (expression expr -1) if expression expr is positive. LEN (str$) ASC("BACK") Gives decimal ASCII value of designated ASC(B$) string variable str. Gives the decimal value of number stored of decimal memory location specified by expression expr. if minus.BASIC FUNCTIONS Functions return a numeric result.zero zero and +1 if expr is positive.Y1)Gives color (number between Ø and 15) of screen at horizontal location designated by expression exprl and vertical location designated by expression expr2 Range of expression exprl is Ø to 39. it gives decimal ASCII value of first character.1. FUNCTION NAME ABS (expr) ASC (str$) 300 PRINT ABS(X) 310 320 330 335 PRINT PRINT PRINT PRINT Gives absolute value of the expression expr. i. it gives random number between Ø and (expression expr +1). other statements may be used.Ø: POKE .or 3) or else 255 is returned. number of characters.4))character is in designated string or ASC(B$(Y)) sub-string.163Ø2.e.e. If more than one ASC(B$(4.. 350 PRINT PDL(X) Gives number between Ø and 255 corresponding ponding to paddle position on game paddle number designated by expression expr and must be legal paddle (Ø.. -1 if expression expr is negative. Range of expression expr2 is Ø to 39 if in standar mixed colorgraphics display mode as set by GR command or Ø to 47 if in all color mode set by POKE -163Ø4 . 340 PRINT LEN(B$) Gives current length of designated string variable str$. PDL (expr) PEEK (expr) 360 PRINT PEEK(X) RND (expr) 370 PRINT RND(X) SCRN(expr1 . PRINT is used for examples only. SGN (expr) 22 . use negative number.Ø'. expr2) 380 PRINT SCRN (X1. For MEMORY locations above 32676.i.. 39Ø PRINT SGN(X) Gives sign (not sine) of expression expr i.
location in example 1Ø is hexidecimal number $FC53 In standard resolution color (GR) graphics mode. example in line is illegal but 85 is allowed. Sets debug mode that DSP variable var each time it changes and the line number where the change occured. For number arrays APPLE reserves approximately 2 times expr bytes of memory limited by available memory. Last defined variable may b'e redimensioned at any time.e. or THEN. The DIM statement causes APPLE II to reserve memory for the specified variables. COLOR=expr 3Ø COLOR=12 DIM varl (expr1) str$ (expr2) var2 (expr3) 5Ø DIM 6Ø DIM 7Ø DIM Illegal: 8Ø DIM Legal: 85 DIM A(2Ø). or REM. this command sets screen TV color to value in expression expr in the range Ø to 15 as described in Table A. AT. String variables names must end with a $ (dollar sign). For string arrays -str$. STEP. Variable names may not contain buried any of the following words: AND. OR. NAME CALL expr 1Ø CALL-936 Causes execution of a machine level language subroutine at decimal memory location specified by expression expr Locations above 32767 are specified using negative numbers.BASIC STATEMENTS Each BASIC statement must have a line number between Ø and 32767. MOD. Variable names may not begin with the letters END. Multiple statements may appear under the same line number if separated by a : (colon) as long as the total number of characters in the line (including spaces) is less than approximately 15Ø characters Most statements may also be used as commands.. LET.B 1Ø2 DSP AB$ 1Ø4 DSP A(5) Legal: 1Ø5 A=A(5): DSP A 23 .(expr) must be in the range of 1 to 255.B(1Ø) B$(3Ø) C (2) A(3Ø) C(1ØØØ) DSPvar Legal: 9Ø DSP AX: DSP L Illegal: 1ØØ DSP AX. BASIC statements are executed by RUN or GOTO commands. Variable names must start with an alpha character and may be any number of alphanumeric characters up to 1ØØ. i. thus. Actually expression expr may be in the range Ø to 255 without error message since it is implemented as if it were expression expr MOD 16.
Begins FOR.39 AT 2Ø 21Ø HLIN Z. 19 AT Ø is a horizontal line at the top of the screen extending from left corner to center of screen and HLIN 2Ø.NAME END FOR var= exp'21 TOexpr2 STEPexpr3 EXAMPLE 11Ø END 11Ø 12Ø 13Ø 15Ø FOR L=Ø to 39 FOR X=Y1 TO Y3 FOR 1=39 TO 1 GOSUB 1ØØ *J2 DESCRIPTION Stops program execution.. In standard resolution color graphics mode. expr2ATexpr3 Sets mixed standard resolution color graphics mode. Negative numbers are allowed. until value of expression expr2 is reached. Causes immediate jump to legal line number specified by expression expr. Sends carriage return and "> " BASIC prompt) to screen. this command draws a horizontal line of a predefined color (set by COLOR=) starting at horizontal position defined by expression exprl and ending at position expr2 at vertical position defined by expression expr3 . a STEP of +1 is assumed. 2ØØ HLIN Ø.NEXT loop.Z+6 AT I Note: HLIN Ø. Example 19Ø sets all color mode (4Øx48 field) with no text at bottom of screen. Causes branch to BASIC subroutine starting at legal line number specified by expression expr Subroutines may be nested up to 16 levels. If STEP expr3 is omitted. initializes variable var to value of expression expr1 then increments it by amount in expression expr3 each time the corresponding "NEXT" statement is encountered.expr1 and expr2 must be in the range of Ø to 39 and expr1 < = expr2 .Ø HLIN expr1.. 24 . expr3 be in the range of Ø to 39 (or Ø to 47 if not in mixed mode). Initializes COLOR = Ø (Black) for top 4Øx4Ø of screen and sets scrolling window to lines 21 through 24 by 4Ø characters for four lines of text at bottom of screen. GOSUB expr 14Ø GOSUB 5ØØ GOTO expr 16Ø GOTO 2ØØ 17Ø GOTO ALPHA+1ØØ GR 18Ø GR 19Ø GR: POKE -163Ø2.39 AT 39 is a horizontal line at the bottom of the screen extending from center to right corner.
A$ If expression is true (non-zero) then execute statement.1)# "Y" THEN 1ØØ Illegal: 26Ø IF L> 5 THEN 5Ø: ELSE 6Ø Legal: 27Ø IF L> 5 THEN 5Ø GO TO 6Ø 28Ø INPUT X. One pair of " " may be used immediately after INPUT to output prompting text enclosed within the quotation marks to the screen. str$ 22Ø IF A> B THEN PRINT A 23Ø IF X=Ø THEN C=1 24Ø IF A#1Ø THEN GOSUB 2ØØ 25Ø IF A$(1. The "ELSE" in example 26Ø is illegal but may be implemented as shown in example 27Ø.IF expression THEN statement INPUT varl. "LET" is optional IN# expr 31Ø IN# 6 32Ø IN# Y+2 33Ø IN# 0 LET LIST num1. if string input is expected no "?" will be outputed. If statement is an expression.K 38Ø NO DSP I 39Ø NO TRACE Causes program from line number num1 through line number num2 to be displayed on screen. Transfers source of data for subsequent INPUT statements to peripheral I/O slot (1-7) as specified as by expression expr. Increments corresponding "FOR" variable and loops back to statement following "FOR" until variable exceeds limit.Y. var2 NO DSP var NO TRACE 34Ø LET X=5 35Ø IF X > 6 THEN LIST 5Ø 36Ø NEXT I 37Ø NEXT J. String inputs must be separated by a carriage return only. IN#Ø (Example 33Ø) is used to return data source from peripherial I/O to keyboard connector. var2. num2 NEXT varl. Assignment operator. Enters data into memory from I/O device. if false do not execute statement. DLLR 3ØØ INPUT "Y or N?". Multiple numeric inputs to same statement may be separated by a comma or a carriage return. APPLE wil output "?". Slot Ø is not addressable from BASIC.Z(3) 29Ø INPUT "AMT". then a GOTO expr type of statement is assumed to be implied. Turns-off DSP debug mode for variable Turns-off TRACE debug mode 25 . If number input is expected.
25 4ØØ PLT XV. "HELLO" 2+3 Outputs data specified by variable var or string variable str$ starting at current cursor location. Semi-colon (Ex.B$.DX A$. str$ 44Ø POP 45Ø 46Ø 47Ø 48Ø 49Ø 492 494 PRINT PRINT PRINT PRINT PRINT PRINT PRINT Ll Li. expr2 42Ø POKE 2Ø." or ".YV In standard resolution color graphics. Text imbedded in " " will be printed and may appear multiple times. Like IN#. POKE expr1. "POPS" nested GOSUB return stack address by one. Do not confuse "RETURN" statement with Return key on keyboard. transfers output to I/O slot defined by expression expr PR# Ø is video output not I/O slot Ø. PR# expr 500 PR# 7 REM 5l0 REM REMARK RETURN 52Ø RETURN 53Ø IFX= 5 THEN RETURN 26 . Commas (Ex.. RETURN ends a subroutine. 4Ø 430 POKE 7*256. X2 "AMT=". XMOD255 POP PRINT var1. If there is not trailing "." (Ex 45Ø) a carriage return will be generated. 47Ø) inhibits print of any spaces. 39 (or PLOT 39. var.PLOT expr1. All characters after REM are treated as a remark until terminated by a carriage return.e. expr2 4ØØ PLOT 15. this command plots a small square of a predefined color (set by COLOR=) at horizontal location specified by expression expr1 in range Ø to 39 and vertical location specified by expression expr2 in range Ø to 39 (or Ø to 47 if in all graphics mode) NOTE: PLOT Ø Ø is upper left and PLOT 39. 47) is lower right corner. 46Ø) outputs data in 5 left justified columns. No action. Stores decimal number defined by expression expr2 in range of Ø 255 at decimal memory location specified by expression expr1 Locations above 32767 are specified by negative numbers. i. Causes branch to statement following last GOSUB.
Resets scrolling window to 24 lines by 4Ø characters. Position is left to right Sets all text mode. 39AT15 6ØØ VLIN Z. Example 56Ø also clears screen and homes cursor to upper left corner Sets debug mode that displays each line number as it is executed.Z+6ATY 61Ø VTAB 18 62Ø VTAB Z+2 VLIN exprl. TEXT TRACE 570 TRACE 580 IFN >32ØØØ THEN TRACE 59Ø VLIN Ø. VTAB l is top line on screen.TAB expr 53Ø TAB 24 54Ø TAB 1+24 55Ø IF A#B THEN TAB 2Ø 55Ø TEXT 56Ø TEXT: CALL-936 Moves cursor to absolute horizontal position specified by expression expr in the range of 1 to 4Ø. Similar to TAB. VTAB24 is bottom. Moves cursor to absolute vertical position specified by expression expr in the range l to 24. expr2 AT expr3 VTAB expr 27 . Similar to HLIN except draws vertical line starting at expr1 and ending at expr2 at horizontal position expr3.
Apple keyboards have + key on right side which also performs this function. They are obtained by pressing and releasing the ESC key then typing specified letter. a control B and a carriage return will transfer control to BASIC. If in System Monitor (as indicated by a "*"). Immediately deletes current line. control C and a carraige return will enter BASIC without killing current program. scratching (killing) any existing BASIC program and set HIMEM: to maximum installed user memory and LOMEM: to 2048. Control is transfered to System Monitor and Apple prompts with a "*" (asterisk) and a bell. Program may be continued with a CON command. They are obtained by holding down the CTRL key while typing the letter. B and C must be followed by a carriage return. Edit characters send information only to display screen and does not send data to memory. Control characters are NOT displayed on the TV screen. Sounds bell (beeps speaker) Backspaces cursor and deletes any overwritten characters from computer but not from screen. * If BASIC program is expecting keyboard input. halts program and displays line number where stop occurred*. Apply supplied keyboards have special key "÷" on right side of keyboard that provides this functions without using control button. CHARACTER RESET key DESCRIPTION OF ACTION Immediately interrupts any program execution and resets computer. Also sets all text mode with scrolling window at maximum. you will have to hit carriage return key after typing control C. Issues line feed only Compliment to HC. (as indicated by "*"). Screen editing characters are indicated by a sub-scripted "E" such as DE. Uc moves to cursor to right and copies text while AE moves cursor to right but does not copy text. For example.SPECIAL CONTROL AND EDITING CHARACTERS "Control" characters are indicated by a super-scripted "C" such as Gc. Hitting RESET key does NOT destroy existing BASIC or machine language program. Control B Control C Control G Control H Control J Control V Control X 28 . If in BASIC. Forward spaces cursor and copies over written characters. If in System Monitor.
Table A: Note: APPLE II COLORS AS SET BY COLOR = Colors may vary depending on TV tint (hue) setting and may also be changes by adjusting trimmer capacitor C3 on APPLE II P. Board.C. 0 1 2 3 4 5 6 7 = = = = = = = = Black Magnenta Bark Blue Light Purple Dark Green Grey Medium Blue Light Blue 8 9 10 11 12 13 14 15 = = = = = = = = Brown Orange Grey Pink Green Yellow Blue/Green White 29 . clear text to end of page.CHARACTER DESCRIPTION OF ACTION A B C D E F @ E E E E E E E 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.
CH 15Ø TAB(CH+l) ØØ25 16Ø CV=PEEK (37) 17Ø POKE 37.Ø -l63Ø2.Ø -l63Ø1.L1 Set left side of scrolling window to location specified by Ll in range of Ø to 39.Ø -l63ØØ. Read/set cusor vertical position in the range Ø to 23. Wl>Ø 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. clear screen (FE) Clear from cusor to end of page ØØ21 ØØ22 ØØ23 ØØ24 1ØØ POKE 33.Ø POKE -l6298.Ø POKE -l6297. 14Ø and 15Ø perform identical function.T1 12Ø POKE 35.l27 2ØØ POKE 5Ø.Ø Set color graphics mode Set text mode Clear mixed graphics Set mixed graphics (4 lines text) Clear display Page. 2ØØ) (@E) Home cusor.Ø TEXT Mode Controls ØØ2Ø 9Ø POKE 32.W1 11Ø POKE 34. Set inverse flag if 127 (Ex. 2 (BASIC commands use Page l only) Set display to Page 2 (alternate) Clear HIRES graphics mode Set HIRES graphics mode POKE -l6299. you must add "1" to cusor positior read value.Ø -l63Ø3. Similar to above.CV 18Ø VTAB(CV+l) 19Ø POKE 5Ø.B1 13Ø CH=PEEK(36) 14Ø POKE 36. Set window width to amount specified by WI.255 21Ø CALL -936 22Ø CALL -958 ØØ32 FC58 FC42 30 . l9Ø) Set normal flag if 255(Ex. Ex.Special Controls and Features Hex BASIC Example Description Display Mode Controls CO5Ø CO51 CO52 CO53 CO54 CO55 CO56 CO57 lØ 2Ø 3Ø 4Ø 5Ø 6Ø 7Ø 8Ø POKE POKE POKE POKE POKE -l63Ø4. Ll+W1<4Ø. If using TAB. B1>T1 Read/set cusor horizontal position in the range of Ø to 39.
Ø 37Ø X=PEEK(-16384) Toggle speaker Read keyboard.Hex FC9C FC66 FC7Ø BASIC Example 23Ø CALL -868 24Ø CALL -922 25Ø CALL -9l2 Description (EE) Clear from cusor to end of line (JC) Line feed Scroll up text one line Miscellaneous CØ3Ø CØØØ 36Ø X=PEEK(-l6336) 365 POKE -l6336. Clear keyboard strobe . Read PDL(2) push button switch.Ø 45Ø POKE -l6293.always after reading keyboard. if X>127 then key was pressed.Ø 48Ø POKE -l629Ø.Ø 47Ø POKE -l629l. Read PDL(Ø) push button switch.Ø 43Ø POKE -l6295. If X>l27 then switch is "on".Ø 46Ø POKE -l6292. Read PDL(l) push button switch.Ø 49Ø POKE -l6289. Clear Game I/O ANØ output Set Game I/O ANØ output Clear Game I/O ANl output Set Game I/O ANl 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 CØlØ CØ6l CØ62 CØ63 CØ58 CØ59 CØ5A CØ5B CØ5C CØ5D CØ5E CØ5F 38Ø POKE -l6368.Ø 39Ø X=PEEK(16287) 4ØØ X=PEEK(-l6286) 4lØ X=PEEK(-l6285) 42Ø POKE -l6296.Ø 44Ø POKE -l6294.Ø 31 .
TAB.APPLE II BASIC ERROR MESSAGES *** SYNTAX ERR *** > 32767 ERR *** > 255 ERR *** BAD BRANCH ERR *** BAD RETURN ERR *** BAD NEXT ERR Results from a syntactic or typing error. Results from an attempt to execute an illegal string operation. A value entered or calculated was less than -32767 or greater than 32767.VLIN. Results from an attempt to execute a NEXT statement for which there was not a corresponding FOR statement. The number of characters assigned to a string exceeded the DIMensioned value for that string. The last statement executed was not an END. *** 16 GOSUBS ERR *** 16 FORS ERR *** NO END ERR *** MEM FULL ERR *** TOO LONG ERR *** DIM ERR *** RANGE ERR *** STR OVFL ERR *** STRING ERR RETYPE LINE 32 . This message also requests that the illegal item be retyped. Results from an attempt to DIMension a string array which has been previously dimensioned. An array was larger than the DIMensioned value or smaller than l or HLIN. Results from illegal data being typed in response to an INPUT statement. A value restricted to the range Ø to 255 was outside that range. Results from more than l2 nested parentheses or more than l28 characters in input line. or VTAB arguments are out of range. Results from more than l6 nested GOSUBs. Results from an attempt to branch to a nonexistant line number. PLOT. Results from more than l6 nested FOR loops. The memory needed for the program has exceeded the memory size allotted. Results from an attempt to execute more RETURNs than previously executed GOSUBs.
Simplified Memory Map FFFF 64K Monitor and BASIC Routines in ROM EØØØ 56K Future enhancement or user supplied PROMS DØØØ CØØØ 52K 48K Peripheral I/O XX XX (HIMEM:) User specified RAM memory size User Workspace (LOMEM:) 2K 1K Ø Internal Workspace 7FF 4ØØ Ø Screen Memory 33 .
set to 0l when DSP set in BASIC initiates a process that displays this variable with the line number every time it is changed within a program. Appearing in order sequentually are the Variable Name.hexadecimal equivalent of numeric information. DATA(N) hn+l VARIABLE NAME . low order byte first. the Next Variable Address. Diagramatically this is represented as: YN l DSP NVA DATA(0) h l DATA(l) h2 . Numeric variables are mapped into memory with four attributes. NVA (NEXT VARIABLE ADDRESS) . DSP (DISPLAY) BYTE .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. DATA . represented in pairs of bytes. the Display Byte.two bytes (first low order. the second high order) indicating the memory location of the next variable. and the Data of the Variable. 34 . This paper discusses a simple subroutine that serves this purpose.up to 100 characters represented in memory as ASCII equivalents with the high order bit set. Before discussing the Read/Save routines a rudimentary knowledge of how variables are mapped into memory is needed.
As it turns out.hex $8ØØ (2Ø48) unless manually shifted by the"LOMEM:" command. Program statements are placed into memory starting at the top of RAM memory* unless manually shifted by the "HIMEM:.two bytes (first low order.. One is the location of the variables used for the program.. l6384 will be the value of "HIMEM:" for a l6K system.a string terminator which designates the end of a string. and are pushed down as each new (numerically larger) line numbered statement is entered into the system. 35 . the second high order) indicating the memory location of the next variable. 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.String variables are formatted a bit differently than numeric ones. 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. DATA . the mapping of these within memory is a straightforward process. DSP (DISPLAY) BYTE . Figure la illustrates this process diagramatically. h2 DATA(n) hn+l ST VARIABLE NAME . NVA (NEXT VARIABLE ADDRESS) .none high order bit set character indicating END of string.set to Øl when DSP set in BASIC. A string variable is formatted as follows: VN l DSP NVA DATA(Ø) hl DATA(l).up to lØØ characters represented in memory as ASCII equivalents with the high order bit set. STRING TERMINATOR (ST) .ASCII equivalents with high order bit set. initiates a process that displays this variable with the line number every time it is changed within a program. There are two parts of any BASIC program represented in memory. and the other is the actual BASIC program statements. Variables on the other hand are mapped into memory starting at the lowest position of RAM memory .." command. These variables have one extra attribute .
Depressing the "RESET" key places the Apple II into the monitor mode (step 4). The steps in this process are outlined in example I. 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. We have then found 36 . respectively. Examining these contents we see that Cl is equal to the variable name and is the memory equivalent of "A" and that FF FF is the equivalent of -1. Since the variable table resides from $8ØØ hex to $8ØC hex typing in "8ØØ. These also happen to be the values of OMEN and HIMEN: But this is expected because upon using the Bc command both memory pointers are initialized indicating no program statements and no variables. LOMEN has not been readjusted so it is equal to 2Ø48. Using the statements from Figure 2 it is found that for a 16K Apple II CM is equal to 2Ø48 and PP is equal to 16384. is equal to the value resulting from statement 2b. and use the CTRL B (control B) command to place the system into BASIC initializing the memory pointers. power up the Apple II. Figure 3 lists the contents with each memory location labelled. Variable A is defined as equal to -1 (step 1). reset it. Then for convenience another variable . Therefore the variable table resides in memory from 2Ø48 ($8ØØ hex) to 2Ø6Ø ($88C). From this. These statements(Figure 2) can then be used on any Apple II computer to find the limits of the program and variable table. 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. FINDING THE VARIABLE TABLE FROM BASIC First. PP. Now that the variable table has been defined use of statement 2a indicates that CM is equal to 2Ø6Ø (step 3). since the variable name is at the beginning of the table and the data is at the end. These are the BASIC memory program pointers and their values can be found by using the statements in Figure 2. the program pointer.B is defined as equal to Ø (step 2). the variable table representation of A extends from $8ØØ to $8O5.The computer keeps track of the amount of memory used for the variable table and program statements. We are now ready to examine the memory contents of the variable table. By placing the end memory location of each into $CC-CD(2Ø4-2Ø5) and $CA-CB(2Ø3-2Ø4).8ØC" and then depressing the "RETURN" key (step 5) will list the memory contents of this range.
The first section (lines Ø-1Ø) defines variable A and transfers control to the main program.the memory range of where the variable A is mapped into memory. When it is time a GOSUB3Ø statement will initiate the read process. After this the variable table is read in (line 34) and control is then returned to the main program (line 36). is written to tape first (line 22) followed by the desired data (line 24). READING A DATA TABLE The second step is to read the data from tape. the record length is read in and checked to see if enough memory is available (line 32-34). Record length. The reason forthis will become clear in the next section. READ/SAVE ROUTINE The READ/SAVE subroutine has three parts. Lines 2Ø through 26 represents the Write data to tape routine and lines 3Ø-38 represent the Read data from tape subroutine. First. Next within the main program when it is time to write the data a GOSUB2Ø statement will execute the write to tape process. When this process is completed control is returned to the main program. must be the first variable defined the value obtained from statement a of figure 2 is equal to the value of "LOMEM:" Nominally 2Ø48 SAVING A DATA TABLE The first step in a hard copy routine is to place the desired data onto tape. The variables used in this subroutine are defined as follows: A = CM= LM= record length. If not enough memory is available then an error is generated and control is returned to the main program (line 38) 37 . variable A. If exactly the same dimension statements are used it is almost guaranteed that there will be enough memory available. 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. Both READ and SAVE routines are executable by the BASIC "GOSUB X" (where X is 2Ø for write and 3Ø 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. This is accomplished by determining the length of the variable table and setting A equal to it.
This program dimensions a variable array of twenty by one. 38 . writes the data table to tape. To get a feeling for how to use these routines enter this program and explore how the Read/Save routines work. To illustrate this a test program is listed in example 2. This routine will increase the flexibility of the Apple II by providing a permanent record of the data generated within a program. 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.EXAMPLE OF READ/SAVE USAGE The Read/Save routines may be incorporated directly into a main program. fills the array with numbers. This program can be reprocessed. The Read/Save routines are a valuable addition to any data processing program. and then reads the data from tape listing the data on the video display.
Pn-2 Pn-l Pn LOMEN: $8ØØ CM End of Variable Table PP beginning of Program HIMEM Max System Size b Variable Data a BASIC Program Figure l a) PRINT PEEK(2Ø4) + PEEK(2Ø5)*256 b) PRINT PEEK(2Ø2) + PEEK(2Ø3)*256 PP CM Figure 2 8ØØ Cl VAR NAM 8Ø1 ØØ DSP 8Ø2 8Ø3 Ø8 Ø6 L H NVA 8Ø4 8Ø5 FF FF L H DATA 8Ø6 C2 VAR NAM 8Ø7 ØØ DSP 8Ø8 8Ø9 OC Ø8 L H NVA 8ØA ØØ 8ØB ØØ 8ØC ØØ DATA Figure 3 $8ØØ.Varl Var2 ..8ØC rewritten with labelling 39 ....... Varn Unused Memory Pl P2 P3 ..
it will equal the length of the data base.LM MOD 256: 61.8: CALL -259 IF A<0 THEN 38: P=LM+A: IF P>HM THEN 38: CM=P: POKE 6Ø.4: POKE 6l.5: POKE 63.5: POKE 63. LM/256: POKE 62. 40 . B$ A=CM-LM: POKE 6Ø. CM/256: CALL -259 PRINT "DATA READ IN": RETURN PRINT "***TOO MUCH DATA BASE***": RETURN Returning control to main program.8: POKE 62. It is initially Ø. CM/256: -3Ø7 22 24 Writing data table to tape 26 3Ø PRINT "DATA TABLE SAVED": RETURN PRINT "REWIND THE TAPE THEN START TAPE RECORDER": INPUT "AND HIT RETURN". Lines 30-38 are the READ data from tape subroutine. 36 38 Returning control to main program. CM MOD 256: 63. 1Ø 2Ø GOTO 1ØØ PRINT "REWIND TAPE THEN START TAPE RECORDER": INPUT "THEN HIT RETURN". 32 34 Checking the record length (A) for memory requirements if everything is satisfactory the data is READ in.8: POKE 62. LM/256: 62. B$ POKE 6Ø. CM MOD 256: POKE 63.4: POKE 6l. Lines 20-26 are the write data to tape subroutine.FIGURE 4b READ/SAVE PROGRAM Ø A=Ø COMMENTS This must be the first statement in the program.8: CALL -3Ø7 POKE POKE POKE POKE CALL 6Ø. NOTE: CM. This statement moves command to the main program. LM and A must be defined within the main program. but if data is to be saved. LM MOD 256: POKE 6l.
then hit RETURN Use statement 2a to find the end of the VARIABLE TABLE 4 5 > * *8ØØ.Cl ØØ 86 Ø8 FF FF C2 ØØ Ø8Ø8 ØC Ø8 ØØ ØØ ØØ Example l 41 .l 2 3 >A=l > >B=Ø > >PRINT PEEK (2Ø4) + PEEK (2Ø5) * 256 computer responds with= 2Ø6Ø Define variable A=-l. then hit RETURN Define variable B=Ø. Computer responds with: Ø8ØØ. Apple moves into Monitor mode.8ØC Hit the RESET key. Type in VARIABLE TABLE RANGE and HIT the RETURN KEY.
8: CALL -307 24 POKE 60.4: POKE 61 .LM MOD 256: POKE 61 .LM/256: POKE 62 .CM MOD 256: POKE 63.”)= “.I.A$ 130 CALL -936: PRINT “NOW WRITING DA TA TO TAPE”: GOSUB 20 135 PRINT “NOW THE DATA IS SAVE” 140 PRINT “NOW WE ARE GOING TO CLEAR THE X(20) TABLE AND READ THE DA TA FROM TAPE” 150 FOR I=1 TO 20:X(I): NEXT I “X(”.I.5: POKE 63.8: POKE 62.CM MOD 256 : POKE 63.4: POKE 61.X(20) 105 FOR I=1 TO 20:X(I)=I: NEXT I 108 LM=2048:CM=2106:A=58:HM=16383 110 PRINT “20 NUMBERS GENERATED” 120 PRINT “NOW WE ARE GOING TO SAVE THE DATA”: PRINT “WHEN YOU ARE R EADY START THE RECORDER IN RECOR D MORE”: INPUT “AND HIT RETURN” .CM/256 : CALL .A$ 165 PRINT “A ”. “)=”. CM/256: CALL -307 26 RETURN 30 REM READ DATA SUBROUTINE 32 POKE 60.X(I): NEXT I 160 PRINT “NOW START TAPE RECORDER” :INPUT “AND THEN HIT RETURN” .LM MOD 256: POKE 61.259 36 RETURN 38 PRINT “*** TOO MUCH DATA BASE ** *”:END 100 DIM A$(1).8: POKE 62.A 170 GOSUB 30 180 PRINT “ALL THE DATA READ IN” 190 FOR I-1 TO 20: PRINT “X(”.5: POKE 63.LM/256: POKE 62.X(I): NEXT I 195 PRINT “THIS IS THE END” 200 END 42 .Example 2 >LIST 0 A=0 10 GOTO 100 20 REM WRITE DATA TO TAPE ROUTINE 22 A=CM-LM: POKE 60.8: CALL -259 34 IF A<0 THEN 38:P=LM+A: IF P> HM THEN 38: CM=P: POKE 60.
produce tones. Generation of tones is the goal. After the values for frequency and duration are placed into memory a CALL2 statement from BASIC will activate this routine. a mere PEEK . So to reduce this problem humanizing of the computer is needed. has emotion. Machine Language Program This machine language program resides in page Ø of memory from $Ø2 (2) to $14 (2Ø). Figure l lists a machine language routine that satisfies these requirements. Tone Generation To generate tones in a computer three things are needed: a speaker. so describing frequency and duration is needed. This paper discusses the incorporation and usage of a tone subroutine within the Apple II computer. it only emits clicks. a circuit to drive the speaker. and makes errors. cold and accurate. This is accomplished by toggling the speaker at regular intervals for a fixed period of time. Control of the speaker is accomplished through software. Toggling the speaker is a simple process. $ØØ (ØØ) is used to store the relative period (P) between toggling of the speaker and $Ø1 (Ø1) is used as the memory location for the value of relative duration (Ø).A SIMPLE TONE SUBROUTINE INTRODUCTION Computers can perform marvelous feats of mathematical computation at well beyond the speed capable of most human minds. Humanizing means incorporating within the computer procedures that aid in a program's usage. As it happens the Apple II computer was designed with a two-inch speaker and an efficient speaker driving circuit.16336 ($CØ3Ø) in BASIC statement will perform this operation. and a means of triggering the circuit. One such technique is the addition of a tone subroutine. however. Both P and D can range in value from $ØØ (Ø) to $FF (255). These differences create problems when the two interact with one another. They are fast. The speaker is toggled with the machine language statement residing at $Ø2 and then a 43 . man on the other hand is slower. This does not.
These routines can also help in transforming a dull program into a lively one. They are in the form of a subroutine and can be activated by a GOSUB 32ØØØ statement. They are relatively easy to use and are a valuable addition to any program. Figure 2 lists the appropriate statement that will deposit the machine language routine into memory. The values of P and D are placed into $ØØ and $Øl and the CALL2 command activates the machine language program that toggles the speaker. Since the computer operates at a faster rate than man does. and supplement video displays on the Apple II computer system. It is only necessary to use this statement once at the beginning of a program. This statement is also in the form of a GOSUB because it can be used repetitively in a program. After the tone has ended control is returned to the main program. prompting can be used to indicate when the computer expects data to be entered. After that the machine language program will remain in memory unless a later part of the main program modifies the first 2Ø locations of page Ø. CONCLUSION The incorporation of tones through the routines discussed in this paper will aid in the humanizing of software used in the Apple computer. For example.delay in time equal to the value in $ØØ occurs. The statements in Figures 2 and 3 can be directly incorporated into BASIC programs to provide for the generation of tones. Once the frequency 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. Tones can be generated at just about any time for any reason in a program. Basic Program The purpose of the machine language routine is to generate tones controllable from BASIC as the program dictates. tones can be used to prompt. The programmer's imagination can guide the placement of these tones. indicate an error in entering or answering questions. After the GOSUB 32ØØØ has placed the machine language program into memory it may be activated by the statement in Figure 3. Once added to a program an infinite variety of tone combinations can be produced. This process is repeated until the tone has lasted a relative period of time equal to the duration (value in $Øl) and then this program is exited (statement $l4). 44 .
166: POKE 16. Lutas.96: RETURN FIGURE 2. Machine Language Program adapted from a program by P. BASIC "POKES" 25 POKE 0.2: POKE 19.000000000002000500060008000A000C000D000F00110014- FF FF AD 88 D0 C6 F0 CA D0 A6 4C 60 30 C0 04 01 08 F6 00 02 00 ??? ??? LDA DEY BNE DEC BEQ DEX BNE LDX JMP RTS $C030 $000C $01 $0014 $0005 $00 $0002 FIGURE 1.0: POKE 17.76 : POKE 18.208: POKE 14.192: POKE 5.D: CALL 2: RETURN FIGURE 3.202: POKE 13.1: POKE 10.136: POKE 6.4: P0KE 8.0: POKE 20.246: POKE 15 .198: POKE 9. 32000 POKE 2.240 32005 POKE 11.48: POKE 4. GOSUB 45 .8: POKE 12.P: POKE 1.208 : POKE 7.173: POKE 3.
on the screen. or draw and animate a predefined shape. There are seven subroutines in this package. Equivalent addresses for the ROM subroutines will be in italic type face. clear the screen.Only Memory (ROM). all addresses given will be in decimal. BASIC programs can access these subroutines by use of . For machine language programming. The hexadecimal substitutes will be preceded by a dollar sign ($). These subroutines occupy 757 bytes of memory and are available on either cassette tape or Read. With these. for both BASIC and machine. and can pass information by using the POKE state ment. All entry points given are for the cassette tape subroutines. a programmer can initialize High-Resolution mode. 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. a JSR to the appropriate subroutine address will perform the same function as a BASIC CALL.High-Resolution Operating Subroutines These subroutines were created to make programming for High-Resolution Graphics easier. plot a point. In the following subroutine descriptions. This note describes use and care of these subroutines.the CALL statement. There are also some other general-purpose subroutines to shorten and simplify programming. 46 . which load into addresses CØØ to FFF (hex). language programs. draw a line.
801. From BASIC: CALL 3780 (or CALL -21589) From machine language: JSR $C7C (or JSR $L107C) This subroutine plots a single point on the screen. X. PLOT Plots a point on the screen.High-Resolution Operating Subroutines INIT Initiates High-Resolution Graphics mode. From BASIC: CALL 3072 (or CALL -12288) From machine language: JSR $C00 (or JSR $D000) This subroutine sets High-Resolution Graphics mode with a 280 x 160 matrix of dots in the top portion of the screen and four lines of text in the bottom portion of the screen. and Y registers from machine language. The Y (vertical) coordinate can be from 0 47 . CLEAR Clears the screen. The X and Y coodinates of the point are passed in locations 800. From BASIC: CALL 3886 (or CALL -12274) From machine language: JSR SCOE (or JSR $L000E) This subroutine clears the High-Resolution screen without resetting the High-Resblution Graphics mode. and 802 from BASIC. or in the A. INIT also clears the screen.
ROD'S COLOR PATTERN PROGRAM DESCRIPTION ROD'S COLOR PATTERN is a simple but eloquent program.I 140 NEXT J.40-I: PLOT K.40-I: PLOT 40-I.40-K 136 PLOT 40-K.K: PLOT K.K: PLOT I.I: PLOT 40 -I. PROGRAM LISTING 100 105 110 115 120 130 135 GR FOR W=3 TO 50 FOR I=1 TO 19 FOR J=0 TO 19 K=I+J COLOR=J+3/(I+3)+IxW/12 PLOT I.40-K: PLOT 40-K.I 145 NEXT W: GOTO 105 55 . Many of the patterns generated by this program are pleasing to the eye and will dazzle the mind for minutes at a time. It generates a continuous flow of colored mosaic-like patterns in a 4Ø high by 4Ø wide block matrix. BASIC is the programming language used. REQUIREMENTS 4K or greater Apple II system with a color video display.
An enormous number of distinct pictures can be drawn on the sketch pad and this program will provide many hours of visual entertainment.COLOR SKETCH PROGRAM DESCRIPTION Color Sketch is a little program that transforms the Apple II into an artist's easel. The user as an artist has a 4Ø high by 4Ø wide (16ØØ blocks) sketching pad to fill with a rainbow of fifteen colors. REQUIREMENTS This program will fit into a 4K system in the BASIC mode. Colors are selected by depressing a letter from A through P on the keyboard. one for the horizontal and the other for the vertical. the screen into a sketch pad. Placement of colors is determined by controlling paddle inputs. 57 .
BASIC is the programming language. Guesses for a turn are made by selecting a color for each of the five hidden bars. A color may be used more than once. Violet (V). Orange (0).MASTERMIND PROGRAM PROGRAM DESCRIPTION MASTERMIND is a game of strategy that matches your wits against Apple's. 59 . Eight different colors are possible for each bar . Yellow (Y). After hitting the RETURN key Apple will indicate the correctness of the turn. No squares indicate you're way off. The object of the game is to choose correctly which 5 colored bars have been secretly chosen by the computer. White (W). and Black (B). Each grey square acknowledges a correctly colored but improperly positioned bar. Test your skill and challenge the Apple II to a game of MASTERMIND. REQUIREMENTS 8K or greater Apple II computer system.Red (R). Each white square to the right of your turn indicates a correctly colored and positioned bar.
These days are. 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. When they cross a "baseline" the functions change phase . coordination. Biorhythm theory states that aspects of the mind run in cycles. logic and analytic functions of the individual. strength. according to the theory. BASIC is the programming language used.become unstable . and creativity. and frustration are most likely on emotionally critical days. Finally. Accidents. mood.PROGRAM DESCRIPTION This program plots three Biorhythm functions: Physical (P). 61 . Mental The mental cycle takes 33 days to complete and indirectly indicates the level of alertness. slowness of the mind. mental health. basic bodily functions.and this causes Critical Days. catching colds. and Mental (M) or intellectual. Biorhythms Biorhythms are thought to affect behavior. All three functions are plotted in the color graphics display mode. quarrels. It indirectly indicates the level of sensitivity. Emotional (E). and resistance to disease. REQUIREMENTS This program fits into a 4K or greater system. and mental receptivity. Depression. and bodily harm may occur on physically critical days. resistance to new situations and unclear thinking are likely on mentally critical days. our weakest and most vulnerable times. It covers physical well-being. Emotional The Emotional Biorhythm takes 28 days to complete.
A mazeis constructed on the video screen. R for right. dragon. A reddish-brown square indicates your position and a purple square represents the dragon's. U for up. The scent of humans drives the dragon crazy. * Color tints may vary depending upon video monitor or television adjustments. REQUIREMENTS 8K or greater Apple II computer system. 63 . for the weak at heart. The object of the game is to get out of the maze before the dragon eats you. As you advance so does the dragon. After it is finished the maze is hidden as if the lights were turned out. and L for left.* You move by hitting a letter on the keyboard.DRAGON MAZE PROGRAM PROGRAM DESCRIPTION DRAGON MAZE is a game that will test your skill and memory. BASIC is the programming language. You watch carefully as it is completed. when he is DRAGON MAZE is not a game Try it if you dare to attempt out-smarting the enraged he breaks through walls to get at you. D for down.
DRAGON MAZE cont. 7110 DX=-1:DY=0: GOTO 7020 7150 IF SY=1 THEN 7005: IF T(SX+ 13*(SY-1))>9 THEN 7160: IF M(SX+13*(SY-1)-13)/10 THEN 7005 7160 DX=0:DY=-1: GOTO 7020 8000 GOSUB 5000: GOSUB 5000: GOSUB 5000: GOSUB 5000: PRINT “THE DRA GON GOT YOU!” 1999 END 66 .
APPLE II FIRMWARE 1. 6502 Op Codes 67 . Special Controls and Features 4. Sweet 16 Interpreter Listing 7. Control and Editing Characters 3. Annotated Monitor and Dis-assembler Listing 5. System Monitor Commands 2. Binary Floating Point Package 6.
lØ48 Examines (displays) single memory location of (adrs) Examines (displays) range of memory from (adrsl) thru (adrs2) Examines (displays) next 8 memory locations. *A256:EF 2Ø 43 Deposits data into memory starting at location (adrs). This action will not kill current BASIC program which may be re-entered by a Cc (control C). Apple II will respond with an "*" (asterisk) prompt character on the TV display. Examines (displays) memory from current location through location (adrs2) Example Description (return) *(return) .adrs2 *CØF2 *lØ24. 68 .B4lØM Copy the data now in the memory range from (adrs2) to (adrs3) into memory locations starting at (adrsl). *:FØ A2 l2 Verify Memory adsr1<adrs2 adrs3V *1ØØ<BØlØ.System Monitor Commands Apple II contains a powerful machine level monitor for use by the advanced programmer.adrs2 *. To enter the monitor either press RESET button on keyboard or CALL-l5l (Hex FF65) from Basic.4Ø96 Change Memory adrs:data data data :data data data Move Memory adrsl<adrs2. adrs3M *1ØØ<BØlØ.B4lØV 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. Command Format Examine Memory adrs adrsl. Deposits data into memory starting after (adrs) last used for deposits. Remember to press "return" button at the end of each line. NOTE: "adrs" is a four digit hexidecimal number and "data" is a two digit hexidecimal number.
Command Format Cassette I/O adrsl.adrs2R
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 specified memory (adrs) range.
Display I M *I *N Set inverse video mode. (Black characters on white background) Set normal video mode. (White characters on black background)
Dis-assembler adrsL *C8ØØL Decodes 2Ø instructions starting at memory (adrs) into 65Ø2 assembly nmenonic code. Decodes next 2Ø instructions starting at current memory address.
Mini-assembler (Turn-on) *F666G Turns-on mini-assembler. Prompt character is now a "!" (exclamation point). Executes any monitor command from miniassembler then returns control to miniassembler. 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 65Ø2 instruction into machine codes. If error, machine will refuse instruction, sound bell, and reprint line with up arrow under error.
adrs:(65Ø2 MNEMONIC instruction)
Command Format (space) (65Ø2 mnemonic instruction) (TURN-OFF)
Example ! STA ØlFF
Description Assembles instruction into next available memory location. (Note space between "f" and instruction) Exits mini-assembler and returns to system monitor.
! (Reset Button)
Monitor Program Execution and Debuging adrsG adrsT *3ØØG *8ØØT 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 ØØ (BRK), and returns control to system monitor. Opens 65Ø2 status registers (see note l) Single steps through program beginning at memory location (adrs). Type a letter S for each additional step that you want displayed. Opens 65Ø2 status registers (see Note l). Displays 65Ø2 status registers and opens them for modification (see Note l) Executes user specified machine language subroutine starting at memory location (3F8).
(Control E) (Control Y)
Note l: 65Ø2 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 *: FF *:FF ØØ 33 Y = ØØ P = 32 S = F2 Changes A register only 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
Set Input/Output Ports (X) (Control P) (X) (Control K) *5PC *2KC 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: ØPC or ØKC) resets ports to internal video display and keyboard. These commands will not work unless Apple II interfaces are plugged into specificed I/O slot.
Multiple Commands *lØØL 4ØØG AFFT Multiple monitor commands may be given on same line if separated by a "space". Single letter commands may be repeated without spaces.
control C and a carriage return will enter BASIC without killing current program. Control B Control C Control G Control H Control J Control V Control X 72 . Issues line feed only Compliment to HC. Bc and Cc must be followed by a carriage return. Control is transferred to System Monitor and Apple prompts with a "*" (asterisk) and a bell. For example. They are obtained by pressing and releasing the ESC key then typing specified letter. (as indicated by "*"). If in System Monitor (as indicated by a "*"). scratching (killing) any existing BASIC program and set HIMEM: to maximum installed user memory and LOMEM: to 2048. Apple keyboards have "+" key on right side which also performs this function. Control characters are NOT displayed on the TV screen. Apply supplied keyboards have special key "4-. Immediately deletes current line. Hitting RESET key does NOT destroy existing BASIC or machine language program.SPECIAL CONTROL AND EDITING CHARACTERS "Control" characters are indicated by a super-scripted "C" such as Gc." on right side of keyboard that provides this functions without using control button. halts program and displays line number where stop occurred*. a control B and a carriage return will transfer control to BASIC. Uc moves to cursor to right and copies text while AE moves cursor to right but does not copy text. Screen editing characters are indicated by a sub-scripted "E" such as DE. Forward spaces cursor and copies over written characters. If in System Monitor. Program may be continued with a CON command. Edit characters send information only to display screen and does not send data to memory. Also sets all text mode with scrolling window at maximum. * If BASIC program is expecting keyboard input. If in BASIC. They are obtained by holding down the CTRL key while typing the specified letter. Sounds bell (beeps speaker) Backspaces cursor and deletes any overwritten characters from computer but not from screen. CHARACTER RESET key DESCRIPTION OF ACTION Immediately interrupts any program execution and resets computer. you will have to hit carriage return key after typing control C.
SPECIAL CONTROL AND EDITING CHARACTERS (continued) CHARACTER DESCRIPTION OF ACTION AE BE CE DE EE FE @E 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. 73 . clear text to end of page.
B1 13Ø CH=PEEK(36) 14Ø POKE 36. Ll+Wl<4Ø. Set window width to amount specified by Wl. Wl>Ø 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.Ø TEXT Mode Controls ØØ2Ø 9Ø POKE 32.Special Controls and Features Hex BASIC Example Description Display Mode Controls CO5Ø CO51 CO52 CO53 CO54 CO55 CO56 CO57 1Ø 2Ø 3Ø 4Ø 5Ø 6Ø 7Ø 8Ø POKE POKE POKE POKE POKE -163Ø4. 2ØØ) (@E) Home cusor. l9Ø) Set normal flag if 255(Ex. l4Ø and l5Ø perform identical function.Ø POKE -16297.Ø -163ØØ. Similar to above.Ø POKE -16298.Ø -163Ø2. B1>T1 Read/set cusor horizontal position in the range of Ø to 39. Ex. Read/set cusor vertical position in the range Ø to 23.CV 18Ø VTAB(CV+l) 19Ø POKE 5Ø.255 21Ø CALL -936 22Ø CALL -958 ØØ32 FC58 FC42 74 .Ll Set left side of scrolling window to location specified by Ll in range of Ø to 39.Ø -163Ø1. Set inverse flag if 127 (Ex.T1 12Ø POKE 35.W1 11Ø POKE 34. you must add "1" to cusor position read value.CH 15Ø TAB(CH+1) ØØ25 16Ø CV=PEEK(37) 17Ø POKE 37.127 2ØØ POKE 5Ø.Ø 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 POKE -16299.Ø -163Ø3. clear screen (FE) Clear from cusor to end of page ØØ21 ØØ22 ØØ23 ØØ24 1ØØ POKE 33. If using TAB.
Read PDL(Ø) push button switch. Clear Game I/O ANØ output Set Game I/O ANØ output Clear Game I/O ANl output Set Game I/O ANl 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 CØlØ CØ6l CØ62 CØ63 CØ58 CØ59 CØ5A CØ5B CØ5C CØ5D CØ5E CØ5F 38Ø POKE -l6368.Ø 49Ø POKE -l6289.always after reading keyboard.Ø 46Ø POKE -l6292. Read PDL(2) push button switch.Ø 37Ø X=PEEK(-16384 Toggle speaker Read keyboard.Ø 47Ø POKE -l629l. if X>127 then key was pressed.Ø 39Ø X=PEEK(16287) 4ØØ X=PEEK(-l6286) 4lØ X=PEEK(-l6285 42Ø POKE -l6296.Ø 44Ø POKE -l6294.Ø 43Ø POKE -l6295. If X>l27 then switch is "on".Ø 75 .Hex FC9C FC66 FC7Ø BASIC Example 23Ø CALL -868 24Ø CALL -922 25Ø CALL -9l2 Description (EE) Clear from cusor to end of line (JC) Line feed Scroll up text one line Miscellaneous CØ3Ø CØØØ 36Ø X=PEEK(-l6336) 365 POKE -l6336.Ø 45Ø POKE -l6293. Clear keyboard strobe . Read PDL(l) push button switch.Ø 48Ø POKE -l629Ø.
BAUM * * * *************************** TITLE "APPLE II SYSTEM MONITOR" LOC0 EPZ $00 LOC1 EPZ $01 WNDLFT EPZ $20 WNDWDTH EPZ $21 WNDTOP EPZ $22 WNDBTM EPZ $23 CH EPZ $24 CV EPZ $25 GBASL EPZ $26 GBASH EPZ $27 BASL EPZ $28 BASH EPZ $29 BAS2L EPZ $2A 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 $3B XQT EPZ $3C A1L EPZ $3C A1H EPZ $3D A2L EPZ $3E A2H EPZ $3F A3L EPZ $40 A3H EPZ $41 A4L EPZ $42 A4H EPZ $43 A5L EPZ $44 A5H EPZ $45 76 .*************************** * * * APPLE II * * SYSTEM MONITOR * * * * COPYRIGHT 1977 BY * * APPLE COMPUTER. INC. * * * * ALL RIGHTS RESERVED * * * * S. WOZNIAK * * A.
LOOP RTS1 RTS CLRSCR LDY #$2F MAX Y.Y TO DATA RTS HLINE JSR PLOT PLOT SQUARE HLINE1 CPY H2 DONE? BCS RTS1 YES.Y DATA EOR COLOR EOR COLOR AND MASK AND MASK EOR (GBASL). FULL SCRN CLR BNE CLRSC2 ALWAYS TAKEN CLRTOP LDY #$27 MAX Y.H PLP RESTORE LSB FROM CARRY LDA #$0F MASK $0F IF EVEN BCC RTMASK ADC #$E0 MASK $F0 IF ODD RTMASK STA MASK PLOT1 LDA (GBASL).ACC XREG YREG STATUS SPNT RNDL RNDH ACL ACH XTNDL XTNDH AUXL AUXH PICK IN USRADR NMI IRQLOC IOADR KBD KBDSTRB TAPEOUT SPKR TXTCLR TXTSET MIXCLR MIXSET LOWSCR HISCR LORES HIRES TAPEIN PADDL0 PTRIG BASIC BASIC2 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: F856: 4A 08 20 28 A9 90 69 85 B1 45 25 51 91 60 20 C4 B0 C8 20 90 69 48 20 68 C5 90 60 A0 D0 A0 84 A0 A9 85 20 88 10 60 48 4A 29 09 85 68 29 90 69 85 47 F8 0F 02 E0 2E 26 30 2E 26 26 00 F8 2C 11 0E F8 F6 01 00 F8 2D F5 2F 02 27 2D 27 00 30 28 F8 F6 03 04 27 18 02 7F 26 EQU $45 EQU $46 EQU $47 EQU $48 EQU $49 EQU $4E EQU $4F EQU $50 EQU $51 EQU $52 EQU $53 EQU $54 EQU $55 EQU $95 EQU $0200 EQU $03F8 EQU $03FB EQU $03FE EQU $C000 EQU $C000 EQU $C010 EQU $C020 EQU $C030 EQU $C050 EQU $C051 EQU $C052 EQU $C053 EQU $C054 EQU $C055 EQU $C056 EQU $C057 EQU $C060 EQU $C064 EQU $C070 EQU $E000 EQU $E003 ORG $F800 ROM START ADDRESS PLOT LSR Y-COORD/2 PHP SAVE LSB IN CARRY JSR GBASCALC CALC BASE ADR IN GBASL. INCR INDEX (X-COORD) JSR PLOT1 PLOT NEXT SQUARE BCC HLINE1 ALWAYS TAKEN VLINEZ ADC #$01 NEXT Y-COORD VLINE PHA SAVE ON STACK JSR PLOT PLOT SQUARE PLA CMP V2 DONE? BCC VLINEZ NO.Y XOR DATA STA (GBASL). TOP SCREEN CLR CLRSC2 STY V2 STORE AS BOTTOM COORD FOR VLINE CALLS LDY #$27 RIGHTMOST X-COORD (COLUMN) CLRSC3 LDA #$00 TOP COORD FOR VLINE CALLS STA COLOR CLEAR COLOR (BLACK) JSR VLINE DRAW VLINE DEY NEXT LEFTMOST X-COORD BPL CLRSC3 LOOP UNTIL DONE RTS GBASCALC PHA FOR INPUT 000DEFGH LSR AND #$03 ORA #$04 GENERATE GBASH=000001FG STA GBASH PLA AND GBASL=HDEDE000 AND #$18 BCC GBCALC ADC #$7F GBCALC STA GBASL 77 . RETURN INY NO.
1=2 BYTE. LEN BYTES SAVE MNEMONIC TABLE INDEX (PCL). USE LO H SHIFT HIGH HALF BYTE DOWN MASK 4-BITS PRINT PCL.Y PRBYTE #$01 PRINT 2 BLANKS PRBL2 LENGTH PRINT INST (1-3 BYTES) IN A 12 CHR FIELD PRNTOP #$03 CHAR COUNT FOR MNEMONIC PRINT #$04 INSTDSP PRNTOP PRNTBL 78 .Y RTMSKZ A A A A #$0F PCL PCH PRYX2 PRBLNK (PCL.X INDEX INTO PRINT FORMAT TABLE FORMAT SAVE FOR ADR FIELD FORMATTING #$03 MASK FOR 2-BIT LENGTH (P=1 BYTE.X) A IEVEN ERR #$A2 ERR #$87 A FMT1. 2=3 BYTE) LENGTH OPCODE #$8F MASK FOR 1XXX1010 TEST SAVE IT OPCODE TO A AGAIN #$03 #$8A MNNDX3 A MNNDX3 FORM INDEX INTO MNEMONIC TABLE A A 1) 1XXX1010->00101XXX #$20 2) XXXYYY01->00111XXX 3) XXXYYY10->00110XXX MNNDX2 4) XXXYY100->00100XXX 5) XXXXX000->000XXXXX MNNDX1 $FF.X SCRN2 GETFMT #$80 #$00 INCREMENT COLOR BY 3 SETS COLOR=17*A MOD 16 BOTH HALF BYTES OF COLOR EQUAL READ SCREEN Y-COORD/2 SAVE LSB (CARRY) CALC BASE ADDRESS GET BYTE RESTORE LSB FROM CARRY IF EVEN.$FF INSDS1 GEN FMT.H FOLLOWED BY A BLANK GET OP CODE EVEN/ODD TEST BIT 1 TEST XXXXXX11 INVALID OP OPCODE $89 INVALID MASK BITS LSB INTO CARRY FOR L/R TEST GET FORMAT INDEX BYTE R/L H-BYTE ON CARRY SUBSTITUTE $80 FOR INVALID OPS SET PRINT FORMAT INDEX TO 0 03 8A 0B MNNDX1 08 MNNDX2 20 FA MNNDX3 F2 FF FF 82 F8 3A DA FD 01 4A F9 2F F1 03 04 FMT2.$FF.F858: F859: F85A: F85C: F85E: F85F: F861: F862: F864: F866: F868: F869: F86A: F86B: F86C: F86E: F870: F871: F872: F873: F876: F878: F879: F87B: F87C: F87D: F87E: F87F: F881: F882: F884: F886: F889: F88C: F88E: F88F: F890: F892: F893: F895: F897: F899: F89B: F89C: F89D: F8A0: F8A3: F8A5: F8A7: F8A9: F8AA: F8AD: F8AF: F8B1: F8B3: F8B4: F8B6: F8B7: 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: 0A 0A 05 85 60 A5 18 69 29 85 0A 0A 0A 0A 05 85 60 4A 08 20 B1 28 90 4A 4A 4A 4A 29 60 A6 A4 20 20 A1 A8 4A 90 6A B0 C9 F0 29 4A AA BD 20 D0 A0 A9 AA BD 85 29 85 98 29 AA 98 A0 E0 F0 4A 90 4A 4A 09 88 D0 C8 88 D0 60 FF 20 48 B1 20 A2 20 C4 C8 90 A2 C0 26 26 30 03 0F 30 NXTCOL SETCOL 30 30 SCRN 47 F8 26 04 SCRN2 0F 3A 3B 96 FD 48 F9 3A RTMSKZ INSDS1 INSDS2 09 10 A2 0C 87 IEVEN 62 F9 79 F8 04 80 00 A6 F9 2E 03 2F 8F ERR GETFMT ASL ASL ORA STA RTS LDA CLC ADC AND STA ASL ASL ASL ASL ORA STA RTS LSR PHP JSR LDA PLP BCC LSR LSR LSR LSR AND RTS LDX LDY JSR JSR LDA TAY LSR BCC ROR BCS CMP BEQ AND LSR TAX LDA JSR BNE LDY LDA TAX LDA STA AND STA TYA AND TAX TYA LDY CPX BEQ LSR BCC LSR LSR ORA DEY BNE INY DEY BNE RTS DFB JSR PHA LDA JSR LDX JSR CPY INY BCC LDX CPY A A GBASL GBASL COLOR #$03 #$0F COLOR A A A A COLOR COLOR A GBASCALC (GBASL).
$33 $0D.$0D.$90.$20.$04. 1=2-BYTE 2=3-BYTE TEST DISPLACEMENT SIGN (FOR REL BRANCH) EXTEND NEG BY DEC PCH PCL+LENGTH(OR DISPL)+1 TO A CARRY INTO Y (PCH) XXXXXXY0 INSTRS THEN LEFT HALF BYTE THEN RIGHT HALF BYTE (X=INDEX) F962: F965: F967: F96A: F96C: F96F: F971: F974: F976: F979: F97B: F97E: F980: F983: F985: F988: 04 30 80 03 54 80 90 54 0D 90 20 0D 04 22 33 44 DFB DFB $04.$80.$0D $80.Y +1 TO Y.$04.$00 0D DFB 20 DFB 04 DFB 3B DFB 00 DFB C8 DFB 79 .$04 $20.X BEQ PRADR3 JSR COUT DEX BNE PRADR1 RTS DEY BMI PRADR2 JSR PRBYTE LDA FORMAT CMP #$E8 LDA (PCL).$03.$54.Y STA LMNEM LDA MNEMR.F8E7: F8E9: F8EA: F8EB: F8EE: F8F0: F8F3: F8F5: F8F7: F8F9: F8FB: F8FD: F8FE: F8FF: F901: F903: F906: F907: F909: F90C: F90E: F910: F912: F914: F916: F918: F91B: F91E: F921: F923: F926: F927: F929: F92A: F92B: F92D: F930: F932: F934: F936: F938: F93B: F93C: F93D: F93F: F940: F941: F944: F945: F948: F94A: F94C: F94F: F950: F952: F953: F954: F956: F958: F959: F95B: F95C: F95E: F960: F961: 90 68 A8 B9 85 B9 85 A9 A0 06 26 2A 88 D0 69 20 CA D0 20 A4 A2 E0 F0 06 90 BD 20 BD F0 20 CA D0 60 88 30 20 A5 C9 B1 90 20 AA E8 D0 C8 98 20 8A 4C A2 A9 20 CA D0 60 38 A5 A4 AA 10 88 65 90 C8 60 F2 C0 F9 2C 00 FA 2D 00 05 2D 2C PRMN1 PRMN2 F8 BF ED FD EC 48 2F 06 03 1C 2E 0E B3 ED B9 03 ED E7 PRADR4 E7 DA FD 2E E8 3A F2 56 F9 F9 PRADR1 PRADR2 F9 FD F9 FD PRADR3 PRADR5 RELADR 01 PRNTYX PRNTAX PRNTX PRBLNK PRBL2 PRBL3 DA FD DA FD 03 A0 ED FD F8 2F 3B 01 3A 01 PCADJ PCADJ2 PCADJ3 PCADJ4 RTS2 * * * * 20 0D 04 22 33 04 04 33 80 04 54 80 90 44 0D 00 54 FMT1 90 BCC PRNTBL PLA TAY LDA MNEML.PCH+OFFSET+1 TO A.$C8.$54.$33.$04 $90.$54.$44.$22 $54. HANDLE REL ADR MODE SPECIAL (PRINT TARGET.$30.$80.$00.Y STA RMNEM LDA #$00 LDY #$05 ASL RMNEM ROL LMNEM ROL DEY BNE PRMN2 ADC #$BF JSR COUT DEX BNE PRMN1 JSR PRBLNK LDY LENGTH LDX #$06 CPX #$03 BEQ PRADR5 ASL FORMAT BCC PRADR3 LDA CHAR1-1.Y BCC PRADR4 JSR PCADJ3 TAX INX BNE PRNTYX INY TYA JSR PRBYTE TXA JMP PRBYTE LDX #$03 LDA #$A0 JSR COUT DEX BNE PRBL2 RTS SEC LDA LENGTH LDY PCH TAX BPL PCADJ4 DEY ADC PCL BCC RTS2 INY RTS FMT1 BYTES: IF Y=0 IF Y=1 RECOVER MNEMONIC INDEX FETCH 3-CHAR MNEMONIC (PACKED IN 2-BYTES) SHIFT 5 BITS OF CHARACTER INTO A (CLEARS CARRY) ADD "?" OFFSET OUTPUT A CHAR OF MNEM OUTPUT 3 BLANKS CNT FOR 6 FORMAT BITS IF X=3 THEN ADDR.X OUTPUT TARGET ADR OF BRANCH AND RETURN BLANK COUNT LOAD A SPACE OUTPUT A BLANK LOOP UNTIL COUNT=0 0=1-BYTE.$44 $33.X JSR COUT LDA CHAR2-1.$0D.$90. NOT OFFSET) PCL.$20.$0D.$04.$22.$90.$3B.$80 $04.
#($" F9BA: D9 00 D8 F9BD: A4 A4 00 CHAR2 *CHAR2: * * * * * * * MNEML DFB $D9.$5D.$00 "Y".$24.$31.$88.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: F9B7: 11 33 C8 01 44 80 90 44 0D 90 26 9A 00 21 81 82 00 00 59 4D 91 92 86 4A 85 9D AC A3 22 0D 44 22 33 04 01 33 80 44 DFB A9 DFB 0D DFB 22 DFB 04 DFB $0D.$00 (C) FORMAT $15.$6D.$B4.$53 $19.$19.$44.$80.$AE.$ $1B.$A2.$29 $19.0 MNEML IS OF FORM: (A) XXXXX000 (B) XXXYY100 (C) 1XXX1010 (D) XXXYYY10 (E) XXXYYY01 (X=INDEX) DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB $1C.$E8.$74.$90 $26.$0D.$23 $24.$04 $C8.$22.Y $4A (ABS) $85 ZPAG.$5A.$8A.$33 $44.$72 (B) FORMAT $44.$C8.$33.$00 $7C.$26.$1D.$48.$24 (B) FORMAT $AE.$22 $11.$D8.$94."X$$".$8B.$44.$13.$53 (D) FORMAT $84.$01.$A8.$00.$A4.$A1.$C8 (D) FORMAT $C4.$33.$9C.$A0 (E) FORMAT $D8.$44.$32.X $92 ABS.$A5.$44 $A2.$B2.$A8.$54.$04.$26.$23 $9D.$A4.$62.$0D 31 87 FMT2 DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB A9 AC A8 A4 CHAR1 ASC ".$A5.$29.$5B.$00.X) $4D (ZPAG).$11.$69 $23.$80.$28.Y $91 ZPAG.$22.Y $9D RELATIVE $90.$23.$B2.$69.$A9.$AD.$87.$72 $88.$00 (C) FORMAT $1A.$1B.$26.$23.$A5.$00.$72.X $86 ABS.$84.$F2 $A4.$CC.$44.$69 $24.$74 $74.$1D.$F4.$9A $ZZXXXY01 INSTR'S $00 ERR $21 IMM $81 Z-PAGE $82 ABS $00 IMPLIED $00 ACCUMULATOR $59 (ZPAG.$AA.$48.$C8 (E) FORMAT F9C0: F9C3: F9C6: F9C9: F9CC: F9CF: F9D2: F9D5: F9D8: F9DB: F9DE: F9E0: F9E3: F9E6: F9E8: F9EB: F9EE: F9F0: F9F3: F9F6: F9F8: F9FB: F9FE: FA00: FA03: FA06: FA09: FA0C: FA0F: FA12: FA15: FA18: FA1B: FA1E: FA20: FA23: FA26: FA28: FA2B: FA2E: FA30: FA33: FA36: FA38: FA3B: FA3E: 1C 23 1B 8A 9D A1 19 A8 24 23 19 00 5B 24 AE AD 7C 15 9C 29 84 11 23 D8 48 94 44 68 94 08 B4 74 4A A4 00 A2 74 44 32 22 1A 26 88 C4 48 A2 8A 5D A1 1D 8B 00 AE 19 53 24 A1 1A A5 24 AE 29 00 9C A5 53 13 A5 A0 62 26 88 C8 44 00 84 28 F4 72 8A AA 74 72 68 B2 00 1A 72 C8 CA 44 C8 1C 8B 9D 23 1D 29 69 23 1B 53 5B 69 A8 00 6D 69 34 69 5A 62 54 54 E8 B4 74 6E CC F2 A2 74 B2 00 26 72 26 44 MNEMR DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB 80 .$1A.$54 $68.$6E $74.$44.$A2.$9C.$AE.$69 $29.$68.$8A (A) FORMAT $00.$00 $22.$9D.$5B.$01.$72.$26.$53.$8A.$34.$CA.$A1.).$44.$4A.$74.0.$B4 $08.$1A.$A1 (A) FORMAT ABOVE $00.$62 $94.$1C.
JMP.$FF. THEN RTS RTS SIMULATION EXTRACT PC FROM STACK AND UPDATE PC BY 1 (LEN=0) UPDATE PC BY LEN STATUS PCL PCH LENGTH PCADJ3 PCH NEWPCL PCADJ2 UPDATE PC AND PUSH ONTO STACH FOR JSR SIMULATE #$02 (PCL).X INIT XEQ AREA XQT.Y XQT. RTS. JMP ().$FF INSTDSP DISASSEMBLE ONE INST AT (PCL. AND REG'S GO TO MONITOR SIMULATE RTI BY EXPECTING STATUS FROM STACK.H) RTNL ADJUST TO USER STACK. RTI SPECIAL COPY USER INST TO XEQ AREA WITH TRAILING NOPS CHANGE REL BRANCH DISP TO 4 FOR JMP TO BRANCH OR NBRANCH FROM XEQ. RESTORE USER REG CONTENTS. SAVE RTNH RTN ADR.Y XQ1 RESTORE XQT ACC USER OPCODE BYTE SPECIAL IF BREAK LEN FROM DISASSEMBLY HANDLE JSR. #$08 INITBL-1.X XQINIT (PCL.FA40: FA43: FA46: FA47: FA49: FA4A: FA4C: FA4E: FA51: FA53: FA54: FA56: FA58: FA5A: FA5C: FA5E: FA60: FA62: FA64: FA66: FA68: FA6A: FA6C: FA6E: FA70: FA72: FA74: FA76: FA78: FA7A: FA7D: FA7E: FA80: FA83: FA86: FA88: FA89: FA8A: FA8B: FA8C: FA8D: FA8F: FA92: FA93: FA96: FA97: FA99: FA9A: FA9C: FA9F: FAA2: FAA5: FAA6: FAA7: FAA9: FAAA: FAAC: FAAD: FAAF: FAB1: FAB4: FAB6: FAB7: FAB9: FABA: FABD: FABE: FABF: FAC0: FAC1: FAC2: FAC4: FAC5: FAC7: FAC8: FAC9: FACB: FACD: FACF: FAD1: FAD3: FAD4: FAD6: FAD7: FADA: FADC: FF 20 68 85 68 85 A2 BD 95 CA D0 A1 F0 A4 C9 F0 C9 F0 C9 F0 C9 F0 C9 F0 29 49 C9 F0 B1 99 88 10 20 4C 85 68 48 0A 0A 0A 30 6C 28 20 68 85 68 85 20 20 4C 18 68 85 68 85 68 85 A5 20 84 18 90 18 20 AA 98 48 8A 48 A0 18 B1 AA 88 B1 86 85 B0 A5 48 A5 48 20 A9 85 FF FF D0 F8 2C 2D 08 10 FB 3C F8 3A 42 2F 20 59 60 45 4C 5C 6C 59 40 35 1F 14 04 02 3A 3C 00 F8 3F FF 3C 00 45 STEP XQINIT XQ1 XQ2 IRQ 03 FE 03 BREAK 4C FF 3A 3B 82 F8 DA FA 65 FF XBRK XRTI 48 XRTS 3A 3B 2F 56 F9 3B 14 XJSR 54 F9 PCINC2 PCINC3 02 3A XJMP XJMPAT 3A 3B 3A F3 2D 2C 8E FD 45 40 NEWPCL RTNJMP REGDSP RGDSP1 DFB JSR PLA STA PLA STA LDX LDA STA DEX BNE LDA BEQ LDY CMP BEQ CMP BEQ CMP BEQ CMP BEQ CMP BEQ AND EOR CMP BEQ LDA STA DEY BPL JSR JMP STA PLA PHA ASL ASL ASL BMI JMP PLP JSR PLA STA PLA STA JSR JSR JMP CLC PLA STA PLA STA PLA STA LDA JSR STY CLC BCC CLC JSR TAX TYA PHA TXA PHA LDY CLC LDA TAX DEY LDA STX STA BCS LDA PHA LDA PHA JSR LDA STA $FF. XEQ USER OP FROM RAM (RETURN TO NBRANCH) **IRQ HANDLER A A A BREAK (IRQLOC) SAV1 PCL PCH INSDS1 RGDSP1 MON TEST FOR BREAK USER ROUTINE VECTOR IN RAM SAVE REG'S ON BREAK INCLUDING PC PRINT USER PC.Y LOAD PC FOR JMP.Y PCH PCL XJMP RTNH RTNL CROUT #ACC A3L DISPLAY USER REG CONTENTS WITH LABELS 81 . (JMP) SIMULATE. (PCL).X) XBRK LENGTH #$20 XJSR #$60 XRTS #$4C XJMP #$6C XJMPAT #$40 XRTI #$1F #$14 #$04 XQ2 (PCL).
X XTNDL+2. BTTM AT LINE 24 VTAB TO ROW 23 VTABS TO ROW IN A-REG ABS VAL OF AC AUX INDEX FOR 16 BITS ACX * AUX + XTND TO AC.FADE: FAE0: FAE2: FAE4: FAE6: FAE9: FAEC: FAEF: FAF1: FAF4: FAF6: FAF9: FAFA: FAFC: FAFD: FAFE: FB00: FB02: FB05: FB07: FB08: FB09: FB0B: FB0E: FB0F: FB11: FB12: FB13: FB16: FB19: FB1A: FB1B: FB1C: FB1D: FB1E: FB21: FB23: FB24: FB25: FB28: FB2A: FB2B: FB2D: FB2E: FB2F: FB31: FB33: FB36: FB39: FB3C: FB3E: FB40: FB43: FB46: FB49: FB4B: FB4D: FB4F: FB51: FB53: FB55: FB57: FB59: FB5B: FB5D: FB60: FB63: FB65: FB67: FB68: FB6A: FB6B: FB6D: FB6F: FB71: FB73: FB74: FB76: FB78: FB79: FB7A: FB7B: FB7D: FB7E: FB80: A9 85 A2 A9 20 BD 20 A9 20 B5 20 E8 30 60 18 A0 B1 20 85 98 38 B0 20 38 B0 EA EA 4C 4C C1 D8 D9 D0 D3 AD A0 EA EA BD 10 C8 D0 88 60 A9 85 AD AD AD A9 F0 AD AD 20 A9 85 A9 85 A9 85 A9 85 A9 85 4C 20 A0 A5 4A 90 18 A2 B5 75 95 E8 D0 A2 76 50 CA 10 88 D0 60 00 41 FB A0 ED 1E ED BD ED 4A DA E8 RDSP1 FD FA FD FD FD BRANCH 01 3A 56 F9 3A A2 4A FF 9E NBRNCH INITBL 0B FB FD FA RTBL 70 C0 00 PREAD 64 C0 04 F8 PREAD2 00 48 56 54 51 00 0B 50 53 36 14 22 00 20 28 21 18 23 17 25 22 A4 10 50 0C FE 54 56 54 F7 03 RTS2D INIT C0 C0 C0 SETTXT C0 C0 F8 SETGR SETWND TABV FC FB MULPM MUL MUL2 MUL3 MUL4 MUL5 FB E5 LDA STA LDX LDA JSR LDA JSR LDA JSR LDA JSR INX BMI RTS CLC LDY LDA JSR STA TYA SEC BCS JSR SEC BCS NOP NOP JMP JMP DFB DFB DFB DFB DFB LDA LDY NOP NOP LDA BPL INY BNE DEY RTS LDA STA LDA LDA LDA LDA BEQ LDA LDA JSR LDA STA LDA STA LDA STA LDA STA LDA STA JMP JSR LDY LDA LSR BCC CLC LDX LDA ADC STA INX BNE LDX DFB DFB DEX BPL DEY BNE RTS #ACC/256 A3H #$FB #$A0 COUT RTBL-$FB.X COUT #$BD COUT ACC+5.X RTS2D PREAD2 #$00 STATUS LORES LOWSCR TXTSET #$00 SETWND TXTCLR MIXSET CLRTOP #$14 WNDTOP #$00 WNDLFT #$28 WNDWDTH #$18 WNDBTM #$17 CV VTAB MD1 #$10 ACL A MUL4 #$FE XTNDL+2. ADD LEN+2 TO PC #$01 (PCL).X PRBYTE RDSP1 BRANCH TAKEN.Y PCADJ3 PCL PCINC2 SAVE PCINC3 NORMAL RETURN AFTER XEQ USER OF GO UPDATE PC DUMMY FILL FOR XEQ AREA NBRNCH BRANCH $C1 $D8 $D9 $D0 $D3 PTRIG #$00 TRIGGER PADDLES INIT COUNT COMPENSATE FOR 1ST COUNT COUNT Y-REG EVERY 12 USEC EXIT AT 255 MAX PADDL0.X AUXL+2. XTND IF NO CARRY.X MUL3 #$03 $76 $50 MUL5 MUL2 CLR STATUS FOR DEBUG SOFTWARE INIT VIDEO MODE SET FOR TEXT MODE FULL SCREEN WINDOW SET FOR GRAPHICS MODE LOWER 4 LINES AS TEXT WINDOW SET FOR 40 COL WINDOW TOP IN A-REG. ADD MPLCND (AUX) TO PARTIAL PROD (XTND) 82 . NO PARTIAL PROD.
X LOC0. GENERATE BASH=000001CD AND BASL=EABAB000 BASL BASL #$87 RTS2B #$40 WAIT #$C0 #$0C WAIT SPKR BELL2 CH (BASL). AUX WITH RESULT SIGN IN LSB OF SIGN.X LOC1. ELSE MOVE UP SET CH TO WNDWDTH-1 (RIGHTMOST SCREEN POS) CURSOR V INDEX BELL CHAR? (CNTRL-G) NO. LINE FEED? IF SO. OK.<=$17 ARG=000ABCDE. CR? YES. INDEX FOR 16 BITS XTND/AUX TO AC. INVERSE VIDEO? YES.X MDRTS ABS VAL OF AC. 83 .FB81: FB84: FB86: FB88: FB8A: FB8C: FB8E: FB8F: FB91: FB93: FB94: FB96: FB98: FB9A: FB9C: FB9E: FBA0: FBA1: FBA3: FBA4: FBA6: FBA8: FBAA: FBAD: FBAF: FBB1: FBB3: FBB4: FBB5: FBB7: FBB9: FBBA: FBBC: FBBE: FBC0: FBC1: FBC2: FBC3: FBC5: FBC7: FBC9: FBCA: FBCC: FBCE: FBD0: FBD2: FBD3: FBD4: FBD6: FBD8: FBD9: FBDB: FBDD: FBDF: FBE2: FBE4: FBE6: FBE9: FBEC: FBED: FBEF: FBF0: FBF2: FBF4: FBF6: FBF8: FBFA: FBFC: FBFD: FBFF: FC01: FC02: FC04: FC06: FC08: FC0A: FC0C: FC0E: FC10: FC12: FC14: FC16: FC18: FC1A: FC1C: 20 A0 06 26 26 26 38 A5 E5 AA A5 E5 90 86 85 E6 88 D0 60 A0 84 A2 20 A2 B5 10 38 98 F5 95 98 F5 95 E6 60 48 4A 29 09 85 68 29 90 69 85 0A 0A 05 85 60 C9 D0 A9 20 A0 A9 20 AD 88 D0 60 A4 91 E6 A5 C5 B0 60 C9 B0 A8 10 C9 F0 C9 F0 C9 D0 C6 10 A5 85 C6 A5 C5 A4 FB 10 50 51 52 53 52 54 53 55 06 52 53 50 DIVPM DIV DIV2 DIV3 E3 00 2F 54 AF FB 50 01 0D MD1 MD3 00 00 01 01 2F MDRTS BASCALC 03 04 29 18 02 7F 28 BSCLC2 28 28 87 12 40 A8 FC C0 0C A8 FC 30 C0 F5 24 28 24 24 21 66 A0 EF EC 8D 5A 8A 5A 88 C9 24 E8 21 24 24 22 25 RTS2B STOADV ADVANCE BELL1 BELL2 RTS3 VIDOUT BS UP JSR LDY ASL ROL ROL ROL SEC LDA SBC TAX LDA SBC BCC STX STA INC DEY BNE RTS LDY STY LDX JSR LDX LDA BPL SEC TYA SBC STA TYA SBC STA INC RTS PHA LSR AND ORA STA PLA AND BCC ADC STA ASL ASL ORA STA RTS CMP BNE LDA JSR LDY LDA JSR LDA DEY BNE RTS LDY STA INC LDA CMP BCS RTS CMP BCS TAY BPL CMP BEQ CMP BEQ CMP BNE DEC BPL LDA STA DEC LDA CMP MD1 #$10 ACL ACH XTNDL XTNDH XTNDL AUXL XTNDH AUXH DIV3 XTNDL XTNDH ACL DIV2 #$00 SIGN #AUXL MD3 #ACL LOC1. DO IT.Y CH CH WNDWDTH CR #$A0 STOADV STOADV #$8D CR #$8A LF #$88 BELL1 CH RTS3 WNDWDTH CH CH WNDTOP CV CURSOR H INDEX TO Y-REG STORE CHAR IN LINE INCREMENT CURSOR H INDEX (MOVE RIGHT) BEYOND WINDOW WIDTH? YES CR TO NEXT LINE NO. RETURN DELAY . CHECK FOR BELL. BACK SPACE? (CNTRL-H) NO. DECREMENT CURSOR H INDEX IF POS. X SPECIFIES AC OR AUX LOC0. AUX.H FOR GIVEN LINE NO 0<=LINE NO.01 SECONDS TOGGLE SPEAKER AT 1 KHZ FOR .X LOC1.RETURN CONTROL CHAR? NO. ABS VAL OF AC.OUTPUT IT. A #$03 #$04 BASH #$18 BSCLC2 #$7F BASL CALC BASE ADR IN BASL. OUTPUT IT.1 SEC.X SIGN COMPL SPECIFIED REG IF NEG. MOD TO XTND.
SET CARRY CLEAR FROM H INDEX=0 FOR REST INCREMENT CURRENT LINE (CARRY IS SET) DONE TO BOTTOM OF WINDOW? NO.0204 USEC (13+27/2*A+5/2*A*A) INCR 2-BYTE A4 AND A1 INCR 2-BYTE A1.H TO BAS2L. CLEAR TO END OF LINE NOT F. RETURN CURSOR H TO Y INDEX CURSOR V TO A-REGISTER SAVE CURRENT LINE ON STK CALC BASE ADDRESS CLEAR TO EOL. DO HOME AND CLEAR ESC-A OR B CHECK A. KEEP CLEARING LINES YES. DOWN D.Y (BAS2L).H (BASE ADDR) MOVE A CHR UP ON LINE NEXT CHAR OF LINE #$01 WNDBTM SCRL3 VTABZ (BASL). AND COMPARE TO A2 84 .Y SCRL2 SCRL1 #$00 CLEOLZ VTAB CH #$A0 (BASL). ADVANCE B. BACKSPACE ESC-C OR D CHECK C.H INIT Y TO RIGHTMOST INDEX OF SCROLLING WINDOW INCR LINE NUMBER DONE? YES. TAB TO CURRENT LINE INIT CURSOR V AND H-INDICES THEN CLEAR TO END OF PAGE CURSOR TO LEFT OF INDEX (RET CURSOR H=0) INCR CURSOR V(DOWN 1 LINE) OFF SCREEN? NO.Y WNDWDTH CLEOL2 NEXT LINE (ALWAYS TAKEN) CLEAR BOTTOM LINE GET BASE ADDR FOR BOTTOM LINE CARRY IS SET CURSOR H INDEX STORE BLANKS FROM 'HERE' TO END OF LINES (WNDWDTH) #$01 WAIT3 #$01 WAIT2 A4L NXTA1 A4H A1L A2L A1H 1.FC1E: FC20: FC22: FC24: FC27: FC29: FC2B: FC2C: FC2E: FC30: FC32: FC34: FC36: FC38: FC3A: FC3C: FC3E: FC40: FC42: FC44: FC46: FC47: FC4A: FC4D: FC4F: FC50: FC52: FC54: FC56: FC58: FC5A: FC5C: FC5E: FC60: FC62: FC64: FC66: FC68: FC6A: FC6C: FC6E: FC70: FC72: FC73: FC76: FC78: FC7A: FC7C: FC7E: FC80: FC81: FC82: FC84: FC86: FC88: FC89: FC8C: FC8E: FC90: FC91: FC93: FC95: FC97: FC9A: FC9C: FC9E: FCA0: FCA2: FCA3: FCA5: FCA7: FCA8: FCA9: FCAA: FCAC: FCAE: FCAF: FCB1: FCB3: FCB4: FCB6: FCB8: FCBA: FCBC: FCBE: B0 C6 A5 20 65 85 60 49 F0 69 90 F0 69 90 F0 69 90 D0 A4 A5 48 20 20 A0 68 69 C5 90 B0 A5 85 A0 84 F0 A9 85 E6 A5 C5 90 C6 A5 48 20 A5 85 A5 85 A4 88 68 69 C5 B0 48 20 B1 91 88 10 30 A0 20 B0 A4 A9 91 C8 C4 90 60 38 48 E9 D0 68 E9 D0 60 E6 D0 E6 A5 C5 A5 0B 25 25 C1 FB 20 28 C0 28 FD C0 DA FD 2C DE FD 5C E9 24 25 24 FC 9E FC 00 00 23 F0 CA 22 25 00 24 E4 00 24 25 25 23 B6 25 22 24 FC 28 2A 29 2B 21 VTAB VTABZ RTS4 ESC1 CLREOP CLEOP1 HOME CR LF SCROLL SCRL1 01 23 0D 24 FC 28 2A F9 E1 00 9E FC 86 24 A0 28 21 F9 WAIT WAIT2 WAIT3 SCRL2 SCRL3 CLREOL CLEOLZ CLEOL2 01 FC 01 F6 42 02 43 3C 3E 3D NXTA4 NXTA1 BCS DEC LDA JSR ADC STA RTS EOR BEQ ADC BCC BEQ ADC BCC BEQ ADC BCC BNE LDY LDA PHA JSR JSR LDY PLA ADC CMP BCC BCS LDA STA LDY STY BEQ LDA STA INC LDA CMP BCC DEC LDA PHA JSR LDA STA LDA STA LDY DEY PLA ADC CMP BCS PHA JSR LDA STA DEY BPL BMI LDY JSR BCS LDY LDA STA INY CPY BCC RTS SEC PHA SBC BNE PLA SBC BNE RTS INC BNE INC LDA CMP LDA RTS4 CV CV BASCALC WNDLFT BASL #$C0 HOME #$FD ADVANCE BS #$FD LF UP #$FD CLREOL RTS4 CH CV VTABZ CLEOLZ #$00 #$00 WNDBTM CLEOP1 VTAB WNDTOP CV #$00 CH CLEOP1 #$00 CH CV CV WNDBTM VTABZ CV WNDTOP VTABZ BASL BAS2L BASH BAS2H WNDWDTH IF TOP LINE THEN RETURN DEC CURSOR V-INDEX GET CURSOR V-INDEX GENERATE BASE ADR ADD WINDOW LEFT INDEX TO BASL ESC? IF SO. SET BASE ADDR DECR CURSOR V (BACK TO BOTTOM) START AT TOP OF SCRL WNDW GENERATE BASE ADR COPY BASL. FINISH FORM BASL. GO UP ESC-E OR F CHECK E.
READ KEY ESC? YES. SOUND BELL ADVANCE INPUT INDEX BACKSLASH AFTER CANCELLED LINE NOTCR1 13 DC ED FD CANCEL 85 .Y #$3F #$40 (BASL).X #$88 BCKSPC #$98 CANCEL #$F8 NOTCR1 BELL NXTCHAR #$DC COUT DECR Y UNTIL TAPE TRANSITION SET CARRY ON Y SET SCREEN TO FLASH GO TO USER KEY-IN INCR RND NUMBER KEY DOWN? LOOP REPLACE FLASHING SCREEN GET KEYCODE CLR KEY STROBE GET KEYCODE HANDLE ESC FUNC.X COUT INVFLG IN.Y (KSWL) RNDL KEYIN2 RNDH KBD KEYIN (BASL).Y KBD KBDSTRB RDKEY ESC1 RDKEY #$9B ESC INVFLG #$FF INVFLG IN.FCC0: FCC2: FCC4: FCC6: FCC8: FCC9: FCCB: FCCE: FCD0: FCD2: FCD4: FCD6: FCD9: FCDA: FCDB: FCDC: FCDE: FCE0: FCE2: FCE3: FCE5: FCE8: FCEA: FCEB: FCEC: FCEE: FCEF: FCF2: FCF3: FCF4: FCF6: FCF7: FCF9: FCFA: FCFD: FCFE: FD01: FD03: FD05: FD07: FD09: FD0B: FD0C: FD0E: FD10: FD11: FD13: FD15: FD17: FD18: FD1B: FD1D: FD1F: FD21: FD24: FD26: FD28: FD2B: FD2E: FD2F: FD32: FD35: FD38: FD3A: FD3C: FD3D: FD3F: FD40: FD42: FD44: FD47: FD4A: FD4B: FD4D: FD50: FD52: FD54: FD56: FD58: FD5A: FD5C: FD5F: FD60: FD62: FD64: E5 E6 D0 E6 60 A0 20 D0 69 B0 A0 20 C8 C8 88 D0 90 A0 88 D0 AC A0 CA 60 A2 48 20 68 2A A0 CA D0 60 20 88 AD 45 10 45 85 C0 60 A4 B1 48 29 09 91 68 6C E6 D0 E6 2C 10 91 AD 2C 60 20 20 20 C9 F0 60 A5 48 A9 85 BD 20 68 85 BD C9 F0 C9 F0 E0 90 20 E8 D0 A9 20 3F 3C 02 3D 4B DB FC F9 FE F5 21 DB FC RTS4B HEADR WRBIT ZERDLY FD 05 32 ONEDLY FD 20 C0 2C WRTAPE SBC INC BNE INC RTS LDY JSR BNE ADC BCS LDY JSR INY INY DEY BNE BCC LDY DEY BNE LDY LDY DEX RTS LDX PHA JSR PLA ROL LDY DEX BNE RTS JSR DEY LDA EOR BPL EOR STA CPY RTS LDY LDA PHA AND ORA STA PLA JMP INC BNE INC BIT BPL STA LDA BIT RTS JSR JSR JSR CMP BEQ RTS LDA PHA LDA STA LDA JSR PLA STA LDA CMP BEQ CMP BEQ CPX BCC JSR INX BNE LDA JSR A2H A1L RTS4B A1H #$4B ZERDLY HEADR #$FE HEADR #$21 ZERDLY (CARRY SET IF >=) WRITE A*256 'LONG 1' HALF CYCLES (650 USEC EACH) THEN A 'SHORT 0' (400 USEC) WRITE TWO HALF CYCLES OF 250 USEC ('0') OR 500 USEC ('0') ZERDLY WRTAPE #$32 ONEDLY TAPEOUT #$2C Y IS COUNT FOR TIMING LOOP 08 FA FC RDBYTE RDBYT2 #$08 RD2BIT 8 BITS TO READ READ TWO TRANSITIONS (FIND EDGE) NEXT BIT COUNT FOR SAMPLES 3A F5 FD FC 60 C0 2F F8 2F 2F 80 24 28 3F 40 28 38 4E 02 4F 00 F5 28 00 10 00 KEYIN RDKEY RD2BIT RDBIT #$3A RDBYT2 RDBIT TAPEIN LASTIN RDBIT LASTIN LASTIN #$80 CH (BASL). DON'T RETURN C0 KEYIN2 C0 C0 ESC RDCHAR 0C FD 2C FC 0C FD 9B F3 32 FF 32 00 02 ED FD 32 00 02 88 1D 98 0A F8 03 3A FF NOTCR ECHO USER LINE NON INVERSE CHECK FOR EDIT KEYS BS. CTRL-X MARGIN? YES.
OR SUB RTS4C XAMPM EA 3E 02 FF 3C BD ED FD SUB: FORM 2'S COMPLEMENT ADD PRINT '='. ADD. OR SUB KEEP IN STORE MODE 86 . DESTROYS A-REG PRBYTE E5 FD 0F B0 BA 02 06 36 00 A0 02 32 35 FD FB 35 34 9F 16 BA BB 31 3E BL1 BLANK PRHEX PRHEXZ A A A A PRHEXZ #$0F #$B0 #$BA COUT #$06 (CSWL) #$A0 COUTZ INVFLG YSAV1 VIDOUT YSAV1 YSAV XAM8 SETMDZ #$BA XAMPM MODE A2L PRINT HEX DIG IN A-REG LSB'S COUT COUT1 VECTOR TO USER OUTPUT ROUTINE DON'T OUTPUT CTRL'S INVERSE MASK WITH INVERSE FLAG SAV Y-REG SAV A-REG OUTPUT A-REG AS ASCII RESTORE A-REG AND Y-REG THEN RETURN COUTZ STOR BLANK TO MON AFTER BLANK DATA STORE MODE? NO. THEN RESULT PRINT BYTE AS 2 HEX DIGITS. XAM.Y PRBYTE NXTA1 MODSCHK A XAM A A A2L ADD #$FF A1L #$BD COUT OUTPUT CR OUTPUT PROMPT CHAR INIT INPUT INDEX WILL BACKSPACE TO 0 USE SCREEN CHAR FOR CTRL-U CAPTST CONVERT TO CAPS ADD TO INPUT BUF 02 ADDINP FC CROUT PRA1 FD F9 PRYX2 CLR TO EOL IF CR PRINT CR.A1 IN HEX PRINT '-' FD XAM8 SET TO FINISH AT MOD 8=7 MODSCHK FD FD FD FC XAM DATAOUT OUTPUT BLANK OUTPUT BYTE IN HEX CHECK IF TIME TO.Y #$E0 ADDINP #$DF IN.X #$8D NOTCR CLREOL #$8D COUT A1H A1L CROUT PRNTYX #$00 #$AD COUT A1L #$07 A2L A1H A2H A1L #$07 DATAOUT PRA1 #$A0 COUT (A1L).FD67: FD6A: FD6C: FD6F: FD71: FD72: FD74: FD75: FD78: FD7A: FD7C: FD7E: FD80: FD82: FD84: FD87: FD89: FD8B: FD8E: FD90: FD92: FD94: FD96: FD99: FD9C: FD9E: FDA0: FDA3: FDA5: FDA7: FDA9: FDAB: FDAD: FDAF: FDB1: FDB3: FDB6: FDB8: FDBB: FDBD: FDC0: FDC3: FDC5: FDC6: FDC7: FDC9: FDCA: FDCB: FDCD: FDCF: FDD1: FDD3: FDD4: FDD6: FDD9: FDDA: FDDB: FDDC: FDDD: FDDE: FDDF: FDE2: FDE3: FDE5: FDE7: FDE9: FDEB: FDED: FDF0: FDF2: FDF4: FDF6: FDF8: FDF9: FDFC: FDFD: FDFF: FE00: FE02: FE04: FE05: FE07: FE09: FE0B: FE0D: 20 A5 20 A2 8A F0 CA 20 C9 D0 B1 C9 90 29 9D C9 D0 20 A9 D0 A4 A6 20 20 A0 A9 4C A5 09 85 A5 85 A5 29 D0 20 A9 20 B1 20 20 90 60 4A 90 4A 4A A5 90 49 65 48 A9 20 68 48 4A 4A 4A 4A 20 68 29 09 C9 90 69 6C C9 90 25 84 48 20 68 A4 60 C6 F0 CA D0 C9 D0 85 A5 8E FD 33 ED FD 01 F3 35 FD 95 02 28 E0 02 DF 00 8D B2 9C 8D 5B 3D 3C 8E 40 00 AD ED 3C 07 3E 3D 3F 3C 07 03 92 A0 ED 3C DA BA E8 GETLNZ GETLN BCKSPC NXTCHAR JSR LDA JSR LDX TXA BEQ DEX JSR CMP BNE LDA CMP BCC AND STA CMP BNE JSR LDA BNE LDY LDX JSR JSR LDY LDA JMP LDA ORA STA LDA STA LDA AND BNE JSR LDA JSR LDA JSR JSR BCC RTS LSR BCC LSR LSR LDA BCC EOR ADC PHA LDA JSR PLA PHA LSR LSR LSR LSR JSR PLA AND ORA CMP BCC ADC JMP CMP BCC AND STY PHA JSR PLA LDY RTS DEC BEQ DEX BNE CMP BNE STA LDA CROUT PROMPT COUT #$01 GETLNZ RDCHAR #PICK CAPTST (BASL). PRINT ADDR DETERMINE IF MON MODE IS XAM ADD.
X BASIC BASIC2 TO BASIC WITH SCRATCH CONTINUE BASIC 87 .X PCL.Y (A4L). '.Y VFYOK PRA1 (A1L). COPY A2 (2 BYTES) TO A4 AND A5 MOVE (A1 TO A2) TO (A4) VERIFY (A1 TO A2) WITH (A4) MOVE A1 (2 BYTES) TO PC IF SPEC'D AND DISEMBLE 20 INSTRS ADJUST PC EACH INSTR #$01 LIST2 NEXT OF 20 INSTRS A1PCRTS A1L.X A4L. '-'.Y A3L RTS5 A3H YSAV IN-1.Y (A4L).X LOC1.X LT2 (A1L).X A5L.' AS MODE.Y MODE #$01 A2L. '+'.Y NXTA4 MOVE (A1L).Y PRBYTE #$A0 COUT #$A8 COUT (A4L).X A1PCLP #$3F SETIFLG #$FF INVFLG IF USER SPEC'D ADR COPY FROM A1 TO PC SET FOR INVERSE VID VIA COUT1 SET FOR NORMAL VID #$00 SIMULATE PORT #0 INPUT A2L SPECIFIED (KEYIN ROUTINE) #KSWL #KEYIN IOPRT #$00 SIMULATE PORT #0 OUTPUT A2L SPECIFIED (COUT1 ROUTINE) #CSWL #COUT1 A2L SET RAM IN/OUT VECTORS #$0F IOPRT1 #IOADR/256 #$00 IOPRT2 #COUT1/256 LOC0.FE0F: FE11: FE13: FE15: FE17: FE18: FE1A: FE1D: FE1F: 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: FE82: FE84: FE86: FE88: FE89: FE8B: FE8D: FE8F: FE91: FE93: FE95: FE97: FE99: FE9B: FE9D: FE9F: FEA1: FEA3: FEA5: FEA7: FEA9: FEAB: FEAD: FEAE: FEAF: FEB0: FEB3: 91 E6 D0 E6 60 A4 B9 85 60 A2 B5 95 95 CA 10 60 B1 91 20 90 60 B1 D1 F0 20 B1 20 A9 20 A9 20 B1 20 A9 20 20 90 60 20 A9 48 20 20 85 84 68 38 E9 D0 60 8A F0 B5 95 CA 10 60 A0 D0 A0 84 60 A9 85 A2 A0 D0 A9 85 A2 A0 A5 29 F0 09 A0 F0 A9 94 95 60 EA EA 4C 4C 40 40 02 41 34 FF 01 31 01 3E 42 44 F7 3C 42 B4 FC F7 3C 42 1C 92 3C DA A0 ED A8 ED 42 DA A9 ED B4 D9 MOVE RTS5 SETMODE SETMDZ LT LT2 VFY FD FD FD FD FD FD FC VFYOK 75 FE 14 D0 F8 53 F9 3A 3B LIST LIST2 01 EF A1PC 07 3C 3A F9 3F 02 FF 32 00 3E 38 1B 08 00 3E 36 F0 3E 0F 06 C0 00 02 FD 00 01 A1PCRTS SETINV SETNORM SETIFLG SETKBD INPORT INPRT A1PCLP SETVID OUTPORT OUTPRT IOPRT IOPRT1 IOPRT2 00 E0 03 E0 XBASIC BASCONT STA INC BNE INC RTS LDY LDA STA RTS LDX LDA STA STA DEX BPL RTS LDA STA JSR BCC RTS LDA CMP BEQ JSR LDA JSR LDA JSR LDA JSR LDA JSR LDA JSR JSR BCC RTS JSR LDA PHA JSR JSR STA STY PLA SEC SBC BNE RTS TXA BEQ LDA STA DEX BPL RTS LDY BNE LDY STY RTS LDA STA LDX LDY BNE LDA STA LDX LDY LDA AND BEQ ORA LDY BEQ LDA STY STA RTS NOP NOP JMP JMP (A3L).Y PRBYTE #$A9 COUT NXTA4 VFY A1PC #$14 INSTDSP PCADJ PCL PCH STORE AS LOW BYTE AS (A3) INCR A3. RETURN SAVE CONVERTED ':'.
FEB6: FEB9: FEBC: FEBF: FEC2: FEC4: FEC7: FECA: FECD: FECF: FED2: FED4: FED6: FED8: FED9: FEDB: FEDE: FEE1: FEE3: FEE4: FEE6: FEE8: FEEB: FEED: FEEF: FEF0: FEF3: FEF5: FEF6: FEF9: FEFA: FEFB: FEFD: FF00: FF02: FF05: FF07: FF0A: FF0C: FF0F: FF11: FF14: FF16: FF19: FF1B: FF1D: FF1F: FF22: FF24: FF26: FF29: FF2B: FF2D: FF2F: FF32: FF34: FF37: FF3A: FF3C: FF3F: FF41: FF42: FF44: FF46: FF48: FF49: FF4A: FF4C: FF4E: FF50: FF51: FF52: FF54: FF55: FF57: FF58: FF59: FF5C: FF5F: FF62: FF65: FF66: FF69: FF6B: FF6D: 20 20 6C 4C C6 20 4C 4C A9 20 A0 A2 41 48 A1 20 20 A0 68 90 A0 20 F0 A2 0A 20 D0 60 20 68 68 D0 20 A9 20 85 20 A0 20 B0 20 A0 20 81 45 85 20 A0 90 20 C5 F0 A9 20 A9 20 20 A9 4C A5 48 A5 A6 A4 28 60 85 86 84 08 68 85 BA 86 D8 60 20 20 20 20 D8 20 A9 85 20 75 3F 3A D7 34 75 43 F8 40 C9 27 00 3C FE FF 00 FA FE FA 03 FC GO REGZ TRACE STEPZ USR WRITE WR1 3C ED FE BA FC 1D EE 22 ED FE 4D 10 D6 FC FA 00 FE CRMON WRBYTE WRBYT2 6C FA 16 C9 2E FA 24 FD F9 FD 3B EC 3C 2E 2E BA 35 F0 EC 2E 0D C5 ED D2 ED ED 87 ED 48 45 46 47 FC FC FC READ RD2 FC FC FC RD3 FC FC PRERR FD FD FD BELL FD RESTORE RESTR1 45 46 47 SAVE SAV1 48 49 84 2F 93 89 FE FB FE FE RESET MON 3A FF AA 33 67 FD MONZ JSR JSR JMP JMP DEC JSR JMP JMP LDA JSR LDY LDX EOR PHA LDA JSR JSR LDY PLA BCC LDY JSR BEQ LDX ASL JSR BNE RTS JSR PLA PLA BNE JSR LDA JSR STA JSR LDY JSR BCS JSR LDY JSR STA EOR STA JSR LDY BCC JSR CMP BEQ LDA JSR LDA JSR JSR LDA JMP LDA PHA LDA LDX LDY PLP RTS STA STX STY PHP PLA STA TSX STX CLD RTS JSR JSR JSR JSR CLD JSR LDA STA JSR A1PC RESTORE (PCL) REGDSP YSAV A1PC STEP USRADR #$40 HEADR #$27 #$00 (A1L.5 SECONDS INIT CHKSUM=$FF FIND TAPEIN EDGE LOOK FOR SYNC BIT (SHORT 0) LOOP UNTIL FOUND SKIP SECOND SYNC H-CYCLE INDEX FOR 0/1 TEST READ A BYTE STORE AT (A1) UPDATE RUNNING CHKSUM INC A1. SOUND BELL AND RETURN PRINT "ERR".X) (A1L.X) CHKSUM CHKSUM NXTA1 #$35 RD3 RDBYTE CHKSUM BELL #$C5 COUT #$D2 COUT COUT #$87 COUT STATUS ACC XREG YREG OUTPUT BELL AND RETURN RESTORE 6502 REG CONTENTS USED BY DEBUG SOFTWARE ACC XREG YREG SAVE 6502 REG CONTENTS STATUS SPNT SETNORM INIT SETVID SETKBD BELL #$AA PROMPT GETLNZ SET SCREEN MODE AND INIT KBD/SCREEN AS I/O DEV'S MUST SET HEX MODE! '*' PROMPT FOR MON READ A LINE 88 . THEN BELL MONZ RD2BIT #$16 HEADR CHKSUM RD2BIT #$24 RDBIT RD2 RDBIT #$3B RDBYTE (A1L. COMPARE TO A2 COMPENSATE 0/1 INDEX LOOP UNTIL DONE READ CHKSUM BYTE GOOD.X) WRBYTE NXTA1 #$1D WR1 #$22 WRBYTE BELL #$10 A WRBIT WRBYT2 BL1 ADR TO PC IF SPEC'D RESTORE META REGS GO TO USER SUBR TO REG DISPLAY ADR TO PC IF SPEC'D TAKE ONE STEP TO USR SUBR AT USRADR WRITE 10-SEC HEADER HANDLE A CR AS BLANK THEN POP STACK AND RTN TO MON FIND TAPEIN EDGE DELAY 3.
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: FFA0: FFA2: FFA3: FFA5: FFA7: FFA9: FFAB: FFAD: FFB0: FFB1: FFB3: FFB5: FFB7: FFB9: FFBB: FFBD: FFBE: FFC0: FFC1: FFC4: FFC5: FFC7: FFC9: FFCB: FFCC: FFCD: FFCE: FFCF: FFD0: FFD1: FFD2: FFD3: FFD4: FFD5: FFD6: FFD7: FFD8: FFD9: FFDA: FFDB: FFDC: FFDD: FFDE: FFDF: FFE0: FFE1: FFE2: FFE3: FFE4: FFE5: FFE6: FFE7: FFE8: FFE9: FFEA: FFEB: FFEC: FFED: FFEE: FFEF:
20 20 84 A0 88 30 D9 D0 20 A4 4C A2 0A 0A 0A 0A 0A 26 26 CA 10 A5 D0 B5 95 95 E8 F0 D0 A2 86 86 B9 C8 49 C9 90 69 C9 B0 60 A9 48 B9 48 A5 A0
C7 FF A7 FF 34 17 E8 CC FF F8 BE FF 34 73 FF 03
NXTBIT 3E 3F F8 31 06 3F 3D 41 F3 06 00 3E 3F 00 02 B0 0A D3 88 FA CD FE E3 FF 31 00 TOSUB
JSR JSR STY LDY DEY BMI CMP BNE JSR LDY JMP LDX ASL ASL ASL ASL ASL ROL ROL DEX BPL LDA BNE LDA STA STA INX BEQ BNE LDX STX STX LDA INY EOR CMP BCC ADC CMP BCS RTS LDA PHA LDA PHA LDA LDY STY RTS DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB
ZMODE GETNUM YSAV #$17 MON CHRTBL,Y CHRSRCH TOSUB YSAV NXTITM #$03 A A A A A A2L A2H NXTBIT MODE NXTBS2 A2H,X A1H,X A3H,X NXTBAS NXTCHR #$00 A2L A2H IN,Y #$B0 #$0A DIG #$88 #$FA DIG #GO/256 SUBTBL,Y MODE #$00 MODE $BC $B2 $BE $ED $EF $C4 $EC $A9 $BB $A6 $A4 $06 $95 $07 $02 $05 $F0 $00 $EB $93 $A7 $C6 $99 BASCONT-1 USR-1 REGZ-1 TRACE-1 VFY-1 INPRT-1 STEPZ-1 OUTPRT-1 XBASIC-1 SETMODE-1 SETMODE-1 MOVE-1 LT-1
CLEAR MON GET ITEM, CHAR IN X-REG=0
MODE, SCAN IDX NON-HEX A-REG IF NO HEX INPUT
NOT FOUND, GO TO MON FIND CMND CHAR IN TEL FOUND, CALL CORRESPONDING SUBROUTINE
GOT HEX DIG, SHIFT INTO A2
LEAVE X=$FF IF DIG
IF MODE IS ZERO THEN COPY A2 TO A1 AND A3
IF HEX DIG, THEN
PUSH HIGH-ORDER SUBR ADR ON STK PUSH LOW-ORDER SUBR ADR ON STK CLR MODE, OLD MODE TO A-REG GO TO SUBR VIA RTS F("CTRL-C") F("CTRL-Y") F("CTRL-E") F("T") F("V") F("CTRL-K") F("S") F("CTRL-P") F("CTRL-B") F("-") F("+") F("M") (F=EX-OR $B0+$89) F("<") F("N") F("I") F("L") F("W") F("G") F("R") F(":") F(".") F("CR") F(BLANK)
84 31 60 BC B2 BE ED EF C4 EC A9 BB A6 A4 06 95 07 02 05 F0 00 EB 93 A7 C6 99 B2 C9 BE C1 35 8C C3 96 AF 17 17 2B 1F
FFF0: FFF1: FFF2: FFF3: FFF4: FFF5: FFF6: FFF7: FFF8: FFF9: FFFA: FFFB: FFFC: FFFD: FFFE: FFFF:
83 7F 5D CC B5 FC 17 17 F5 03 FB 03 59 FF 86 FA XQTNZ
DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB EQU
SETNORM-1 SETINV-1 LIST-1 WRITE-1 GO-1 READ-1 SETMODE-1 SETMODE-1 CRMON-1 BLANK-1 NMI NMI/256 RESET RESET/256 IRQ IRQ/256 $3C
NMI VECTOR RESET VECTOR IRQ VECTOR
F500: F502: F503: F505: F507: F509: F50B: F50C: F50D: F50E: F50F: F511: F513: F515: F516:
E9 4A D0 A4 A6 D0 88 CA 8A 18 E5 85 10 C8 98
81 14 3F 3E 01
3A 3E 01
*********************** * * * APPLE-II * * MINI-ASSEMBLER * * * * COPYRIGHT 1977 BY * * APPLE COMPUTER INC. * * * * ALL RIGHTS RESERVED * * * * S. WOZNIAK * * A. BAUM * *********************** TITLE "APPLE-II MINI-ASSEMBLER" FORMAT EQU $2E LENGTH EQU $2F MODE EQU $31 PROMPT EQU $33 YSAV EQU $34 L EQU $35 PCL EQU $3A PCH EQU $3B A1H EQU $3D A2L EQU $3E A2H EQU $3F A4L EQU $42 A4H EQU $43 FMT EQU $44 IN EQU $200 INSDS2 EQU $F88E INSTDSP EQU $F8D0 PRBL2 EQU $F94A PCADJ EQU $F953 CHAR1 EQU $F9B4 CHAR2 EQU $F9BA MNEML EQU $F9C0 MNEMR EQU $FA00 CURSUP EQU $FC1A GETLNZ EQU $FD67 COUT EQU $FDED BL1 EQU $FE00 A1PCLP EQU $FE78 BELL EQU $FF3A GETNUM EQU $FFA7 TOSUB EQU $FFBE ZMODE EQU $FFC7 CHRTBL EQU $FFCC ORG $F500 REL SBC #$81 IS FMT COMPATIBLE LSR WITH RELATIVE MODE? BNE ERR3 NO. LDY A2H LDX A2L DOUBLE DECREMENT BNE REL2 DEY REL2 DEX TXA CLC SBC PCL FORM ADDR-PC-2 STA A2L BPL REL3 INY REL3 TYA
ERR. TRY NEXT OPCODE NO MORE. SUBTRACT OFFSET LEGAL CHAR? NO. HANDLE IT IN MONITOR HANDLE CR OUTSIDE MONITOR GET TRIAL OPCODE GET FMT+LENGTH FOR OPCODE GET LOWER MNEMONIC BYTE MATCH? NO. COMPRESS-LEFT JUSTIFY DO 5 TRIPLE WORD SHIFTS 92 . BACKUP A CHAR GET A NUMBER ':' TERMINATOR? NO.X A4H NEXTOP FMT FORMAT #$9D REL FORMAT FINDOP A1H TRYNEXT FMT L TRYNEXT YSAV ERROR IF >1-BYTE BRANCH MOVE INST TO (PC) RESTORE CURSOR TYPE FORMATTED LINE UPDATE PC GET NEXT LINE GO TO DELIM HANDLER RESTORE Y-INDEX READ PARAM SAVE Y-INDEX INIT DELIMITER INDEX CHECK NEXT DELIM ERR IF UNRECOGNIZED DELIM COMPARE WITH DELIM TABLE NO MATCH MATCH. IS IT CR? NO. TRY NEXT OPCODE. TRY NEXT OPCODE GET TRIAL FORMAT TRIAL FORMAT RELATIVE? YES. PRBL2 #$DE COUT BELL #$A1 PROMPT GETLNZ ZMODE IN #$A0 SPACE #$A4 FAKEMON GETNUM #$93 ERR2 ERR2 A1PCLP #$3 A1H GETNSP A #$BE #$C2 ERR2 A A #$4 A PRINT ^ UNDER LAST READ CHAR TO INDICATE ERROR POSITION. '!' INITIALIZE PROMPT GET LINE. SAME FORMAT? YES.F517: F519: F51B: F51D: F520: F522: F523: F525: F528: F52B: F52E: F531: F533: F535: F538: F53B: F53D: F540: F542: F544: F545: F547: F54A: F54C: F54E: F550: F552: F554: F556: F559: F55C: F55E: F561: F562: F565: F567: F569: F56C: F56E: F570: F572: F574: F576: F578: F57A: F57C: F57E: F580: F582: F584: F586: F588: F589: F58A: F58D: F58F: F592: F595: F597: F599: F59C: F59F: F5A2: F5A4: F5A6: F5A7: F5A9: F5AB: F5AC: F5AF: F5B1: F5B3: F5B4: F5B6: F5B9: F5BB: F5BD: F5C0: F5C1: F5C3: F5C5: F5C7: F5C8: F5C9: F5CB: E5 D0 A4 B9 91 88 10 20 20 20 20 84 85 4C 20 A4 20 84 A0 88 30 D9 D0 C0 D0 A5 A0 C6 20 4C A5 20 AA BD C5 D0 BD C5 D0 A5 A4 C0 F0 C5 F0 C6 D0 E6 C6 F0 A4 98 AA 20 A9 20 20 A9 85 20 20 AD C9 F0 C8 C9 F0 88 20 C9 D0 8A F0 20 A9 85 20 0A E9 C9 90 0A 0A A2 0A 3B 6B 2F 3D 00 3A F8 1A 1A D0 53 3B 3A 95 BE 34 A7 34 17 4B CC F8 15 E8 31 00 34 00 95 3D 8E FC FC F8 F9 F5 FF FF FF FE F5 F8 00 FA 42 13 C0 F9 43 0C 44 2E 9D 88 2E 9F 3D DC 44 35 D6 34 4A DE ED 3A A1 33 67 C7 00 A0 13 A4 92 F9 FD FF FD FF 02 A7 FF 93 D5 D2 78 FE 03 3D 34 F6 BE C2 C1 04 SBC BNE LDY LDA STA DEY BPL JSR JSR JSR JSR STY STA JMP FAKEMON3 JSR LDY FAKEMON JSR STY LDY FAKEMON2 DEY BMI CMP BNE CPY BNE LDA LDY DEC JSR JMP TRYNEXT LDA JSR TAX LDA CMP BNE LDA CMP BNE LDA LDY CPY BEQ NREL CMP BEQ NEXTOP DEC BNE INC DEC BEQ ERR LDY ERR2 TYA TAX JSR LDA JSR RESETZ JSR NXTLINE LDA STA JSR JSR LDA CMP BEQ INY CMP BEQ DEY JSR CMP ERR4 BNE TXA BEQ JSR SPACE LDA STA NXTMN JSR NXTM ASL SBC CMP BCC ASL ASL LDX NXTM2 ASL ERR3 FINDOP FNDOP2 PCH ERR LENGTH A1H. GET UPPER MNEMONIC BYTE MATCH? NO.Y (PCL). COUNT OF CHARS IN MNEMONIC GET FIRST MNEM CHAR.X A4L NEXTOP MNEML. INIT SCREEN STUFF GET CHAR ASCII BLANK? YES ASCII '$' IN COL 1? YES. SIMULATE MONITOR NO. NO. TRY WITH LEN=2 WAS L=2 ALREADY? NO.Y FNDOP2 CURSUP CURSUP INSTDSP PCADJ PCH PCL NXTLINE TOSUB YSAV GETNUM YSAV #$17 RESETZ CHRTBL. MOVE ADR TO PCL. PCH.Y FAKEMON2 #$15 FAKEMON3 MODE #$0 YSAV BL1 NXTLINE A1H INSDS2 MNEMR. UNRECOGNIZED INST. NO ADR PRECEDING COLON. YES.
IS SECOND HALF ZERO? YES.X FORM4 #$A4 FORM4 YSAV DONE WITH 3 CHARS? YES.X FORM5 CHAR2.X FORM3 GETNSP CHAR2. GET NEXT NON BLANK CHAR 93 . ERR.Y #$BB FORM9 #$8D ERR4 TRYNEXT IN. CLEAR BIT-NO MATCH BACK UP 1 CHAR FORM FORMAT BYTE TIME TO CHECK FOR ADDR. NO YES HIGH-ORDER BYTE ZERO NO. NO. YES. NO.F5CC: F5CE: F5D0: F5D1: F5D3: F5D5: F5D7: F5D9: F5DB: F5DE: F5E0: F5E3: F5E5: F5E8: F5EB: F5ED: F5F0: F5F2: F5F4: F5F6: F5F8: F5F9: F5FA: F5FC: F5FE: F600: F603: F605: F607: F608: F60A: F60C: F60D: F60F: F610: F612: F614: F615: F616: F618: F61A: F61C: F61E: F620: F622: F624: F626: F629: F62B: F62D: F62F: F631: F634: F637: F638: F63A: F63C: 26 26 CA 10 C6 F0 10 A2 20 84 DD D0 20 DD F0 BD F0 C9 F0 A4 18 88 26 E0 D0 20 A5 F0 E8 86 A2 88 86 CA 10 A5 0A 0A 05 C9 B0 A6 F0 09 85 84 B9 C9 F0 C9 D0 4C B9 C8 C9 F0 60 42 43 F8 3D F4 E4 05 34 34 B4 13 34 BA 0D BA 07 A4 03 34 F6 F9 F6 F9 F9 FORM1 FORM2 44 03 0D A7 FF 3F 01 35 03 3D C9 44 FORM3 FORM4 FORM5 FORM6 FORM7 35 20 06 35 02 80 44 34 00 02 BB 04 8D 80 5C F5 00 02 A0 F8 FORM8 FORM9 GETNSP F666: 4C 92 F5 MINIASM ROL ROL DEX BPL DEC BEQ BPL LDX JSR STY CMP BNE JSR CMP BEQ LDA BEQ CMP BEQ LDY CLC DEY ROL CPX BNE JSR LDA BEQ INX STX LDX DEY STX DEX BPL LDA ASL ASL ORA CMP BCS LDX BEQ ORA STA STY LDA CMP BEQ CMP BNE JMP LDA INY CMP BEQ RTS ORG JMP A4L A4H NXTM2 A1H NXTM2 NXTMN #$5 GETNSP YSAV CHAR1.Y #$A0 GETNSP $F666 RESETZ ADD "$" IF NONZERO LENGTH AND DON'T ALREADY HAVE IT GET NEXT NONBLANK '' START OF COMMENT? YES CARRIAGE RETURN? NO. GET SECOND CHAR MATCHES SECOND HALF? YES. PUT LENGTH IN LOW BITS FMT #$3 FORM7 GETNUM A2H FORM6 L #$3 A1H FORM2 FMT A A L #$20 FORM8 L FORM8 #$80 FMT YSAV IN.SECOND HALF OPTIONAL? YES. BUT DO 1 MORE SHIFT NO 5 CHARS IN ADDR MODE GET FIRST CHAR OF ADDR FIRST CHAR MATCH PATTERN? NO YES. INCR FOR 2-BYTE STORE LENGTH RELOAD FORMAT INDEX BACKUP A CHAR SAVE INDEX DONE WITH FORMAT CHECK? NO.
BYTE. SWAP1 STY E-1.X EXP/MANT2 AND LEAVE A COPY OF STY X1-1. BNE SWPALGN IF #. RETURN WITH MANT1 NORMALIZED DEC X1 DECREMENT EXP1.X LDA X1-1. RTS1 RTS RETURN. COMPLEMENTING LSB.F425: F426: F428: F42A: F42C: F42E: F42F: F431: F432: F434: F437: F439: F43B: F43E: F440: F441: F443: F445: F447: F449: F44B: F44D: F44E: F450: F451: F453: F455: F457: F459: F45B: F45D: F45F: F461: F463: F465: F467: F468: F46B: F46E: F470: F472: F474: F477: F479: 18 A2 B5 75 95 CA 10 60 06 20 24 10 20 E6 38 A2 94 B5 B4 94 95 CA D0 60 A9 85 A5 C9 30 C6 06 26 26 A5 D0 60 20 20 A5 C5 D0 20 50 70 02 F9 F5 F9 F7 F3 37 F4 F9 05 A4 F4 F3 04 FB F7 F3 F7 F3 F3 8E F8 F9 C0 0C F8 FB FA F9 F8 EE A4 F4 7B F4 F4 F8 F7 25 F4 EA 05 *********************** * * * APPLE-II FLOATING * * POINT ROUTINES * * * * COPYRIGHT 1977 BY * * APPLE COMPUTER INC.X SWAP A BYTE OF EXP/MANT1 WITH LDY X2-1. RTS RETURN MD1 ASL SIGN CLEAR LSB OF SIGN. ADDEND BVC NORM NO OVERFLOW. JSR ADD ADD ALIGNED MANTISSAS. BPL ADD1 LOOP UNTIL DONE. * * * * ALL RIGHTS RESERVED * * * * S.X MANT1 IN E (3 BYTES). INC SIGN INCR SIGN. COMPLEMENT IT. SWAP LDX #$4 INDEX FOR 4 BYTE SWAP. ABSWAP1 SEC SET CARRY FOR RETURN TO MUL/DIV.X ADC M2. NORMALIZE RESULT. ADD1 LDA M1. BVS RTLOG OV: SHIFT M1 RIGHT. CARRY INTO SIGN 94 . JSR ABSWAP ABS VAL OF M1. NORM1 LDA M1 HIGH-ORDER MANT1 BYTE.SWAP ADDENDS OR ALIGN MANTS.X DEX INDEX TO NEXT MORE SIGNIF.X DEX ADVANCE INDEX TO NEXT BYTE BNE SWAP1 LOOP UNTIL DONE.X ADD A BYTE OF MANT2 TO MANT1 STA M1. ASL M1+2 ROL M1+1 SHIFT MANT1 (3 BYTES) LEFT. CONTINUE NORMALIZING. CMP #$C0 UPPER TWO BITS UNEQUAL? BMI RTS1 YES. ROL M1 NORM LDA X1 EXP1 ZERO? BNE NORM1 NO. WOZNIAK * * * *********************** TITLE "FLOATING POINT ROUTINES" SIGN EPZ $F3 X2 EPZ $F4 M2 EPZ $F5 X1 EPZ $F8 M1 EPZ $F9 E EPZ $FC OVLOC EQU $3F5 ORG $F425 ADD CLC CLEAR CARRY LDX #$2 INDEX FOR 3-BYTE ADD. SWAP WITH MANT2 AND RETURN. FSUB JSR FCOMPL CMPL MANT1.CLEARS CARRY UNLESS 0 SWPALGN JSR ALGNSWP RIGHT SHIFT MANT1 OR SWAP WITH FADD LDA X2 CMP X1 COMPARE EXP1 WITH EXP2. STA X1 THEN NORMALIZE TO FLOAT. THEN SWAP WITH M2 ABSWAP BIT M1 MANT1 NEGATIVE? BPL ABSWAP1 NO. RTS RETURN FLOAT LDA #$8E INIT EXP1 TO 14. E+3 USED STA X2-1. JSR FCOMPL YES.
JSR MD2 SAVE AS QUOTIENT EXP. FMUL JSR MD1 ABS VAL OF MANT1. RTS RETURN.X SUBTRACT BYTE OF EXP1. PHA SAVE ON STACK.X DIV4 INX NEXT LESS SIGNIFICANT BYTE. RTS RETURN. MUL1 JSR RTLOG1 M1 AND E RIGHT (PROD AND MPLIER) BCC MUL2 IF CARRY CLEAR. EXP AND PREP. ROL M1+2 ROL M1+1 ROLL QUOTIENT LEFT. BPL MUL1 LOOP UNTIL DONE.NORMALIZE PROD. NORMX BCC NORM IF EVEN.X SUBTRACT A BYTE OF E FROM MANT2. DIV2 LDA M2. BEQ MDEND NORM. LDX #$FD INDEX FOR 3-BYTE CONDITIONAL MOVE DIV3 PLA PULL BYTE OF DIFFERENCE OFF STACK BCC DIV4 IF M2<E THEN DON'T RESTORE M2. FOR MUL CLC CLEAR CARRY FOR FIRST BIT.ELSE COMP FCOMPL SEC SET CARRY FOR SUBTRACT. MDEND LSR SIGN TEST SIGN LSB. ROR1 ROR E+3. DEX NEXT MORE SIGNIFICANT BYTE.CHECK FOR OVFL BMI MD3 IF NEG THEN NO UNDERFLOW.F47B: 90 C4 F47D: F47F: F480: F482: F484: F486: F488: F489: F48B: F48C: F48F: F491: F494: F495: F498: F49A: F49D: F49E: F4A0: F4A2: F4A4: F4A5: F4A7: F4A9: F4AB: F4AD: F4AE: F4B0: F4B2: F4B5: F4B7: F4BA: F4BB: F4BD: F4BF: F4C1: F4C2: F4C3: F4C5: F4C7: F4C8: F4CA: F4CC: F4CD: F4CF: F4D1: F4D3: F4D5: F4D7: F4D9: F4DB: F4DD: F4DE: F4E0: F4E2: F4E4: F4E6: F4E8: F4EA: F4EC: F4ED: F4EE: F4F0: F4F2: F4F4: F4F6: F4F7: F4F9: F63D: F640: F642: F644: F646: F648: F64A: F64C: F64E: F650: F652: F654: F656: F657: F659: F65B: F65D: A5 0A E6 F0 A2 76 E8 D0 60 20 65 20 18 20 90 20 88 10 46 90 38 A2 A9 F5 95 CA D0 F0 20 E5 20 38 A2 B5 F5 48 CA 10 A2 68 90 95 E8 D0 26 26 26 06 26 26 B0 88 D0 F0 86 86 86 B0 30 68 68 90 49 85 A0 60 10 4C 20 A5 10 C9 D0 24 10 A5 F0 E6 D0 E6 60 A9 85 85 60 F9 F8 75 FA FF FB 32 F4 F8 E2 F4 84 F4 03 25 F4 F5 F3 BF 03 00 F8 F8 F7 C5 32 F4 F8 E2 F4 02 F5 FC F8 FD 02 F8 F8 FB FA F9 F7 F6 F5 1C DA BE FB FA F9 0D 04 B2 80 F8 17 F7 F5 03 7D F4 F8 13 8E F5 F9 0A FB 06 FA 02 F9 00 F9 FA ALGNSWP BCC SWAP SWAP IF CARRY CLEAR. OVCHK BPL MD3 IF POSITIVE EXP THEN NO OVFL. * ELSE SHIFT RIGHT ARITH. QUOTIENT AND CORRECT SIGN. PLA POP ONE RETURN LEVEL. MANT2. BNE ROR1 LOOP UNTIL DONE. SET CARRY. BNE DIV1 LOOP UNTIL DONE 23 ITERATIONS. CARRY INTO LSB ROL M1 ASL M2+2 ROL M2+1 SHIFT DIVIDEND LEFT ROL M2 BCS OVFL OVFL IS DUE TO UNNORMED DIVISOR DEY NEXT DIVIDE ITERATION. BEQ ADDEND NORMALIZE (OR SHIFT RT IF OVFL). STA X1.X RESTORE IT.X INX NEXT BYTE OF SHIFT. SBC X1 SUBTRACT EXP1 FROM EXP2. STA M2+3. FDIV JSR MD1 TAKE ABS VAL OF MANT1. BNE DIV3 LOOP UNTIL DONE. STX M1 BCS OVCHK IF CALC. LDX #$2 INDEX FOR 3-BYTE SUBTRACTION. LDX #$3 INDEX FOR 3 BYTE SUBTRACT. BNE COMPL1 LOOP UNTIL DONE. RTLOG INC X1 INCR X1 TO ADJUST FOR RIGHT SHIFT BEQ OVFL EXP1 OUT OF RANGE. MD3 EOR #$80 COMPLEMENT SIGN BIT OF EXPONENT. PLA BCC NORMX CLEAR X1 AND RETURN. DIV1 SEC SET CARRY FOR SUBTRACT. STA X1 STORE IT. COMPL1 LDA #$0 CLEAR A. RTLOG1 LDX #$FA INDEX FOR 6:BYTE RIGHT SHIFT. DEX NEXT MORE SIGNIFICANT BYTE. OVFL JMP OVLOC ORG $F63D FIX1 JSR RTAR FIX LDA X1 BPL UNDFL CMP #$8E BNE FIX1 BIT M1 BPL FIXRTS LDA M1+2 BEQ FIXRTS INC M1+1 BNE FIXRTS INC M1 FIXRTS RTS UNDFL LDA #$0 STA M1 STA M1+1 RTS 95 . RTAR LDA M1 SIGN OF MANT1 INTO CARRY FOR ASL RIGHT ARITH SHIFT. LDY #$17 COUNT 24 MUL/23 DIV ITERATIONS. BPL DIV2 LOOP UNTIL DONE. MANT2 ADC X1 ADD EXP1 TO EXP2 FOR PRODUCT EXP JSR MD2 CHECK PROD. SBC X1. SKIP PARTIAL PROD JSR ADD ADD MULTIPLICAND TO PRODUCT. MD2 STX M1+2 STX M1+1 CLEAR MANT1 (3 BYTES) FOR MUL/DIV.X SBC E. MUL2 DEY NEXT MUL ITERATION.
Y NOW HAVE OPCODE BEQ TOBR IF ZERO THEN NON-REG OP STX R14H INDICATE'PRIOR RESULT REG' LSR A LSR A OPCODE*2 TO LSB'S LSR A TAY TO Y REG FOR INDEXING LDA OPTBL-2. BNC. SW16C INC R15L BNE SW16D INCR SWEET16 PC FOR FETCH INC R15H SW16D LDA #SW16PAG PHA PUSH ON STACK FOR RTS LDY #$0 LDA (R15L).X LOW ORDER ADR BYTE PHA ONTO STACK FOR NON-REG OP LDA R14H 'PRIOR RESULT REG' INDEX LSR A PREPARE CARRY FOR BC. WOZNIAK * * * *********************** TITLE "SWEET16 INTERPRETER" R0L EQU $0 R0H EQU $1 R14H EQU $1D R15L EQU $1E R15H EQU $1F SW16PAG EQU $F7 SAVE EQU $FF4A RESTORE EQU $FF3F ORG $F689 SW16 JSR SAVE PRESERVE 6502 REG CONTENTS PLA STA R15L INIT SWEET16 PC PLA FROM RETURN STA R15H ADDRESS SW16B JSR SW16C INTERPRET AND EXECUTE JMP SW16B ONE SWEET16 INSTR.Y FETCH INSTR AND #$F MASK REG SPECIFICATION ASL A DOUBLE FOR TWO BYTE REGISTERS TAX TO X REG FOR INDEXING LSR A EOR (R15L). RTS GOTO NON-REG OP ROUTINE RTNZ PLA POP RETURN ADDRESS PLA JSR RESTORE RESTORE 6502 REG CONTENTS JMP (R15L) RETURN TO 6502 CODE VIA PC SETZ LDA (R15L).Y LOW ORDER ADR BYTE PHA ONTO STACK RTS GOTO REG-OP ROUTINE TOBR INC R15L BNE TOBR2 INCR PC INC R15H TOBR2 LDA BRTBL.Y HIGH-ORDER BYTE OF CONSTANT 96 .F689: F68C: F68D: F68F: F690: F692: F695: F698: F69A: F69C: F69E: F6A0: F6A1: F6A3: F6A5: F6A7: F6A8: F6A9: F6AA: F6AC: F6AE: F6B0: F6B1: F6B2: F6B3: F6B4: F6B7: F6B8: F6B9: F6BB: F6BD: F6BF: F6C2: F6C3: F6C5: F6C6: F6C7: F6C8: F6C9: F6CC: F6CF: 20 68 85 68 85 20 4C E6 D0 E6 A9 48 A0 B1 29 0A AA 4A 51 F0 86 4A 4A 4A A8 B9 48 60 E6 D0 E6 BD 48 A5 4A 60 68 68 20 6C B1 4A FF 1E 1F 98 F6 92 F6 1E 02 1F F7 00 1E 0F 1E 0B 1D E1 F6 1E 02 1F E4 F6 1D 3F FF 1E 00 1E *********************** * * * APPLE-II PSEUDO * * MACHINE INTERPRETER * * * * COPYRIGHT 1977 * * APPLE COMPUTER INC * * * * ALL RIGHTS RESERVED * * S.
X) R0L #$0 R0H STAT3 #$0 POP2 DCR (R0L.X) R0H INR STAT ADD 2 TO PC 1X 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 R0 MOVE R0 TO RX STORE BYTE INDIRECT INDICATE R0 IS RESULT NEG INCR RX LOAD INDIRECT (RX) TO R0 ZERO HIGH-ORDER R0 BYTE ALWAYS TAKEN HIGH ORDER BYTE = 0 ALWAYS TAKEN DECR RX POP HIGH ORDER BYTE @RX SAVE IN Y-REG DECR RX LOW-ORDER BYTE TO R0 INDICATE R0 AS LAST RESULT REG LOW-ORDER BYTE TO R0.X R0L (R0L.X R0H R0H.X) DCR (R0L.X) #$0 R14H R0L.X (R0L.Y R0L.X (R15L).X R0H R0L R0L. INCR RX HIGH-ORDER BYTE TO R0 INCR RX STORE INDIRECT LOW-ORDER 97 .X *-1 R0L R0H.X INR2 R0H.X LOW-ORDER BYTE OF CONSTANT Y-REG CONTAINS 1 R15L R15L SET2 R15H SET-1 RTN-1 LD-1 BR-1 ST-1 BNC-1 LDAT-1 BC-1 STAT-1 BP-1 LDDAT-1 BM-1 STDAT-1 BZ-1 POP-1 BNZ-1 STPAT-1 BM1-1 ADD-1 BNM1-1 SUB-1 BK-1 POPD-1 RS-1 CPR-1 BS-1 INR-1 NUL-1 DCR-1 NUL-1 NUL-1 NUL-1 SETZ R0L.X) R0L R0H #$0 R14H LDAT (R0L.F6D1: F6D3: F6D4: F6D6: F6D8: F6D9: F6DA: F6DC: F6DE: F6E0: F6E2: F6E3: F6E4: 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 88 B1 95 98 38 65 85 90 E6 60 02 F9 04 9D 0D 9E 25 AF 16 B2 47 B9 51 C0 2F C9 5B D2 85 DD 6E 05 33 E8 70 93 1E E7 65 E7 E7 E7 10 B5 85 B5 85 60 A5 95 A5 95 60 A5 81 A0 84 F6 D0 F6 60 A1 85 A0 84 F0 A0 F0 20 A1 A8 20 A1 85 84 A0 84 60 20 A1 85 4C 20 01 1E 00 1E 1E 02 1F SET2 OPTBL BRTBL CA 00 00 01 01 00 00 01 01 00 00 00 1D 00 02 01 00 00 00 01 ED 00 06 66 F7 00 66 F7 00 00 01 00 1D 26 F7 00 01 1F F7 17 F7 SET LD BK ST STAT STAT2 STAT3 INR INR2 LDAT POP POPD POP2 POP3 LDDAT STDAT STA DEY LDA STA TYA SEC ADC STA BCC INC RTS DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB DFB 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 BNE INC RTS LDA STA LDY STY BEQ LDY BEQ JSR LDA TAY JSR LDA STA STY LDY STY RTS JSR LDA STA JMP JSR R0H.
X #$0 R0L R0L.X R0H.X #$FF BR1 A R0L.Y BR2 R15L R15L R15H R15H BR A R0H.X BR1 A R0L.Y R0H R0H.X R0H.X R0H.Y #$0 R14H R0L R0L.X BR1 A R0L.X #$0 SUB2 R15L STAT2 R15H STAT2 BNC2 (R15L).X BR1 A R0H.X #$FF BR1 #$18 BYTE AND INCR RX.X) INR DCR R0L (R0L.X BR1 A R0L.X R0L R0H R0H.X R0L.X R0H.F755: F757: 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: F7B0: F7B2: F7B3: F7B4: F7B5: F7B7: F7B9: F7BA: F7BB: F7BC: F7BE: F7C0: F7C1: F7C2: F7C3: F7C5: F7C7: F7C9: F7CA: F7CB: F7CC: F7CE: F7D0: F7D2: F7D3: F7D4: F7D5: F7D7: F7D9: F7DB: F7DD: F7DE: F7DF: F7E0: F7E2: F7E4: F7E6: F7E8: F7E9: A5 81 4C 20 A5 81 4C B5 D0 D6 D6 60 A0 38 A5 F5 99 A5 F5 99 98 69 85 60 A5 75 85 A5 75 A0 F0 A5 20 A5 20 18 B0 B1 10 88 65 85 98 65 85 60 B0 60 0A AA B5 10 60 0A AA B5 30 60 0A AA B5 15 F0 60 0A AA B5 15 D0 60 0A AA B5 35 49 F0 60 0A AA B5 35 49 D0 60 A2 01 00 1F F7 66 F7 00 00 43 F7 00 02 01 00 00 00 00 00 00 01 01 01 00 00 1D 00 00 00 01 01 00 E9 1E 19 F7 1F 19 F7 0E 1E 01 1E 1E 1F 1F EC STPAT DCR DCR2 SUB CPR SUB2 ADD BS BR BNC BR1 BR2 BNC2 BC BP 01 E8 BM 01 E1 BZ 00 01 D8 BNZ 00 01 CF BM1 00 01 FF C4 BNM1 00 01 FF B9 18 NUL RS LDA STA JMP JSR LDA 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 BEQ LDA JSR LDA JSR CLC BCS LDA BPL DEY ADC STA TYA ADC STA RTS BCS RTS ASL TAX LDA BPL RTS ASL TAX LDA BMI RTS ASL TAX LDA ORA BEQ RTS ASL TAX LDA ORA BNE RTS ASL TAX LDA AND EOR BEQ RTS ASL TAX LDA AND EOR BNE RTS LDX R0H (R0L.X) POP3 R0L.X R0H.X DCR2 R0H.X R0L. THEN STORE HIGH-ORDER BYTE. INCR RX AND RETURN DECR RX STORE R0 LOW BYTE @RX INDICATE R0 AS LAST RSLT REG DECR RX RESULT TO R0 NOTE Y-REG = 13*2 FOR CPR R0-RX TO RY LAST RESULT REG*2 CARRY TO LSB R0+RX TO R0 R0 FOR RESULT FINISH ADD NOTE X-REG IS 12*2! PUSH LOW PC BYTE VIA R12 PUSH HIGH-ORDER PC BYTE NO CARRY TEST DISPLACEMENT BYTE ADD TO PC DOUBLE RESULT-REG INDEX TO X REG FOR INDEXING TEST FOR PLUS BRANCH IF SO DOUBLE RESULT-REG INDEX TEST FOR MINUS DOUBLE RESULT-REG INDEX TEST FOR ZERO (BOTH BYTES) BRANCH IF SO DOUBLE RESULT-REG INDEX TEST FOR NON-ZERO (BOTH BYTES) BRANCH IF SO DOUBLE RESULT-REG INDEX CHECK BOTH BYTES FOR $FF (MINUS 1) BRANCH IF SO DOUBLE RESULT-REG INDEX CHECK BOTH BYTES FOR NO $FF BRANCH IF NOT MINUS 1 12*2 FOR R12 AS STACK POINTER 98 .
F7EB: F7EE: F7F0: F7F2: F7F5: F7F7: F7F9: F7FA: 20 A1 85 20 A1 85 60 4C 66 F7 00 1F 66 F7 00 1E C7 F6 RTN JSR LDA STA JSR LDA STA RTS JMP DCR (R0L.X) R15H DCR (R0L.X) R15L RTNZ DECR STACK POINTER POP HIGH RETURN ADDRESS TO PC SAME FOR LOW-ORDER BYTE 99 .
6502 MICROPROCESSOR INSTRUCTIONS ADC Add Memory to Accumulator with Carry AND "AND" Memory with Accumulator ASL Shift Left One Bit (Memory or Accumulator) BCC Branch on Carry Clear BCS Branch on Carry Set BEQ Branch on Result Zero BIT Test Bits in Memory with Accumulator BMI Branch on Result Minus BNE Branch on Result not Zero BPL Branch on Result Plus BRK Force Break BVC Branch on Overflow Clear BVS Branch on Overflow Set CLC Clear Carry Flag CLD Clear Decimal Mode Clear Interrupt Disable Bit CLI CLV Clear Overflow Flag CMP Compare Memory and Accumulator CPX Compare Memory and Index X CPY Compare Memory and Index Y DEC Decrement Memory by One DEX Decrement index X by One DEY Decrement Index Y by One EOR "Exclusive-Or" Memory with Accumulator INC Increment Memory by One INX Increment Index X by One INY Increment Index `I by One JMP Jump to New Location JSR Jump to New Location Saving Return Address LDA LDX LDY LSR NOP ORA PHA PHP PLA PLP ROL ROR RTI RTS SBC SEC SED SEI STA STX STY TAX TAY TSX TXA TXS TYA Load Accumulator with Memory Load Index X with Memory Load Index Y with Memory Shift Right one Bit (Memory or Accumulator) No Operation OR Memory with Accumulator Push Accumulator on Stack Push Processor Status on Stack Pull Accumulator from Stack Pull Processor Status from Slack Rotate One Bit Left (Memory or Accumulator) Rotate One Bit Right (Memory or Accumulator) Return from Interrupt Return from Subroutine Subtract Memory from Accumulator with Borrow Set Carry Flag Set Decimal Mode Set Interrupt Disable Status Store Accumulator in Memory Store Index X in Memory Store Index Y in Memory Transfer Accumulator to Index X Transfer Accumulator to Index Y Transfer Stack Pointer to Index X Transfer Index X to Accumulator Transfer Index X to Stack Pointer Transfer Index Y to Accumulator 100 .
THE FOLLOWING NOTATION APPLIES TO THIS SUMMARY:
A X,Y M C P S FIGURE 1. ASL-SHIFT LEFT ONE BIT OPERATION C 7 6 5 4 3 2 1 0 0
FIGURE 2 ROTATE ONE BIT LEFT (MEMORY OR ACCUMULATOR) M OR A 7 6 5 4 3 2 1 0 C
FIGURE 3. V PC PCH PCL OPER #
NOTE 1: BIT — TEST BITS
7 A 7 Y 7 X 15 PCH 7 01 S 7 PCL 0 STACK POINTER 0 PROGRAM COUNTER 0 INDEX REGISTER X 0 INDEX REGISTER Y 0 ACCUMULATOR
7 N V B D I Z
0 C PROCESSOR STATUS REGISTER, ¨P¨ CARRY ZERO INTERRUPT DISABLE DECIMAL MODE BREAK COMMAND OVERFLOW NEGATIVE
X 76 — ROR — Zero Page. X NOP 7F — NOP 80 — NOR 81 — STA — (Indirect. X 84 — LDY — Zero Page. Y 98 — TVA 97 — NOP 96 — STX — Zero Page. Y 87 — NOP B8 — CLV 89 — LDA — Absolute. X FE — INC — Absolute. X FF — NOP 85 — LDA — Zero Page. X D6 — DEC — Zero Page. Y BF — NOP CO — CPY — Immediate C1 — CMP — (Indirect. X) 22 — NOR 23 — NOP 24 — BIT — Zero Page 25 — AND — Zero Page 26 — ROL — Zero Page 27 — NOP 28 — PLP 29 — AND — Immediate 2A — ROL — Accumulator 2B — NOP 2C — BIT — Absolute 2D — AND — Absolute 2E — ROL — Absolute . X BD — LDA — Absolute. X 56 — LSR — Zero Page. X F6 — INC — Zero Page. Y DA — NOP ED — SBC — Absolute EE — INC — Absolute EE — NOP FO — BM F1 — SBC — (Indirect). X 93 — NOR 92 — NOP 91 — STA — (Indirect). Y IA — NOR 1B — NOP 1C —NOR 10 — ORA — Absolute. Y 7A — NOP 7B — NOP 7C — NOP 7D — ADC — Absolute. Y 90 — BCC 8F — NOP BE — STX — Absolute 30 — BM! 31 — AND — (Indirect). X BE — LOX — Absolute. X 17 — NOR 18 — CLC 19 — ORA — Absolute. Y FA — NOP FB — NOP FC — NOP FD — SBC — Absolute. X) E2 — NOP E3 — NOP E4 — CPX — Zero Page E5 — SBC —Zero Page E6 — INC—Zero Page E7 — NOP EB — INX E9 — SBC — Immediate EA — NOP EB — NOP EC — CPX — Absolute C6 — DEC — Zero Page C7 — NOP C8 — INY C9 — CMP — Immediate CA — DEX CB —MOP CC —CPY — Absolute CD —CMP — Absolute CE — DEC DEC — Absolute CF — NOP DO — BNE D1 — CMP — (Indirect). X C2 — NOP C3 — NOP C4 — CPY — Zero Page C5 — CMP — Zero Page SF — NOP 60 — RTS 61 — ADC — Indirect. X F7 — NOP F8 — SED F9 — SBC — Absolute. X 07 —NOR 08 — CLD D9 —CMP — Absolute.HEX OPERATION CODES 2F — NOP 5E —LSR — Absolute. X 16 — ASL — Zero Page. Y BA — TSX BB — NOP BC — LDY — Absolute. X 42 — NOP 43 — NOP 44 — NOR 45 — EOR — Zero Page 46 — LSR — Zero Page 47 — NOP 48 — PHA 49 — EOR — Immediate 4A — LSR — Accumulator 4B —NOR 4C — JMP — Absolute 4D — EOR — Absolute 4E — LSR — Absolute 4F —MOP 50 — BVC 51 — EOR Indirect. X 77 — NOP 78 — SEI 79 — ADC — Absolute. X 9C — NOP 9B — MOP 9A — TXS 99 — STA — Absolute. Y 72 — NOP 73 — MOP 74 — NOP 75 — ADC — Zero Page. X 8D — STA — Absolute 00 — BRK 01 — ORA — (Indirect. XI AO — LDY — Immediate 9F — NOP 9E — NOP 9D — STA — Absolute. X 57 — NOP 58 — CLI 59 — FOR-. Y 95 — STA — Zero Page. V 32 — NOP 33 — NOP 34 — NOP 35 — AND — Zero Page.Absolute. X 1E — ASL — Absolute. X B6 — LOX — Zero Page. X 3F — NOP 40 — RTI 41 — EOR — Indirect. Y B2 — NOP B3 — NOP D2 — NOP D3 — NOR D4 — NOP 05 — CMP — Zero Page. X 62 — NOR 63 — NOP 64 — NOR 65 — ADC — Zero Page 66 — ROR — Zero Page 67 — NOP 68 — PLA 69 — ADC — Immediate 6A — ROR — Accumulator 6B — NOP 6C — JMP — Indirect 6D — ADC — Absolute 6E — ROR — Absolute 6F — NOP 70 — BVS 71 — ADC — (Indirect). Y 52 — NOP 53 — NOP 54 — NOP 55 — EOR — Zero Page. X 1F — NOP 20 — JSR 21 — AND —(Indirect. X 94 — STY — Zero Page. Y F2 — NOP F3 — NOR F4 — NOP F5 — SBC — Zero Page. X D8 — NOR DC —MOP DO —C CMP — Absolute X DE — DEC — Absolute. Y 5A — NOP 5B — NOP 5C — NOP 50 — EOR — Absolute. X 37 — NOP 38 — SEC 39 — AND — Absolute. X 36 — ROL — Zero Page. XI 02 — NOP 03 — NOR 04 — NOR 05 — ORA — Zero Page 06 — ASL — Zero Page 07 — NOP 08 — PHP 09 — ORA — Immediate OA — ASL — Accumulator OB — NOP OC — NOP OD — ORA — Absolute OE --ASL --Absolute OF — NOP 10 — BPL 11 — ORA — (Indirect). Y 3A — NOP 3B — NOP 3C — NOP 3D — AND — Absolute. X OF — NOP E0 — CPX — Immediate El — SBC — (Indirect. Y 12 — NOP 13 — NOP 14 — NOR 15 — ORA — Zero Page. V AB — NOP AC —LDY — Absolute AD —Absolute AE — LDX — Absolute AF —NOR BO — BCS 81 — LDA — (Indirect). Xi 82 — NOP 83 — NOP 84 —STY — Zero Page 85 — STA — Zero Page 86 — STX — Zero Page 87 — NOP 88 — DEY 89 — NOP 8A — TXA 88 — NOP 8C — STY — Absolute A8 — TAY A9 — LDA — Immediate AA — TAX Al — NOP A3 — NOR A4 — LDY — Zero Page AS — LDA — Zero Page A6 — LDX — Zero Page A2 —LOX — Immediate Al — LDA —(Indirect. X 3E — ROL — Absolute. X NOP 7E — 808 — Absolute.
Pin Connections 6. Loading. Map. Memory — Options. System Timing 8. 3. Schematics 1. Address 7. 4. 2. Expansion. 106 . 5.APPLE II HARDWARE Getting Started with Your APPLE II Board APPLE II Switching Power Supply Interfacing with the Home TV Simple Serial Output Interfacing the APPLE — Signals.
For 8K. you will need -12V at 5ØmA. b. +l2 Volts with the following current capacity! a. d. d.85ØmA. 4. For 4K or l6K systems . power connector with cable. OPTIONAL: If -l2 Volts is reouired by your keyboard. e.55ØmA. l6K or greater: 3 cassettes. f. A color TV set (or B & W) equipped with a direct video input connector for best performance or a commercially available RF modulator such as a “Pixi-verter”tm Higher channel (7-l3) modulators generally provide better system performance than lower channel modulators (2-6). (For 4K: 1 cassette (2 programs). -5 Volts at lØmA. In addition you will need: g.c. 2ØK or 32K . APPLE II P. l ea. l ea. 2.35ØmA. l6 pin headers plugged into locations A7 and Jl4. Preliminary Manual Demonstration cassette tapes.) 107 . 36K or 48K . l ea. 2" speaker with cable. For 12K.6 amps 3. l ea. c.): l. You should have received the following: a. +5 Volts at l. 2 ea.GETTING STARTED WITH YOUR APPLE II BOARD INTRODUCTION ITEMS YOU WILL NEED: Your APPLE II board comes completely assembled and thoroughly tested. h. The following power supplies (NOTE: current ratings do not include any capacity for peripheral boards. 24K. b. l ea.C. (If using an APPLE II supplied keyboard. c. Board complete with specified RAM memory.
i.B. 7. connect power supplies to d. 3. Case to hold all the above m. Using detailed information on pin functions in hardware section of manual. (l or 2) Optionally you may desire: l. Cable for the following: l. 108 . k. An ASCII encoded keyboard equipped with a "reset" switch.c. cable assembly. 6. Plug in speaker cable. Connect keyboard to APPLE II by unplugging leader in location A7 and wiring keyboard cable to it.C. Use both ground wires to miminize resistance.C. An audio cassette recorder such as a Panasonic model RQ-3O9 DS which is used to load and save programs.B. turn on power supplies and verify voltages on connector pins. Check to see that APPLE II board is not contacting any conducting surface. 2. Improper supply connections such as reverse polarity can severely damage your APPLE II.C. Game paddles or pots with cables to APPLE II Game I/O connector. 5. Connect cable from cassette monitor output to APPLE II cassette input.B. Keyboard to APPLE II P. 4. 8. (Several demo programs use PDL(0) and "Pong" also uses PDL(l). 2. then plug back into APPLE II P. Connect video cable. Video out 75 ohm cable to TV or modulator Cassette to APPLE II P. With cable assembly disconnected from APPLE II mother board. 3. With power supplies turned off. Final Assembly Steps l. j. plug in power connector to mother board then recheck all cableing. Optionally connect one or two game paddles using leader supplied in socket located at J14.
You may now try "Monitor" commands if you wish. Load one of the supplied demonstration cassettes into recorder. Verify operating supply voltages are within +3% of nominal value. First beep indicates that APPLE II has found beginning of program. 2. Set recorder level to approximately 5 and start recorder. 2.. If not check video level pot on mother board. Type RUN and carriage return to execute demonstration program.POWER UP l. 109 . Press "esc" button. 3. A ">" prompt character should appear on screen indicating that you are now in BASIC. If error occurs on loading. 4. You should now have random video display. Listings of these are included in the last section of this manual. type "control B" and press return button. press reset button. Press reset button. See details in "Monitor" software section. immediately turn off and recheck power cable wiring. 3. Also check video cables for opens and shorts. Turn power on. second indicates end of program followed by ">" character on screen. Speaker should beep and a "*" prompt character with a blinking cursor should appear in lower left on screen. Turn power on. RUNNING BASIC l. Type "LOAD" and return. try a different demo tape or try changing cassette volume level. release and type a "@" (shift-P) to clear screen. If power supplies overload. full clockwise is maximum video output. Check modulator if you are using one.
the operating frequency will drop into the audible range with squeels and squawks warning the user that something is wrong. etc. Similar systems are used in TV sets to provide horizontal deflection and the high voltages to run the CRT. the greater the output power needed. and results in four low voltage DC supplies to run APPLE II. In the "flyback" system. In this system. If the converter is overloaded. It is important to make sure that the third wine is returned to earth ground. All DC outputs are regulated at the same time and one of the four outputs (the +5 volt supply) is compared to a reference voltage with the difference error fed to a feedback loop to assist the oscillator in running at the needed frequency. CSA) and international (VDE) agencies must be returned to earth to function properly and to avoid potential shock hazards. Since all DC outputs are regulated together.. Continuity should be checked for between the power supply case and an available water pipe for example. "chopped up" by a high frequency oscillator and coupled through a small transformer to the diodes. Your Apple II is equipped with an AC line voltage filter and a three wire AC line cord. filters. The line filter. the AC line is rectified directly.L. Use a continuity checker or ohmmeter to ensure that the third wire is actually returned to earth. The transformer isolates the DC supplies from the line and is provided with several shields to prevent "hash" from being coupled into the logic or peripherals. the lower the frequency of the converter. which is of a type approved by domestic (U. The Apple II user is urged to review this section. The APPLE II power supply is of the "flyback" switching type. 110 . their voltages will reflect to some extent unequal loadings. then transferred to the output filter capacitors on the second half of the operating cycle. the energy transferred through from the AC line side to DC supply side is stored in the transformer's inductance on one-half of the operating cycle.THE APPLE II SWITCHING POWER SUPPLY Switching power supplies generally have both advantages and peculiarities not generally found in conventional power supplies. Regulation of the DC voltages is accomplished by controlling the frequency at which the converter operates.
1Ø7V to 132V. then all other supply voltages will increase in voltage slightly.For example. Under no circumstances. A 9 watt load distributed roughly 5O-5O between the +5 and +12 supply is the nominal minimum load. and special equipment is needed for service. The AC line voltage input must be within the specified limits. 111 .15 volts. there is no load on the supply. CMOS.e. The over-voltage protection references to the DC output voltages only. The Apple II power supply will power the Apple II board and all present and forthcoming plug-in cards. conversely. and since that frequency has an upper limit determined by the switching speed of power transistors. so that the total power drawn is within the thermal limits of the entire system. the Apple II board with minimum memory (4K) is well above that minimum load. with the board disconnected.5 volts. the APPLE II design is conservative with respect to component ratings and operating termperatures.Ø + Ø. they should be provided for in the peripheral design. However. The supply voltages are +5. In particular. +11.8 + Ø. there then must be a minimum load on the supply. and the internal over-voltage protection circuitry causes the supply to turn off. The -12V supply load is 1/lØ.Ø + 1V. that of the +5V. An over-voltage crowbar shutdown system and an auxilliary control feedback loop are provided to ensure that even very unlikely failure modes will not cause damage to theAPPLE II computer system. NO REPAIR BY THE USER IS ALLOWED. the user should keep the total power drawn by any one card to less than 1. Permanent damage will result.12V use use use use no no no no more more more more than than than than 25Ø 5ØØ 2ØØ 2ØØ mA mA mA mA The power supply is allowed to run indefinetly under short circuit or open circuit conditions. i. Since the output voltages are controlled by changing the operating frequency of the converter. etc.5V .5V supply load is 1/1Ø that of the +5V. if the +5 supply is loaded very heavily. Nominal load current ratios are: The +12V supply load is ½ that of the +5V. In general.. The tolerances are greatly reduced when the loads are close to nominal. we recommend the use of low power TTL. very light loading on the +5 supply and heavy loading on the +12 supply will cause both it and the others to sag lightly. should more than 14Ø VAC be applied to the input of the power supply. The . -5.5 watts.5 volts. If precision reference voltages are needed for peripheral applications. Much of the internal circuitry is NOT isolated from the power line. CAUTION: There are dangerous high voltages inside the power supply case. and the total current drawn by all the cards together within the following limits: + 12V + 5V . -12.2 + O.
Box 212 Burlingame. operates the TV set in a linear mode rather than the 100% contrast mode satisfactory for displaying text. The Apple II.O. CA 94O88 the RF Modulator Electronics Systems P.25 MHz (channel 3) or 67. Users report success with the following RF modulators: the "PixieVerter" (a kit) ATV Research 13th and Broadway Dakota City. board and a small trimmer capacitor. The PixieVerter and the TV-1 have tuning by means of a jumper on the P. This RF signal is then modulated with the composite video signal generated by the Apple II. CA 9O6O1 the "Sup-r-Mod" by (assembled & tested) M&R Enterprises P.C. The unit from Electronics Systems is just a printed circuit board with assembly instructions. All these modulators have a free running transistor oscillator. Whittier. CA 94O1O (a P. or an antenna switch. These units are called "RF Modulators" and they generate a radio frequency signal corresponding to the carrier of one or two of the lower VHF television bands. The unit from M&R has the least residual FM. The kits from UHF Associates and ATV do not have an RF cable or a shielded box or a balun transformer. board) Most of the above are available through local computer stores. All the units except the M&R unit are kits to be built and tuned by the customer. All these units have a residual FM which may cause trouble if the TV set in use has a IF pass band with excessive ripple. All the kits are incomplete to some extent.O. radio frequency interference (RFI) generated by a computer (or peripherals) will beat with the 112 .NOTES ON INTERFACING WITH THE HOME TV Accessories are available to aid the user in connecting the Apple II system to a home color TV with a minimum of trouble. Box 1O11 Sunnyvale. The M&R unit is complete.25 MHz (channel 4). The Apple II owner who wishes to use one of these RF Modulators should read the following notes carefully. Nebraska 68731 the "TV-1" (a kit) UHF Associates 6O37 Haviland Ave. For this reason. 61.C. by virtue of its color graphics capability. Some cautions are in order. The M&R Enterprises unit is pre-tuned to Channel 4.
Most home TV sets have "Brightness" and "Contrast" controls with a very wide range of adjustment. Belden #8241 or an equivalent miniature type such as Belden #8218. 113 . In fact. The M&R "Sup-r-Mod is supplied with a coax cable and toroids. some trouble may be encountered with worms.a faint discoloration of the TV CRT may occur as an inverse pattern observable with the TV set turned off. and can be greatly helped by threading the coax cable connecting the modulator to the TV set repeatedly through a Ferrite toroid core Apple Computer supplies these cores in a kit:along with a 4 circuit connector/cable assembly to match the auxilliary video connector found on the Apple II board. The user is urged not to connect "antennas" to this computer. wires strung about carrying clocks and/data will act as antennas. Therefore we recommend that a good. This condition may be avoided by keeping the "Brightness” turned down slightly and "Contrast" moderate. When an un-changing picture is displayed with high brightness for a long period . is presented to the VHF input of the TV set.carrier of the RF modulator to produce faint spurious background patterns (called "worms") This RFI "trash" must be of quite a low level if worms are to be prevented. then stray RFI getting into the TV must be less than 5ØØ V to obtain a clean picture. and subsequent radiated energy may prove to be a nuisance. Another caution concerns possible long term effects on the TV picture tube. We also recommend that the RF modulator been closed in a tight metal box (an unpainted die cast aluminum box such as Pomona #2428). This kit has order number A2MØ1ØX. Any computer containing fast switching logic and high frequency clocks will radiate some 'radio frequency energy. such as RG/59u (with copper shield). co-ax cable be used to carry the signal from any modulator to the TV set. these spurious beats must be 4Ø to 5Ødb below the signal level to reduce worms to an acceptable level. Apple II is equipped with a good line filter and many other precautions have been taken to minimize radiated energy. When it is remembered that only 2 to 6 mV (across 3ØØ . Even with these precautions.
etc. these output lines may be used to serialize data in a format suitable for a teletype.33 Teletype of recent vintage has a transistor circuit to drive its solenoids. This circuit is quite easy to interface to.33 Teletype The ASR . Recommended terminals are Molex #Ø2-Ø92136. to the computer for paddle control and other game applications. has outputs available as well. The ASR . switches. This socket. (Figure la) It can be set up for a 2OmA current loop and interfaced as follows (whether or not the teletype is strapped for full duplex or half duplex operation): a) The yellow wire and purple wire should both go to terminal 9 of Terminal Strip X. Pin 8 is the input line + or high.3k resistor and the transistor base lead is floating).A SIMPLE SERIAL OUTPUT The Apple II is equipped with a l6 pin DIP socket most frequently used to connect potentiometers. terminal 7 (the + input line) and 6 (the . located at J-14. This is necessary to change from the 6OmA current loop to the 2OmA current loop.input line). Pin 7 is the input line . If the purple wire is going to terminal 8. With an appropriate machine language program. A suitable interface circuit must be built since the outputs are merely LSTTL and won't run a teletype without help. c) The following circuit can be built on a 16 pin DIP component carrier and then plugged into the Apple's l6 pin socket found at J-l4: (The junction of the 3. then remove it and relocate it at terminal 9. Pins 16 and 9 are used as tie points as they are unconnected on the Apple board. This connector mates with a Molex receptacle model l375 #Ø3-Ø9-2l5l or #O3-O9-2l53. (Figure la). since it is provided with its own power supply.or low. An alternate connection method is via spade lugs to Terminal Strip X. b) Above Terminal Strip X is a connector socket identified as "2". 114 . Several interface circuits are discussed below and the user may pick the one best suited to his needs.
This program resides in memory from $37Ø to $3E9. 115 . The "protective" ground wire normally found on pin 1 of the DB-25 connector may be connected to the Apple's base plate if desired. it is necessary to twice invert the signal appearing at J-14 pin 15 and have it swing more than 5 volts both above and below ground. Figure 3 lists such a teletype output machine language routine. Now type in the data from columns one. The -12 volt supply may be found at pin 33 of the peripheral connectors (see Figure 4) or at the power supply connector (see Figure 5 of the manual). The +12 volt supply is easily found on the auxiliary Video connector (see Figure S-11 or Figure 7 of the manual). A Serial Out Machine Center Language Program Once the appropriate circuit has been selected and constructed a machine language program is needed to drive the circuit. From BASIC a CALL 88Ø ($37Ø) will start the execution of this program. Executing this Program l. The signal output connects to pin 3 of the DB-25 connector. The following circuit does that but requires that both +12 and -12 supplies be used. To enter this program into the Apple II the following procedure is followed: Entering Machine Language Program l. For example. 2. Columns three and four of the listing show the op-code used. type in "37Ø: A9 82" and then depress and release the "RETURN" key. Then repeat this procedure for the data at $372 and on until you complete entering the program. Placing a #4 lug under one of the four power supply mounting screws is perhaps the simplest method. Power up Apple II Depress and release the "RESET" key. 3. An asterick and flashing cursor should appear on the left hand side of the screen below the random text matrix. two and three for each line from $37Ø to Ø3E9. It will use the teletype or suitable 8Ø column printer as the primary output device. The output ground connects to pin 7 of the DB-25 connector.232 Interface" For this interface to be legitimate. (Figure 2) Snipping off pins on the DIP-component carrier will allow the spare terminals to be used for tie points.The "RS . It can be used in conjunction with an Integer BASIC program that doesn't require page $3ØØ hex of memory.
that is unless you prefer to enter it by keyboard every time you want to use it.Ø3E9W 37Ø. The system should move into Monitor mode. 2. When the program has been written to tape.XYZØl123456789" 2Ø PR#Ø 25 END Type in RUN and hit the "RETURN" key. The text in line l5 should be printed on the teletype and control is returned to the keyboard and Video monitor 4. Bc (control B) into BASIC 2. Hit the "RESET" key.2. An asterick "*" and flashing cursor should appear on the left-hand side of the screen. for convenience. Turn the teletype (printer on) Type in the following lØ CALL 88Ø l5 PRINT "ABCD. 3. 116 . PR#Ø will inactivate the printer transfering control back to the Video monitor as the primary output device. 5. The Program After entering.. be saved on tape . Insert a blank program cassette into the tape recorder and rewind it. The way it is saved is as follows: 1. Saving the Machine Language Program After the machine language program has been entered and checked for accuracy it should. checking and saving the program perform the following procedure to get a feeling of how the program is used: 1. Type in "37Ø. In Monitor mode $37ØG activates the printer and hitting the "RESET" key exits the program. the asterick and flashing cursor will reappear. 4. 3.. 3. Start the tape recorder in record mode and depress the "RETURN" key.Ø3E9W".
And is a valuable addition to any users program library. Line 2Ø deactivates the printer and the program ends on line 25. Conclusion With the circuits and machine language program described in this paper the user may develop a relatively simple serial output interface to an ASR-3 or RS-232 compatible printers.Line lØ activates the teletype machine routine and all "PRINT" statements following it will be printed to the teletype until a PR#Ø statement is encountered. This circuit can be activated through BASIC or monitor modes. Then the text in line l5 will appear on the teletype's output. 117 .
) 3.3K 150 Ω 8 - 150Ω + OUTPUT TO TELETYPE - PIN 15 J-14 RESISTORS ARE 1/4 WATT CARBON 9 + (a) FIGURE 2 ASR-33 (b) +12 (JUMPERED TO +12 SUPPLY) 3.2K PIN 15 J-14 FIGURE 2 RS-232 118 .3K PIN 8 J-14 -12 (JUMPERED TO -12 SUPPLY) 470Ω 2.3K 2N3906 (OR EQUIV.3K 3.+5V 3.3K 1 EBC 16 15 3.3K 2N3906 2N3904 3.
WOZNIAK 16 * * 17 ************************* .DO MORE SPACES FOR TA BCC #$OD 039C: 90 E6 50 . LDA #$A0 038D: A9 AO 43 .PRINT THE CHAR ON TTY PRNTIT: JSR DOCHAR 0397: 20 C1 47 ..CURSOR HORIZ.ELIM PARITY ASL FINISH 03A0: OA 52 . DONE.SET WINDOW WIDTH LDA #72 0378: A9 48 31 .RESTORE OUTPUT CHAR.AND PUT BACK ON STAC PHA TTOUT2 0393: 48 49 .IF NOT.IF C SET.IF CONTROL CHAR.PRINT A SPACE.M. OUT SWITCH CSWL EQU $36 20 YSAVE EQU $778 21 .CHAR.ON STACK.COLUMN COUNT LOC.TO NUMBER COLUMNS ONT STA WNDWDTH 037A: 85 21 32 LDA CH 037C: A5 24 33 .RESTORE CHAR PLA 039A: 68 48 .HIGH BYTE 0374: A9 03 29 STA CSWL+1 0376: 85 37 30 . CH EQU $24 19 .CHECK FOR CAR RET. BNE 03A1: DO OD 53 TELETYPE DRIVER ROUTINES PAGE: 1 FIGURE 3a 119 . TTOUT2: LDA COLCNT 0384: AD F8 38 CMP CH 0387: C5 24 39 . ADD ONE TO CM INC COLCNT 0394: EE F8 46 .TRICK TO DETERMINE TESTCTRL: BIT RTS1 038F: 2C CO 44 .IF NOT CR. * 12 * * 11/18/77 13 * * 14 * * R. WIGGINTON 15 * * S.3:42 P. NO TAB BCS TESTCTRL 038A: BO 03 41 PHA 038C: 48 42 . BEQ PRNTIT 0392: FO 03 45 .WHERE WE ARE NOW. 11/18/1977 TITLE TELETYPE DRIVER ROUTINES' 1 ************************* 2 3 * * 4 * * TTYDRIVER: 5 * TELETYPE OUTPUT * 6 * * ROUTINE FOR 72 7 * COLUMN PRINT WITH * 8 * * BASIC LIST 9 * * 10 * COPYRIGHT 1977 BY: * 11 * APPLE COMPUTER INC.POINT TO TTY ROUTINES STA CSWL 0372: 85 36 28 LDA #TTOUT/256 . EQU $7F8 22 COLCNT MARK EQU $CO58 23 EQU $CO59 24 SPACE WAIT EQU $FCA8 25 ORG $370 26 ***WARNING: OPERAND OVERFLOW IN LINE 27 #TTOUT 0370: A9 82 27 TTINIT: LDA .SAVE TWICE PHA 0382: 48 36 TTOUT: .FOR APPLE-II $21 18 WNDWDTH EQU . STA COLCNT 037E: 8D F8 34 RTS 0381: 60 35 .CHECK FOR A TAB. FOR A 039E: 49 OD 51 . PHA 0383: 48 37 . PLA 0389: 68 40 .
200MSEC DELAY FOR LIB .ADJUST CH SETCH: RETURN: RTS1: * HERE DOCHAR: TELETYPE PRINT YSAVE #SOS . .11 BITS (1 START.SAVE A REG AND SET FOI . .RETURN TO CALLER A CHARACTER ROUTINE: .BEGIN 7ITH SPACE (ST2 .M.FOR CR.CHECK IF IN MARGIN .IF SO.SAVE STATUS. RESET CH .TELETYPE DRIVER ROUTINES 11/13/1977 3:42 P.RESTORE Y-REG. .DELAY 9.NOW DO LINE FEED FINISH: .SEND A SPACE . CARRY SET.RETURN ********SUCCESSFUL ASSEMBLY: NO ERRORS FIGURE 3b 120 .NEXT BIT (STOP BITS ? LOOP 11 3ITS.110 BAUD .RESTORE STATUS . 1 2 .SEND A MARK . 03A3: 8D F8 07 54 03A6: A9 8A 55 03A8: 20 C1 03 56 03AB: A9 58 57 03AD: 20 A8 FC 58 0330: AD F8 07 59 0333: F0 08 60 0335: E5 21 61 0337: E9 F7 62 0339: 90 04 63 0393: 69 1F 64 033D: 85 24 65 033F: 68 66 03C0: 60 67 03C1: 68 03C4: 8C 78 07 69 03C5: 08 70 03C7: A0 08 71 03C3: 18 72 03C9: 48 73 03C3: 80 05 74 03CE: AD 59 C0 75 0300: 90 03 76 0303: AD 58 C0 77 0305: A9 D7 78 0306: 48 79 03D8: A9 20 80 0309: 4A 81 03D3: 90 FD 82 03DC: 68 83 030E: 6A 84 03E0: 88 85 03E1: D0 E3 86 03E2: AC 78 07 87 03E3: 28 88 03E5: 60 89 03E8: 90 03E9: 91 STA LDA JSR LDA JSR LDA 3E0 S3C SSC BCC ADC STA PLA RTS STY PHP LDY CLC PHA 3CS LDA 3CC LDA LDA PHA LDA LSR BCC PLA SBC 3NE PLA ROR DEY BNE LDY PLP RTS COLCNT #38A DOCHAR #153 7AIT COLCNT SETCH 7VD7DTH #SF7 RETURN #11F CH PAGE: 2 .091 MSEC FOR TTOUT3: MARKOUT: TTOUT4: DLY1: DLY2: MARKOUT SPACE TTOUT4 MARK #%D7 #$20 A DLY2 #101 DLY1 A TTOUT3 YSAVE . .CLEAR COLUMN COUNT ..
CROSS-REFERNCE:TELETYPE DRIVER ROUTINES 0024 0033 0039 0065 CH 0718 0034 0038 0046 COLCNT 0036 0028 0030 05YL 0305 0085 DLYI 0308 0082 DLY2 0301 0047 0056 DOCHAR 0330 0053 FINISH CO58 0077 MARK 0300 0074 MARKOUT 0397 0045 PRNTIT 038F 0063 RETURN 0300 0044 RTS1 0330 0060 SETCH CO59 0075 SPACE 033F 0041 TESTCTRL 0370 TTINIT 0332 0027 0029 TTOUT 0384 0050 TTOUT2 03C8 0089 TTOUT3 0303 0076 TTOUT4 FCAB 0058 WAIT 0021 0032 0061 WNDWDTH 0778 0069 0090 YSAVE ILE: 0054 0059 FIGURE 3c 121 .
loading constraints and other useful information. TABLE OF CONTENTS l. 8.INTERFACING THE APPLE This section defines the connections by which external devices are attached to the APPLE II board. 2. CONNECTOR LOCATION DIAGRAM CASSETTE DATA JACKS (2 EACH) GAME I/O CONNECTOR KEYBOARD CONNECTOR PERIPHERAL CONNECTORS (8 EACH) POWER CONNECTOR SPEAKER CONNECTOR VIDEO OUTPUT JACK AUXILIARY VIDEO OUTPUT CONNECTOR 122 . Included are pin diagrams. signal descriptions. 9. 6. 5. 7. 3. 4.
Figure lA APPLE II Board-Complete View 123 .
Figure 1B TOP VIEW PE RIPHE RALS Connector Location Detail APPLE II PC BOARD CASSETTE DATA IN CASSETTE DATA OUT VIDEO OUTPUT 0 1 2 3 4 5 6 7 K12 K13 K14 POWER CONNECTOR K K1 BACK EDGE OF PC BOARD J14B AUXILIARY VIDEO OUTPUT CONNECTOR J GAME I/O CONNECTOR J14 J4 J5 J6 J8 J9 J11 J12 J2 B A7 B14A SPEAKER CONNECTOR KEYBOARD CONNECTOR A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Front of PC Board CONNECTOR LOCATIONS Right Side of PC Board 124 .
etc. Figure 2 GAME I/O CONNECTOR ( Front Edge of PC Board ) +5V SWO SW1 SW2 CO4O STB PDLO PDL2 GND 1 2 3 4 5 6 7 8 16 15 14 13 12 11 10 9 N. GAME I/O CONNECTOR The Game I/O Connector provides a means for connecting paddle controls.C. CASSETTE DATA IN JACK: Designed for connection to the "EARPHONE" or "MONITOR" output found on most audio cassette tape recorders. V =25 mV into 100 Ohms.C. V =lVpp (nominal).CASSETTE JACKS A convenient means for interfacing an inexpensive audio cassette tape recorder to the APPLE II is provided by these two standard (3.5mm) miniature phone jacks located at the back of the APPLE II board. It is a 16 pin IC socket located at Jl4 and is illustrated in Figure l and 2. Located at Kl3 as illustrated OUT OUT in in Figure l. lights and switches to the APPLE II for use in controlling video games. ANO AN1 AN2 AN3 PDL3 PDL1 N. TOP VIEW LOCATION J14 125 . Z =l2K Ohms. Z =lØØ Ohms. Located at K12 as illustrated in IN IN Figure CASSETTE DATA OUT JACK: Designed for connection to the "MIC" or "MICROPHONE" input found on most audio cassette tape recorders.
SIGNAL DESCRIPTIONS FOR GAME I/O AN0-AN3: 8 addresses (CØ58-CØ5F) are assigned to selectively "SET" or "CLEAR" these four "ANNUNCIATOR" outputs. Envisioned to control indicator lights, each is a 74LSxx series TTL output and must be buffered if used to drive lamps. A utility strobe output. Will go low during Ø2 of a read or write cycle to addresses CØ4Ø-CØ4F. This is a 74LSxx series TTL output. System circuit ground. 0 Volt line from power supply. No connection. Paddle control inputs. resistance and +5V for resistors are provided prevent excess current ohms. Requires a Ø-l5ØK ohm variable each paddle. Internal lØØ ohm in series with external pot to if pot goes completely to zero
GND: NC: PDLØ-PDL3:
Switch inputs. Testable by reading from addresses CØ61-CØ63 (or CØ69-CØ6B). These are uncommitted 74LSxx series inputs. Positive 5-Volt supply. To avoid burning out the connector pin, current drain MUST be less than l00mA.
KEYBOARD CONNECTOR This connector provides the means for connecting as ASCII keyboard to the APPLE II board. It is a l6 pin IC socket located at A7 and is illustrated in Figures 1 and 3.
( Front Edge of PC Board )
+5V STROBE RESET N.C. B6 B5 B7 GND 1 2 3 4 5 6 7 8 16 15 14 13 12 11 10 9 N.C. -12V N.C. B2 B1 B4 B3 N.C.
SIGNAL DESCRIPTION FOR KEYBOARD INTERFACE Bl-B7: GND: NC: RESET: 7 bit ASCII data from keyboard, positive logic (high level= "l"), TTL logic levels expected. System circuit ground. No connection. System reset input. Requires switch closure to ground. Ø Volt line from power supply.
STROBE: Strobe output from keyboard. The APPLE II recognizes the positive going edge of the incoming strobe. +5V: -l2V: Positive 5-Volt supply. To avoid burning out the connector pin, current drain MUST be less than 1ØØmA. Negative l2-Volt supply. Keyboard should draw less than 5OmA.
PERIPHERAL CONNECTORS The eight Peripheral Connectors mounted near the back edge of the APPLE II board provide a convenient means of connecting expansion hardware and peripheral devices to the APPLE II I/O Bus. These are Winchester #2HW25CØ-lll (or equivalent) pin card edge connectors with pins on .1Ø" centers. Location and pin outs are illustrated in Figures 1 and 4. SIGNAL DESCRIPTION FOR PERIPHERAL I/O AØ-A15: 16 bit system address bus. Addresses are set up by the 65Ø2 within 3ØØnS after the beginning of Ø1. These lines will drive up to a total of l6 standard TTL loads. Sixteen addresses are set aside for each peripheral connector. A read or write to such an address will send pin 4l on the selected connector low during Ø2 (5ØØnS). Each will drive 4 standard TTL loads. 8 bit system data bus. During a write cycle data is set up by the 65Ø2 less than 3ØØnS after the beginning of Ø2. During a read cycle the 65Ø2 expects data to be ready no less than 1ØØnS before the end of Ø2. These lines will drive up to a total of 8 total low power schottky TTL loads.
Direct Memory Access control output. This line has a 3K Ohm pullup to +5V and should be driven with an open collector output. Direct Memory Access daisy chain input from higher priority peripheral devices. Will present no more than 4 standard TTL loads to the driving device. Direct Memory Access daisy chain output to lower priority peripheral devices. This line will drive 4 standard TTL loads. System circuit ground. Ø Volt line from power supply. Inhibit Line.When a device pulls this line low, all ROM's on board are disabled (Hex addressed DØØØ through FFFF). This line has a 3K Ohm pullup to +5V and should be driven with an open collector output. Interrupt daisy chain input from higher priority peripheral devices. Will present no more than 4 standard TTL loads to the driving device. Interrupt daisy chain output to lower priority peripheral devices. This line will drive 4 standard TTL loads. 256 addresses are set aside for each peripheral connector (see address map in "MEMORY" section). A read or write of such an address will send pin 1 on the selected connector low during Ø2 (5ØØnS). This line will drive 4 standard TTL loads. Pin 2Ø on all peripheral connectors will go low during Ø2, of a read or write to any address C8ØØ-CFFF. This line will drive a total of 4 standard TTL loads. Interrupt request line to the 65Ø2. This line has a 3K Ohm pullup to +5V and should be driven with an open collector output.It is active low. No connection. Non Maskable Interrupt request line to the 65Ø2. This line has a 3K Ohm pullup to +5V and should be driven with an open collector output.It is active low. A 1MHz (nonsymmetrical) general purpose timing signal. Will drive up to a total of 16 standard TTL loads. "Ready" line to the 65Ø2. This line should change only during Ø1, and when low will halt the microprocessor at the next READ cycle. This line has a 3K Ohm pullup to +5V and should be driven with an open collector output. Reset line from "RESET" key on keyboard. Active low. Will drive 2 MOS loads per Peripheral Connector. 128
Q 3: RDY:
and when low that a write cycle is in progress. The function of this line will be described in a later document. Microprocessor phase V clock. complement of Ø0. Ø Volt line from power supply.6 pin connector. Seven MHz high frequency clock. PIN DESCRIPTION GND: +l2V: +5V: -5V: -l2V: (2 pins) system circuit ground. Positive 12-Volt line from power supply. Positive 5-Volt line from power supply. Positive l2-Volt supply. When high indicates that a read cycle is in progress. Will drive up to a total of l6 standard TTL loads. Negative 5-Volt line from power supply.R/W: READ/WRITE line from 65Ø2. Phase l clock. Will drive up to a total of 16 standard TTL loads. Will drive up to a total of 16 standard TTL loads. This line will drive up to a total of 16 standard TTL loads. See location and pin out in Figures l and 5. Negative l2-Volt supply. Negative 5-Volt line from power supply. Positive 5-Volt supply Negative 5-Volt supply. USER l: ØO: Ø1: 7M: +12V: +5V: -5V: -12V: POWER CONNECTOR The four voltages required by the APPLE II are supplied via this AMP #9-35Ø28-l. 129 .
C. R/W A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 I/O SELECT ( Toward Front Edge of PC Board) LOCATIONS J2 TO J12 Figure 5 PINOUT POWER CONNECTOR TOP VIEW ( Toward Right side of PC Board) 5 3 1 6 4 2 (BLUE/WHITE WIRE) -12V (ORANGE WIRE) +5V (BLACK WIRE) GND .5V (BLUE WIRE) +12V (ORANGE/WHITE WIRE) GND (BLACK WIRE) LOCATION K1 130 . 7M Q3 1 USER 1 0 DEVICE SELECT D7 D6 D5 D4 D3 D2 D1 D0 +12V 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 +5V DMA OUT INT OUT DMA RDY I/O STROBE N.C.Figure 4 PINOUT PERIPHERAL CONNECTORS (EIGHT OF EACH) TOP VIEW (Back Edge of PC Board) GND DMA IN INT IN NMI IRQ RES INH -12V -5V N.
SPEAKER CONNECTOR This is a MOLEX KK 1ØØ series connector with two . SIGNAL DESCRIPTION FOR SPEAKER +5V: SPKR: System +5 Volts Output line to speaker. See locations illustrated in Figure l. Will deliver about .lØ" centers. board will supply NTSC compatible.C.25" square pins on . See location and pin out in Figures 1 and 6.5 watt into 8 Ohms. 131 . positive composite video to an external video monitor. A video level control near the connector allows the output level to be adjusted from Ø to l Volt (peak) into an external 75 OHM load. Additional tint (hue) range is provided by an adjustable trimmer capacitor. Figure 6 SPEAKER CONNECTIONS PINOUT Right Edge of PC Board SPKR +5V Right Edge of PC Board LOCATION B14A VIDEO OUTPUT JACK This standard RCA phono jack located at the back edge of the APPLE II P. EIA standard.
Video out on this connector is not adjustable by the on board 200 Ohm trim pot. black level is about . -5 Volt line from power supply.lØ" centers.25" square pins on . It provides composite video and two power supply voltages.75 Volts. NTSC compatible positive composite VIDEO. Ø Volt line from power supply. See Figures l and 7. Output level is non-adjustable. SYNC TIP is Ø Volts. +l2 Volt line from power supply.Ø Volts into 47Ø Ohms.AUXILIARY VIDEO OUTPUT CONNECTOR This is a MOLEX KK 100 series connector with four . +l2V: +5V: PINOUT +12V -5V VIDEO GND Right Edge of PC Board LOCATION J14B 132 Back Edge of PC Board Figure 7 AUXILIARY VIDEO OUTPUT CONNECTOR . SIGNAL DESCRIPTION GND: VIDEO: System circuit ground. DC coupled emitter follower output (not short circuit protected). and white level is about 2.
These must be used in sets of 8 to match the system data bus (which is 8 bits wide) and are organized into rows of 8. or 16384 x 1 bit called "4K" and "16K" RAMs respectively.INSTALLING YOUR OWN RAM THE POSSIBILITIES The APPLE II computer is designed to use dynamic RAM chips organized as 4O96 x l bit. If all three rows on the APPLE II board are filled with 4K RAM chips. E1. Since RAM can be installed in increments as small as 4K. and if all three rows contain l6K RAM chips then 49152 (commonly called 48K) locations of RAM memory will exist on board! RESTRICTIONS It is quite possible to have the three rows of RAM sockets filled with any combination of 4K RAMs. All sockets in a row must have the same type (4K or 16K) RAMs. then l2288 (l2K) memory locations will be available for storing programs or data. 2. each row may contain either 4Ø96 (4K) or 16384 (l6K) locations of Random Access Memory depending upon whether 4K or 16K chips are used. a means of selecting which address range each row of memory chips will respond to has been provided by the inclusion of three MEMORY SELECT sockets on board. F1 133 . l6K RAMs or empty as long as certain rules are followed: 1. There MUST be RAM assigned to the zero block of addresses. Thus. Figure 8 PINOUT (0000-OFFF) (1000-1FFF) (2000-2FFF) (3000-3FFF) (4000-4FFF) (5000-5FFF) (6000-EFFF) 4K 4K 4K 4K 4K 4K 4K MEMORY SELECT SOCKETS TOP VIEW "0" BLOCK1 "1" BLOCK 2 "2" BLOCK 3 "3" BLOCK 4 "4" BLOCK 5 "5" BLOCK 6 "6" BLOCK 7 14 13 12 11 10 9 8 RAM ROW C RAM ROW D RAM ROW E N. 16K "0" BLOCK (0000-3FFF) 16K "4" BLOCK (4000-7FFF) 16K "8" BLOCK (8000-BFFF) LOCATIONS D1.C. ASSIGNING RAM The APPLE II has 48K addresses available for assignment of RAM memory.
5. and hardware functions. INTRODUCTION INSTALLING YOUR OWN RAM MEMORY SELECT SOCKETS MEMORY MAP BY 4K BLOCKS DETAILED MAP OF ASSIGNED ADDRESSES INTRODUCTION APPLE II is supplied completely tested with the specified amount of RAM memory and correct memory select jumpers. 4. Both type l and 2 are supplied with l2K systems. 4. which allows 65536 (commonly called 65K) different memory locations to be specified.MEMORY TABLE OF CONTENTS 1. 3. 2. 2ØK and 24K systems. the I/O bus. certain address ranges have been assigned to RAM memory. For convenience we represent each l6 bit (binary) address as a 4-digit hexadecimal number. The 65Ø2 microprocessor generates a l6 bit address. Type l is a contiguous memory range for maximum BASIC program size. 134 . There are five different sets of standard memory jumper blocks: l. Additional memory may easily be added just by plugging into sockets along with correct memory jumper blocks. ROM memory. Type 2 is non-contiguous and allows 8K dedicated to HIRES screen memory with approximately 2K of user BASIC space. 3. Type 4 with 30K and 36K systems and type 5 with 48K systems. The memory and address maps give the details. 2. In the APPLE II. 4K 4K 4K BASIC 4K 4K 4K HIRES l6K 4K 4K l6K l6K 4K l6K l6K 16K A set of three each of one of the above is supplied with the board. Type l is supplied with 4K or 8K systems. Type 3 is supplied with l6K. 5. Hexadecimal notation (hex) is explained in the Monitor section of this manual.
jumper pin l4 to pin lØ on all three MEMORY SELECT sockets (thereby assigning row "C" to the ØØØØ-3FFF range of memory). Remember to jumper all three MEMORY SELECT sockets the same. If in addition you have inserted 4K RAMs into rows "D" and "E". RAM memory is assigned to various address ranges by inserting jumper wires as described below. Jumper all three MEMORY SELECT sockets the same! If you are not sure think carefully. Thcated at Dl. Now you have a large contiguous range of addresses filled with RAM memory. By following the above examples you should be able to assign each row of RAM to any address range allowed on the MEMORY SELECT sockets. and you want them each to occupy the first 4K addresses starting at 4ØØØ and 5ØØØ respectively. and jumper pin l2 to pin 6 (thereby assigning row "E" to the 5ØØØ-5FFF range of memory). essentially all the necessary information is given above. Remember that to do this properly you must know three things: l. HOW TO USE There are three MEMORY SELECT sockets. 2. This is the 24K addresses from ØØØØ-5FFF. El and Fl respectively. Let us learn by example: If you have plugged 16K RAMs into row "C" (the sockets located at C3-ClØ on the board). 135 . jumper pin 13 to pin 5 (thereby assigning row "D" to the 4ØØØ-4FFF range of memory). All three MEMORY SELECT sockets MUST be jumpered identically! The easiest way to do this is to use Apple supplied memory blocks. and you want them to occupy the first 16K of addresses starting at ØØØØ.MEMORY SELECT SOCKETS The location and pin out for memory select sockets are illustrated in Figures l and 8. Which rows have RAM installed? Which address ranges do you want them to occupy? 3.
Ø23 MHz nominal.3l8 MHz +/. 14. Microprocessor phase l clock. Intermediate timing signal. 7. Included here because the 6502 hardware and programming manuals use the designation Ø2 instead of Ø0 . During a write cycle.SYSTEM TIMING SIGNAL DESCRIPTIONS l4M: 7M: Master oscillator output. the microprocessor will expect data to appear on the data bus no less than l00nS prior to the end of Ø2. Ø0: Ø1: Ø2 : Q3: Phase Ø clock to microprocessor. timing signals are derived from this one.35 ppm. During a read cycle. l. All other COLOR REF: Color reference frequency used by video circuitry.580 MHz. l. complement of Ø0.l59 MHz. A general purpose timing signal which occurs at the same rate as the microprocessor clocks but is nonsymmetrical. and is stable about 3ØØnS after the start of Ø2. SYSTEM TIMING DIAGRAM TIMING CIRCUITRY BLOCK DIAGRAM MASTER OSCILLATOR DATA READ: TIMING RELATIONSHIPS 14M TIMING CIRCUITRY 7M COLOR REF 0 1 2 3 140 . Same as Ø0. data from the microprocessor appears on the data bus during Ø2. MICROPROCESSOR OPERATIONS ADDRESS: DATA WRITE: The address from the microprocessor changes during Ø1. 3. and is stable about 300nS after the start of Ø1.023 Mhz nominal.
3K 14 +5V 10 11 AD7 AD8 AD9 12 AD10 32 INH 5 4 6 A2 A3 A4 7 A1 3 8 A0 4 5 6 F5 F6 F8 F9 F11 VCC D0 D1 D2 9 10 11 DA0 DA1 DA2 49 48 47 ROM ROM ROM ROM ROM SEE FIG. S-2 ROM SYSTEM BUS F8 20 21 20 21 20 21 20 21 20 21 20 21 8 F0 E8 E0 D8 D0 7 9316B 13 3 A5 ROM D3 2K x 8 2 A6 14 1 23 22 19 18 D4 A7 A8 A9 A10 D7 CS2 CS1 CS3 GND D5 D6 15 16 17 DA3 DA4 DA5 DA6 DA7 20 21 12 46 45 44 43 42 145 20 15 Z0 E1 E2 5 1 2 3 A1 A2 A3 E3 6 4 38 13 14 I/O SEL F12 74LS138 GND 8 VCC 27 Z1 TO H12 PERI I/O MUX F12-15 FIG. S-9 CHIP SELECTS FROM F12 1 AD11 AD12 AD13 4 5 H1 6 15 16 17 AD14 AD15 74LS08 (1/4) FIGURE S-5 ROM MEMORY .ROM PINOUT DETAIL ROM MEMORY ARRAY 24 +5V F3 2 AD0 AD1 AD2 AD3 AD4 AD5 AD6 9 +5V 16 26 25 24 23 22 7 9 10 11 12 13 RA01 3.
S. CALIFORNIA 95014 U.A. TELEPHONE (408) 996-1010 .10260 BRANDLEY DRIVE CUPERTINO.
S. TELEPHONE (408) 996-1010 .10260 BRANDLEY DRIVE CUPERTINO.A. CALIFORNIA 95014 U.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.