Apple II User Manual

Page of 257
Apple II Original ROM Information
Source
http://members.buckeye-express.com/marksm/6502/
27 June 2004
The 6502 Firmware Page
This site is mostly about the firmware -- software in ROM -- that came with the
original Apple II, not the II+, IIe, IIc, or IIgs. The original Apple II had 4K of
RAM and 8K of ROM. The ROM contains software, such as the Monitor and Integer
BASIC, appropriate for a SBC.
Red Book refers to the original Apple II Reference Manual dated 1978.
WOZPAK refers to the WOZPAK II, a publication by Call-A.P.P.L.E., an Apple II user
group.
DDJ refers to Dr. Dobbs Journal, a computer magazine.
IA refers to Interface Age, a publication of the SCCS (Southern California
Computer Society).
SYM and AIM refer to early 6502 single board computers.
Contents
*
Apple II ROM (12 KB binary)
*
Memory map of the Apple II ROMs
*
Summary of Monitor Commands
*
Red Book Monitor listing
*
Red Book Sweet-16 listing
*
WOZPAK Sweet-16 article by Steve Wozniak
*
WOZPAK Sweet-16 article by Dick Sedgewick
*
Red Book Mini-Assembler listing
*
Red Book Floating point listing
*
WOZPAK Floating point routines description
*
DDJ Floating point article
*
IA Floating point article
*
SYM Monitor listing
*
AIM Monitor listing
*
AIM BASIC Language Reference Manual
------------------------------------------------------------------------
Questions or comments? Email me at
paulrsm@buckeye-express.com
------------------------------------------------------------------------
Updates
*
2000-09-01 -- Added AIM BASIC Language Reference Manual

Summary of Contents of user manual for Apple II

  • Page 1: + Apple II Original ROM Information Source http://members.buckeye-express.com/marksm/6502/ 27 June 2004 The 6502 Firmware Page This site is mostly about...
  • Page 2+------------------------------------------------------------------------ | TOPIC -- Apple II -- Apple II ROM (12 KB binary) +------------------------------------------------------------------------ File ............. "a2rom.bin" Fork ............. DATA...
  • Page 3D/0002E0: 0320D9D0 CAD0E5A5 514A4A4A D0D3E61A [........QJJJ....] D/0002F0: D002E61B A11AD0C9 602090D3 8D240320 [........`....$..] D/000300: AFD34820 9AD36820 2ED0AE23 036020F9 [..H...h....#.`..] D/000310: D24C7DD0...
  • Page 4D/000660: 20DAFDA5 0A208AD6 A501910A 208AD668 [...............h] D/000670: 4CCB02A5 0920DAFD A508208A D6A50220 [L...............] D/000680: 8AD6202D FFA98D4C EDFD20DA FDA9A04C [...-...L.......L] D/000690: EDFD840F...
  • Page 5D/0009E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A10: FFFFFFFF...
  • Page 6D/000D60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D90: FFFFFFFF...
  • Page 7D/0010E0: 85E41869 A020EDFD 88E0C090 EC200CE0 [...i............] D/0010F0: 68C95DF0 A4C928D0 8AF09E20 18E19550 [h.]...(........P] D/001100: D5789011 A02B4CE0 E32034EE D55090F4 [.x...+L...4..P..] D/001110: 20E4EF95...
  • Page 8D/001460: FA88B038 0A3035B4 5884FFB4 80E810DA [...8.05.X.......] D/001470: F0B3C97E B022CA10 04A00610 299480A4 [...~."......)...] D/001480: FF9458A4 C894A8A4 F194D129 1FA8B997 [..X........)....] D/001490: F10AA8A9...
  • Page 9D/0017E0: CF602015 E7A5CE85 F6A5CF85 F78884F8 [.`..............] D/0017F0: C8A90A85 F484F560 2015E7A5 CEA4CF10 [.......`........] D/001800: F22015E7 B55085DA B57885DB A5CE91DA [.....P...x......] D/001810: C8A5CF4C...
  • Page 10D/001B60: C5D854D3 D4CFD0D0 C5C4A0C1 D420AAAA [..T.............] D/001B70: AA20A0C5 D2D20DBE B2B535D2 C1CEC745 [..........5....E] D/001B80: C4C94DD3 D4D2A0CF D6C64CDC 0DD2C5D4 [..M.......L.....] D/001B90: D9D0C5A0...
  • Page 11D/001EE0: 724C61F1 203FF206 CE26CF30 FAB0DCD0 [rLa..?...&.0....] D/001EF0: 04C5CEB0 D6602015 E7B1CE94 9F4C08E7 [.....`.......L..] D/001F00: 2034EEA5 CE85C860 2015E7A5 C891CE60 [.4.....`.......`] D/001F10: 206CEEA5...
  • Page 12D/002260: E756504C 36E720C9 EF154F10 0520C9EF [.VPL6.....O.....] D/002270: 354F9550 10ED4CC9 EF2015E7 A4FBA5CE [5O.P..L.........] D/002280: 995F01A5 CF4C66E9 99500188 3051B940 [._...Lf..P..0Q.@] D/002290: 01D550D0...
  • Page 13D/0025E0: DDB4F9D0 132034F6 DDBAF9F0 0DBDBAF9 [......4.........] D/0025F0: F007C9A4 F003A434 18882644 E003D00D [.......4..&D....] D/002600: 20A7FFA5 3FF001E8 8635A203 88863DCA [....?....5....=.] D/002610: 10C9A544...
  • Page 14D/002960: C8600420 54300D80 04900322 54330D80 [.`..T0....."T3..] D/002970: 04900420 54330D80 04900420 543B0D80 [....T3......T;..] D/002980: 04900022 44330DC8 44001122 44330DC8 [..."D3..D.."D3..] D/002990: 44A90122...
  • Page 15D/002CE0: A03288D0 FDAC20C0 A02CCA60 A2084820 [.2.......,.`..H.] D/002CF0: FAFC682A A03ACAD0 F56020FD FC88AD60 [..h*.:...`.....`] D/002D00: C0452F10 F8452F85 2FC08060 A424B128 [.E/..E/./..`.$.(] D/002D10: 48293F09...
  • Page 16+------------------------------------------------------------------------ | TOPIC -- Apple II -- Memory map of the Apple II ROMs +------------------------------------------------------------------------ Memory map of the Apple...
  • Page 17+------------------------------------------------------------------------ | TOPIC -- Apple II -- Summary of Monitor Commands +------------------------------------------------------------------------ Summary of Apple II Monitor Commands Examining Memory....
  • Page 18* {adrs}T Step infinitely. The TRACE command stops only when it executes a BRK instruction or when you press RESET....
  • Page 19+------------------------------------------------------------------------ | TOPIC -- Apple II -- Red Book Monitor listing +------------------------------------------------------------------------ 1 *************************** 2 * * 3 * APPLE...
  • Page 20 57 A2L EQU $3E 58 A2H EQU $3F 59 A3L EQU $40 60 A3H EQU $41 61 A4L EQU...
  • Page 21F820: C8 119 INY ; NO, INC INDEX (X-COORD) F821: 20 0E F8 120 JSR PLOT1 ;PLOT NEXT SQUARE F824:...
  • Page 22F884: A4 3B 181 LDY PCH F886: 20 96 FD 182 JSR PRYX2 F889: 20 48 F9 183 JSR PRBLNK...
  • Page 23F8F5: A9 00 243 PRMN1 LDA #$00 F8F7: A0 05 244 LDY #$05 F8F9: 06 2D 245 PRMN2 ASL RMNEM...
  • Page 24F962: 04 20 54 305 FMT1 DFB $04,$20,$54,$30,$0D F965: 30 0D F967: 80 04 90 306 DFB $80,$04,$90,$03,$22 F96A: 03...
  • Page 25F9D8: 24 53 1B 347 DFB $24,$53,$1B,$23,$24,$53 F9DB: 23 24 53 F9DE: 19 A1 348 DFB $19,$A1 ;(A) FORMAT ABOVE...
  • Page 26FA70: 29 1F 395 AND #$1F FA72: 49 14 396 EOR #$14 FA74: C9 04 397 CMP #$04 ;COPY USER...
  • Page 27FADE: A9 00 457 LDA #ACC/256 FAE0: 85 41 458 STA A3H FAE2: A2 FB 459 LDX #$FB FAE4: A9...
  • Page 28FB59: A9 17 519 LDA #$17 FB5B: 85 25 520 TABV STA CV ;VTABS TO ROW IN A-REG FB5D: 4C...
  • Page 29FBC7: 85 29 581 STA BASH ; BASH=000001CD FBC9: 68 582 PLA ; AND FBCA: 29 18 583 AND #$18...
  • Page 30FC3E: 90 5C 643 BCC CLREOL ; E, CLEAR TO END OF LINE FC40: D0 E9 644 BNE RTS4 ;...
  • Page 31FCB3: 60 705 RTS FCB4: E6 42 706 NXTA4 INC A4L ;INCR 2-BYTE A4 FCB6: D0 02 707 BNE NXTA1...
  • Page 32FD26: 91 28 767 STA (BASL),Y ;REPLACE FLASHING SCREEN FD28: AD 00 C0 768 LDA KBD ;GET KEYCODE FD2B: 2C...
  • Page 33FDAD: A5 3C 829 MODSCHK LDA A1L FDAF: 29 07 830 AND #$07 FDB1: D0 03 831 BNE DATAOUT FDB3:...
  • Page 34FE20: A2 01 891 LT LDX #$01 FE22: B5 3E 892 LT2 LDA A2L,X ;COPY A2 (2 BYTES) TO FE24:...
  • Page 35FE9B: A5 3E 953 IOPRT LDA A2L ;SET RAM IN/OUT VECTORS FE9D: 29 0F 954 AND #$0F FE9F: F0 06...
  • Page 36FF24: 90 F0 1015 BCC RD3 ;LOOP UNTIL DONE FF26: 20 EC FC 1016 JSR RDBYTE ;READ CHKSUM BYTE FF29:...
  • Page 37FFA0: 95 41 1077 STA A3H,X FFA2: E8 1078 NXTBS2 INX FFA3: F0 F3 1079 BEQ NXTBAS FFA5: D0 06...
  • Page 38FFF2: 5D 1139 DFB LIST-1 FFF3: CC 1140 DFB WRITE-1 FFF4: B5 1141 DFB GO-1 FFF5: FC 1142 DFB READ-1...
  • Page 39+------------------------------------------------------------------------ | TOPIC -- Apple II -- Red Book Sweet-16 listing +------------------------------------------------------------------------ 1 *********************** 2 * * 3 * APPLE-II...
  • Page 40F6C5: 4A 57 LSR ;PREPARE CARRY FOR BC, BNC. F6C6: 60 58 RTS ;GOTO NON-REG OP ROUTINE F6C7: 68 59...
  • Page 41F717: A5 00 119 STAT LDA R0L F719: 81 00 120 STAT2 STA (R0L,X) ;STORE BYTE INDIRECT F71B: A0 00...
  • Page 42F796: 20 19 F7 181 JSR STAT2 ;PUSH LOW PC BYTE VIA R12 F799: A5 1F 182 LDA R15H F79B:...
  • Page 43+------------------------------------------------------------------------ | TOPIC -- Apple II -- WOZPAK Sweet-16 article by Steve Wozniak +------------------------------------------------------------------------ SWEET 16: A Pseudo 16 Bit...
  • Page 4430A 41 MLOOP LD @R1 ;R1 holds source 30B 52 ST @R2 ;R2 holds dest. addr. 30C F3 DCR R3...
  • Page 45 En INR Rn (Increment) Fn DCR Rn (Decrement) Non-register OPS- 00 RTN (Return to 6502 mode) 01 BR ea...
  • Page 46 EXAMPLE: 25 LD R5 ;Copy the contents 36 ST R6 ;of R5 to R6 LOAD INDIRECT: LD @Rn [...
  • Page 47STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides...
  • Page 48 EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move...
  • Page 49 from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order...
  • Page 50DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other...
  • Page 51 $300: 01 50 BR $352 BRANCH IF NO CARRY: BNC ea [ 02 d ] A branch to the...
  • Page 52BRANCH IF MINUS ONE BM1 ea [ 08 d ] A branch is effected only if the prior 'result' was...
  • Page 53Theory of Operation: -------------------- SWEET 16 execution mode begins with a subroutine call to SW16. All 6502 registers are saved...
  • Page 54To save code, the subroutine entry address (minus 1) is pushed onto the stack, high-order byte first. A 6502 RTS...
  • Page 55User Modifications: ------------------- You may wish to add some of your own instructions to this implementation of SWEET 16. If...
  • Page 56+------------------------------------------------------------------------ | TOPIC -- Apple II -- WOZPAK Sweet-16 article by Dick Sedgewick +------------------------------------------------------------------------ SWEET 16 - INTRODUCTION by Dick...
  • Page 57$301, $302, and $312 respectively). The SWEET 16 subroutine of course performs the move, and is entered at Hex locations...
  • Page 58studied in the first four SWEET 16 registers. Therefore, the 8 byte display starting at $0000 is large enough for...
  • Page 59 | | | | | String VN DSP NVA DATA DATA Terminator The SWEET 16 registers are as shown:...
  • Page 60 40 INPUT "ENTER # BYTES " , B 50 IF NOT B THEN 40 : REM AT LEAST 1...
  • Page 61+------------------------------------------------------------------------ | TOPIC -- Apple II -- Red Book Mini-Assembler listing +------------------------------------------------------------------------ 1 *********************** 2 * * 3 * APPLE-II...
  • Page 62F50D: 8A 57 TXA F50E: 18 58 CLC F50F: E5 3A 59 SBC PCL ;FORM ADDR-PC-2 F511: 85 3E 60...
  • Page 63F58F: 20 ED FD 119 JSR COUT ;POSITION. F592: 20 3A FF 120 RESETZ JSR BELL F595: A9 A1 121...
  • Page 64F60D: 86 3D 181 FORM7 STX A1H ;SAVE INDEX F60F: CA 182 DEX ;DONE WITH FORMAT CHECK? F610: 10 C9...
  • Page 65+------------------------------------------------------------------------ | TOPIC -- Apple II -- Red Book Floating point listing +------------------------------------------------------------------------ Apple II Reference Manual (Red Book), January...
  • Page 66F461: 26 F9 ROL M1 F463: A5 F8 NORM LDA X1 EXP1 ZERO? F465: D0 EE BNE NORM1 NO, CONTINUE...
  • Page 67F4D7: 26 F6 ROL M2+1 SHIFT DIVIDEND LEFT F4D9: 26 F5 ROL M2 F4DB: B0 1C BCS OVFL OVFL IS...
  • Page 68+------------------------------------------------------------------------ | TOPIC -- Apple II -- WOZPAK Floating point routines description +------------------------------------------------------------------------ Wozpak ][, November 1979, pages 109-115. FLOATING...
  • Page 69The exponent is a binary scaling factor (power of two) which is applied to the mantissa. Ranging from -128 to...
  • Page 70 - 3 81 A0 00 00 - 4 81 80 00 00 - 5 82 B0 00 00 -...
  • Page 71FADD subroutine (address $F46E) Purpose: To add two numbers in floating point form. Entry: The two addends are in FP1...
  • Page 72FSUB subroutine (address $F468) Purpose: To subtract two floating point numbers. Entry: The minuend is in FP1 and the subtrahend...
  • Page 73truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is...
  • Page 74altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to...
  • Page 75M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other...
  • Page 76Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order...
  • Page 77 |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1...
  • Page 78ABSWAP Subroutine (address $F437) Purpose: To take the absolute value of FP1 and then swap FP1 with FP2. Note that...
  • Page 79Note: M1 sign bit is unchanged. RTLOG subroutine (address $F480) Purpose: To shift the 6-byte field MANT1 and E one...
  • Page 80MD2 subroutine (address $F4E2) Purpose: To clear the 3-byte MANT1 field for FMUL and FDIV, check for inital result exponent...
  • Page 81+------------------------------------------------------------------------ | TOPIC -- Apple II -- DDJ Floating point article +------------------------------------------------------------------------ Dr. Dobb's Journal, August 1976, pages 17-19. Floating...
  • Page 82exit used in the event of a non-positive log argument. OVFLW (1E3B) is the error exit for overflow occuring during...
  • Page 83 * WHEN THE NUMBER IS LESS THAN 2**(-128). * * EXPONENT: THE EXPONENT REPRESENTS POWERS OF TWO. THE *...
  • Page 841D3D 95 04 STA X2,X 1D3F CA DEX 1D40 10 F0 BPL SAVET 1D42 20 50 1F JSR FADD Z+SQRT(2)...
  • Page 85 * COMMON LOG OF MANT/EXP1 RESULT IN MANT/EXP1 * 1DBC 20 00 1D LOG10 JSR LOG COMPUTE NATURAL LOG...
  • Page 861E3B 00 OVFLW BRK OVERFLOW * 1E3C 20 2C 1F CONTIN JSR FLOAT FLOAT INT 1E3F A2 03 LDX =3...
  • Page 871EBB 95 04 STA X2,X LOAD EXP/MANT2 WITH Z 1EBD CA DEX 1EBE 10 F9 BPL LF3 1EC0 20 9D...
  • Page 88 * * 1F2C A9 8E FLOAT LDA =$8E 1F2E 85 08 STA X1 SET EXPN TO 14 DEC 1F30...
  • Page 891F8D 90 AF NORMX BCC NORM IF EXEN, NORMALIZE PRODUCT, ELSE COMPLEMENT 1F8F 38 FCOMPL SEC SET CARRY FOR SUBTRACT...
  • Page 901FEE 60 RTRN RTS RETURN END *************************************************************************** Dr. Dobb's Journal, November/December 1976, page 57. ERRATA FOR RANKIN'S 6502 FLOATING POINT...
  • Page 91+------------------------------------------------------------------------ | TOPIC -- Apple II -- IA Floating point article +------------------------------------------------------------------------ Interface Age, November 1976, pages 103-111. Floating Point...
  • Page 92|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_| |7 6 5 4 3 2 1 0|7 6.5 4 3 2 1 0|7 6 5 4 3 2...
  • Page 93mant1 and act as floating point registers. On entry to the subroutines these registers contain the numbers to be operated...
  • Page 94 39 0003 EA SIGN NOP 40 0004 EA X2 NOP EXPONENT 2 41 0005 00 00 00 M2 BSS 3...
  • Page 95101 1D5D 10 F7 BPL MIT 102 1D5F 20 77 1F JSR FMUL T*T 103 1D62 20 1C 1F JSR...
  • Page 96161 1DD8 7F 58 LE2 DCM 0.69314718 LOG BASE E OF 2 B9 0C 162 1DDC 80 52 A1 DCM...
  • Page 97218 1E56 20 77 1F JSR FMUL Z*Z 219 1E59 A2 03 LDX =3 4 BYTE MOVE 220 1E5B BD...
  • Page 98 279 1ED7 60 RTS RETURN ANS=(.5+Z/(-Z+D+C2*Z*Z- B2/(Z*Z+A2))*2**(INT+1) 280 1ED8 80 5C L2E DCM 1.4426950409 LOG BASE 2 OF E 55...
  • Page 99 335 1F41 45 09 EOR M1 336 1F43 30 04 BMI RTS1 YES,RETURN WITH MANT1 NORMALIZED 337 1F45 A5 08...
  • Page 100396 * 397 1F9D 20 0D 1F FDIV JSR MD1 TAKE ABS VAL OF MANT1, MANT2 398 1FA0 E5 08...
  • Page 1011D60 77 1F 20 1C 1F A2 03 BD E4 1D 95 08 CA 10 F8 20 1D70 4A 1F...
  • Page 102+------------------------------------------------------------------------ | TOPIC -- SYM Computer -- SYM Monitor listing +------------------------------------------------------------------------ SYM-1 SUPERMON AND AUDIO CASSETTE INTERFACE SOURCES COMBINED AND...
  • Page 1030055 A659 PCLR .BLOCK 1 ;PROG CTR 0056 A65A PCHR .BLOCK 1 0057 A65B SR .BLOCK 1 ;STACK 0058 A65C...
  • Page 1040117 801F 6C F6 FF JMP ($FFF6) 0118 8022 68 DETIRQ PLA ;IRQ (NON BRK) 0119 8023 AA TAX 0120...
  • Page 1050179 809F 20 64 80 JSR SAVINT 0180 80A2 20 D3 80 JSR DBOFF ;STOP NMI'S 0181 80A5 AD 56...
  • Page 1060241 8131 10 02 BPL HASHUS+2 0242 8133 0A HASHUS ASL A ;HASH 'USER' CMDS TO ONE BYTE A 0243...
  • Page 1070303 81A0 9D 07 01 STA $0107,X 0304 81A3 BD 08 01 LDA $0108,X 0305 81A6 9D 04 01 STA...
  • Page 1080365 8206 38 SEC 0366 8207 60 RTS 0367 8208 A2 10 PSHOVE LDX #$10 ;PUSH PARMS DOWN 0368 820A...
  • Page 1090427 8291 18 CLC 0428 8292 60 M29 RTS 0429 8293 EE 4A A6 INCP3 INC P3L ;INCREMENT P3 (16...
  • Page 1100489 8308 60 RTS 0490 8309 29 0F NIBASC AND #$0F ;NIBBLE IN A TO ASCII IN A 0491 830B...
  • Page 1110551 838E B0 FB BCS INST1 0552 8390 38 SEC 0553 8391 60 INST2 RTS 0554 8392 6C 67 A6...
  • Page 1120613 840C 48 PHA 0614 840D AC 5F A6 LDY YR 0615 8410 AE 5E A6 LDX XR 0616 8413...
  • Page 1130675 84A1 20 D9 81 LDBYTE JSR INBYTE 0676 84A4 4C DD 82 JMP CHKSAD 0677 84A7 C9 44 DEPZ...
  • Page 1140737 8526 A0 00 LDY #$00 0738 8528 91 FE STA ($FE),Y 0739 852A D1 FE CMP ($FE),Y ;VERIFY MEM...
  • Page 1150799 859D 8D 4C A6 STA P2L 0800 85A0 18 CLC 0801 85A1 69 07 ADC #$07 0802 85A3 8D...
  • Page 1160861 8619 ; 0862 8619 C9 10 STD2 CMP #$10 ;STORE DOUBLE BYTE 0863 861B D0 12 BNE MEM2 0864...
  • Page 1170923 86A3 20 FA 86 SP2C JSR DIFFZ 0924 86A6 B0 03 BCS SP2D 0925 86A8 4C C4 81 SPEXIT...
  • Page 1180985 872B 20 C1 87 JSR BRTT ;INC ERCNT (UP TO FF) 0986 872E 20 B2 82 F3 JSR INCCMP...
  • Page 1191047 87B6 60 RTS 1048 87B7 A0 00 BMOVE LDY #0 ;MOVE 1 BYT + VER 1049 87B9 B1 FE...
  • Page 1201109 8835 6D 4C A6 ADC P2L 1110 8838 A8 TAY 1111 8839 AD 4F A6 LDA P1H 1112 883C...
  • Page 1211171 88B7 D0 13 BNE EXITGK 1172 88B9 20 CF 88 JSR GK 1173 88BC 8A TXA 1174 88BD 0A...
  • Page 1221233 893B 49 07 EOR #$07 1234 893D D0 05 BNE LK1 1235 893F 2C 00 A4 BIT PADA 1236...
  • Page 1231295 89B7 CA DEX 1296 89B8 88 DEY 1297 89B9 10 F0 BPL CON1 1298 89BB 4C C4 81 JMP...
  • Page 1241357 8A2F D0 0B BNE INRT2 1358 8A31 AD 53 A6 LDA TECHO 1359 8A34 49 40 EOR #$40 ;TOGGLE...
  • Page 1251419 8ABD D0 FD BNE PHAKE 1420 8ABF EA NOP 1421 8AC0 4A LSR A 1422 8AC1 CA DEX 1423...
  • Page 1261481 8B2D AD 02 A4 LDA PBDA 1482 8B30 0A ASL A 1483 8B31 60 RTS 1484 8B32 AE 50...
  • Page 1271543 8BAF AD 54 A6 LDA TOUTFL 1544 8BB2 09 40 ORA #$40 1545 8BB4 8D 54 A6 STA TOUTFL...
  • Page 1281605 8BFD 45 .DB $45 ;E 1606 8BFE 46 .DB $46 ;F 1607 8BFF 0D .DB $0D ;CR 1608 8C00...
  • Page 1291667 8C38 71 .DB $71 ;F 1668 8C39 F0 .DB $F0 ;CR 1669 8C3A 40 .DB $40 ;DASH 1670 8C3B...
  • Page 1301729 8C78 BUFADH =$FF 1730 8C78 ;TAPDEL =$A630 ;HI SPEED TAPE DELAY 1731 8C78 ;KMBDRY =$A631 ;KIM READ BDRY 1732...
  • Page 1311791 8C8E 85 FD STA MODE 1792 8C90 20 26 8E JSR RDBYTX ;READ ID BYTE ON TAPE 1793 8C93...
  • Page 1321853 8D03 C9 2F LT7HB CMP #'/' ;EA, MUST BE "/" 1854 8D05 D0 29 BNE LCERR ;LAST CHAR NOT...
  • Page 1331915 8D69 85 F8 SY100 STA BDRY 1916 8D6B A9 6D LDA #$6D 1917 8D6D 8D 00 A4 STA DIG...
  • Page 1341977 8DDE 65 F8 ADC BDRY 1978 8DE0 60 RTS 1979 8DE1 1980 8DE1 24 FD RDCHTX BIT MODE ;READ...
  • Page 1352039 8E3C C9 30 PACKT CMP #$30 ;LT "0"? 2040 8E3E 90 1D BCC PACKT3 2041 8E40 C9 47 CMP...
  • Page 1362101 8E87 20 A9 8D DUMPT JSR START ;INIT VIA & CKSUM, SA TO BUFAD & START 2102 8E8A A9...
  • Page 1372163 8F01 E6 FE INC BUFADL ;BUMP BUFFER ADDR 2164 8F03 D0 C9 BNE DUMPT2 2165 8F05 E6 FF INC...
  • Page 1382225 8F56 8E 38 A6 OUTCHT STX SCR8 ;PRESERVE X 2226 8F59 8C 39 A6 STY SCR9 ;DITTO Y 2227...
  • Page 1392287 8FB2 46 .DB $46 ;HS TAPE BOUNDARY 2288 8FB3 00 00 .DB $00,$00 ;SCR3,SCR4 2289 8FB5 33 .DB $33...
  • Page 140+------------------------------------------------------------------------ | TOPIC -- AIM Computer -- AIM Monitor listing +------------------------------------------------------------------------ 0001 0000 ;TELEMARK CROSS ASSEMBLER (TASM) http://www.halcyon.com/squakvly/ 0002 0000...
  • Page 1410057 00E5 END .BLOCK 2 ;LIMITS OF BUFFER (END) 0058 00E7 SAVE .BLOCK 2 ;USED BY REPLACE 0059 00E9 OLDLEN...
  • Page 1420119 A416 CURPOS .BLOCK 1 ;PRINTER POINTER 0120 A417 CNTH30 .BLOCK 1 ;BAUD RATE &... 0121 A418 CNTL30 .BLOCK 1...
  • Page 1430181 A484 ; WRITE EDGE DETECT CONTROL (NOT USED BECAUSE KB) 0182 A484 *=$A484 0183 A484 DNPA7 .BLOCK 1 ;DISABLE...
  • Page 1440243 A810 ; ****************************** 0244 A810 ; REGISTERS FOR DISPLAY (6520) 0245 AC00 *=$AC00 0246 AC00 RA .BLOCK 1 ;REGISTER...
  • Page 1450305 E000 46524F4DBD M1 .DB "FROM",EQS 0306 E005 54 4F BD M3 .DB "TO",EQS 0307 E008 202A2A2A2A20M4 .DB " ****...
  • Page 1460363 E0C0 78 SEI ;DISABLE INTERRUPT 0364 E0C1 A2 FF LDX #$FF ;INIT STACK PTR 0365 E0C3 9A TXS 0366...
  • Page 1470425 E13E 20 13 EA RS6 JSR CRLOW ;CLEAR DISPLAY 0426 E141 4C 72 FF JMP PAT21 0427 E144 A2...
  • Page 1480487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL...
  • Page 1490542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85...
  • Page 1500604 E2E0 BE 1C A4 LDX ADDR,Y 0605 E2E3 4C 42 EA JMP WRAX 0606 E2E6 0607 E2E6 ;***** L...
  • Page 1510666 E35F 20 BD ED JSR ADDBK1 ;JUST OUTPUT BLK CNT 0667 E362 A2 01 LDX #1 ;RESTORE X 0668...
  • Page 1520728 E3E5 4C D1 E3 JMP LOADK5 ;NEXT 0729 E3E8 20 FD E3 LOADK7 JSR RBYTE ;END OF DATA CMP...
  • Page 1530790 E46A EE 10 A4 INC BKFLG ;SET FLG 0791 E46D ;CHCK OUTPUT DEV 0792 E46D AD 13 A4 DU1A...
  • Page 1540852 E4EE 20 BA E9 JSR SEMI ;OUTPUT ';' 0853 E4F1 A2 02 LDX #2 0854 E4F3 A9 00 LDA...
  • Page 1550914 E569 D0 03 BNE *+5 0915 E56B EE 07 01 INC S2+1 0916 E56E 60 RTS 0917 E56F 0918...
  • Page 1560976 E5E9 60 RTS 0977 E5EA 0978 E5EA ;***** P COMMAND-ALTER PROCESSOR STATUS ***** 0979 E5EA A2 00 CGPS LDX...
  • Page 1571038 E64F 20 13 EA JSR CRLOW 1039 E652 20 3E E8 SH1 JSR BLANK 1040 E655 BE 00 01...
  • Page 1581100 E6C9 D0 2F BNE BRK4 ;IF $10 TAPE CNTRL IS OFF 1101 E6CB 1102 E6CB ;***** 2 COMMAND-TOGGLE TAPE...
  • Page 1591162 E732 65 EA ADC LENGTH 1163 E734 8D 25 A4 STA SAVPC 1164 E737 90 03 BCC JD3 1165...
  • Page 1601221 E7A9 20 AF E7 TO1 JSR KEP 1222 E7AC 4C B1 EA JMP ADDNE ;GET ADDRESS 1223 E7AF 1224...
  • Page 1611283 E81E 8D 16 A4 PSL0C STA CURPOS 1284 E821 A2 00 LDX #0 1285 E823 B9 38 A4 PSL0D...
  • Page 1621345 E892 A9 0D LDA #CR ;OUTPUT LAST LINE IF ON 1346 E894 4C 00 F0 JMP OUTPRI ;& CLEAR...
  • Page 1631407 E901 A9 0D OUTLOW LDA #CR 1408 E903 8D 13 A4 STA OUTFLG 1409 E906 60 OUTL1 RTS 1410...
  • Page 1641469 E973 ;READ AND ECHO A CHAR FROM KB OR TTY 1470 E973 20 83 FE REDOUT JSR CUREAD 1471...
  • Page 1651531 E9DE 2E 11 A4 ROL PRIFLG ;RESTORE FLG 1532 E9E1 60 RTS 1533 E9E2 ;USER DEFINED 1534 E9E2 C9...
  • Page 1661593 EA42 20 46 EA WRAX JSR NUMA 1594 EA45 8A TXA 1595 EA46 1596 EA46 ;PRINT ONE BYTE=TWO ASCII...
  • Page 1671655 EAA3 CA DEX 1656 EAA4 D0 F9 BNE PAK2 1657 EAA6 AE 2D A4 LDX CPIY+3 ;REST X 1658...
  • Page 1681717 EB15 C8 INY 1718 EB16 B9 1C A4 LDA ADDR,Y 1719 EB19 C8 INY 1720 EB1A 20 84 EA...
  • Page 1691779 EB85 8D 29 A4 STA STIY+2 1780 EB88 8D 2C A4 STA CPIY+2 1781 EB8B A9 99 LDA #$99...
  • Page 1701841 EBEA 20 23 EC JSR DEHALF ;DELAY 1/2 BIT TIME 1842 EBED AD 00 A8 GET3 LDA DRB ;GET...
  • Page 1711903 EC5E 4A LSR A ;ONLY ROW 1 1904 EC5F 90 06 BCC GETK00 ;GOT YOU 1905 EC61 68 PLA...
  • Page 1721965 ECC3 E0 00 CPX #0 ;IF SHIFT IS NOT ADV PAPER 1966 ECC5 F0 25 BEQ GETK10 ;NO SHIFT...
  • Page 1732027 ED3B ;GET A CHAR FROM TAPE SUBROUTINE 2028 ED3B ;A BUFFER IS USED TO GET BLOCKS OF DATA 2029...
  • Page 1742089 EDB7 4C A1 E1 JMP COMIN 2090 EDBA 2091 EDBA ;ADD 1 TO BLK COUNT AND OUTPUT IT 2092...
  • Page 1752151 EE2E 4E 2A A4 LSR CPIY ;MAKE ROOM FOR MSB 2152 EE31 0D 2A A4 ORA CPIY ;OR IN...
  • Page 1762213 EEA4 30 FB BMI CKF4 2214 EEA6 10 D9 BPL CKF2 ;GO GET TIMING 2215 EEA8 2216 EEA8 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;...
  • Page 1772275 EF17 E0 3C OUTD1A CPX #60 ;LAST CHAR FOR DISP? 2276 EF19 90 05 BCC OUTD2 2277 EF1B 20...
  • Page 1782337 EF81 A9 04 LDA #4 ;FIRST CHIP SELECT 2338 EF83 E0 00 CPX #0 ;FIRST CHIP ? 2339 EF85...
  • Page 1792399 F036 68 PLA 2400 F037 60 RTS 2401 F038 A9 20 OUTPR LDA #' ' ;FILL REST OF BUFF...
  • Page 1802461 F0B2 A9 06 LDA #PRTIME/256 ;START T2 FOR 1.7 MSEC 2462 F0B4 8D 09 A8 STA T2H 2463 F0B7...
  • Page 1812523 F0F0 20 58 EB JSR LDAY 2524 F0F3 2C 7C A4 BIT IMASK ;SEE IF DOT IS SET 2525...
  • Page 1822585 F15D DE 74 A4 OP06 DEC IDIR,X ;DIRECTION <= $FF (-) 2586 F160 2587 F160 ;START OF NEW PRINT...
  • Page 1832647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS...
  • Page 1842709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07...
  • Page 1852771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA...
  • Page 1862813 F379 087849410841 .DB $08,$78,$49,$41,$08,$41,$01,$40 ;X -- ( 2813 F37F 0140 2814 F381 004F00147F08 .DB $00,$4F,$00,$14,$7F,$08,$59,$02 ; -- ' 2814...
  • Page 1872846 F45F 5D5B 2847 F461 2848 F461 ;DISASSEMBLE INSTRUCTIONS AND SHOW REGS IS REGF SET 2849 F461 AD 0E A4...
  • Page 1882908 F4CC 8D 17 01 STA LMNEM 2909 F4CF B9 F9 F5 LDA MNEMR,Y 2910 F4D2 8D 18 01 STA...
  • Page 1892970 F550 AA TAX 2971 F551 10 01 BPL PCADJ4 2972 F553 88 DEY 2973 F554 6D 25 A4 PCADJ4...
  • Page 1903011 F621 4468B232B200 .DB $44,$68,$B2,$32,$B2,0,$22,0 3011 F627 2200 3012 F629 1A1A26267272 .DB $1A,$1A,$26,$26,$72,$72,$88,$C8 3012 F62F 88C8 3013 F631 C4CA26484444 .DB...
  • Page 1913070 F692 A5 E6 LDA END+1 ;CMP WITH END 3071 F694 CD 1D A4 CMP ADDR+1 3072 F697 F0 11...
  • Page 1923132 F706 4C AF E7 JMP KEP 3133 F709 A0 00 UPNO LDY #0 3134 F70B 20 E9 F8 JSR...
  • Page 1933194 F780 C9 7F CMP #$7F ;RUB 3195 F782 4C 2A FF JMP PATC17 ;NO ZEROS IN CASE OF PAPER...
  • Page 1943256 F80C ;***** F COMMAND-FIND STRING ***** 3257 F80C ;FIND STRING AND PRINT LINE TO TERMINAL 3258 F80C 20 1E...
  • Page 1953318 F889 4C 7C F8 JMP CHN1 3319 F88C AD 29 A4 CHN2 LDA STIY+2 ;GET CHAR COUNT 3320 F88F...
  • Page 1963380 F8F6 60 RTS 3381 F8F7 18 AT01 CLC 3382 F8F8 60 RTS 3383 F8F9 3384 F8F9 ;SEE IF WE...
  • Page 1973442 F951 F0 EB BEQ REP2 3443 F953 B9 38 A4 R88 LDA DIBUFF,Y 3444 F956 91 DF STA (NOWLN),Y...
  • Page 1983504 F9D1 38 SEC 3505 F9D2 E5 E9 SBC OLDLEN 3506 F9D4 A4 E9 LDY OLDLEN 3507 F9D6 D0 02...
  • Page 1993566 FA55 8D 1D A4 STA ADDR+1 3567 FA58 4C 33 EB JMP MEMERR 3568 FA5B 60 GOGO1 RTS ;OK...
  • Page 2003625 FAE2 3626 FAE2 ;ROM TABLE LOCATIONS: 3627 FAE2 00020008F2FFTYPTR1 .DB 00,02,00,08,$F2,$FF,$80,01 3627 FAE8 8001 3628 FAEA C0E2C0C0FF00 .DB $C0,$E2,$C0,$C0,$FF,00,00...
  • Page 2013663 FBB8 20 3B E8 JSR BLANK2 3664 FBBB 20 3B E8 JSR BLANK2 3665 FBBE 4C 06 FE JMP...
  • Page 2023725 FC3A 4C CB FC JMP OPCOMP 3726 FC3D 4C B6 FC HATCJ JMP HATCH 3727 FC40 A9 04 TRY34...
  • Page 2033787 FCC3 D0 06 BNE OPCOMP 3788 FCC5 20 94 E3 ERRORM JSR CKER00 ;OUTPUT ERROR MESSAGE 3789 FCC8 4C...
  • Page 2043849 FD38 F0 0B BEQ FORMDS 3850 FD3A 88 DEY 3851 FD3B B8 CLV 3852 FD3C 50 F2 BVC STSHLP...
  • Page 2053911 FDBB 38 CMPBR1 SEC ;COMPUTE BRANCH RELATIVE ADDRESS 3912 FDBC AD 35 A4 LDA OPCODE+1 3913 FDBF ED 26...
  • Page 2063973 FE33 A2 05 LDX #05 ;SET UP INNER LOOP 3974 FE35 4A INLUP LSR A ;SHIFT 5 BITS ACC...
  • Page 2074035 FE9C AE 15 A4 PATCH4 LDX CURPO2 ;DONT DO ANYTHING IF "8D" 4036 FE9F C9 8D CMP #CR+$80 ;SO...
  • Page 2084097 FF14 4C 0A E5 JMP DU11 4098 FF17 4099 FF17 20 F0 E9 PATC15 JSR CRLF ;DECODE COMMAND 4100...
  • Page 2094158 FF99 00 .DB 0 4159 FF9A 4160 FF9A EE 68 01 PAT22 INC BLKO 4161 FF9D 4C BD ED...
  • Page 210COUNT A419 CKSUM A41E CPIY A42A CRA AC01 CRB AC03 CR 000D COMIN E1A1 COMB E1C4 CHNGG E2A0 CHNG1 E2A6...
  • Page 211GID1 E427 GOERR E608 GCNT E785 GCN1 E78C GETTTY EBDB GET1 EBE2 GET3 EBED GETKD0 EC38 GETKEY EC40 GETKY EC43...
  • Page 212NHIS E688 NH1 E690 NAMO E8CF NAMO1 E8D6 NAMO2 E8E9 NAMO3 E8EB NAMO4 E8F5 NUMA EA46 NOUT EA51 NEWROW F160...
  • Page 213READ2 E94D REA1 E956 RB2 E95C RDRUP E95F RDR1 E96A REDOUT E973 RED2 E976 RD2 EA5D RD1 EA70 RSPAC EA7B...
  • Page 214UT1LH A007 UT2L A008 UT2H A009 USR A00A UACR A00B UPCR A00C UIFR A00D UIER A00E UDRA A00F UIN 0108...
  • Page 215+------------------------------------------------------------------------ | TOPIC -- AIM Computer -- AIM BASIC Language Reference Manual +------------------------------------------------------------------------ AIM 65 MICROCOMPUTER BASIC LANGUAGE REFERENCE MANUAL...
  • Page 216problems. 100 INSTALLING BASIC IN THE AIM 65 ROM INSTALLATION PROCEDURE Before handling the BASIC ROM circuits, be sure to...
  • Page 217 memory to be initialized with AA (hex) in all bytes, starting with address 532. This, of course, destroys any...
  • Page 218PRINT commands will be directed to the display only. If the printer is turned on, all commands and data from...
  • Page 219* Although the ATN function is not included in AIM 65 BASIC, the ATN command is recognized (see Appendix H)....
  • Page 220BASIC will reply with: 10 PRINT 2+3 20 PRINT 2-3 DELETING A LINE Sometimes it is desirable to delete a...
  • Page 221If we use a ";" instead of a comma, the next value will be printed immediately following the previous value....
  • Page 222 +1 1 -1 -1 6523 6523 -23.460 -23.46 1E20 1E+20 -12.3456E-7 -1.23456E-06 1.234567E-10 1.23457E-10 1000000000 1E+09 999999999 999999999 .1...
  • Page 223 Z1 ZIABCD (variable name too long) TP TO (variable names cannot be reserved words) PSTG$ RGOTO (variable names cannot...
  • Page 224REMARKS The REM (short for "remark") statement is used to insert comments or notes into a program. When BASIC encounters...
  • Page 225At line 20, if A is smaller than B, A<=B is true so we goto line 50. At line 50,...
  • Page 226The output of the program listed above will be exactly the same as the previous two programs. At line 10,...
  • Page 227 10 FOR I=1 TO 5 20 FOR J=1 TO 3 30 PRINT I,J 40 NEXT I 50 NEXT J...
  • Page 228 100 INPUT N 110 IF N=INT(N) THEN 140 120 PRINT "MUST BE INTEGER." 130 GOTO 100 140 RETURN This...
  • Page 229If more values are read than there are numbers in the DATA statements, an out of data (OD) error occurs....
  • Page 230 ROCKW ROCKWE ROCKWEL ROCKWELL ROCKWELL R ROCKWELL R6 ROCKWELL R65 ROCKWELL R650 ROCKWELL R6500 Since A$ has 14 characters...
  • Page 231 B$="BASIC FOR"+" "+A$ PRINT B$ BASIC FOR ROCKWELL R6500 Concatenation is especially useful if you wish to take a...
  • Page 232ADDITIONAL STRING CONSIDERATIONS 1. A string may contain from 0 to 255 characters. All string variable names end in a...
  • Page 233 command level and OK is typed. Prints "BREAK IN LINE XXXX," where XXXX is the line number of the...
  • Page 234 (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the...
  • Page 235 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to...
  • Page 236For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1...
  • Page 237 values you may become satisfied that your program is functioning correctly. You should then type in CONT to Continue...
  • Page 238POKE POKE location, byte 357 POKE I,J The POKE statement stores the byte specified by its second argument (J) into...
  • Page 239 FNJ7, FNKO, FNR2. User defined func- tions are restricted to one line. A function may be defined to be...
  • Page 240 is => the final value, then the first state- ment following the FOR statement is executed. Otherwise, the statement...
  • Page 241 In this example, if X is less than 0, the 26 IF X<0 THEN PRINT PRINT statement will be...
  • Page 242 In this case V=0 will be executed, 505 V=0: REM SET V=0 STATEMENT SYNTAX/FUNCTION EXAMPLE RESTORE RESTORE 510 RESTORE...
  • Page 243 commas (,), you must enclose the string in double quotes. It is illegal so have a double quote within...
  • Page 244 then a carriage return/line feed is executed. "VALUE IS" will be displayed and printed. 410 PRINT ! "VALUE IS";A...
  • Page 245 Inputs a single character from the keyboard. If data is at the keyboard, it is put in the variable...
  • Page 246307 ARITHMETIC FUNCTIONS STATEMENT SYNTAX/FUNCTION EXAMPLE ABS ABS (expression) 120 PRINT ABS(X) Gives the absolute value of the expression X....
  • Page 247 Note that (B-A)*RND(1)+A will generate a random number between A and B. STATEMENT SYNTAX/FUNCTION EXAMPLE SGN SGN (expression) 230...
  • Page 248FUNCTION FUNCTION EXPRESSED IN TERMS OF BASIC FUNCTIONS INVERSE HYPERBOLIC SINE ARGSINH(X) = LOG(X+SQR(X*X+1)) INVERSE HYPERBOLIC COSINE ARGCOSH(X) = LOG(X+SQR(X*X-1))...
  • Page 249 subroutine has been patched in 7. Calls to MID$, LEFT$, RIGHT$, WAIT, PEEK, POKE, TAB, SPC or ON...GOTO with...
  • Page 250 3. Delete all REM statements. Each REM statement uses at least one byte plus the number in the comment...
  • Page 251 2. THIS IS PROBABLY THE MOST IMPORTANT SPEED HINT. Use variables instead of constants. It takes more time to...
  • Page 252 5. Programs which use the MAT functions available in some BASICs will have to be re-written using FOR...NEXT loops...
  • Page 253Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator...
  • Page 254 * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating...
  • Page 255 position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be...
  • Page 256observed: When BASIC stores a program on cassette, it inserts a CTRL/Z after the last line. The AIM 65 Editor...
  • Page 257address of the ATN function instructions. This can be done using BASIC initialization, as follows: <5> MEMORY SIZE? 3968 Limit...