O=====|====|====|====|====|====|====|====|====|====|====|====|====|====|====|=== DOS 3.3 COMMANDS @APPEND CATALOG EXEC INT MON PR# SAVED BBLOAD CHAIN FP LOAD NOMON READ UNLOCKC ABRUN CLOSE IN# LOCK OPEN RENAME WRITED BBSAVE DELETE INIT MAXFILES POSITION RUN VERIFYO M_____________________________________________________________________________$ "__________________________________ APPLESOFT BASIC RESERVED WORDS KABS DEL HCOLOR= LEFT$ ON REM SIN TRACEK IAND DIM HGR LEN ONERR RESTORE SPC( USRK IASC DRAW HGR2 LET OR RESUME SPEED= VALL JAT END HIMEM: LIST PDL RETURN SQR VLINL JATN EXP HLIN LOAD PEEK RIGHT$ STEP VTABL JCALL FLASH HOME LOG PLOT RND STOP WAITM KCHR$ FN HPLOT LOMEM: POKE ROT= STORE XPLOTM KCLEAR FOR HTAB MID$ POP RUN STR$ XDRAWI GCOLOR= FRE IF NEW POS SAVE TAB( &I GCONT GET IN# NEXT PRINT SCALE= TAN ?B @COS GOSUB INPUT NORMAL PR# SCRN( TEXTB @DATA GOTO INT NOT READ SGN THEN@ >DEF GR INVERSE NOTRACE RECALL SHLOAD TO INTEGER BASIC RESERVED WORDS JABS CON GOTO LET NOTRACE PRINT SGN VTABM KAND DEL GR LIST ON PR# STEP XPLOTI GASC DIM HLIN LOAD OR REM TAB( &I GAT DSP TAB( MAN PDL RETURN TEXT ?B @AUTO END IF MOD PEEK RND THEN@ >CALL FOR IN# NEW PLOT RUN TOC ACLR FP INPUT NEXT POKE SAVE TRACEB @COLOR= GOSUB LEN NOT POP SCRN( VLIN EQUIVALENT INTEGER BASIC COMMANDS INTEGER BASIC APPLESOFT EQUIVALENT CLEAR..........CLR CONT...........CON HTAB...........TAB HOME...........CALL -936 FLASH..........POKE 50,63 INVERSE........POKE 50,127 NORMAL.........POKE 50,255 <>.............#O M_____________________________________________________________________________$ "__________________________________ SYMBOLS SYMBOL \/ WHAT IT STANDS FOR A] Applesoft BASIC prompt $ hex number prefixE C> Integer BASIC prompt @ octal number prefixH F* Monitor prompt ' ASCII character prefixF D! mini-assembler prompt # immediate addressingE C? usual INPUT prompt in a BASIC program () indirect addressingE C& ampersand . assembler directive ^ exponentiationO M_____________________________________________________________________________$ "__________________________________ SOFT SWITCHES POKE (-16304,0) 49232,0 Graphics POKE (-16303,0) 49233,0 Text ,POKE (-16302,0) 49234,0 Full Screen Graphics4 2POKE (-16301,0) 49235,0 Split Screen Text/Graphics POKE (-16300,0) 49236,0 Page One" POKE (-16299,0) 49237,0 Page Two POKE (-16298,0) 49238,0 Lo-Res POKE (-16297,0) 49239,0 Hi-ResO M_____________________________________________________________________________$ "__________________________________ CURSOR CALLS & CALL OTHER EQUIV. EXPLANATION --> CALL -1036..............Moves cursor RIGHT. ,<- CALL -1008..............Moves cursor LEFT, */\ CALL -998...............Moves cursor UP. ,\/ CALL -922...............Moves cursor DOWN7 5\/ CALL -926...CALL -626...Performs a carriage returnC A CALL -912...............Scrolls current text screen up one row- + CALL -936.....ESC @.....HOMEs the cursorB @-> CALL -868.....ESC E.....Clears text line from cursor to rightK I\/ CALL -958.....ESC F.....Clears text from cursor position to bottom of screenO M_____________________________________________________________________________$ "__________________________________ HI-RES COLORS LO-RES AND DOUBLE HI-RES COLORS M0 Black 1 4 Black 2 | 0 Black 4 Dark Green 8 Brown 12 Bright GreenI G1 Green 5 Orange | 1 Magenta 5 Grey 1 9 Orange 13 YellowG E2 Violet 6 Blue | 2 Dark Blue 6 Medium Blue 10 Grey 2 14 AquaH F3 White 1 7 White 2 | 3 Violet 7 Light Blue 11 Pink 15 WhiteO M_____________________________________________________________________________$ "__________________________________ ONERR ERROR CODES DOS 3.3 ProDOS BASIC G1 Language Not Available 2 Range Error 0 ?Next Without ForE C2 Range Error 3 No Device Connected 16 ?Syntax ErrorM K3 Range Error 4 Write-Protected 22 ?Return Without GosubD B4 Write-Protected 5 End of Data 42 ?Out of DataI G5 End of Data 6 Path Not Found 53 ?Illegal QuantityA ?6 File Not Found 8 I/O Error 69 ?OverflowF D7 Volume Mismatch 9 Disk Full 77 ?Out of MemoryJ H8 I/O Error 10 File Locked 90 ?Undef'd StatementF D9 Disk Full 11 Invalid Parameter 107 ?Bad SubscriptF D10 File Locked 12 No Buffers Available 120 ?Redim'd ArrayI G11 Syntax Error 13 File Type Mismatch 133 ?Division by ZeroF D12 No Buffers Available 14 Program Too Large 163 ?Type MismatchH F13 File Type Mismatch 15 Not Direct Command 176 ?String Too LongL J14 Program Too Large 16 Syntax Error 191 ?Formula Too ComplexI G15 Not Direct Command 17 Directory Full 224 ?Undef'd Function@ > 18 File Not Open 254 ?ReenterO M 19 Duplicate File Name 255 ( interrupt)( & 20 File Busy1 / 21 File(s) Still OpenO M_____________________________________________________________________________$ "__________________________________ APPLE MAIN MEMORY ALLOCATION CBLOCK OF MEMORY POSITIVE NEGATIVE ADDRESS HEXADECIMAL MZero Page RAM.......................0-255..........................$0000.00FFO MSystem Stack........................256-511........................$0100.02FFO MKeyboard Input Buffer...............512-76.........................$0200.02FFO MMonitor Variables/Vectors...........768-1023.......................$0300.03FFO MText/Lo-Res Page 1..................1024-2047......................$0400.07FFO MText/Lo-Res Page 2..................2048-3071......................$0800.0BFFO MUser RAM............................3072-8191......................$0C00.1FFFO MHi-Res Page 1.......................8192-16383...-57344 to -49153..$2000.3FFFO MHi-Res Page 2.......................16384-24575..-49152 to -40961..$4000.5FFFO MUser RAM............................24576-38400..-40960 to -27137..$6000.95FFO MDOS.................................38400-44151..-27136 to -16385..$9600.BFFFO M DOS file buffers (Maxfiles = 3)..38400-40191..-27136 to -25345..$9600.9CFFO M Main DOS routines................40192-43772..-25344 to -21764..$9D00.AAFCO M File Manager.....................43773-47028..-21763 to -18508..$AAFD.B7B4O M RWTS.............................47029-44151..-18507 to -16385..$B7B5.BFFFO MInput/Output Peripheral Cards.......49152-53247..-16384 to -12289..$C000.CFFFO M Built-In I/O.....................49152-49279..-16384 to -16257..$C000.C079O M Peripheral Card I/O Slots 0-7....49280-49407..-16256 to -16127..$C080.C0FFO M Peripheral Card PROM Slots 1-7...49408-51199..-16128 to -14337..$C100.C7FFO M Expansion ROM....................51200-53247..-14336 to -12289..$C800.CFFFO MSystem ROM..........................53248-65535..-12288 to -1......$D000.FFFFO M Applesoft ROM....................53248-63487..-12288 to -2049...$D000.F7FFO M Monitor ROM......................63488-65535...-2048 to -1......$F800.FFFFO M_____________________________________________________________________________$ "__________________________________ APPLE MAIN MEMORY MAP " __________________- + -1 / 65536 |___ MONITOR ROM ____| $FFFF+ ) -2048 / 63488 | | $F800% # | |% # | APPLESOFT ROM |% # | |% # |__________________|+ )-12288 / 53248 | | $D000' % |__ EXPANSION ROM ___|+ )-14336 / 51200 |CUSTOM PROM SPACE | $C800' % | FOR CARDSLOTS 1-7 )-16384 / 49152 | | $C000% # | |% # | |% # | |+ )-20480 / 45056 | DOS | $B000% # | |% # | |% # | |+ )-24576 / 40960 | | $A000% # | |9 7-27136 / 38400 |------------------| $9600 DEFALUT HIMEM: 8 | | IF DOS IS USED+ )-28672 / 36864 | | $9000% # | |% # | |% # | |+ )-32768 / 32768 | | $8000% # | USER RAM |% # | |% # | |+ )-36864 / 28672 | | $7000% # | |% # | |% # |__________________|+ )-40960 / 24576 | | $6000% # | |% # | |% # | HI-RES PAGE 2 |+ )-45056 / 20480 | | $5000% # | |% # | |% # |__________________|+ )-49152 / 16384 | | $4000% # | |% # | |% # | HI-RES PAGE 1 |+ )-53248 / 12288 | | $3000% # | |% # | |% # |__________________|+ ) -57344 / 8192 | | $2000% # | |% # | USER RAM |% # | |+ ) 4096 |__________________| $1000- + 3072 | TEXT/LO-RES PAGE 2 | $0C00; 9 2048 | TEXT/LO-RES PAGE 1 | $0800 DEFAULT LOMEM+ ) 1024 |__________________| $0400+ ) 0 / \ $0000& $ / \' % /______________________\/ - 1024 |__ MONITOR VARIABLES ___| $0400/ - 768 |__ KEY. INPUT BUFFER ___| $0300/ - 512 |_____ SYSTEM STACK _____| $0200/ - 256 |____ ZERO PAGE RAM _____| $0100/ - 0 $0000O M_____________________________________________________________________________$ "__________________________________ INVALUABLE PROGRAMMING INFORMATION LTo POKE a value (0-65535) into two consecutive bytes, follow this procedure 7 5where B1 and B2 are the two bytes and V is the value:: 8 POKE B1,V-INT(V/256)*256: POKE B2,INT(V/256) FIn order to PEEK two bytes, do this where B1 and B2 are the two bytes:# ! PEEK(B1)+PEEK(B2)*256 HVariable names may be up to 239 characters long, but only the first two % #characters are considered by BASIC.N LTo run the mini-assembler, load Integer BASIC into the language card, enter the monitor, and type F666G.P NTo disable the AUTO function in Integer BASIC, execute a and then enter the MAN command.- +To execute a GOTO in immediate mode, enter:! POKE 51,0: GOTO line#, *For a better random number generator, use:/ - INT(RND(PEEK(78)+PEEK(79)*256)*N+1)( & where N is the high number limit.9 7To scrunch your program listings, execute a POKE 33,33.2 0To obtain the results of MOD in Applesoft BASIC:$ " remainder=X-(INT(X/Y)*Y)3 1 where X and Y are the numbers to be divided.P NTo turn on the Mouse Character set, print a CHR$(27) (which is Esc). To turn J Hoff the alternate set, print CHR$(24). Only for Apple IIc, IIc+, IIgs, or enhanced IIe.? =To round a number N digits to the right of the decimal point:! X=INT(X*10^N+.5)/10^N* (To print 40-column text screen page one: 4 10 ? CHR$(4); "PR#1": PRINT CHR$(9); "80N"9 7 20 FOR H=1024 TO 1104 STEP 40: FOR J=0 TO 896+ ) 30 FOR K=0 TO 39: A=PEEK(J+K+H)N L 40 A=A+(A<32)*192: A=A+(A<64)*128: A=A+(A<96)*64: A=A+(A<128)*64: A=A+(A<160)*64. , 50 ? CHR$(A);: NEXT K: ?: NEXT J,H# ! 60 ?: ? CHR$(4); "PR#0" GTo correct a "No Buffers Available" message, set MAXFILES to 3 or less.D BTo save a program that is in memory while DOS 3.3 or ProDOS isn't:I G 1. Enter the monitor 5. Enter the monitor againF D 2. Enter 4000<800.3FFFM 6. Enter 800<4000.8000MA ? 3. Enter Control-C 7. Enter Control-C6 4 4. Boot a DOS disk 8. LISTM KTo delete program lines greater than 63999, add this line (may be any line number) and GOTO it: N 5000 A=PEEK(121)+PEEK(122)*256: A=A+3: POKE A-2,0: POKE A-1,0: POKE + )175,A-INT(A/256)*256: POKE 176,INT(A/256) JIn Applesoft BASIC, line numbers range from 0 through and including 63999.J HIn Integer BASIC, line numbers range from 0 through and including 32767.K IWhen a negative decimal memory address is given, add 65536 to obtain the I Gpositive equivalent. Example: -21503 plus 65536 equals 44033. In the I Gcase that your brain or your calculator does not have a -/+ key, enter F Dthe negative address without the negative sign, subtract 65536, and J Hignore the negative sign given in the answer. Example: 21503 (negative @ >address) minus 65536 equals -44033 (ignore the negative sign).N LWhen a positive decimal memory address is given, subtract 65536 to find the A ?negative equivalent. Example: 49152 minus 65536 equals -16384.N LAnother way to find an equivalent (negative or positive) is to subtract the K Iaddress (if negative, do not enter a negative sign) from 65536. In your C Amind, add a negative sign to the answer if you wanted a negative I Gequivalent. Example: 65536 minus 62436 (positive address) equals 3100 I G(negative equivalent; add a negative sign mentally). Another example: I G65536 minus 3082 (negative address excluding the negative sign) equals 62454 (positive equivalent).P NEight bits equal one byte; Four bytes equal one nibble; One nibble equals one hexadecimal digit.P NMSB is the abbreviation for Most Significant Byte (in $AC01, the MSB is $AC); K ILSB is the abbreviation for Least Significant Byte (in $AC01, the LSB is M_____________________________________________________________________________$ "__________________________________O M_____________________________________________________________________________$ "__________________________________ MACHINE LANGUAGE PROGRAMMING INFORMATION 6502'S INTERNAL REGISTERS 5(all take up one byte except PC which uses two bytes) 7A = accumulator PC = program counter7 5X = X index register S = stack pointerO MY = Y index register P = processor status register (see below)O M_____________________________________________________________________________$ "__________________________________ STATUS FLAGS MSB LSB FN = negative result I = IRQ (Interrupt ReQuest) disable4 2V = overflow Z = zero result0 .B = BRK instruction = carry/ -D = decimal mode C = borrowO M_____________________________________________________________________________$ "__________________________________ LOGICAL OPERATORS--BOOLEAN LOGIC < AND INCLUSIVE OR EXCLUSIVE OR< :01011001 01101001 01001011; 9 | | ||||| | || ||< :01100101 10111000 00101101< :-------- -------- --------< :01000001 11111001 01100110 FIf both bits are on, If either or both If either bit is on,K Ithe result bit is on. bits are on, the but not if both are on,I G result bit is on. the result bit is on. M_____________________________________________________________________________$ "__________________________________ INVALUABLE MACHINE LANGUAGE INFORMATION AThe monitor always uses hexadecimal; Dollar signs are not needed.H FTo enter the monitor, enter CALL -151; To leave it, enter ., *To look at one address, type that address.P NTo list more than one address, type the first and last addresses to be looked at separated by a period.I GType a period followed by the last address to be looked at to see more ? =addresses starting at the last address printed on the screen.J HTo look at the content of the next eight addresses, just press .N LTo enter data into memory, type the first address in the range of addresses I Gto have data put into them, follow it by a colon, and begin typing the data./ -To move a block of data in RAM, type this in: addr1" (1 stands for slot #1).J HImmediate means "put this number in;" absolute means "put the number in $ "that's contained in this address."O MThe beginning address of the mini-assembler is 2048 ($800) and the length is 328 ($148) bytes.O MIn order to display the current content of all the internal registers, enter .H FTo change the 6502's internal registers, type , colon, the A ?register, and then the number to be plugged into that register. M_____________________________________________________________________________$ "__________________________________ THE 6502 INSTRUCTION SET [(^4 2 ASSEMBLER COMMAND ABBREVIATION3 1HEXADECIMAL OPERATION CODE(S) \/ OPERATIONL J69, 65, 75, 6D, 7D, 79, 61, 71 = ADC = ADD memory to the accumulator with carryG E29, 25, 35, 2D, 3D, 39, 21, 31 = AND = logically AND memory with the accumulatorO M 0A, 06, 16, 0E, 1E = ASL = shift memory of the accumulator 1 bit to the left> < 90 = BCC = branch on carry clear< : 80 = BCS = branch on carry set> < F0 = BEQ = branch on result zeroN L 24, 2C = BIT = test memory bits with the accumulator? = 30 = BMI = branch on result minusB @ D0 = BNE = branch on result not zero> < 10 = BPL = branch on result plus5 3 00 = BRK = forced breakA ? 50 = BVC = branch on overflow clear? = 70 = BVS = branch on overflow set9 7 18 = CLC = clear carry flagF D D8 = CLD = clear decimal arithmetic modeD B 58 = CLI = clear interrupt disable bit< : B8 = CLV = clear overflow flagK IC9, C5, D5, CD, DD, D9, C1, D1 = CMP = compare memory and the accumulatorF D E0, E4, EC = CPX = compare memory and X registerF D C0, C4, CC = CPY = compare memory and Y register> < C6, D6, CE, DE = DEC = decrement memory by 1B @ CA = DEX = decrement X register by 1B @ 88 = DEY = decrement Y register by 1O M49, 45, 55, 4D, 5D, 59, 41, 51 = EOR = logically EXCLUSIVE-OR memory and the accumulator> < E6, F6, EE, FE = INC = increment memory by 1B @ E8 = INX = increment X register by 1B @ C8 = INY = increment Y register by 1J H 4C, 6C = JMP = unconditional jump to new addressM K 20 = JSR = jump to new address and save return addressM KA9, A5, B5, AD, BD, B9, A1, B1 = LDA = load the the accumulator with memoryD B A2, A6, B6, AE, BE = LDX = load X register with memoryD B A0, A4, B4, AC, BC = LDY = load Y register with memoryO M 4A, 46, 56, 4E, 5E = LSR = shift memory or the accumulator 1 bit to right5 3 EA = NOP = no operationE C09, 05, 15, 0D, 1D, 19, 01, 11 = ORA = logically OR memory and the accumulatorM K 48 = PHA = push the accumulator to top of stackM K 08 = PHP = push status register to top of stackM K 68 = PLA = pull top of stack to the accumulatorM K 28 = PLP = pull top of stack to status registerP N 2A, 26, 36, 2E, 3E = ROL = rotate memory or the accumulator 1 bit to leftP N 6A, 66, 76, 6E, 7E = ROR = rotate memory or the accumulator 1 bit to right> < 40 = RTI = return from interrupt? = 60 = RTS = return from subroutineN LE9, E5, F5, ED, FD, F9, E1, F1 = SBC = subtract memory from the accumulator with borrow7 5 38 = SEC = set carry flagD B F8 = SED = set decimal arithmetic modeC A 78 = SEI = set disable interrupt flagH F 85, 95, 8D, 9D, 99, 81, 91 = STA = store the accumulator in memoryC A 86, 96, 8E = STX = store X register in memoryC A 84, 94, 8C = STY = store Y register in memoryO M AA = TAX = transfer the accumulator to X registerO M A8 = TAY = transfer the accumulator to Y registerM K BA = TSX = transfer stack pointer to X registerO M 8A = TXA = transfer X register to the accumulatorM K 9A = TXS = transfer X register to stack pointerO M 98 = TYA = transfer Y register to the accumulator M_____________________________________________________________________________$ "__________________________________ HEXADECIMAL/DECIMAL CONVERSION CHART LSD MSD >>M K\/ 1 2 3 4 5 6 7 8 9 A B C D E FN L -------------------------------------------------------------------------N L0 | 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 |N L1 | 17 33 49 65 81 97 113 129 145 161 177 193 209 225 241 |N L2 | 18 34 50 66 82 98 114 130 146 162 178 194 210 226 242 |N L3 | 19 35 51 67 83 99 115 131 147 163 179 195 211 227 243 |N L4 | 20 36 52 68 84 100 116 132 148 164 180 196 212 228 244 |N L5 | 21 37 53 69 85 101 117 133 149 165 181 197 213 229 245 |N L6 | 22 38 54 70 86 102 118 134 150 166 182 198 214 230 246 |N L7 | 23 39 55 71 87 103 119 135 151 167 183 199 215 231 247 |N L8 | 24 40 56 72 88 104 120 136 152 168 184 200 216 232 248 |N L9 | 25 41 57 73 89 105 121 137 153 169 185 201 217 233 249 |N LA | 26 42 58 74 90 106 122 138 154 170 186 202 218 234 250 |N LB | 27 43 59 75 91 107 123 139 155 171 187 203 219 235 251 |N LC | 28 44 60 76 92 108 124 140 156 172 188 204 220 236 252 |N LD | 29 45 61 77 93 109 125 141 157 173 189 205 221 237 253 |N LE | 30 46 62 78 94 110 126 142 158 174 190 206 222 238 254 |N LF | 31 47 63 79 95 111 127 143 159 175 191 207 223 239 255