DOS 3.3 COMMANDS APPEND CATALOG EXEC INT MON PR# SAVE BLOAD CHAIN FP LOAD NOMON READ UNLOCK BRUN CLOSE IN# LOCK OPEN RENAME WRITE BSAVE DELETE INIT MAXFILES POSITION RUN VERIFY _______________________________________________________________________________________________________________ APPLESOFT BASIC RESERVED WORDS ABS DEL HCOLOR= LEFT$ ON REM SIN TRACE AND DIM HGR LEN ONERR RESTORE SPC( USR ASC DRAW HGR2 LET OR RESUME SPEED= VAL AT END HIMEM: LIST PDL RETURN SQR VLIN ATN EXP HLIN LOAD PEEK RIGHT$ STEP VTAB CALL FLASH HOME LOG PLOT RND STOP WAIT CHR$ FN HPLOT LOMEM: POKE ROT= STORE XPLOT CLEAR FOR HTAB MID$ POP RUN STR$ XDRAW COLOR= FRE IF NEW POS SAVE TAB( & CONT GET IN# NEXT PRINT SCALE= TAN ? COS GOSUB INPUT NORMAL PR# SCRN( TEXT DATA GOTO INT NOT READ SGN THEN DEF GR INVERSE NOTRACE RECALL SHLOAD TO INTEGER BASIC RESERVED WORDS ABS CON GOTO LET NOTRACE PRINT SGN VTAB AND DEL GR LIST ON PR# STEP XPLOT ASC DIM HLIN LOAD OR REM TAB( & AT DSP TAB( MAN PDL RETURN TEXT ? AUTO END IF MOD PEEK RND THEN CALL FOR IN# NEW PLOT RUN TO CLR FP INPUT NEXT POKE SAVE TRACE 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 <>.............# _______________________________________________________________________________________________________________ SYMBOLS SYMBOL \/ WHAT IT STANDS FOR ] Applesoft BASIC prompt $ hex number prefix > Integer BASIC prompt @ octal number prefix * Monitor prompt ' ASCII character prefix ! mini-assembler prompt # immediate addressing ? usual INPUT prompt in a BASIC program () indirect addressing & ampersand . assembler directive ^ exponentiation _______________________________________________________________________________________________________________ SOFT SWITCHES POKE (-16304,0) 49232,0 Graphics POKE (-16303,0) 49233,0 Text POKE (-16302,0) 49234,0 Full Screen Graphics POKE (-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-Res _______________________________________________________________________________________________________________ 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 DOWN \/ CALL -926...CALL -626...Performs a carriage return CALL -912...............Scrolls current text screen up one row CALL -936.....ESC @.....HOMEs the cursor -> CALL -868.....ESC E.....Clears text line from cursor to right \/ CALL -958.....ESC F.....Clears text from cursor position to bottom of screen _______________________________________________________________________________________________________________ HI-RES COLORS LO-RES AND DOUBLE HI-RES COLORS 0 Black 1 4 Black 2 | 0 Black 4 Dark Green 8 Brown 12 Bright Green 1 Green 5 Orange | 1 Magenta 5 Grey 1 9 Orange 13 Yellow 2 Violet 6 Blue | 2 Dark Blue 6 Medium Blue 10 Grey 2 14 Aqua 3 White 1 7 White 2 | 3 Violet 7 Light Blue 11 Pink 15 White _______________________________________________________________________________________________________________ ONERR ERROR CODES DOS 3.3 ProDOS BASIC 1 Language Not Available 2 Range Error 0 ?Next Without For 2 Range Error 3 No Device Connected 16 ?Syntax Error 3 Range Error 4 Write-Protected 22 ?Return Without Gosub 4 Write-Protected 5 End of Data 42 ?Out of Data 5 End of Data 6 Path Not Found 53 ?Illegal Quantity 6 File Not Found 8 I/O Error 69 ?Overflow 7 Volume Mismatch 9 Disk Full 77 ?Out of Memory 8 I/O Error 10 File Locked 90 ?Undef'd Statement 9 Disk Full 11 Invalid Parameter 107 ?Bad Subscript 10 File Locked 12 No Buffers Available 120 ?Redim'd Array 11 Syntax Error 13 File Type Mismatch 133 ?Division by Zero 12 No Buffers Available 14 Program Too Large 163 ?Type Mismatch 13 File Type Mismatch 15 Not Direct Command 176 ?String Too Long 14 Program Too Large 16 Syntax Error 191 ?Formula Too Complex 15 Not Direct Command 17 Directory Full 224 ?Undef'd Function 18 File Not Open 254 ?Reenter 19 Duplicate File Name 255 ( interrupt) 20 File Busy 21 File(s) Still Open _______________________________________________________________________________________________________________ APPLE MAIN MEMORY ALLOCATION BLOCK OF MEMORY POSITIVE NEGATIVE ADDRESS HEXADECIMAL Zero Page RAM.......................0-255..........................$0000.00FF System Stack........................256-511........................$0100.02FF Keyboard Input Buffer...............512-76.........................$0200.02FF Monitor Variables/Vectors...........768-1023.......................$0300.03FF Text/Lo-Res Page 1..................1024-2047......................$0400.07FF Text/Lo-Res Page 2..................2048-3071......................$0800.0BFF User RAM............................3072-8191......................$0C00.1FFF Hi-Res Page 1.......................8192-16383...-57344 to -49153..$2000.3FFF Hi-Res Page 2.......................16384-24575..-49152 to -40961..$4000.5FFF User RAM............................24576-38400..-40960 to -27137..$6000.95FF DOS.................................38400-44151..-27136 to -16385..$9600.BFFF DOS file buffers (Maxfiles = 3)..38400-40191..-27136 to -25345..$9600.9CFF Main DOS routines................40192-43772..-25344 to -21764..$9D00.AAFC File Manager.....................43773-47028..-21763 to -18508..$AAFD.B7B4 RWTS.............................47029-44151..-18507 to -16385..$B7B5.BFFF Input/Output Peripheral Cards.......49152-53247..-16384 to -12289..$C000.CFFF Built-In I/O.....................49152-49279..-16384 to -16257..$C000.C079 Peripheral Card I/O Slots 0-7....49280-49407..-16256 to -16127..$C080.C0FF Peripheral Card PROM Slots 1-7...49408-51199..-16128 to -14337..$C100.C7FF Expansion ROM....................51200-53247..-14336 to -12289..$C800.CFFF System ROM..........................53248-65535..-12288 to -1......$D000.FFFF Applesoft ROM....................53248-63487..-12288 to -2049...$D000.F7FF Monitor ROM......................63488-65535...-2048 to -1......$F800.FFFF _______________________________________________________________________________________________________________ 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 | | -27136 / 38400 |------------------| $9600 DEFALUT HIMEM | | 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 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 $0000 _______________________________________________________________________________________________________________ INVALUABLE PROGRAMMING INFORMATION To POKE a value (0-65535) into two consecutive bytes, follow this procedure where B1 and B2 are the two bytes and V is the value: POKE B1,V-INT(V/256)*256: POKE B2,INT(V/256) In order to PEEK two bytes, do this where B1 and B2 are the two bytes: PEEK(B1)+PEEK(B2)*256 Variable names may be up to 239 characters long, but only the first two characters are considered by BASIC. To run the mini-assembler, load Integer BASIC into the language card, enter the monitor, and type F666G. To 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. To scrunch your program listings, execute a POKE 33,33. To obtain the results of MOD in Applesoft BASIC: remainder=X-(INT(X/Y)*Y) where X and Y are the numbers to be divided. To turn on the Mouse Character set, print a CHR$(27) (which is Esc). To turn off 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: 10 ? CHR$(4); "PR#1": PRINT CHR$(9); "80N" 20 FOR H=1024 TO 1104 STEP 40: FOR J=0 TO 896 30 FOR K=0 TO 39: A=PEEK(J+K+H) 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" To correct a "No Buffers Available" message, set MAXFILES to 3 or less. To save a program that is in memory while DOS 3.3 or ProDOS isn't: 1. Enter the monitor 5. Enter the monitor again 2. Enter 4000<800.3FFFM 6. Enter 800<4000.8000M 3. Enter Control-C 7. Enter Control-C 4. Boot a DOS disk 8. LIST To delete program lines greater than 63999, add this line (may be any line number) and GOTO it: 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) In Applesoft BASIC, line numbers range from 0 through and including 63999. In Integer BASIC, line numbers range from 0 through and including 32767. When a negative decimal memory address is given, add 65536 to obtain the positive equivalent. Example: -21503 plus 65536 equals 44033. In the case that your brain or your calculator does not have a -/+ key, enter the negative address without the negative sign, subtract 65536, and ignore the negative sign given in the answer. Example: 21503 (negative address) minus 65536 equals -44033 (ignore the negative sign). When a positive decimal memory address is given, subtract 65536 to find the negative equivalent. Example: 49152 minus 65536 equals -16384. Another way to find an equivalent (negative or positive) is to subtract the address (if negative, do not enter a negative sign) from 65536. In your mind, add a negative sign to the answer if you wanted a negative equivalent. Example: 65536 minus 62436 (positive address) equals 3100 (negative equivalent; add a negative sign mentally). Another example: 65536 minus 3082 (negative address excluding the negative sign) equals 62454 (positive equivalent). Eight bits equal one byte; Four bytes equal one nibble; One nibble equals one hexadecimal digit. MSB is the abbreviation for Most Significant Byte (in $AC01, the MSB is $AC); LSB is the abbreviation for Least Significant Byte (in $AC01, the LSB is 1). _______________________________________________________________________________________________________________ _______________________________________________________________________________________________________________ MACHINE LANGUAGE PROGRAMMING INFORMATION 6502'S INTERNAL REGISTERS (all take up one byte except PC which uses two bytes) A = accumulator PC = program counter X = X index register S = stack pointer Y = Y index register P = processor status register (see below) _______________________________________________________________________________________________________________ STATUS FLAGS MSB LSB |N|V|-|B|D|I|Z|C| N = negative result I = IRQ (Interrupt ReQuest) disable V = overflow Z = zero result B = BRK instruction C = carry D = decimal mode C = borrow _______________________________________________________________________________________________________________ LOGICAL OPERATORS--BOOLEAN LOGIC AND INCLUSIVE OR EXCLUSIVE OR 01011001 01101001 01001011 | | ||||| | || || 01100101 10111000 00101101 -------- -------- -------- 01000001 11111001 01100110 If both bits are on, If either or both If either bit is on, the result bit is on. bits are on, the but not if both are on, result bit is on. the result bit is on. _______________________________________________________________________________________________________________ INVALUABLE MACHINE LANGUAGE INFORMATION The monitor always uses hexadecimal; Dollar signs are not needed. To enter the monitor, enter CALL -151; To leave it, enter . To look at one address, type that address. To list more than one address, type the first and last addresses to be looked at separated by a period. Type a period followed by the last address to be looked at to see more addresses starting at the last address printed on the screen. To look at the content of the next eight addresses, just press . To enter data into memory, type the first address in the range of addresses to 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). Immediate means "put this number in;" absolute means "put the number in that's contained in this address." The beginning address of the mini-assembler is 2048 ($800) and the length is 328 ($148) bytes. In order to display the current content of all the internal registers, enter . To change the 6502's internal registers, type , colon, the register, and then the number to be plugged into that register. _______________________________________________________________________________________________________________ THE 6502 INSTRUCTION SET ASSEMBLER COMMAND ABBREVIATION HEXADECIMAL OPERATION CODE(S) \/ OPERATION 69, 65, 75, 6D, 7D, 79, 61, 71 = ADC = ADD memory to the accumulator with carry 29, 25, 35, 2D, 3D, 39, 21, 31 = AND = logically AND memory with the accumulator 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 zero 24, 2C = BIT = test memory bits with the accumulator 30 = BMI = branch on result minus D0 = BNE = branch on result not zero 10 = BPL = branch on result plus 00 = BRK = forced break 50 = BVC = branch on overflow clear 70 = BVS = branch on overflow set 18 = CLC = clear carry flag D8 = CLD = clear decimal arithmetic mode 58 = CLI = clear interrupt disable bit B8 = CLV = clear overflow flag C9, C5, D5, CD, DD, D9, C1, D1 = CMP = compare memory and the accumulator E0, E4, EC = CPX = compare memory and X register C0, C4, CC = CPY = compare memory and Y register C6, D6, CE, DE = DEC = decrement memory by 1 CA = DEX = decrement X register by 1 88 = DEY = decrement Y register by 1 49, 45, 55, 4D, 5D, 59, 41, 51 = EOR = logically EXCLUSIVE-OR memory and the accumulator E6, F6, EE, FE = INC = increment memory by 1 E8 = INX = increment X register by 1 C8 = INY = increment Y register by 1 4C, 6C = JMP = unconditional jump to new address 20 = JSR = jump to new address and save return address A9, A5, B5, AD, BD, B9, A1, B1 = LDA = load the the accumulator with memory A2, A6, B6, AE, BE = LDX = load X register with memory A0, A4, B4, AC, BC = LDY = load Y register with memory 4A, 46, 56, 4E, 5E = LSR = shift memory or the accumulator 1 bit to right EA = NOP = no operation 09, 05, 15, 0D, 1D, 19, 01, 11 = ORA = logically OR memory and the accumulator 48 = PHA = push the accumulator to top of stack 08 = PHP = push status register to top of stack 68 = PLA = pull top of stack to the accumulator 28 = PLP = pull top of stack to status register 2A, 26, 36, 2E, 3E = ROL = rotate memory or the accumulator 1 bit to left 6A, 66, 76, 6E, 7E = ROR = rotate memory or the accumulator 1 bit to right 40 = RTI = return from interrupt 60 = RTS = return from subroutine E9, E5, F5, ED, FD, F9, E1, F1 = SBC = subtract memory from the accumulator with borrow 38 = SEC = set carry flag F8 = SED = set decimal arithmetic mode 78 = SEI = set disable interrupt flag 85, 95, 8D, 9D, 99, 81, 91 = STA = store the accumulator in memory 86, 96, 8E = STX = store X register in memory 84, 94, 8C = STY = store Y register in memory AA = TAX = transfer the accumulator to X register A8 = TAY = transfer the accumulator to Y register BA = TSX = transfer stack pointer to X register 8A = TXA = transfer X register to the accumulator 9A = TXS = transfer X register to stack pointer 98 = TYA = transfer Y register to the accumulator _______________________________________________________________________________________________________________ HEXADECIMAL/DECIMAL CONVERSION CHART LSD MSD >> \/ 1 2 3 4 5 6 7 8 9 A B C D E F ------------------------------------------------------------------------- 0 | 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 | 1 | 17 33 49 65 81 97 113 129 145 161 177 193 209 225 241 | 2 | 18 34 50 66 82 98 114 130 146 162 178 194 210 226 242 | 3 | 19 35 51 67 83 99 115 131 147 163 179 195 211 227 243 | 4 | 20 36 52 68 84 100 116 132 148 164 180 196 212 228 244 | 5 | 21 37 53 69 85 101 117 133 149 165 181 197 213 229 245 | 6 | 22 38 54 70 86 102 118 134 150 166 182 198 214 230 246 | 7 | 23 39 55 71 87 103 119 135 151 167 183 199 215 231 247 | 8 | 24 40 56 72 88 104 120 136 152 168 184 200 216 232 248 | 9 | 25 41 57 73 89 105 121 137 153 169 185 201 217 233 249 | A | 26 42 58 74 90 106 122 138 154 170 186 202 218 234 250 | B | 27 43 59 75 91 107 123 139 155 171 187 203 219 235 251 | C | 28 44 60 76 92 108 124 140 156 172 188 204 220 236 252 | D | 29 45 61 77 93 109 125 141 157 173 189 205 221 237 253 | E | 30 46 62 78 94 110 126 142 158 174 190 206 222 238 254 | F | 31 47 63 79 95 111 127 143 159 175 191 207 223 239 255