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 +------------------------------------------------------------------------ | TOPIC -- Apple II -- Apple II ROM (12 KB binary) +------------------------------------------------------------------------ File ............. "a2rom.bin" Fork ............. DATA Size (bytes) ..... 12,288 (12KB) / $00003000 Created .......... Sunday, December 8, 2002 -- 8:47:53 PM Modified ......... Sunday, December 8, 2002 -- 8:47:53 PM D/000000: A9208D26 03AD57C0 AD53C0AD 50C0A900 [...&..W..S..P...] D/000010: 851CAD26 03851BA0 00841AA5 1C911A20 [...&............] D/000020: A2D0C8D0 F6E61BA5 1B291FD0 EE608D22 [.........)...`."] D/000030: 038E2003 8C210348 29C08526 4A4A0526 [.....!.H)..&JJ.&] D/000040: 85266885 270A0A0A 26270A26 270A6626 [.&h.'...&'.&'.f&] D/000050: A527291F 0D260385 278AC000 F005A023 [.')..&..'......#] D/000060: 6904C8E9 07B0FB8C 2503AABD EAD08530 [i.......%......0] D/000070: 984AAD24 03851CB0 2960202E D0A51C51 [.J.$....)`.....Q] D/000080: 26253051 26912660 1024A530 4AB00549 [&%0Q&.&`.$.0J..I] D/000090: C0853060 881002A0 27A9C085 308C2503 [..0`....'...0.%.] D/0000A0: A51C0AC9 C01006A5 1C497F85 1C60A530 [.........I...`.0] D/0000B0: 0A498030 DCA981C8 C02890DF A000B0DB [.I.0.....(......] D/0000C0: 18A55129 04F027A9 7F253031 26D01BEE [..Q)..'..%01&...] D/0000D0: 2A03A97F 25A2E: 22 00 366 DFB $22,$00 ;(C) FORMAT FA30: 1A 1A 26 367 DFB $1A,$1A,$26,$26,$72,$72 FA33: 26 72 72 FA36: 88 C8 368 DFB $88,$C8 ;(D) FORMAT FA38: C4 CA 26 369 DFB $C4,$CA,$26,$48,$44,$44 FA3B: 48 44 44 FA3E: A2 C8 370 DFB $A2,$C8 ;(E) FORMAT FA40: FF FF FF 371 DFB $FF,$FF,$FF FA43: 20 D0 F8 372 STEP JSR INSTDSP ;DISASSEMBLE ONE INST FA46: 68 373 PLA ; AT (PCL,H) FA47: 85 2C 374 STA RTNL ;ADJUST TO USER FA49: 68 375 PLA ; STACK. SAVE FA4A: 85 2D 376 STA RTNH ; RTN ADR. FA4C: A2 08 377 LDX #$08 FA4E: BD 10 FB 378 XQINIT LDA INITBL-1,X ;INIT XEQ AREA FA51: 95 3C 379 STA XQT,X FA53: CA 380 DEX FA54: D0 F8 381 BNE XQINIT FA56: A1 3A 382 LDA (PCL,X) ;USER OPCODE BYTE FA58: F0 42 383 BEQ XBRK ;SPECIAL IF BREAK FA5A: A4 2F 384 LDY LENGTH ;LEN FROM DISASSEMBLY FA5C: C9 20 385 CMP #$20 FA5E: F0 59 386 BEQ XJSR ;HANDLE JSR, RTS, JMP, FA60: C9 60 387 CMP #$60 ; JMP (), RTI SPECIAL FA62: F0 45 388 BEQ XRTS FA64: C9 4C 389 CMP #$4C FA66: F0 5C 390 BEQ XJMP FA68: C9 6C 391 CMP #$6C FA6A: F0 59 392 BEQ XJMPAT FA6C: C9 40 393 CMP #$40 FA6E: F0 35 394 BEQ XRTI FA70: 29 1F 395 AND #$1F FA72: 49 14 396 EOR #$14 FA74: C9 04 397 CMP #$04 ;COPY USER INST TO XEQ AREA FA76: F0 02 398 BEQ XQ2 ; WITH TRAILING NOPS FA78: B1 3A 399 XQ1 LDA (PCL),Y ;CHANGE REL BRANCH FA7A: 99 3C 00 400 XQ2 STA XQT,Y ; DISP TO 4 FOR FA7D: 88 401 DEY ; JMP TO BRANCH OR FA7E: 10 F8 402 BPL XQ1 ; NBRANCH FROM XEQ. FA80: 20 3F FF 403 JSR RESTORE ;RESTORE USER REG CONTENTS. FA83: 4C 3C 00 404 JMP XQT ;XEQ USER OP FROM RAM FA86: 85 45 405 IRQ STA ACC ; (RETURN TO NBRANCH) FA88: 68 406 PLA FA89: 48 407 PHA ;**IRQ HANDLER FA8A: 0A 408 ASL FA8B: 0A 409 ASL FA8C: 0A 410 ASL FA8D: 30 03 411 BMI BREAK ;TEST FOR BREAK FA8F: 6C FE 03 412 JMP (IRQLOC) ;USER ROUTINE VECTOR IN RAM FA92: 28 413 BREAK PLP FA93: 20 4C FF 414 JSR SAV1 ;SAVE REG'S ON BREAK FA96: 68 415 PLA ; INCLUDING PC FA97: 85 3A 416 STA PCL FA99: 68 417 PLA FA9A: 85 3B 418 STA PCH FA9C: 20 82 F8 419 XBRK JSR INSDS1 ;PRINT USER PC. FA9F: 20 DA FA 420 JSR RGDSP1 ; AND REG'S FAA2: 4C 65 FF 421 JMP MON ;GO TO MONITOR FAA5: 18 422 XRTI CLC FAA6: 68 423 PLA ;SIMULATE RTI BY EXPECTING FAA7: 85 48 424 STA STATUS ; STATUS FROM STACK, THEN RTS FAA9: 68 425 XRTS PLA ;RTS SIMULATION FAAA: 85 3A 426 STA PCL ; EXTRACT PC FROM STACK FAAC: 68 427 PLA ; AND UPDATE PC BY 1 (LEN=0) FAAD: 85 3B 428 PCINC2 STA PCH FAAF: A5 2F 429 PCINC3 LDA LENGTH ;UPDATE PC BY LEN FAB1: 20 56 F9 430 JSR PCADJ3 FAB4: 84 3B 431 STY PCH FAB6: 18 432 CLC FAB7: 90 14 433 BCC NEWPCL FAB9: 18 434 XJSR CLC FABA: 20 54 F9 435 JSR PCADJ2 ;UPDATE PC AND PUSH FABD: AA 436 TAX ; ONTO STACH FOR FABE: 98 437 TYA ; JSR SIMULATE FABF: 48 438 PHA FAC0: 8A 439 TXA FAC1: 48 440 PHA FAC2: A0 02 441 LDY #$02 FAC4: 18 442 XJMP CLC FAC5: B1 3A 443 XJMPAT LDA (PCL),Y FAC7: AA 444 TAX ;LOAD PC FOR JMP, FAC8: 88 445 DEY ; (JMP) SIMULATE. FAC9: B1 3A 446 LDA (PCL),Y FACB: 86 3B 447 STX PCH FACD: 85 3A 448 NEWPCL STA PCL FACF: B0 F3 449 BCS XJMP FAD1: A5 2D 450 RTNJMP LDA RTNH FAD3: 48 451 PHA FAD4: A5 2C 452 LDA RTNL FAD6: 48 453 PHA FAD7: 20 8E FD 454 REGDSP JSR CROUT ;DISPLAY USER REG FADA: A9 45 455 RGDSP1 LDA #ACC ; CONTENTS WITH FADC: 85 40 456 STA A3L ; LABELS FADE: A9 00 457 LDA #ACC/256 FAE0: 85 41 458 STA A3H FAE2: A2 FB 459 LDX #$FB FAE4: A9 A0 460 RDSP1 LDA #$A0 FAE6: 20 ED FD 461 JSR COUT FAE9: BD 1E FA 462 LDA RTBL-$FB,X FAEC: 20 ED FD 463 JSR COUT FAEF: A9 BD 464 LDA #$BD FAF1:049FF 8501A53D 85078509 850BA000 [..I....=........] D/0005E0: 84068408 840AA63E A5009108 C8D0FBE6 [.......>........] D/0005F0: 09CAD0F6 A63EB106 C500F013 48A50720 [.....>......H...] D/000600: DAFD9820 8AD6A500 208AD668 2092D6C8 [...........h....] D/000610: D0E4E607 CAD0DFA6 3EA50191 0A840D84 [........>.......] D/000620: 0CE60CA5 012045D6 A5002045 D6060C26 [......E....E...&] D/000630: 0DA50DC5 3E90ECA5 00910AE6 0AD0DAE6 [....>...........] D/000640: 0BCAD0D5 608502A5 0A450C85 08A50B45 [....`....E.....E] D/000650: 0D8509A5 029108B1 0AC501F0 E748A50B [.............H..] D/000660: 20DAFDA5 0A208AD6 A501910A 208AD668 [...............h] D/000670: 4CCB02A5 0920DAFD A508208A D6A50220 [L...............] D/000680: 8AD6202D FFA98D4C EDFD20DA FDA9A04C [...-...L.......L] D/000690: EDFD840F 850E208A D6202DFF A500450E [..........-...E.] D/0006A0: 850EA007 460E9023 A9A020ED FDA53DC9 [....F..#......=.] D/0006B0: 50A9C469 0020EDFD A9AD20ED FD98D005 [P..i............] D/0006C0: A9B120ED FDB9D3D6 20EDFD88 10D6A40F [................] D/0006D0: 4C85D6B0 B9B8B7B6 B5B4B3B2 B1A00084 [L...............] D/0006E0: 06840788 98D00EA0 1A200ED7 85068407 [................] D/0006F0: A021200E D7850884 09A00820 0ED78502 [.!..............] D/000700: 8403A011 200ED785 0484054C 08D4B14A [...........L...J] D/000710: 48C8B14A A868604C 4ED7A401 AD30C0E6 [H..J.h`LN....0..] D/000720: 02D005E6 03D00560 EA4C2CD7 88F0054C [.......`.L,....L] D/000730: 32D7D0EB A400AD30 C0E602D0 05E603D0 [2......0........] D/000740: 0560EA4C 46D788F0 D14C4CD7 D0EBADFF [.`.LF....LL.....] D/000750: 020AA8B9 96D78500 ADFD024A F0044600 [...........J..F.] D/000760: D0F9B996 D738E500 8501C8B9 96D76500 [.....8........e.] D/000770: 8500A900 38EDFE02 8503A900 8502A501 [....8...........] D/000780: D098EAEA 4C87D7E6 02D005E6 03D00560 [....L..........`] D/000790: EA4C94D7 D0EC0000 F6F6E8E8 DBDBCFCF [.L..............] D/0007A0: C3C3B8B8 AEAEA4A4 9B9B9292 8A8A8282 [................] D/0007B0: 7B7B7474 6D6E6768 61625C5C 57575252 [{{ttmnghab\\WWRR] D/0007C0: 4D4E4949 45454141 3D3E3A3A 36373334 [MNIIEEAA=>::6734] D/0007D0: 30312E2E 2B2C2929 26272425 22232021 [01..+,))&'$%"#.!] D/0007E0: 1E1F1D1D 1B1C1A1A 18191717 15161415 [................] D/0007F0: 13141212 11111010 0F100E0F FFFFFFFF [................] D/000800: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000810: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000820: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000830: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000840: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000850: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000860: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000870: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000880: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000890: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0008A0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0008B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0008C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0008D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0008E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0008F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000900: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000910: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000920: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000930: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000940: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000950: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000960: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000970: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000980: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000990: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009A0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/0009F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A10: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A20: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A30: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A40: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A50: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000A90: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000AA0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000AB0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000AC0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000AD0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000AE0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000AF0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B10: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B20: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B30: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B40: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B50: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000B90: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000BA0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000BB0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000BC0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000BD0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000BE0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000BF0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C10: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C20: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C30: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C40: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C50: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000C90: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000CA0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000CB0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000CC0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000CD0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000CE0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000CF0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D10: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D20: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D30: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D40: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D50: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000D90: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000DA0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000DB0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000DC0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000DD0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000DE0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000DF0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E10: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E20: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E30: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E40: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E50: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000E90: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000EA0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000EB0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000EC0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000ED0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000EE0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000EF0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F00: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F10: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F20: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F30: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F40: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F50: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F60: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F70: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F80: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000F90: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000FA0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000FB0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000FC0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000FD0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000FE0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/000FF0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF [................] D/001000: 2000F04C B3E28533 4CEDFD60 8A2920F0 [...L...3L..`.)..] D/001010: 23A9A085 E44CEDFD A920C524 B00CA98D [#....L.....$....] D/001020: A00720ED FDA9A088 D0F8A000 B1E2E6E2 [................] D/001030: D002E6E3 602015E7 2076E5A5 E2C5E6A5 [....`....v......] D/001040: E3E5E7B0 EF206DE0 4C3BE0A5 CA85E2A5 [......m.L;......] D/001050: CB85E3A5 4C85E6A5 4D85E7D0 DE2015E7 [....L...M.......] D/001060: 206DE5A5 E485E2A5 E585E3B0 C786D8A9 [.m..............] D/001070: A085FA20 2AE09885 E4202AE0 AA202AE0 [....*.....*...*.] D/001080: 201BE520 18E084FA AA10180A 10E9A5E4 [................] D/001090: D0032011 E08A20ED FDA92520 1AE0AA30 [..........%....0] D/0010A0: F585E4C9 01D005A6 D84C8EFD 4884CEA2 [.........L..H...] D/0010B0: ED86CFC9 519004C6 CFE95048 B1CEAA88 [....Q.....PH....] D/0010C0: B1CE10FA E0C0B004 E00030F2 AA68E901 [..........0..h..] D/0010D0: D0E924E4 300320F8 EFB1CE10 10AA293F [..$.0.........)?] D/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 784C23E8 2034EEF0 E738E901 [....xL#..4...8..] D/001120: 602018E1 955018F5 784C02E1 A014D0D6 [`....P..xL......] D/001130: 2018E1E8 B55085DA 65CE48A8 B57885DB [.....P..e.H..x..] D/001140: 65CF48C4 CAE5CBB0 E3A5DA69 FE85DAA9 [e.H........i....] D/001150: FFA865DB 85DBC8B1 DAD9CC00 D00F98F0 [..e.............] D/001160: F56891DA 99CC0088 10F7E860 EAA080D0 [.h.........`....] D/001170: 95A90020 0AE7A002 9478200A E786D8AA [.........x......] D/001180: E6332051 F3C6338A A6D89578 B55185CE [.3.Q..3....x.Q..] D/001190: B57985CF E8E820BC E1B54ED5 76B015F6 [.y........N.v...] D/0011A0: 4EA8B1CE B450C4E4 9004A083 D0C191DA [N....P..........] D/0011B0: F65090E5 B4508A91 DA4C23F2 B55185DA [.P...P...L#..Q..] D/0011C0: 38E90285 E4B57985 DBE90085 E5A000B1 [8.....y.........] D/0011D0: E418E5DA 85E460B5 5385CEB5 7B85CFB5 [......`.S...{...] D/0011E0: 5185DAB5 7985DBE8 E8E8A000 947894A0 [Q...y........x..] D/0011F0: C89450B5 4DD57508 48B54FD5 77900768 [..P.M.u.H.O.w..h] D/001200: 28B00256 5060A8B1 CE85E468 A828B0F3 [(..VP`.....h.(..] D/001210: B1DAC5E4 D0EDF64F F64DB0D7 20D7E14C [.......O.M.....L] D/001220: 36E72054 E206CE26 CF900D18 A5E665DA [6..T...&......e.] D/001230: 85E6A5E7 65DB85E7 88F00906 E626E710 [....e........&..] D/001240: E44C7EE7 A5E62008 E7A5E795 A006E590 [.L~.............] D/001250: 284C6FE7 A95585E5 205BE2A5 CE85DAA5 [(Lo..U...[......] D/001260: CF85DB20 15E784E6 84E7A5CF 1009CA06 [................] D/001270: E5206FE7 2015E7A0 1060206C EEF0C5FF [..o......`.l....] D/001280: E633A000 20CEE3C6 33602034 EE4A0820 [.3......3`.4.J..] D/001290: 47F82034 EEA8B126 2890044A 4A4A4A29 [G..4...&(..JJJJ)] D/0012A0: 0FA00020 08E794A0 8884D760 FFFFFFFF [...........`....] D/0012B0: 20D3EF20 8EFD46D9 A9BE2006 E0A00084 [......F.........] D/0012C0: FA24F810 0CA6F6A5 F7201BE5 A9A020ED [.$..............] D/0012D0: FDA2FF9A 20CEE384 F18A85C8 A2202091 [................] D/0012E0: E4A5C869 0085E0A9 00AA6902 85E1A1E0 [...i......i.....] D/0012F0: 29F0C9B0 F0034C83 E8A002B1 E099CD00 [).....L.........] D/001300: 88D0F820 8AE3A5F1 E5C8C904 F0A891E0 [................] D/001310: A5CAF1E0 85E4A5CB E90085E5 A5E4C5CC [................] D/001320: A5E5E5CD 9045A5CA F1E085E6 A5CBE900 [.....E..........] D/001330: 85E7B1CA 91E6E6CA D002E6CB A5E2C5CA [................] D/001340: A5E3E5CB B0E0B5E4 95CACA10 F9B1E0A8 [................] D/001350: 88B1E091 E698D0F8 24F81009 B5F775F5 [........$.....u.] D/001360: 95F7E8F0 F7107E00 000000A0 14D07120 [......~.......q.] D/001370: 15E7A5E2 85E6A5E3 85E72075 E5A5E285 [...........u....] D/001380: E4A5E385 E5D00E20 15E7206D E5A5E685 [...........m....] D/001390: E2A5E785 E3A000A5 CAC5E4A5 CBE5E5B0 [................] D/0013A0: 16A5E4D0 02C6E5C6 E4A5E6D0 02C6E7C6 [................] D/0013B0: E6B1E491 E690E0A5 E685CAA5 E785CB60 [...............`] D/0013C0: 20EDFDC8 B900EB30 F709804C EDFD98AA [.......0...L....] D/0013D0: 2075FD8A A8A9DF99 0002A2FF 6060A006 [.u..........``..] D/0013E0: 20D3EE24 D930034C B6E24C9A EB2A69A0 [...$.0.L..L..*i.] D/0013F0: DD0002D0 53B1FE0A 300688B1 FE3029C8 [....S...0....0).] D/001400: 86C89848 A200A1FE AA4A4940 11FEC9C0 [...H.....JI@....] D/001410: 9001E8C8 D0F368A8 8A4CF8F2 E6F1A6F1 [......h..L......] D/001420: F0BC9D00 0260A6C8 A9A0E8DD 0002B0FA [.....`..........] D/001430: B1FE293F 4AD0B6BD 0002B006 693FC91A [..)?J.......i?..] D/001440: 906F694F C90A9069 A6FDC8B1 FE29E0C9 [.oiO...i.....)..] D/001450: 20F07AB5 A885C8B5 D185F188 B1FE0A10 [..z.............] D/001460: FA88B038 0A3035B4 5884FFB4 80E810DA [...8.05.X.......] D/001470: F0B3C97E B022CA10 04A00610 299480A4 [...~."......)...] D/001480: FF9458A4 C894A8A4 F194D129 1FA8B997 [..X........)....] D/001490: F10AA8A9 762A85FF D001C8C8 86FDB1FE [....v*..........] D/0014A0: 3084D005 A00E4CE0 E3C903B0 C34AA6C8 [0.....L......J..] D/0014B0: E8BD0002 9004C9A2 F00AC9DF F00686C8 [................] D/0014C0: 201CE4C8 88A6FDB1 FE880A10 CFB45884 [..............X.] D/0014D0: FFB480E8 B1FE299F D0ED85F2 85F39848 [......)........H] D/0014E0: 86FDB4D0 84C918A9 0A85F9A2 00C8B900 [................] D/0014F0: 02290F65 F2488A65 F3301CAA 68C6F9D0 [.).e.H.e.0..h...] D/001500: F285F286 F3C4F1D0 DEA4C9C8 84F1201C [................] D/001510: E468A8A5 F3B0A9A0 00108B85 F386F2A2 [.h..............] D/001520: 0486C9A9 B085F9A5 F2DD63E5 A5F3FD68 [..........c....h] D/001530: E5900D85 F3A5F2FD 63E585F2 E6F9D0E7 [........c.......] D/001540: A5F9E8CA F00EC9B0 F00285C9 24C93004 [............$.0.] D/001550: A5FAF00B 20EDFD24 FY01 INSTR'S F9A5: 9A F9A6: 00 319 FMT2 DFB $00 ;ERR F9A7: 21 320 DFB $21 ;IMM F9A8: 81 321 DFB $81 ;Z-PAGE F9A9: 82 322 DFB $82 ;ABS F9AA: 00 323 DFB $00 ;IMPLIED F9AB: 00 324 DFB $00 ;ACCUMULATOR F9AC: 59 325 DFB $59 ;(ZPAG,X) F9AD: 4D 326 DFB $4D ;(ZPAG),Y F9AE: 91 327 DFB $91 ;ZPAG,X F9AF: 92 328 DFB $92 ;ABS,X F9B0: 86 329 DFB $86 ;ABS,Y F9B1: 4A 330 DFB $4A ;(ABS) F9B2: 85 331 DFB $85 ;ZPAG,Y F9B3: 9D 332 DFB $9D ;RELATIVE F9B4: AC A9 AC 333 CHAR1 ASC ",),#($" F9B7: A3 A8 A4 F9BA: D9 00 D8 334 CHAR2 DFB $D9,$00,$D8,$A4,$A4,$00 F9BD: A4 A4 00 335 *CHAR2: "Y",0,"X$$",0 336 * MNEML IS OF FORM: 337 * (A) XXXXX000 338 * (B) XXXYY100 339 * (C) 1XXX1010 340 * (D) XXXYYY10 341 * (E) XXXYYY01 342 * (X=INDEX) F9C0: 1C 8A 1C 343 MNEML DFB $1C,$8A,$1C,$23,$5D,$8B F9C3: 23 5D 8B F9C6: 1B A1 9D 344 DFB $1B,$A1,$9D,$8A,$1D,$23 F9C9: 8A 1D 23 F9CC: 9D 8B 1D 345 DFB $9D,$8B,$1D,$A1,$00,$29 F9CF: A1 00 29 F9D2: 19 AE 69 346 DFB $19,$AE,$69,$A8,$19,$23 F9D5: A8 19 23 F9D8: 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 F9E0: 00 1A 5B 349 DFB $00,$1A,$5B,$5B,$A5,$69 F9E3: 5B A5 69 F9E6: 24 24 350 DFB $24,$24 ;(B) FORMAT F9E8: AE AE A8 351 DFB $AE,$AE,$A8,$AD,$29,$00 F9EB: AD 29 00 F9EE: 7C 00 352 DFB $7C,$00 ;(C) FORMAT F9F0: 15 9C 6D 353 DFB $15,$9C,$6D,$9C,$A5,$69 F9F3: 9C A5 69 F9F6: 29 53 354 DFB $29,$53 ;(D) FORMAT F9F8: 84 13 34 355 DFB $84,$13,$34,$11,$A5,$69 F9FB: 11 A5 69 F9FE: 23 A0 356 DFB $23,$A0 ;(E) FORMAT FA00: D8 62 5A 357 MNEMR DFB $D8,$62,$5A,$48,$26,$62 FA03: 48 26 62 FA06: 94 88 54 358 DFB $94,$88,$54,$44,$C8,$54 FA09: 44 C8 54 FA0C: 68 44 E8 359 DFB $68,$44,$E8,$94,$00,$B4 FA0F: 94 00 B4 FA12: 08 84 74 360 DFB $08,$84,$74,$B4,$28,$6E FA15: B4 28 6E FA18: 74 F4 CC 361 DFB $74,$F4,$CC,$4A,$72,$F2 FA1B: 4A 72 F2 FA1E: A4 8A 362 DFB $A4,$8A ;(A) FORMAT FA20: 00 AA A2 363 DFB $00,$AA,$A2,$A2,$74,$74 FA23: A2 74 74 FA26: 74 72 364 DFB $74,$72 ;(B) FORMAT FA28: 44 68 B2 365 DFB $44,$68,$B2,$32,$B2,$00 FA2B: 32 B2 00 FA2E: 22 00 366 DFB $22,$00 ;(C) FORMAT FA30: 1A 1A 26 367 DFB $1A,$1A,$26,$26,$72,$72 FA33: 26 72 72 FA36: 88 C8 368 DFB $88,$C8 ;(D) FORMAT FA38: C4 CA 26 369 DFB $C4,$CA,$26,$48,$44,$44 FA3B: 48 44 44 FA3E: A2 C8 370 DFB $A2,$C8 ;(E) FORMAT FA40: FF FF FF 371 DFB $FF,$FF,$FF FA43: 20 D0 F8 372 STEP JSR INSTDSP ;DISASSEMBLE ONE INST FA46: 68 373 PLA ; AT (PCL,H) FA47: 85 2C 374 STA RTNL ;ADJUST TO USER FA49: 68 375 PLA ; STACK. SAVE FA4A: 85 2D 376 STA RTNH ; RTN ADR. FA4C: A2 08 377 LDX #$08 FA4E: BD 10 FB 378 XQINIT LDA INITBL-1,X ;INIT XEQ AREA FA51: 95 3C 379 STA XQT,X FA53: CA 380 DEX FA54: D0 F8 381 BNE XQINIT FA56: A1 3A 382 LDA (PCL,X) ;USER OPCODE BYTE FA58: F0 42 383 BEQ XBRK ;SPECIAL IF BREAK FA5A: A4 2F 384 LDY LENGTH ;LEN FROM DISASSEMBLY FA5C: C9 20 385 CMP #$20 FA5E: F0 59 386 BEQ XJSR ;HANDLE JSR, RTS, JMP, FA60: C9 60 387 CMP #$60 ; JMP (), RTI SPECIAL FA62: F0 45 388 BEQ XRTS FA64: C9 4C 389 CMP #$4C FA66: F0 5C 390 BEQ XJMP FA68: C9 6C 391 CMP #$6C FA6A: F0 59 392 BEQ XJMPAT FA6C: C9 40 393 CMP #$40 FA6E: F0 35 394 BEQ XRTI FA70: 29 1F 395 AND #$1F FA72: 49 14 396 EOR #$14 FA74: C9 04 397 CMP #$04 ;COPY USER INST TO XEQ AREA FA76: F0 02 398 BEQ XQ2 ; WITH TRAILING NOPS FA78: B1 3A 399 XQ1 LDA (PCL),Y ;CHANGE REL BRANCH FA7A: 99 3C 00 400 XQ2 STA XQT,Y ; DISP TO 4 FOR FA7D: 88 401 DEY ; JMP TO BRANCH OR FA7E: 10 F8 402 BPL XQ1 ; NBRANCH FROM XEQ. FA80: 20 3F FF 403 JSR RESTORE ;RESTORE USER REG CONTENTS. FA83: 4C 3C 00 404 JMP XQT ;XEQ USER OP FROM RAM FA86: 85 45 405 IRQ STA ACC ; (RETURN TO NBRANCH) FA88: 68 406 PLA FA89: 48 407 PHA ;**IRQ HANDLER FA8A: 0A 408 ASL FA8B: 0A 409 ASL FA8C: 0A 410 ASL FA8D: 30 03 411 BMI BREAK ;TEST FOR BREAK FA8F: 6C FE 03 412 JMP (IRQLOC) ;USER ROUTINE VECTOR IN RAM FA92: 28 413 BREAK PLP FA93: 20 4C FF 414 JSR SAV1 ;SAVE REG'S ON BREAK FA96: 68 415 PLA ; INCLUDING PC FA97: 85 3A 416 STA PCL FA99: 68 417 PLA FA9A: 85 3B 418 STA PCH FA9C: 20 82 F8 419 XBRK JSR INSDS1 ;PRINT USER PC. FA9F: 20 DA FA 420 JSR RGDSP1 ; AND REG'S FAA2: 4C 65 FF 421 JMP MON ;GO TO MONITOR FAA5: 18 422 XRTI CLC FAA6: 68 423 PLA ;SIMULATE RTI BY EXPECTING FAA7: 85 48 424 STA STATUS ; STATUS FROM STACK, THEN RTS FAA9: 68 425 XRTS PLA ;RTS SIMULATION FAAA: 85 3A 426 STA PCL ; EXTRACT PC FROM STACK FAAC: 68 427 PLA ; AND UPDATE PC BY 1 (LEN=0) FAAD: 85 3B 428 PCINC2 STA PCH FAAF: A5 2F 429 PCINC3 LDA LENGTH ;UPDATE PC BY LEN FAB1: 20 56 F9 430 JSR PCADJ3 FAB4: 84 3B 431 STY PCH FAB6: 18 432 CLC FAB7: 90 14 433 BCC NEWPCL FAB9: 18 434 XJSR CLC FABA: 20 54 F9 435 JSR PCADJ2 ;UPDATE PC AND PUSH FABD: AA 436 TAX ; ONTO STACH FOR FABE: 98 437 TYA ; JSR SIMULATE FABF: 48 438 PHA FAC0: 8A 439 TXA FAC1: 48 440 PHA FAC2: A0 02 441 LDY #$02 FAC4: 18 442 XJMP CLC FAC5: B1 3A 443 XJMPAT LDA (PCL),Y FAC7: AA 444 TAX ;LOAD PC FOR JMP, FAC8: 88 445 DEY ; (JMP) SIMULATE. FAC9: B1 3A 446 LDA (PCL),Y FACB: 86 3B 447 STX PCH FACD: 85 3A 448 NEWPCL STA PCL FACF: B0 F3 449 BCS XJMP FAD1: A5 2D 450 RTNJMP LDA RTNH FAD3: 48 451 PHA FAD4: A5 2C 452 LDA RTNL FAD6: 48 453 PHA FAD7: 20 8E FD 454 REGDSP JSR CROUT ;DISPLAY USER REG FADA: A9 45 455 RGDSP1 LDA #ACC ; CONTENTS WITH FADC: 85 40 456 STA A3L ; LABELS FADE: A9 00 457 LDA #ACC/256 FAE0: 85 41 458 STA A3H FAE2: A2 FB 459 LDX #$FB FAE4: A9 A0 460 RDSP1 LDA #$A0 FAE6: 20 ED FD 461 JSR COUT FAE9: BD 1E FA 462 LDA RTBL-$FB,X FAEC: 20 ED FD 463 JSR COUT FAEF: A9 BD 464 LDA #$BD FAF1:Y01 INSTR'S F9A5: 9A F9A6: 00 319 FMT2 DFB $00 ;ERR F9A7: 21 320 DFB $21 ;IMM F9A8: 81 321 DFB $81 ;Z-PAGE F9A9: 82 322 DFB $82 ;ABS F9AA: 00 323 DFB $00 ;IMPLIED F9AB: 00 324 DFB $00 ;ACCUMULATOR F9AC: 59 325 DFB $59 ;(ZPAG,X) F9AD: 4D 326 DFB $4D ;(ZPAG),Y F9AE: 91 327 DFB $91 ;ZPAG,X F9AF: 92 328 DFB $92 ;ABS,X F9B0: 86 329 DFB $86 ;ABS,Y F9B1: 4A 330 DFB $4A ;(ABS) F9B2: 85 331 DFB $85 ;ZPAG,Y F9B3: 9D 332 DFB $9D ;RELATIVE F9B4: AC A9 AC 333 CHAR1 ASC ",),#($" F9B7: A3 A8 A4 F9BA: D9 00 D8 334 CHAR2 DFB $D9,$00,$D8,$A4,$A4,$00 F9BD: A4 A4 00 335 *CHAR2: "Y",0,"X$$",0 336 * MNEML IS OF FORM: 337 * (A) XXXXX000 338 * (B) XXXYY100 339 * (C) 1XXX1010 340 * (D) XXXYYY10 341 * (E) XXXYYY01 342 * (X=INDEX) F9C0: 1C 8A 1C 343 MNEML DFB $1C,$8A,$1C,$23,$5D,$8B F9C3: 23 5D 8B F9C6: 1B A1 9D 344 DFB $1B,$A1,$9D,$8A,$1D,$23 F9C9: 8A 1D 23 F9CC: 9D 8B 1D 345 DFB $9D,$8B,$1D,$A1,$00,$29 F9CF: A1 00 29 F9D2: 19 AE 69 346 DFB $19,$AE,$69,$A8,$19,$23 F9D5: A8 19 23 F9D8: 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 F9E0: 00 1A 5B 349 DFB $00,$1A,$5B,$5B,$A5,$69 F9E3: 5B A5 69 F9E6: 24 24 350 DFB $24,$24 ;(B) FORMAT F9E8: AE AE A8 351 DFB $AE,$AE,$A8,$AD,$29,$00 F9EB: AD 29 00 F9EE: 7C 00 352 DFB $7C,$00 ;(C) FORMAT F9F0: 15 9C 6D 353 DFB $15,$9C,$6D,$9C,$A5,$69 F9F3: 9C A5 69 F9F6: 29 53 354 DFB $29,$53 ;(D) FORMAT F9F8: 84 13 34 355 DFB $84,$13,$34,$11,$A5,$69 F9FB: 11 A5 69 F9FE: 23 A0 356 DFB $23,$A0 ;(E) FORMAT FA00: D8 62 5A 357 MNEMR DFB $D8,$62,$5A,$48,$26,$62 FA03: 48 26 62 FA06: 94 88 54 358 DFB $94,$88,$54,$44,$C8,$54 FA09: 44 C8 54 FA0C: 68 44 E8 359 DFB $68,$44,$E8,$94,$00,$B4 FA0F: 94 00 B4 FA12: 08 84 74 360 DFB $08,$84,$74,$B4,$28,$6E FA15: B4 28 6E FA18: 74 F4 CC 361 DFB $74,$F4,$CC,$4A,$72,$F2 FA1B: 4A 72 F2 FA1E: A4 8A 362 DFB $A4,$8A ;(A) FORMAT FA20: 00 AA A2 363 DFB $00,$AA,$A2,$A2,$74,$74 FA23: A2 74 74 FA26: 74 72 364 DFB $74,$72 ;(B) FORMAT FA28: 44 68 B2 365 DFB $44,$68,$B2,$32,$B2,$00 FA2B: 32 B2 00 FA2E: 22 00 366 DFB $22,$00 ;(C) FORMAT FA30: 1A 1A 26 367 DFB $1A,$1A,$26,$26,$72,$72 FA33: 26 72 72 FA36: 88 C8 368 DFB $88,$C8 ;(D) FORMAT FA38: C4 CA 26 369 DFB $C4,$CA,$26,$48,$44,$44 FA3B: 48 44 44 FA3E: A2 C8 370 DFB $A2,$C8 ;(E) FORMAT FA40: FF FF FF 371 DFB $FF,$FF,$FF FA43: 20 D0 F8 372 STEP JSR INSTDSP ;DISASSEMBLE ONE INST FA46: 68 373 PLA ; AT (PCL,H) FA47: 85 2C 374 STA RTNL ;ADJUST TO USER FA49: 68 375 PLA ; STACK. SAVE FA4A: 85 2D 376 STA RTNH ; RTN ADR. FA4C: A2 08 377 LDX #$08 FA4E: BD 10 FB 378 XQINIT LDA INITBL-1,X ;INIT XEQ AREA FA51: 95 3C 379 STA XQT,X FA53: CA 380 DEX FA54: D0 F8 381 BNE XQINIT FA56: A1 3A 382 LDA (PCL,X) ;USER OPCODE BYTE FA58: F0 42 383 BEQ XBRK ;SPECIAL IF BREAK FA5A: A4 2F 384 LDY LENGTH ;LEN FROM DISASSEMBLY FA5C: C9 20 385 CMP #$20 FA5E: F0 59 386 BEQ XJSR ;HANDLE JSR, RTS, JMP, FA60: C9 60 387 CMP #$60 ; JMP (), RTI SPECIAL FA62: F0 45 388 BEQ XRTS FA64: C9 4C 389 CMP #$4C FA66: F0 5C 390 BEQ XJMP FA68: C9 6C 391 CMP #$6C FA6A: F0 59 392 BEQ XJMPAT FA6C: C9 40 393 CMP #$40 FA6E: F0 35 394 BEQ XRTI FA70: 29 1F 395 AND #$1F FA72: 49 14 396 EOR #$14 FA74: C9 04 397 CMP #$04 ;COPY USER INST TO XEQ AREA FA76: F0 02 398 BEQ XQ2 ; WITH TRAILING NOPS FA78: B1 3A 399 XQ1 LDA (PCL),Y ;CHANGE REL BRANCH FA7A: 99 3C 00 400 XQ2 STA XQT,Y ; DISP TO 4 FOR FA7D: 88 401 DEY ; JMP TO BRANCH OR FA7E: 10 F8 402 BPL XQ1 ; NBRANCH FROM XEQ. FA80: 20 3F FF 403 JSR RESTORE ;RESTORE USER REG CONTENTS. FA83: 4C 3C 00 404 JMP XQT ;XEQ USER OP FROM RAM FA86: 85 45 405 IRQ STA ACC ; (RETURN TO NBRANCH) FA88: 68 406 PLA FA89: 48 407 PHA ;**IRQ HANDLER FA8A: 0A 408 ASL FA8B: 0A 409 ASL FA8C: 0A 410 ASL FA8D: 30 03 411 BMI BREAK ;TEST FOR BREAK FA8F: 6C FE 03 412 JMP (IRQLOC) ;USER ROUTINE VECTOR IN RAM FA92: 28 413 BREAK PLP FA93: 20 4C FF 414 JSR SAV1 ;SAVE REG'S ON BREAK FA96: 68 415 PLA ; INCLUDING PC FA97: 85 3A 416 STA PCL FA99: 68 417 PLA FA9A: 85 3B 418 STA PCH FA9C: 20 82 F8 419 XBRK JSR INSDS1 ;PRINT USER PC. FA9F: 20 DA FA 420 JSR RGDSP1 ; AND REG'S FAA2: 4C 65 FF 421 JMP MON ;GO TO MONITOR FAA5: 18 422 XRTI CLC FAA6: 68 423 PLA ;SIMULATE RTI BY EXPECTING FAA7: 85 48 424 STA STATUS ; STATUS FROM STACK, THEN RTS FAA9: 68 425 XRTS PLA ;RTS SIMULATION FAAA: 85 3A 426 STA PCL ; EXTRACT PC FROM STACK FAAC: 68 427 PLA ; AND UPDATE PC BY 1 (LEN=0) FAAD: 85 3B 428 PCINC2 STA PCH FAAF: A5 2F 429 PCINC3 LDA LENGTH ;UPDATE PC BY LEN FAB1: 20 56 F9 430 JSR PCADJ3 FAB4: 84 3B 431 STY PCH FAB6: 18 432 CLC FAB7: 90 14 433 BCC NEWPCL FAB9: 18 434 XJSR CLC FABA: 20 54 F9 435 JSR PCADJ2 ;UPDATE PC AND PUSH FABD: AA 436 TAX ; ONTO STACH FOR FABE: 98 437 TYA ; JSR SIMULATE FABF: 48 438 PHA FAC0: 8A 439 TXA FAC1: 48 440 PHA FAC2: A0 02 441 LDY #$02 FAC4: 18 442 XJMP CLC FAC5: B1 3A 443 XJMPAT LDA (PCL),Y FAC7: AA 444 TAX ;LOAD PC FOR JMP, FAC8: 88 445 DEY ; (JMP) SIMULATE. FAC9: B1 3A 446 LDA (PCL),Y FACB: 86 3B 447 STX PCH FACD: 85 3A 448 NEWPCL STA PCL FACF: B0 F3 449 BCS XJMP FAD1: A5 2D 450 RTNJMP LDA RTNH FAD3: 48 451 PHA FAD4: A5 2C 452 LDA RTNL FAD6: 48 453 PHA FAD7: 20 8E FD 454 REGDSP JSR CROUT ;DISPLAY USER REG FADA: A9 45 455 RGDSP1 LDA #ACC ; CONTENTS WITH FADC: 85 40 456 STA A3L ; LABELS FADE: A9 00 457 LDA #ACC/256 FAE0: 85 41 458 STA A3H FAE2: A2 FB 459 LDX #$FB FAE4: A9 A0 460 RDSP1 LDA #$A0 FAE6: 20 ED FD 461 JSR COUT FAE9: BD 1E FA 462 LDA RTBL-$FB,X FAEC: 20 ED FD 463 JSR COUT FAEF: A9 BD 464 LDA #$BD FAF1:Y01 INSTR'S F9A5: 9A F9A6: 00 319 FMT2 DFB $00 ;ERR F9A7: 21 320 DFB $21 ;IMM F9A8: 81 321 DFB $81 ;Z-PAGE F9A9: 82 322 DFB $82 ;ABS F9AA: 00 323 DFB $00 ;IMPLIED F9AB: 00 324 DFB $00 ;ACCUMULATOR F9AC: 59 325 DFB $59 ;(ZPAG,X) F9AD: 4D 326 DFB $4D ;(ZPAG),Y F9AE: 91 327 DFB $91 ;ZPAG,X F9AF: 92 328 DFB $92 ;ABS,X F9B0: 86 329 DFB $86 ;ABS,Y F9B1: 4A 330 DFB $4A ;(ABS) F9B2: 85 331 DFB $85 ;ZPAG,Y F9B3: 9D 332 DFB $9D ;RELATIVE F9B4: AC A9 AC 333 CHAR1 ASC ",),#($" F9B7: A3 A8 A4 F9BA: D9 00 D8 334 CHAR2 DFB $D9,$00,$D8,$A4,$A4,$00 F9BD: A4 A4 00 335 *CHAR2: "Y",0,"X$$",0 336 * MNEML IS OF FORM: 337 * (A) XXXXX000 338 * (B) XXXYY100 339 * (C) 1XXX1010 340 * (D) XXXYYY10 341 * (E) XXXYYY01 342 * (X=INDEX) F9C0: 1C 8A 1C 343 MNEML DFB $1C,$8A,$1C,$23,$5D,$8B F9C3: 23 5D 8B F9C6: 1B A1 9D 344 DFB $1B,$A1,$9D,$8A,$1D,$23 F9C9: 8A 1D 23 F9CC: 9D 8B 1D 345 DFB $9D,$8B,$1D,$A1,$00,$29 F9CF: A1 00 29 F9D2: 19 AE 69 346 DFB $19,$AE,$69,$A8,$19,$23 F9D5: A8 19 23 F9D8: 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 F9E0: 00 1A 5B 349 DFB $00,$1A,$5B,$5B,$A5,$69 F9E3: 5B A5 69 F9E6: 24 24 350 DFB $24,$24 ;(B) FORMAT F9E8: AE AE A8 351 DFB $AE,$AE,$A8,$AD,$29,$00 F9EB: AD 29 00 F9EE: 7C 00 352 DFB $7C,$00 ;(C) FORMAT F9F0: 15 9C 6D 353 DFB $15,$9C,$6D,$9C,$A5,$69 F9F3: 9C A5 69 F9F6: 29 53 354 DFB $29,$53 ;(D) FORMAT F9F8: 84 13 34 355 DFB $84,$13,$34,$11,$A5,$69 F9FB: 11 A5 69 F9FE: 23 A0 356 DFB $23,$A0 ;(E) FORMAT FA00: D8 62 5A 357 MNEMR DFB $D8,$62,$5A,$48,$26,$62 FA03: 48 26 62 FA06: 94 88 54 358 DFB $94,$88,$54,$44,$C8,$54 FA09: 44 C8 54 FA0C: 68 44 E8 359 DFB $68,$44,$E8,$94,$00,$B4 FA0F: 94 00 B4 FA12: 08 84 74 360 DFB $08,$84,$74,$B4,$28,$6E FA15: B4 28 6E FA18: 74 F4 CC 361 DFB $74,$F4,$CC,$4A,$72,$F2 FA1B: 4A 72 F2 FA1E: A4 8A 362 DFB $A4,$8A ;(A) FORMAT FA20: 00 AA A2 363 DFB $00,$AA,$A2,$A2,$74,$74 FA23: A2 74 74 FA26: 74 72 364 DFB $74,$72 ;(B) FORMAT FA28: 44 68 B2 365 DFB $44,$68,$B2,$32,$B2,$00 FA2B: 32 B2 00 FA2E: 22 00 366 DFB $22,$00 ;(C) FORMAT FA30: 1A 1A 26 367 DFB $1A,$1A,$26,$26,$72,$72 FA33: 26 72 72 FA36: 88 C8 368 DFB $88,$C8 ;(D) FORMAT FA38: C4 CA 26 369 DFB $C4,$CA,$26,$48,$44,$44 FA3B: 48 44 44 FA3E: A2 C8 370 DFB $A2,$C8 ;(E) FORMAT FA40: FF FF FF 371 DFB $FF,$FF,$FF FA43: 20 D0 F8 372 STEP JSR INSTDSP ;DISASSEMBLE ONE INST FA46: 68 373 PLA ; AT (PCL,H) FA47: 85 2C 374 STA RTNL ;ADJUST TO USER FA49: 68 375 PLA ; STACK. SAVE FA4A: 85 2D 376 STA RTNH ; RTN ADR. FA4C: A2 08 377 LDX #$08 FA4E: BD 10 FB 378 XQINIT LDA INITBL-1,X ;INIT XEQ AREA FA51: 95 3C 379 STA XQT,X FA53: CA 380 DEX FA54: D0 F8 381 BNE XQINIT FA56: A1 3A 382 LDA (PCL,X) ;USER OPCODE BYTE FA58: F0 42 383 BEQ XBRK ;SPECIAL IF BREAK FA5A: A4 2F 384 LDY LENGTH ;LEN FROM DISASSEMBLY FA5C: C9 20 385 CMP #$20 FA5E: F0 59 386 BEQ XJSR ;HANDLE JSR, RTS, JMP, FA60: C9 60 387 CMP #$60 ; JMP (), RTI SPECIAL FA62: F0 45 388 BEQ XRTS FA64: C9 4C 389 CMP #$4C FA66: F0 5C 390 BEQ XJMP FA68: C9 6C 391 CMP #$6C FA6A: F0 59 392 BEQ XJMPAT FA6C: C9 40 393 CMP #$40 FA6E: F0 35 394 BEQ XRTI FA70: 29 1F 395 AND #$1F FA72: 49 14 396 EOR #$14 FA74: C9 04 397 CMP #$04 ;COPY USER INST TO XEQ AREA FA76: F0 02 398 BEQ XQ2 ; WITH TRAILING NOPS FA78: B1 3A 399 XQ1 LDA (PCL),Y ;CHANGE REL BRANCH FA7A: 99 3C 00 400 XQ2 STA XQT,Y ; DISP TO 4 FOR FA7D: 88 401 DEY ; JMP TO BRANCH OR FA7E: 10 F8 402 BPL XQ1 ; NBRANCH FROM XEQ. FA80: 20 3F FF 403 JSR RESTORE ;RESTORE USER REG CONTENTS. FA83: 4C 3C 00 404 JMP XQT ;XEQ USER OP FROM RAM FA86: 85 45 405 IRQ STA ACC ; (RETURN TO NBRANCH) FA88: 68 406 PLA FA89: 48 407 PHA ;**IRQ HANDLER FA8A: 0A 408 ASL FA8B: 0A 409 ASL FA8C: 0A 410 ASL FA8D: 30 03 411 BMI BREAK ;TEST FOR BREAK FA8F: 6C FE 03 412 JMP (IRQLOC) ;USER ROUTINE VECTOR IN RAM FA92: 28 413 BREAK PLP FA93: 20 4C FF 414 JSR SAV1 ;SAVE REG'S ON BREAK FA96: 68 415 PLA ; INCLUDING PC FA97: 85 3A 416 STA PCL FA99: 68 417 PLA FA9A: 85 3B 418 STA PCH FA9C: 20 82 F8 419 XBRK JSR INSDS1 ;PRINT USER PC. FA9F: 20 DA FA 420 JSR RGDSP1 ; AND REG'S FAA2: 4C 65 FF 421 JMP MON ;GO TO MONITOR FAA5: 18 422 XRTI CLC FAA6: 68 423 PLA ;SIMULATE RTI BY EXPECTING FAA7: 85 48 424 STA STATUS ; STATUS FROM STACK, THEN RTS FAA9: 68 425 XRTS PLA ;RTS SIMULATION FAAA: 85 3A 426 STA PCL ; EXTRACT PC FROM STACK FAAC: 68 427 PLA ; AND UPDATE PC BY 1 (LEN=0) FAAD: 85 3B 428 PCINC2 STA PCH FAAF: A5 2F 429 PCINC3 LDA LENGTH ;UPDATE PC BY LEN FAB1: 20 56 F9 430 JSR PCADJ3 FAB4: 84 3B 431 STY PCH FAB6: 18 432 CLC FAB7: 90 14 433 BCC NEWPCL FAB9: 18 434 XJSR CLC FABA: 20 54 F9 435 JSR PCADJ2 ;UPDATE PC AND PUSH FABD: AA 436 TAX ; ONTO STACH FOR FABE: 98 437 TYA ; JSR SIMULATE FABF: 48 438 PHA FAC0: 8A 439 TXA FAC1: 48 440 PHA FAC2: A0 02 441 LDY #$02 FAC4: 18 442 XJMP CLC FAC5: B1 3A 443 XJMPAT LDA (PCL),Y FAC7: AA 444 TAX ;LOAD PC FOR JMP, FAC8: 88 445 DEY ; (JMP) SIMULATE. FAC9: B1 3A 446 LDA (PCL),Y FACB: 86 3B 447 STX PCH FACD: 85 3A 448 NEWPCL STA PCL FACF: B0 F3 449 BCS XJMP FAD1: A5 2D 450 RTNJMP LDA RTNH FAD3: 48 451 PHA FAD4: A5 2C 452 LDA RTNL FAD6: 48 453 PHA FAD7: 20 8E FD 454 REGDSP JSR CROUT ;DISPLAY USER REG FADA: A9 45 455 RGDSP1 LDA #ACC ; CONTENTS WITH FADC: 85 40 456 STA A3L ; LABELS FADE: A9 00 457 LDA #ACC/256 FAE0: 85 41 458 STA A3H FAE2: A2 FB 459 LDX #$FB FAE4: A9 A0 460 RDSP1 LDA #$A0 FAE6: 20 ED FD 461 JSR COUT FAE9: BD 1E FA 462 LDA RTBL-$FB,X FAEC: 20 ED FD 463 JSR COUT FAEF: A9 BD 464 LDA #$BD FAF1:.......$..] D/002CA0: 9128C8C4 2190F960 3848E901 D0FC68E9 [.(..!..`8H....h.] D/002CB0: 01D0F660 E642D002 E643A53C C53EA53D [...`.B...C.<.>.=] D/002CC0: E53FE63C D002E63D 60A04B20 DBFCD0F9 [.?.<...=`.K.....] D/002CD0: 69FEB0F5 A02120DB FCC8C888 D0FD9005 [i....!..........] D/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 40912868 6C3800E6 4ED002E6 [H)?.@.(hl8..N...] D/002D20: 4F2C00C0 10F59128 AD00C02C 10C06020 [O,.....(...,..`.] D/002D30: 0CFD202C FC200CFD C99BF0F3 60A53248 [...,........`.2H] D/002D40: A9FF8532 BD000220 EDFD6885 32BD0002 [...2......h.2...] D/002D50: C988F01D C998F00A E0F89003 203AFFE8 [.............:..] D/002D60: D013A9DC 20EDFD20 8EFDA533 20EDFDA2 [...........3....] D/002D70: 018AF0F3 CA2035FD C995D002 B128C9E0 [......5......(..] D/002D80: 900229DF 9D0002C9 8DD0B220 9CFCA98D [..).............] D/002D90: D05BA43D A63C208E FD2040F9 A000A9AD [.[.=.<....@.....] D/002DA0: 4CEDFDA5 3C090785 3EA53D85 3FA53C29 [L...<...>.=.?.<)] D/002DB0: 07D00320 92FDA9A0 20EDFDB1 3C20DAFD [............<...] D/002DC0: 20BAFC90 E8604A90 EA4A4AA5 3E900249 [.....`J..JJ.>..I] D/002DD0: FF653C48 A9BD20ED FD68484A 4A4A4A20 [.e.] D/002E10: 40E640D0 02E64160 A434B9FF 01853160 [@.@...A`.4....1`] D/002E20: A201B53E 95429544 CA10F760 B13C9142 [...>.B.D...`.<.B] D/002E30: 20B4FC90 F760B13C D142F01C 2092FDB1 [.....`.<.B......] D/002E40: 3C20DAFD A9A020ED FDA9A820 EDFDB142 [<..............B] D/002E50: 20DAFDA9 A920EDFD 20B4FC90 D9602075 [.............`.u] D/002E60: FEA91448 20D0F820 53F9853A 843B6838 [...H....S..:.;h8] D/002E70: E901D0EF 608AF007 B53C953A CA10F960 [....`....<.:...`] D/002E80: A03FD002 A0FF8432 60A90085 3EA238A0 [.?.....2`...>.8.] D/002E90: 1BD008A9 00853EA2 36A0F0A5 3E290FF0 [......>.6...>)..] D/002EA0: 0609C0A0 00F002A9 FD940095 0160EAEA [.............`..] D/002EB0: 4C00E04C 03E02075 FE203FFF 6C3A004C [L..L...u..?.l:.L] D/002EC0: D7FAC634 2075FE4C 43FA4CF8 03A94020 [...4.u.LC.L...@.] D/002ED0: C9FCA027 A200413C 48A13C20 EDFE20BA [...'..A&?....1...?.=] D/002FA0: 9541E8F0 F3D006A2 00863E86 3FB90002 [.A........>.?...] D/002FB0: C849B0C9 0A90D369 88C9FAB0 CD60A9FE [.I.....i.....`..] D/002FC0: 48B9E3FF 48A531A0 00843160 BCB2BEED [H...H.1...1`....] D/002FD0: EFC4ECA9 BBA6A406 95070205 F000EB93 [................] D/002FE0: A7C699B2 C9BEC135 8CC396AF 17172B1F [.......5......+.] D/002FF0: 837F5DCC B5FC1717 F503FB03 59FF86FA [..].........Y...] Brought to you by: dtcdumpfile 1.0.0 (Apple Macintosh File Hex Dumper) Sunday, July 6, 1997 +------------------------------------------------------------------------ | TOPIC -- Apple II -- Memory map of the Apple II ROMs +------------------------------------------------------------------------ Memory map of the Apple II ROMs * $F800-$FFFF Monitor. Handles screen I/O and keyboard input. Also has a disassembler, memory dump, memory move, memory compare, step and trace functions, lo-res graphics routines, multiply and divide routines, and more. This monitor has the cleanest code of all the Apple II monitors. Every one after this had to patch the monitor to add functions while still remaining (mostly) compatible. Complete source code is in the manual. * $F689-F7FC Sweet-16 interpreter. Sweet-16 code has been benchmarked to be about half the size of pure 6502 code but 5-8 times slower. The renumber routine in the Programmer's Aid #1 is written in Sweet-16, where small size was much more important than speed. Complete source code is in the manual. * $F500-F63C and $F666-F668 Mini-assembler. This lets you type in assembly code, one line at a time, and it will assemble the proper bytes. No labels or equates are supported--it is a MINI assembler. Complete source code is in the manual. * $F425-F4FB and $F63D-F65D Floating point routines. Woz's first plans for his 6502 BASIC included floating point, but he abandoned them when he realized he could finish faster by going integer only. He put these routines in the ROMs but they are not called from anywhere. Complete source code is in the manual. * $E000-F424 Integer BASIC by Woz (Steve Wozniak, creator of the Apple II). "That BASIC, which we shipped with the first Apple II's, was never assembled--ever. There was one handwritten copy, all handwritten, all hand assembled." Woz, October 1984. * $D800-DFFF Empty ROM socket. There was at least one third party ROM add-on. * $D000-D7FF Programmer's Aid #1--missing from the original Apple II, this is a ROM add-on Apple sold that contains Integer BASIC utilities such as high-resolution graphics support, renumber, append, tape verify, music, and a RAM test. Complete source code is in the manual. +------------------------------------------------------------------------ | TOPIC -- Apple II -- Summary of Monitor Commands +------------------------------------------------------------------------ Summary of Apple II Monitor Commands Examining Memory. * {adrs} Examines the value contained in one location. * {adrs1}.{adrs2} Displays the values contained in all locations between {adrs1} and {adrs2}. * [RETURN] Displays the values in up to eight locations following the last opened location. Changing the Contents of Memory. * {adrs}:{val} {val} ... Stores the values in consecutive memory locations starting at {adrs}. * :{val} {val} Stores values in memory starting at the next changeable location. Moving and Comparing. * {dest}<{start}.{end}M Copies the values in the range {start}.{end} into the range beginning at {dest}. (M=move) * {dest}<{start}.{end}V Compares the values in the range {start}.{end} to those in the range beginning at {dest}. (V=verify) Saving and Loading via Cassette Tape. * {start}.{end}W Writes the values in the memory range {start}.{end} onto tape, preceded by a ten-second leader. * {start}.{end}R Reads values from tape, storing them in memory beginning at {start} and stopping at {end}. Prints "ERR" if an error occurs. Running and Listing Programs. * {adrs}G Transfers control to the machine language program beginning at {adrs}. (G=go) * {adrs}L Disassembles and displays 20 instructions, starting at {adrs}. Subsequent L's will display 20 more instructions each. (L=list) Miscellaneous. * {adrs}S Disassemble, display, and execute the instruction at {adrs}, and display the contents of the 6502's internal registers. Subsequent S's will display and execute successive instructions. (S=step) * {adrs}T Step infinitely. The TRACE command stops only when it executes a BRK instruction or when you press RESET. (T=trace) * Contrl-E Displays the contents of the 6502's registers. (E=examine) * I Set Inverse display mode. * N Set Normal display mode. Also useful as a delimiter for putting multiple commands on one line. * Control-B Enter the language currently installed in the Apple's ROM (cold start at $E000). * Control-C Reenter the language currently installed in the Apple's ROM (warm start at $E003). * {val1}+{val2} Add the two values and print the result. * {val2}-{val1} Subtract the second value from the first and print the result. * {slot} Control-P Divert output to the device whose interface card in in slot number {slot}. If {slot}=0, then route output to the Apple's screen. * {slot} Control-K Accept input from the device whose interface card is in slot number {slot}. If {slot}=0, then accept input from the Apple's keyboard. * Control-Y Jump to the machine language subroutine at location $03F8. This lets you add your own commands to the Monitor. The Mini-Assembler. * F666G Invoke the Mini-Assembler. * ${command} Execute a Monitor command from the Mini-Assembler. * FF69G Leave the Mini-Assembler. +------------------------------------------------------------------------ | TOPIC -- Apple II -- Red Book Monitor listing +------------------------------------------------------------------------ 1 *************************** 2 * * 3 * APPLE II * 4 * SYSTEM MONITOR * 5 * * 6 * COPYRIGHT 1977 BY * 7 * APPLE COMPUTER, INC. * 8 * * 9 * ALL RIGHTS RESERVED * 10 * * 11 * S. WOZNIAK * 12 * A. BAUM * 13 * * 14 *************************** 15 ; TITLE "APPLE II SYSTEM MONITOR" 16 LOC0 EQU $00 17 LOC1 EQU $01 18 WNDLFT EQU $20 19 WNDWDTH EQU $21 20 WNDTOP EQU $22 21 WNDBTM EQU $23 22 CH EQU $24 23 CV EQU $25 24 GBASL EQU $26 25 GBASH EQU $27 26 BASL EQU $28 27 BASH EQU $29 28 BAS2L EQU $2A 29 BAS2H EQU $2B 30 H2 EQU $2C 31 LMNEM EQU $2C 32 RTNL EQU $2C 33 V2 EQU $2D 34 RMNEM EQU $2D 35 RTNH EQU $2D 36 MASK EQU $2E 37 CHKSUM EQU $2E 38 FORMAT EQU $2E 39 LASTIN EQU $2F 40 LENGTH EQU $2F 41 SIGN EQU $2F 42 COLOR EQU $30 43 MODE EQU $31 44 INVFLG EQU $32 45 PROMPT EQU $33 46 YSAV EQU $34 47 YSAV1 EQU $35 48 CSWL EQU $36 49 CSWH EQU $37 50 KSWL EQU $38 51 KSWH EQU $39 52 PCL EQU $3A 53 PCH EQU $3B 54 XQT EQU $3C 55 A1L EQU $3C 56 A1H EQU $3D 57 A2L EQU $3E 58 A2H EQU $3F 59 A3L EQU $40 60 A3H EQU $41 61 A4L EQU $42 62 A4H EQU $43 63 A5L EQU $44 64 A5H EQU $45 65 ACC EQU $45 66 XREG EQU $46 67 YREG EQU $47 68 STATUS EQU $48 69 SPNT EQU $49 70 RNDL EQU $4E 71 RNDH EQU $4F 72 ACL EQU $50 73 ACH EQU $51 74 XTNDL EQU $52 75 XTNDH EQU $53 76 AUXL EQU $54 77 AUXH EQU $55 78 PICK EQU $95 79 IN EQU $0200 80 USRADR EQU $03F8 81 NMI EQU $03FB 82 IRQLOC EQU $03FE 83 IOADR EQU $C000 84 KBD EQU $C000 85 KBDSTRB EQU $C010 86 TAPEOUT EQU $C020 87 SPKR EQU $C030 88 TXTCLR EQU $C050 89 TXTSET EQU $C051 90 MIXCLR EQU $C052 91 MIXSET EQU $C053 92 LOWSCR EQU $C054 93 HISCR EQU $C055 94 LORES EQU $C056 95 HIRES EQU $C057 96 TAPEIN EQU $C060 97 PADDL0 EQU $C064 98 PTRIG EQU $C070 99 BASIC EQU $E000 100 BASIC2 EQU $E003 101 ORG $F800 ;ROM START ADDRESS F800: 4A 102 PLOT LSR ;Y-COORD/2 F801: 08 103 PHP ;SAVE LSB IN CARRY F802: 20 47 F8 104 JSR GBASCALC ;CALC BASE ADR IN GBASL,H F805: 28 105 PLP ;RESTORE LSB FROM CARRY F806: A9 0F 106 LDA #$0F ;MASK $0F IF EVEN F808: 90 02 107 BCC RTMASK F80A: 69 E0 108 ADC #$E0 ;MASK $F0 IF ODD F80C: 85 2E 109 RTMASK STA MASK F80E: B1 26 110 PLOT1 LDA (GBASL),Y ;DATA F810: 45 30 111 EOR COLOR ; EOR COLOR F812: 25 2E 112 AND MASK ; AND MASK F814: 51 26 113 EOR (GBASL),Y ; EOR DATA F816: 91 26 114 STA (GBASL),Y ; TO DATA F818: 60 115 RTS F819: 20 00 F8 116 HLINE JSR PLOT ;PLOT SQUARE F81C: C4 2C 117 HLINE1 CPY H2 ;DONE? F81E: B0 11 118 BCS RTS1 ; YES, RETURN F820: C8 119 INY ; NO, INC INDEX (X-COORD) F821: 20 0E F8 120 JSR PLOT1 ;PLOT NEXT SQUARE F824: 90 F6 121 BCC HLINE1 ;ALWAYS TAKEN F826: 69 01 122 VLINEZ ADC #$01 ;NEXT Y-COORD F828: 48 123 VLINE PHA ; SAVE ON STACK F829: 20 00 F8 124 JSR PLOT ; PLOT SQUARE F82C: 68 125 PLA F82D: C5 2D 126 CMP V2 ;DONE? F82F: 90 F5 127 BCC VLINEZ ; NO, LOOP F831: 60 128 RTS1 RTS F832: A0 2F 129 CLRSCR LDY #$2F ;MAX Y, FULL SCRN CLR F834: D0 02 130 BNE CLRSC2 ;ALWAYS TAKEN F836: A0 27 131 CLRTOP LDY #$27 ;MAX Y, TOP SCREEN CLR F838: 84 2D 132 CLRSC2 STY V2 ;STORE AS BOTTOM COORD 133 ; FOR VLINE CALLS F83A: A0 27 134 LDY #$27 ;RIGHTMOST X-COORD (COLUMN) F83C: A9 00 135 CLRSC3 LDA #$00 ;TOP COORD FOR VLINE CALLS F83E: 85 30 136 STA COLOR ;CLEAR COLOR (BLACK) F840: 20 28 F8 137 JSR VLINE ;DRAW VLINE F843: 88 138 DEY ;NEXT LEFTMOST X-COORD F844: 10 F6 139 BPL CLRSC3 ;LOOP UNTIL DONE F846: 60 140 RTS F847: 48 141 GBASCALC PHA ;FOR INPUT 000DEFGH F848: 4A 142 LSR F849: 29 03 143 AND #$03 F84B: 09 04 144 ORA #$04 ; GENERATE GBASH=000001FG F84D: 85 27 145 STA GBASH F84F: 68 146 PLA ; AND GBASL=HDEDE000 F850: 29 18 147 AND #$18 F852: 90 02 148 BCC GBCALC F854: 69 7F 149 ADC #$7F F856: 85 26 150 GBCALC STA GBASL F858: 0A 151 ASL F859: 0A 152 ASL F85A: 05 26 153 ORA GBASL F85C: 85 26 154 STA GBASL F85E: 60 155 RTS F85F: A5 30 156 NXTCOL LDA COLOR ;INCREMENT COLOR BY 3 F861: 18 157 CLC F862: 69 03 158 ADC #$03 F864: 29 0F 159 SETCOL AND #$0F ;SETS COLOR=17*A MOD 16 F866: 85 30 160 STA COLOR F868: 0A 161 ASL ;BOTH HALF BYTES OF COLOR EQUAL F869: 0A 162 ASL F86A: 0A 163 ASL F86B: 0A 164 ASL F86C: 05 30 165 ORA COLOR F86E: 85 30 166 STA COLOR F870: 60 167 RTS F871: 4A 168 SCRN LSR ;READ SCREEN Y-COORD/2 F872: 08 169 PHP ;SAVE LSB (CARRY) F873: 20 47 F8 170 JSR GBASCALC ;CALC BASE ADDRESS F876: B1 26 171 LDA (GBASL),Y ;GET BYTE F878: 28 172 PLP ;RESTORE LSB FROM CARRY F879: 90 04 173 22 ;$A034 and $9022 45 LD @R5 ;Move byte from $A034 to $9022 56 ST @R6 ;Both ptrs are incremented LOAD DOUBLE-BYTE INDIRECT: LDD @Rn [ 6n ] The low order ACC byte is loaded from memory location whose address resides in Rn, and Rn is then incremented by 1. The high order ACC byte is loaded from the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the final ACC contents. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;The low-order ACC byte is loaded 65 LDD @R6 ;from $A034, high-order from ;$A035, R5 is incr to $A036 STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides in Rn, and Rn is the incremented by 1. The high-order ACC byte is stored into the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the ACC contents which are not disturbed. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;Load pointers R5, R6 16 22 90 SET R6 $9022 ;with $A034 and $9022 65 LDD @R5 ;Move double byte from 76 STD @R6 ;$A034-35 to $9022-23. ;Both pointers incremented by 2. POP INDIRECT: POP @Rn [ 8n ] The low-order ACC byte is loaded from the memory location whose address resides in Rn after Rn is decremented by 1, and the high order ACC byte is cleared. Branch conditions reflect the final 2-byte ACC contents which will always be positive and never minus one. The carry is cleared. Because Rn is decremented prior to loading the ACC, single byte stacks may be implemented with the ST @Rn and POP @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 04 00 SET R0 4 ;Load 4 into ACC 55 ST @R5 ;Push 4 onto stack 10 05 00 SET R0 5 ;Load 5 into ACC 55 ST @R5 ;Push 5 onto stack 10 06 00 SET R0 6 ;Load 6 into ACC 55 ST @R5 ;Push 6 onto stack 85 POP @R5 ;Pop 6 off stack into ACC 85 POP @R5 ;Pop 5 off stack 85 POP @R5 ;Pop 4 off stack STORE POP INDIRECT: STP @Rn [ 9n ] The low-order ACC byte is stored into the memory location whose address resides in Rn after Rn is decremented by 1. Branch conditions will reflect the 2-byte ACC contents which are not modified. STP @Rn and POP @Rn are used together to move data blocks beginning at the greatest address and working down. Additionally, single-byte stacks may be implemented with the STP @Rn ops. EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move byte from 95 STP @R5 ;$A033 to $9021 84 POP @R4 ;Move byte from 95 STP @R5 ;$A032 to $9020 ADD: ADD Rn [ An ] The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) and R1 11 27 42 SET R1 $4227 A1 ADD R1 ;Add R1 (sum=B85B, C clear) A0 ADD R0 ;Double ACC (R0) to $70B6 ;with carry set. SUBTRACT: SUB Rn [ Bn ] The contents of Rn are subtracted from the ACC contents by performing a two's complement addition: ACC = ACC + Rn + 1 The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. If the 16-bit unsigned ACC contents are greater than or equal to the 16-bit unsigned Rn contents, then the carry is set, otherwise it is cleared. Rn is not disturbed. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) 11 27 42 SET R1 $4227 ;and R1 B1 SUB R1 ;subtract R1 ;(diff=$340D with c set) B0 SUB R0 ;clears ACC. (R0) POP DOUBLE-BYTE INDIRECT: POPD @Rn [ Cn ] Rn is decremented by 1 and the high-order ACC byte is loaded from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order ACC byte is loaded from the corresponding memory location. Branch conditions reflect the final ACC contents. The carry is cleared. Because Rn is decremented prior to loading each of the ACC halves, double-byte stacks may be implemented with the STD @Rn and POPD @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 12 AA SET R0 $AA12 ;Load $AA12 into ACC 75 STD @R5 ;Push $AA12 onto stack 10 34 BB SET R0 $BB34 ;Load $BB34 into ACC 75 STD @R5 ;Push $BB34 onto stack C5 POPD @R5 ;Pop $BB34 off stack C5 POPD @R5 ;Pop $AA12 off stack COMPARE: CPR Rn [ Dn ] The ACC (R0) contents are compared to Rn by performing the 16 bit binary subtraction ACC-Rn and storing the low order 16 difference bits in R13 for subsequent branch tests. If the 16 bit unsigned ACC contents are greater than or equal to the 16 bit unsigned Rn contents, then the carry is set, otherwise it is cleared. No other registers, including ACC and Rn, are disturbed. EXAMPLE: 15 34 A0 SET R5 $A034 ;Pointer to memory 16 BF A0 SET R6 $A0BF ;Limit address B0 LOOP1 SUB R0 ;Zero data 75 STD @R5 ;clear 2 locations ;increment R5 by 2 25 LD R5 ;Compare pointer R5 D6 CPR R6 ;to limit R6 02 FA BNC LOOP1 ;loop if C clear INCREMENT: INR Rn [ En ] The contents of Rn are incremented by 1. The carry is cleared and other branch conditions reflect the incremented value. EXAMPLE: 15 34 A0 SET R5 $A034 ;(Pointer) B0 SUB R0 ;Zero to R0 55 ST @R5 ;Clr Location $A034 E5 INR R5 ;Incr R5 to $A036 55 ST @R5 ;Clrs location $A036 ;(not $A035) DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other branch conditions reflect the decremented value. EXAMPLE: (Clear 9 bytes beginning at location A034) 15 34 A0 SET R5 $A034 ;Init pointer 14 09 00 SET R4 9 ;Init counter B0 SUB R0 ;Zero ACC 55 LOOP2 ST @R5 ;Clear a mem byte F4 DCR R4 ;Decrement count 07 FC BNZ LOOP2 ;Loop until Zero Non-Register Instructions: -------------------------- RETURN TO 6502 MODE: RTN 00 Control is returned to the 6502 and program execution continues at the 22 ;$A034 and $9022 45 LD @R5 ;Move byte from $A034 to $9022 56 ST @R6 ;Both ptrs are incremented LOAD DOUBLE-BYTE INDIRECT: LDD @Rn [ 6n ] The low order ACC byte is loaded from memory location whose address resides in Rn, and Rn is then incremented by 1. The high order ACC byte is loaded from the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the final ACC contents. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;The low-order ACC byte is loaded 65 LDD @R6 ;from $A034, high-order from ;$A035, R5 is incr to $A036 STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides in Rn, and Rn is the incremented by 1. The high-order ACC byte is stored into the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the ACC contents which are not disturbed. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;Load pointers R5, R6 16 22 90 SET R6 $9022 ;with $A034 and $9022 65 LDD @R5 ;Move double byte from 76 STD @R6 ;$A034-35 to $9022-23. ;Both pointers incremented by 2. POP INDIRECT: POP @Rn [ 8n ] The low-order ACC byte is loaded from the memory location whose address resides in Rn after Rn is decremented by 1, and the high order ACC byte is cleared. Branch conditions reflect the final 2-byte ACC contents which will always be positive and never minus one. The carry is cleared. Because Rn is decremented prior to loading the ACC, single byte stacks may be implemented with the ST @Rn and POP @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 04 00 SET R0 4 ;Load 4 into ACC 55 ST @R5 ;Push 4 onto stack 10 05 00 SET R0 5 ;Load 5 into ACC 55 ST @R5 ;Push 5 onto stack 10 06 00 SET R0 6 ;Load 6 into ACC 55 ST @R5 ;Push 6 onto stack 85 POP @R5 ;Pop 6 off stack into ACC 85 POP @R5 ;Pop 5 off stack 85 POP @R5 ;Pop 4 off stack STORE POP INDIRECT: STP @Rn [ 9n ] The low-order ACC byte is stored into the memory location whose address resides in Rn after Rn is decremented by 1. Branch conditions will reflect the 2-byte ACC contents which are not modified. STP @Rn and POP @Rn are used together to move data blocks beginning at the greatest address and working down. Additionally, single-byte stacks may be implemented with the STP @Rn ops. EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move byte from 95 STP @R5 ;$A033 to $9021 84 POP @R4 ;Move byte from 95 STP @R5 ;$A032 to $9020 ADD: ADD Rn [ An ] The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) and R1 11 27 42 SET R1 $4227 A1 ADD R1 ;Add R1 (sum=B85B, C clear) A0 ADD R0 ;Double ACC (R0) to $70B6 ;with carry set. SUBTRACT: SUB Rn [ Bn ] The contents of Rn are subtracted from the ACC contents by performing a two's complement addition: ACC = ACC + Rn + 1 The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. If the 16-bit unsigned ACC contents are greater than or equal to the 16-bit unsigned Rn contents, then the carry is set, otherwise it is cleared. Rn is not disturbed. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) 11 27 42 SET R1 $4227 ;and R1 B1 SUB R1 ;subtract R1 ;(diff=$340D with c set) B0 SUB R0 ;clears ACC. (R0) POP DOUBLE-BYTE INDIRECT: POPD @Rn [ Cn ] Rn is decremented by 1 and the high-order ACC byte is loaded from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order ACC byte is loaded from the corresponding memory location. Branch conditions reflect the final ACC contents. The carry is cleared. Because Rn is decremented prior to loading each of the ACC halves, double-byte stacks may be implemented with the STD @Rn and POPD @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 12 AA SET R0 $AA12 ;Load $AA12 into ACC 75 STD @R5 ;Push $AA12 onto stack 10 34 BB SET R0 $BB34 ;Load $BB34 into ACC 75 STD @R5 ;Push $BB34 onto stack C5 POPD @R5 ;Pop $BB34 off stack C5 POPD @R5 ;Pop $AA12 off stack COMPARE: CPR Rn [ Dn ] The ACC (R0) contents are compared to Rn by performing the 16 bit binary subtraction ACC-Rn and storing the low order 16 difference bits in R13 for subsequent branch tests. If the 16 bit unsigned ACC contents are greater than or equal to the 16 bit unsigned Rn contents, then the carry is set, otherwise it is cleared. No other registers, including ACC and Rn, are disturbed. EXAMPLE: 15 34 A0 SET R5 $A034 ;Pointer to memory 16 BF A0 SET R6 $A0BF ;Limit address B0 LOOP1 SUB R0 ;Zero data 75 STD @R5 ;clear 2 locations ;increment R5 by 2 25 LD R5 ;Compare pointer R5 D6 CPR R6 ;to limit R6 02 FA BNC LOOP1 ;loop if C clear INCREMENT: INR Rn [ En ] The contents of Rn are incremented by 1. The carry is cleared and other branch conditions reflect the incremented value. EXAMPLE: 15 34 A0 SET R5 $A034 ;(Pointer) B0 SUB R0 ;Zero to R0 55 ST @R5 ;Clr Location $A034 E5 INR R5 ;Incr R5 to $A036 55 ST @R5 ;Clrs location $A036 ;(not $A035) DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other branch conditions reflect the decremented value. EXAMPLE: (Clear 9 bytes beginning at location A034) 15 34 A0 SET R5 $A034 ;Init pointer 14 09 00 SET R4 9 ;Init counter B0 SUB R0 ;Zero ACC 55 LOOP2 ST @R5 ;Clear a mem byte F4 DCR R4 ;Decrement count 07 FC BNZ LOOP2 ;Loop until Zero Non-Register Instructions: -------------------------- RETURN TO 6502 MODE: RTN 00 Control is returned to the 6502 and program execution continues at the 22 ;$A034 and $9022 45 LD @R5 ;Move byte from $A034 to $9022 56 ST @R6 ;Both ptrs are incremented LOAD DOUBLE-BYTE INDIRECT: LDD @Rn [ 6n ] The low order ACC byte is loaded from memory location whose address resides in Rn, and Rn is then incremented by 1. The high order ACC byte is loaded from the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the final ACC contents. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;The low-order ACC byte is loaded 65 LDD @R6 ;from $A034, high-order from ;$A035, R5 is incr to $A036 STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides in Rn, and Rn is the incremented by 1. The high-order ACC byte is stored into the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the ACC contents which are not disturbed. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;Load pointers R5, R6 16 22 90 SET R6 $9022 ;with $A034 and $9022 65 LDD @R5 ;Move double byte from 76 STD @R6 ;$A034-35 to $9022-23. ;Both pointers incremented by 2. POP INDIRECT: POP @Rn [ 8n ] The low-order ACC byte is loaded from the memory location whose address resides in Rn after Rn is decremented by 1, and the high order ACC byte is cleared. Branch conditions reflect the final 2-byte ACC contents which will always be positive and never minus one. The carry is cleared. Because Rn is decremented prior to loading the ACC, single byte stacks may be implemented with the ST @Rn and POP @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 04 00 SET R0 4 ;Load 4 into ACC 55 ST @R5 ;Push 4 onto stack 10 05 00 SET R0 5 ;Load 5 into ACC 55 ST @R5 ;Push 5 onto stack 10 06 00 SET R0 6 ;Load 6 into ACC 55 ST @R5 ;Push 6 onto stack 85 POP @R5 ;Pop 6 off stack into ACC 85 POP @R5 ;Pop 5 off stack 85 POP @R5 ;Pop 4 off stack STORE POP INDIRECT: STP @Rn [ 9n ] The low-order ACC byte is stored into the memory location whose address resides in Rn after Rn is decremented by 1. Branch conditions will reflect the 2-byte ACC contents which are not modified. STP @Rn and POP @Rn are used together to move data blocks beginning at the greatest address and working down. Additionally, single-byte stacks may be implemented with the STP @Rn ops. EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move byte from 95 STP @R5 ;$A033 to $9021 84 POP @R4 ;Move byte from 95 STP @R5 ;$A032 to $9020 ADD: ADD Rn [ An ] The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) and R1 11 27 42 SET R1 $4227 A1 ADD R1 ;Add R1 (sum=B85B, C clear) A0 ADD R0 ;Double ACC (R0) to $70B6 ;with carry set. SUBTRACT: SUB Rn [ Bn ] The contents of Rn are subtracted from the ACC contents by performing a two's complement addition: ACC = ACC + Rn + 1 The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. If the 16-bit unsigned ACC contents are greater than or equal to the 16-bit unsigned Rn contents, then the carry is set, otherwise it is cleared. Rn is not disturbed. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) 11 27 42 SET R1 $4227 ;and R1 B1 SUB R1 ;subtract R1 ;(diff=$340D with c set) B0 SUB R0 ;clears ACC. (R0) POP DOUBLE-BYTE INDIRECT: POPD @Rn [ Cn ] Rn is decremented by 1 and the high-order ACC byte is loaded from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order ACC byte is loaded from the corresponding memory location. Branch conditions reflect the final ACC contents. The carry is cleared. Because Rn is decremented prior to loading each of the ACC halves, double-byte stacks may be implemented with the STD @Rn and POPD @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 12 AA SET R0 $AA12 ;Load $AA12 into ACC 75 STD @R5 ;Push $AA12 onto stack 10 34 BB SET R0 $BB34 ;Load $BB34 into ACC 75 STD @R5 ;Push $BB34 onto stack C5 POPD @R5 ;Pop $BB34 off stack C5 POPD @R5 ;Pop $AA12 off stack COMPARE: CPR Rn [ Dn ] The ACC (R0) contents are compared to Rn by performing the 16 bit binary subtraction ACC-Rn and storing the low order 16 difference bits in R13 for subsequent branch tests. If the 16 bit unsigned ACC contents are greater than or equal to the 16 bit unsigned Rn contents, then the carry is set, otherwise it is cleared. No other registers, including ACC and Rn, are disturbed. EXAMPLE: 15 34 A0 SET R5 $A034 ;Pointer to memory 16 BF A0 SET R6 $A0BF ;Limit address B0 LOOP1 SUB R0 ;Zero data 75 STD @R5 ;clear 2 locations ;increment R5 by 2 25 LD R5 ;Compare pointer R5 D6 CPR R6 ;to limit R6 02 FA BNC LOOP1 ;loop if C clear INCREMENT: INR Rn [ En ] The contents of Rn are incremented by 1. The carry is cleared and other branch conditions reflect the incremented value. EXAMPLE: 15 34 A0 SET R5 $A034 ;(Pointer) B0 SUB R0 ;Zero to R0 55 ST @R5 ;Clr Location $A034 E5 INR R5 ;Incr R5 to $A036 55 ST @R5 ;Clrs location $A036 ;(not $A035) DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other branch conditions reflect the decremented value. EXAMPLE: (Clear 9 bytes beginning at location A034) 15 34 A0 SET R5 $A034 ;Init pointer 14 09 00 SET R4 9 ;Init counter B0 SUB R0 ;Zero ACC 55 LOOP2 ST @R5 ;Clear a mem byte F4 DCR R4 ;Decrement count 07 FC BNZ LOOP2 ;Loop until Zero Non-Register Instructions: -------------------------- RETURN TO 6502 MODE: RTN 00 Control is returned to the 6502 and program execution continues at the 22 ;$A034 and $9022 45 LD @R5 ;Move byte from $A034 to $9022 56 ST @R6 ;Both ptrs are incremented LOAD DOUBLE-BYTE INDIRECT: LDD @Rn [ 6n ] The low order ACC byte is loaded from memory location whose address resides in Rn, and Rn is then incremented by 1. The high order ACC byte is loaded from the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the final ACC contents. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;The low-order ACC byte is loaded 65 LDD @R6 ;from $A034, high-order from ;$A035, R5 is incr to $A036 STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides in Rn, and Rn is the incremented by 1. The high-order ACC byte is stored into the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the ACC contents which are not disturbed. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;Load pointers R5, R6 16 22 90 SET R6 $9022 ;with $A034 and $9022 65 LDD @R5 ;Move double byte from 76 STD @R6 ;$A034-35 to $9022-23. ;Both pointers incremented by 2. POP INDIRECT: POP @Rn [ 8n ] The low-order ACC byte is loaded from the memory location whose address resides in Rn after Rn is decremented by 1, and the high order ACC byte is cleared. Branch conditions reflect the final 2-byte ACC contents which will always be positive and never minus one. The carry is cleared. Because Rn is decremented prior to loading the ACC, single byte stacks may be implemented with the ST @Rn and POP @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 04 00 SET R0 4 ;Load 4 into ACC 55 ST @R5 ;Push 4 onto stack 10 05 00 SET R0 5 ;Load 5 into ACC 55 ST @R5 ;Push 5 onto stack 10 06 00 SET R0 6 ;Load 6 into ACC 55 ST @R5 ;Push 6 onto stack 85 POP @R5 ;Pop 6 off stack into ACC 85 POP @R5 ;Pop 5 off stack 85 POP @R5 ;Pop 4 off stack STORE POP INDIRECT: STP @Rn [ 9n ] The low-order ACC byte is stored into the memory location whose address resides in Rn after Rn is decremented by 1. Branch conditions will reflect the 2-byte ACC contents which are not modified. STP @Rn and POP @Rn are used together to move data blocks beginning at the greatest address and working down. Additionally, single-byte stacks may be implemented with the STP @Rn ops. EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move byte from 95 STP @R5 ;$A033 to $9021 84 POP @R4 ;Move byte from 95 STP @R5 ;$A032 to $9020 ADD: ADD Rn [ An ] The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) and R1 11 27 42 SET R1 $4227 A1 ADD R1 ;Add R1 (sum=B85B, C clear) A0 ADD R0 ;Double ACC (R0) to $70B6 ;with carry set. SUBTRACT: SUB Rn [ Bn ] The contents of Rn are subtracted from the ACC contents by performing a two's complement addition: ACC = ACC + Rn + 1 The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. If the 16-bit unsigned ACC contents are greater than or equal to the 16-bit unsigned Rn contents, then the carry is set, otherwise it is cleared. Rn is not disturbed. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) 11 27 42 SET R1 $4227 ;and R1 B1 SUB R1 ;subtract R1 ;(diff=$340D with c set) B0 SUB R0 ;clears ACC. (R0) POP DOUBLE-BYTE INDIRECT: POPD @Rn [ Cn ] Rn is decremented by 1 and the high-order ACC byte is loaded from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order ACC byte is loaded from the corresponding memory location. Branch conditions reflect the final ACC contents. The carry is cleared. Because Rn is decremented prior to loading each of the ACC halves, double-byte stacks may be implemented with the STD @Rn and POPD @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 12 AA SET R0 $AA12 ;Load $AA12 into ACC 75 STD @R5 ;Push $AA12 onto stack 10 34 BB SET R0 $BB34 ;Load $BB34 into ACC 75 STD @R5 ;Push $BB34 onto stack C5 POPD @R5 ;Pop $BB34 off stack C5 POPD @R5 ;Pop $AA12 off stack COMPARE: CPR Rn [ Dn ] The ACC (R0) contents are compared to Rn by performing the 16 bit binary subtraction ACC-Rn and storing the low order 16 difference bits in R13 for subsequent branch tests. If the 16 bit unsigned ACC contents are greater than or equal to the 16 bit unsigned Rn contents, then the carry is set, otherwise it is cleared. No other registers, including ACC and Rn, are disturbed. EXAMPLE: 15 34 A0 SET R5 $A034 ;Pointer to memory 16 BF A0 SET R6 $A0BF ;Limit address B0 LOOP1 SUB R0 ;Zero data 75 STD @R5 ;clear 2 locations ;increment R5 by 2 25 LD R5 ;Compare pointer R5 D6 CPR R6 ;to limit R6 02 FA BNC LOOP1 ;loop if C clear INCREMENT: INR Rn [ En ] The contents of Rn are incremented by 1. The carry is cleared and other branch conditions reflect the incremented value. EXAMPLE: 15 34 A0 SET R5 $A034 ;(Pointer) B0 SUB R0 ;Zero to R0 55 ST @R5 ;Clr Location $A034 E5 INR R5 ;Incr R5 to $A036 55 ST @R5 ;Clrs location $A036 ;(not $A035) DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other branch conditions reflect the decremented value. EXAMPLE: (Clear 9 bytes beginning at location A034) 15 34 A0 SET R5 $A034 ;Init pointer 14 09 00 SET R4 9 ;Init counter B0 SUB R0 ;Zero ACC 55 LOOP2 ST @R5 ;Clear a mem byte F4 DCR R4 ;Decrement count 07 FC BNZ LOOP2 ;Loop until Zero Non-Register Instructions: -------------------------- RETURN TO 6502 MODE: RTN 00 Control is returned to the 6502 and program execution continues at the 22 ;$A034 and $9022 45 LD @R5 ;Move byte from $A034 to $9022 56 ST @R6 ;Both ptrs are incremented LOAD DOUBLE-BYTE INDIRECT: LDD @Rn [ 6n ] The low order ACC byte is loaded from memory location whose address resides in Rn, and Rn is then incremented by 1. The high order ACC byte is loaded from the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the final ACC contents. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;The low-order ACC byte is loaded 65 LDD @R6 ;from $A034, high-order from ;$A035, R5 is incr to $A036 STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides in Rn, and Rn is the incremented by 1. The high-order ACC byte is stored into the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the ACC contents which are not disturbed. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;Load pointers R5, R6 16 22 90 SET R6 $9022 ;with $A034 and $9022 65 LDD @R5 ;Move double byte from 76 STD @R6 ;$A034-35 to $9022-23. ;Both pointers incremented by 2. POP INDIRECT: POP @Rn [ 8n ] The low-order ACC byte is loaded from the memory location whose address resides in Rn after Rn is decremented by 1, and the high order ACC byte is cleared. Branch conditions reflect the final 2-byte ACC contents which will always be positive and never minus one. The carry is cleared. Because Rn is decremented prior to loading the ACC, single byte stacks may be implemented with the ST @Rn and POP @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 04 00 SET R0 4 ;Load 4 into ACC 55 ST @R5 ;Push 4 onto stack 10 05 00 SET R0 5 ;Load 5 into ACC 55 ST @R5 ;Push 5 onto stack 10 06 00 SET R0 6 ;Load 6 into ACC 55 ST @R5 ;Push 6 onto stack 85 POP @R5 ;Pop 6 off stack into ACC 85 POP @R5 ;Pop 5 off stack 85 POP @R5 ;Pop 4 off stack STORE POP INDIRECT: STP @Rn [ 9n ] The low-order ACC byte is stored into the memory location whose address resides in Rn after Rn is decremented by 1. Branch conditions will reflect the 2-byte ACC contents which are not modified. STP @Rn and POP @Rn are used together to move data blocks beginning at the greatest address and working down. Additionally, single-byte stacks may be implemented with the STP @Rn ops. EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move byte from 95 STP @R5 ;$A033 to $9021 84 POP @R4 ;Move byte from 95 STP @R5 ;$A032 to $9020 ADD: ADD Rn [ An ] The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) and R1 11 27 42 SET R1 $4227 A1 ADD R1 ;Add R1 (sum=B85B, C clear) A0 ADD R0 ;Double ACC (R0) to $70B6 ;with carry set. SUBTRACT: SUB Rn [ Bn ] The contents of Rn are subtracted from the ACC contents by performing a two's complement addition: ACC = ACC + Rn + 1 The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. If the 16-bit unsigned ACC contents are greater than or equal to the 16-bit unsigned Rn contents, then the carry is set, otherwise it is cleared. Rn is not disturbed. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) 11 27 42 SET R1 $4227 ;and R1 B1 SUB R1 ;subtract R1 ;(diff=$340D with c set) B0 SUB R0 ;clears ACC. (R0) POP DOUBLE-BYTE INDIRECT: POPD @Rn [ Cn ] Rn is decremented by 1 and the high-order ACC byte is loaded from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order ACC byte is loaded from the corresponding memory location. Branch conditions reflect the final ACC contents. The carry is cleared. Because Rn is decremented prior to loading each of the ACC halves, double-byte stacks may be implemented with the STD @Rn and POPD @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 12 AA SET R0 $AA12 ;Load $AA12 into ACC 75 STD @R5 ;Push $AA12 onto stack 10 34 BB SET R0 $BB34 ;Load $BB34 into ACC 75 STD @R5 ;Push $BB34 onto stack C5 POPD @R5 ;Pop $BB34 off stack C5 POPD @R5 ;Pop $AA12 off stack COMPARE: CPR Rn [ Dn ] The ACC (R0) contents are compared to Rn by performing the 16 bit binary subtraction ACC-Rn and storing the low order 16 difference bits in R13 for subsequent branch tests. If the 16 bit unsigned ACC contents are greater than or equal to the 16 bit unsigned Rn contents, then the carry is set, otherwise it is cleared. No other registers, including ACC and Rn, are disturbed. EXAMPLE: 15 34 A0 SET R5 $A034 ;Pointer to memory 16 BF A0 SET R6 $A0BF ;Limit address B0 LOOP1 SUB R0 ;Zero data 75 STD @R5 ;clear 2 locations ;increment R5 by 2 25 LD R5 ;Compare pointer R5 D6 CPR R6 ;to limit R6 02 FA BNC LOOP1 ;loop if C clear INCREMENT: INR Rn [ En ] The contents of Rn are incremented by 1. The carry is cleared and other branch conditions reflect the incremented value. EXAMPLE: 15 34 A0 SET R5 $A034 ;(Pointer) B0 SUB R0 ;Zero to R0 55 ST @R5 ;Clr Location $A034 E5 INR R5 ;Incr R5 to $A036 55 ST @R5 ;Clrs location $A036 ;(not $A035) DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other branch conditions reflect the decremented value. EXAMPLE: (Clear 9 bytes beginning at location A034) 15 34 A0 SET R5 $A034 ;Init pointer 14 09 00 SET R4 9 ;Init counter B0 SUB R0 ;Zero ACC 55 LOOP2 ST @R5 ;Clear a mem byte F4 DCR R4 ;Decrement count 07 FC BNZ LOOP2 ;Loop until Zero Non-Register Instructions: -------------------------- RETURN TO 6502 MODE: RTN 00 Control is returned to the 6502 and program execution continues at the 922 LIST2 PHA ; DISEMBLE 20 INSTRS FE64: 20 D0 F8 923 JSR INSTDSP FE67: 20 53 F9 924 JSR PCADJ ;ADJUST PC EACH INSTR FE6A: 85 3A 925 STA PCL FE6C: 84 3B 926 STY PCH FE6E: 68 927 PLA FE6F: 38 928 SEC FE70: E9 01 929 SBC #$01 ;NEXT OF 20 INSTRS FE72: D0 EF 930 BNE LIST2 FE74: 60 931 RTS FE75: 8A 932 A1PC TXA ;IF USER SPEC'D ADR FE76: F0 07 933 BEQ A1PCRTS ; COPY FROM A1 TO PC FE78: B5 3C 934 A1PCLP LDA A1L,X FE7A: 95 3A 935 STA PCL,X FE7C: CA 936 DEX FE7D: 10 F9 937 BPL A1PCLP FE7F: 60 938 A1PCRTS RTS FE80: A0 3F 939 SETINV LDY #$3F ;SET FOR INVERSE VID FE82: D0 02 940 BNE SETIFLG ; VIA COUT1 FE84: A0 FF 941 SETNORM LDY #$FF ;SET FOR NORMAL VID FE86: 84 32 942 SETIFLG STY INVFLG FE88: 60 943 RTS FE89: A9 00 944 SETKBD LDA #$00 ;SIMULATE PORT #0 INPUT FE8B: 85 3E 945 INPORT STA A2L ; SPECIFIED (KEYIN ROUTINE) FE8D: A2 38 946 INPRT LDX #KSWL FE8F: A0 1B 947 LDY #KEYIN FE91: D0 08 948 BNE IOPRT FE93: A9 00 949 SETVID LDA #$00 ;SIMULATE PORT #0 OUTPUT FE95: 85 3E 950 OUTPORT STA A2L ; SPECIFIED (COUT1 ROUTINE) FE97: A2 36 951 OUTPRT LDX #CSWL FE99: A0 F0 952 LDY #COUT1 FE9B: A5 3E 953 IOPRT LDA A2L ;SET RAM IN/OUT VECTORS FE9D: 29 0F 954 AND #$0F FE9F: F0 06 955 BEQ IOPRT1 FEA1: 09 C0 956 ORA #IOADR/256 FEA3: A0 00 957 LDY #$00 FEA5: F0 02 958 BEQ IOPRT2 FEA7: A9 FD 959 IOPRT1 LDA #COUT1/256 FEA9: 94 00 960 IOPRT2 STY LOC0,X FEAB: 95 01 961 STA LOC1,X FEAD: 60 962 RTS FEAE: EA 963 NOP FEAF: EA 964 NOP FEB0: 4C 00 E0 965 XBASIC JMP BASIC ;TO BASIC WITH SCRATCH FEB3: 4C 03 E0 966 BASCONT JMP BASIC2 ;CONTINUE BASIC FEB6: 20 75 FE 967 GO JSR A1PC ;ADR TO PC IF SPEC'D FEB9: 20 3F FF 968 JSR RESTORE ;RESTORE META REGS FEBC: 6C 3A 00 969 JMP (PCL) ;GO TO USER SUBR FEBF: 4C D7 FA 970 REGZ JMP REGDSP ;TO REG DISPLAY FEC2: C6 34 971 TRACE DEC YSAV FEC4: 20 75 FE 972 STEPZ JSR A1PC ;ADR TO PC IF SPEC'D FEC7: 4C 43 FA 973 JMP STEP ;TAKE ONE STEP FECA: 4C F8 03 974 USR JMP USRADR ;TO USR SUBR AT USRADR FECD: A9 40 975 WRITE LDA #$40 FECF: 20 C9 FC 976 JSR HEADR ;WRITE 10-SEC HEADER FED2: A0 27 977 LDY #$27 FED4: A2 00 978 WR1 LDX #$00 FED6: 41 3C 979 EOR (A1L,X) FED8: 48 980 PHA FED9: A1 3C 981 LDA (A1L,X) FEDB: 20 ED FE 982 JSR WRBYTE FEDE: 20 BA FC 983 JSR NXTA1 FEE1: A0 1D 984 LDY #$1D FEE3: 68 985 PLA FEE4: 90 EE 986 BCC WR1 FEE6: A0 22 987 LDY #$22 FEE8: 20 ED FE 988 JSR WRBYTE FEEB: F0 4D 989 BEQ BELL FEED: A2 10 990 WRBYTE LDX #$10 FEEF: 0A 991 WRBYT2 ASL FEF0: 20 D6 FC 992 JSR WRBIT FEF3: D0 FA 993 BNE WRBYT2 FEF5: 60 994 RTS FEF6: 20 00 FE 995 CRMON JSR BL1 ;HANDLE A CR AS BLANK FEF9: 68 996 PLA ; THEN POP STACK FEFA: 68 997 PLA ; AND RTN TO MON FEFB: D0 6C 998 BNE MONZ FEFD: 20 FA FC 999 READ JSR RD2BIT ;FIND TAPEIN EDGE FF00: A9 16 1000 LDA #$16 FF02: 20 C9 FC 1001 JSR HEADR ;DELAY 3.5 SECONDS FF05: 85 2E 1002 STA CHKSUM ;INIT CHKSUM=$FF FF07: 20 FA FC 1003 JSR RD2BIT ;FIND TAPEIN EDGE FF0A: A0 24 1004 RD2 LDY #$24 ;LOOK FOR SYNC BIT FF0C: 20 FD FC 1005 JSR RDBIT ; (SHORT 0) FF0F: B0 F9 1006 BCS RD2 ; LOOP UNTIL FOUND FF11: 20 FD FC 1007 JSR RDBIT ;SKIP SECOND SYNC H-CYCLE FF14: A0 3B 1008 LDY #$3B ;INDEX FOR 0/1 TEST FF16: 20 EC FC 1009 RD3 JSR RDBYTE ;READ A BYTE FF19: 81 3C 1010 STA (A1L,X) ;STORE AT (A1) FF1B: 45 2E 1011 EOR CHKSUM FF1D: 85 2E 1012 STA CHKSUM ;UPDATE RUNNING CHKSUM FF1F: 20 BA FC 1013 JSR NXTA1 ;INC A1, COMPARE TO A2 FF22: A0 35 1014 LDY #$35 ;COMPENSATE 0/1 INDEX FF24: 90 F0 1015 BCC RD3 ;LOOP UNTIL DONE FF26: 20 EC FC 1016 JSR RDBYTE ;READ CHKSUM BYTE FF29: C5 2E 1017 CMP CHKSUM FF2B: F0 0D 1018 BEQ BELL ;GOOD, SOUND BELL AND RETURN FF2D: A9 C5 1019 PRERR LDA #$C5 FF2F: 20 ED FD 1020 JSR COUT ;PRINT "ERR", THEN BELL FF32: A9 D2 1021 LDA #$D2 FF34: 20 ED FD 1022 JSR COUT FF37: 20 ED FD 1023 JSR COUT FF3A: A9 87 1024 BELL LDA #$87 ;OUTPUT BELL AND RETURN FF3C: 4C ED FD 1025 JMP COUT FF3F: A5 48 1026 RESTORE LDA STATUS ;RESTORE 6502 REG CONTENTS FF41: 48 1027 PHA ; USED BY DEBUG SOFTWARE FF42: A5 45 1028 LDA ACC FF44: A6 46 1029 RESTR1 LDX XREG FF46: A4 47 1030 LDY YREG FF48: 28 1031 PLP FF49: 60 1032 RTS FF4A: 85 45 1033 SAVE STA ACC ;SAVE 6502 REG CONTENTS FF4C: 86 46 1034 SAV1 STX XREG FF4E: 84 47 1035 STY YREG FF50: 08 1036 PHP FF51: 68 1037 PLA FF52: 85 48 1038 STA STATUS FF54: BA 1039 TSX FF55: 86 49 1040 STX SPNT FF57: D8 1041 CLD FF58: 60 1042 RTS FF59: 20 84 FE 1043 RESET JSR SETNORM ;SET SCREEN MODE FF5C: 20 2F FB 1044 JSR INIT ; AND INIT KBD/SCREEN FF5F: 20 93 FE 1045 JSR SETVID ; AS I/O DEV'S FF62: 20 89 FE 1046 JSR SETKBD FF65: D8 1047 MON CLD ;MUST SET HEX MODE! FF66: 20 3A FF 1048 JSR BELL FF69: A9 AA 1049 MONZ LDA #$AA ;'*' PROMPT FOR MON FF6B: 85 33 1050 STA PROMPT FF6D: 20 67 FD 1051 JSR GETLNZ ;READ A LINE FF70: 20 C7 FF 1052 JSR ZMODE ;CLEAR MON MODE, SCAN IDX FF73: 20 A7 FF 1053 NXTITM JSR GETNUM ;GET ITEM, NON-HEX FF76: 84 34 1054 STY YSAV ; CHAR IN A-REG FF78: A0 17 1055 LDY #$17 ; X-REG=0 IF NO HEX INPUT FF7A: 88 1056 CHRSRCH DEY FF7B: 30 E8 1057 BMI MON ;NOT FOUND, GO TO MON FF7D: D9 CC FF 1058 CMP CHRTBL,Y ;FIND CMND CHAR IN TEL FF80: D0 F8 1059 BNE CHRSRCH FF82: 20 BE FF 1060 JSR TOSUB ;FOUND, CALL CORRESPONDING FF85: A4 34 1061 LDY YSAV ; SUBROUTINE FF87: 4C 73 FF 1062 JMP NXTITM FF8A: A2 03 1063 DIG LDX #$03 FF8C: 0A 1064 ASL FF8D: 0A 1065 ASL ;GOT HEX DIG, FF8E: 0A 1066 ASL ; SHIFT INTO A2 FF8F: 0A 1067 ASL FF90: 0A 1068 NXTBIT ASL FF91: 26 3E 1069 ROL A2L FF93: 26 3F 1070 ROL A2H FF95: CA 1071 DEX ;LEAVE X=$FF IF DIG FF96: 10 F8 1072 BPL NXTBIT FF98: A5 31 1073 NXTBAS LDA MODE FF9A: D0 06 1074 BNE NXTBS2 ;IF MODE IS ZERO FF9C: B5 3F 1075 LDA A2H,X ; THEN COPY A2 TO FF9E: 95 3D 1076 STA A1H,X ; A1 AND A3 FFA0: 95 41 1077 STA A3H,X FFA2: E8 1078 NXTBS2 INX FFA3: F0 F3 1079 BEQ NXTBAS FFA5: D0 06 1080 BNE NXTCHR FFA7: A2 00 1081 GETNUM LDX #$00 ;CLEAR A2 FFA9: 86 3E 1082 STX A2L FFAB: 86 3F 1083 STX A2H FFAD: B9 00 02 1084 NXTCHR LDA IN,Y ;GET CHAR FFB0: C8 1085 INY FFB1: 49 B0 1086 EOR #$B0 FFB3: C9 0A 1087 CMP #$0A FFB5: 90 D3 1088 BCC DIG ;IF HEX DIG, THEN FFB7: 69 88 1089 ADC #$88 FFB9: C9 FA 1090 CMP #$FA FFBB: B0 CD 1091 BCS DIG FFBD: 60 1092 RTS FFBE: A9 FE 1093 TOSUB LDA #GO/256 ;PUSH HIGH-ORDER FFC0: 48 1094 PHA ; SUBR ADR ON STK FFC1: B9 E3 FF 1095 LDA SUBTBL,Y ;PUSH LOW-ORDER FFC4: 48 1096 PHA ; SUBR ADR ON STK FFC5: A5 31 1097 LDA MODE FFC7: A0 00 1098 ZMODE LDY #$00 ;CLR MODE, OLD MODE FFC9: 84 31 1099 STY MODE ; TO A-REG FFCB: 60 1100 RTS ; GO TO SUBR VIA RTS FFCC: BC 1101 CHRTBL DFB $BC ;F("CTRL-C") FFCD: B2 1102 DFB $B2 ;F("CTRL-Y") FFCE: BE 1103 DFB $BE ;F("CTRL-E") FFCF: ED 1104 DFB $ED ;F("T") FFD0: EF 1105 DFB $EF ;F("V") FFD1: C4 1106 DFB $C4 ;F("CTRL-K") FFD2: EC 1107 DFB $EC ;F("S") FFD3: A9 1108 DFB $A9 ;F("CTRL-P") FFD4: BB 1109 DFB $BB ;F("CTRL-B") FFD5: A6 1110 DFB $A6 ;F("-") FFD6: A4 1111 DFB $A4 ;F("+") FFD7: 06 1112 DFB $06 ;F("M") (F=EX-OR $B0+$89) FFD8: 95 1113 DFB $95 ;F("<") FFD9: 07 1114 DFB $07 ;F("N") FFDA: 02 1115 DFB $02 ;F("I") FFDB: 05 1116 DFB $05 ;F("L") FFDC: F0 1117 DFB $F0 ;F("W") FFDD: 00 1118 DFB $00 ;F("G") FFDE: EB 1119 DFB $EB ;F("R") FFDF: 93 1120 DFB $93 ;F(":") FFE0: A7 1121 DFB $A7 ;F(".") FFE1: C6 1122 DFB $C6 ;F("CR") FFE2: 99 1123 DFB $99 ;F(BLANK) FFE3: B2 1124 SUBTBL DFB BASCONT-1 FFE4: C9 1125 DFB USR-1 FFE5: BE 1126 DFB REGZ-1 FFE6: C1 1127 DFB TRACE-1 FFE7: 35 1128 DFB VFY-1 FFE8: 8C 1129 DFB INPRT-1 FFE9: C3 1130 DFB STEPZ-1 FFEA: 96 1131 DFB OUTPRT-1 FFEB: AF 1132 DFB XBASIC-1 FFEC: 17 1133 DFB SETMODE-1 FFED: 17 1134 DFB SETMODE-1 FFEE: 2B 1135 DFB MOVE-1 FFEF: 1F 1136 DFB LT-1 FFF0: 83 1137 DFB SETNORM-1 FFF1: 7F 1138 DFB SETINV-1 FFF2: 5D 1139 DFB LIST-1 FFF3: CC 1140 DFB WRITE-1 FFF4: B5 1141 DFB GO-1 FFF5: FC 1142 DFB READ-1 FFF6: 17 1143 DFB SETMODE-1 FFF7: 17 1144 DFB SETMODE-1 FFF8: F5 1145 DFB CRMON-1 FFF9: 03 1146 DFB BLANK-1 FFFA: FB 1147 DFB NMI ;NMI VECTOR FFFB: 03 1148 DFB NMI/256 FFFC: 59 1149 DFB RESET ;RESET VECTOR FFFD: FF 1150 DFB RESET/256 FFFE: 86 1151 DFB IRQ ;IRQ VECTOR FFFF: FA 1152 DFB IRQ/256 1153 XQTNZ EQU $3C +------------------------------------------------------------------------ | TOPIC -- Apple II -- Red Book Sweet-16 listing +------------------------------------------------------------------------ 1 *********************** 2 * * 3 * APPLE-II PSEUDO * 4 * MACHINE INTERPRETER * 5 * * 6 * COPYRIGHT 1977 * 7 * APPLE COMPUTER INC * 8 * * 9 * ALL RIGHTS RESERVED * 10 * S. WOZNIAK * 11 * * 12 *********************** 13 ; TITLE "SWEET16 INTERPRETER" 14 R0L EQU $0 15 R0H EQU $1 16 R14H EQU $1D 17 R15L EQU $1E 18 R15H EQU $1F 19 SW16PAG EQU $F7 20 SAVE EQU $FF4A 21 RESTORE EQU $FF3F 22 ORG $F689 F689: 20 4A FF 23 SW16 JSR SAVE ;PRESERVE 6502 REG CONTENTS F68C: 68 24 PLA F68D: 85 1E 25 STA R15L ;INIT SWEET16 PC F68F: 68 26 PLA ;FROM RETURN F690: 85 1F 27 STA R15H ; ADDRESS F692: 20 98 F6 28 SW16B JSR SW16C ;INTERPRET AND EXECUTE F695: 4C 92 F6 29 JMP SW16B ;ONE SWEET16 INSTR. F698: E6 1E 30 SW16C INC R15L F69A: D0 02 31 BNE SW16D ;INCR SWEET16 PC FOR FETCH F69C: E6 1F 32 INC R15H F69E: A9 F7 33 SW16D LDA #SW16PAG F6A0: 48 34 PHA ;PUSH ON STACK FOR RTS F6A1: A0 00 35 LDY #$0 F6A3: B1 1E 36 LDA (R15L),Y ;FETCH INSTR F6A5: 29 0F 37 AND #$F ;MASK REG SPECIFICATION F6A7: 0A 38 ASL ;DOUBLE FOR TWO BYTE REGISTERS F6A8: AA 39 TAX ;TO X REG FOR INDEXING F6A9: 4A 40 LSR F6AA: 51 1E 41 EOR (R15L),Y ;NOW HAVE OPCODE F6AC: F0 0B 42 BEQ TOBR ;IF ZERO THEN NON-REG OP F6AE: 86 1D 43 STX R14H ;INDICATE'PRIOR RESULT REG' F6B0: 4A 44 LSR F6B1: 4A 45 LSR ;OPCODE*2 TO LSB'S F6B2: 4A 46 LSR F6B3: A8 47 TAY ;TO Y REG FOR INDEXING F6B4: B9 E1 F6 48 LDA OPTBL-2,Y ;LOW ORDER ADR BYTE F6B7: 48 49 PHA ;ONTO STACK F6B8: 60 50 RTS ;GOTO REG-OP ROUTINE F6B9: E6 1E 51 TOBR INC R15L F6BB: D0 02 52 BNE TOBR2 ;INCR PC F6BD: E6 1F 53 INC R15H F6BF: BD E4 F6 54 TOBR2 LDA BRTBL,X ;LOW ORDER ADR BYTE F6C2: 48 55 PHA ;ONTO STACK FOR NON-REG OP F6C3: A5 1D 56 LDA R14H ;'PRIOR RESULT REG' INDEX F6C5: 4A 57 LSR ;PREPARE CARRY FOR BC, BNC. F6C6: 60 58 RTS ;GOTO NON-REG OP ROUTINE F6C7: 68 59 RTNZ PLA ;POP RETURN ADDRESS F6C8: 68 60 PLA F6C9: 20 3F FF 61 JSR RESTORE ;RESTORE 6502 REG CONTENTS F6CC: 6C 1E 00 62 JMP (R15L) ;RETURN TO 6502 CODE VIA PC F6CF: B1 1E 63 SETZ LDA (R15L),Y ;HIGH-ORDER BYTE OF CONSTANT F6D1: 95 01 64 STA R0H,X F6D3: 88 65 DEY F6D4: B1 1E 66 LDA (R15L),Y ;LOW-ORDER BYTE OF CONSTANT F6D6: 95 00 67 STA R0L,X F6D8: 98 68 TYA ;Y-REG CONTAINS 1 F6D9: 38 69 SEC F6DA: 65 1E 70 ADC R15L ;ADD 2 TO PC F6DC: 85 1E 71 STA R15L F6DE: 90 02 72 BCC SET2 F6E0: E6 1F 73 INC R15H F6E2: 60 74 SET2 RTS F6E3: 22 ;$A034 and $9022 45 LD @R5 ;Move byte from $A034 to $9022 56 ST @R6 ;Both ptrs are incremented LOAD DOUBLE-BYTE INDIRECT: LDD @Rn [ 6n ] The low order ACC byte is loaded from memory location whose address resides in Rn, and Rn is then incremented by 1. The high order ACC byte is loaded from the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the final ACC contents. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;The low-order ACC byte is loaded 65 LDD @R6 ;from $A034, high-order from ;$A035, R5 is incr to $A036 STORE DOUBLE-BYTE INDIRECT: STD @Rn [ 7n ] The low-order ACC byte is stored into memory location whose address resides in Rn, and Rn is the incremented by 1. The high-order ACC byte is stored into the memory location whose address resides in the incremented Rn, and Rn is again incremented by 1. Branch conditions reflect the ACC contents which are not disturbed. The carry is cleared. EXAMPLE: 15 34 A0 SET R5 $A034 ;Load pointers R5, R6 16 22 90 SET R6 $9022 ;with $A034 and $9022 65 LDD @R5 ;Move double byte from 76 STD @R6 ;$A034-35 to $9022-23. ;Both pointers incremented by 2. POP INDIRECT: POP @Rn [ 8n ] The low-order ACC byte is loaded from the memory location whose address resides in Rn after Rn is decremented by 1, and the high order ACC byte is cleared. Branch conditions reflect the final 2-byte ACC contents which will always be positive and never minus one. The carry is cleared. Because Rn is decremented prior to loading the ACC, single byte stacks may be implemented with the ST @Rn and POP @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 04 00 SET R0 4 ;Load 4 into ACC 55 ST @R5 ;Push 4 onto stack 10 05 00 SET R0 5 ;Load 5 into ACC 55 ST @R5 ;Push 5 onto stack 10 06 00 SET R0 6 ;Load 6 into ACC 55 ST @R5 ;Push 6 onto stack 85 POP @R5 ;Pop 6 off stack into ACC 85 POP @R5 ;Pop 5 off stack 85 POP @R5 ;Pop 4 off stack STORE POP INDIRECT: STP @Rn [ 9n ] The low-order ACC byte is stored into the memory location whose address resides in Rn after Rn is decremented by 1. Branch conditions will reflect the 2-byte ACC contents which are not modified. STP @Rn and POP @Rn are used together to move data blocks beginning at the greatest address and working down. Additionally, single-byte stacks may be implemented with the STP @Rn ops. EXAMPLE: 14 34 A0 SET R4 $A034 ;Init pointers 15 22 90 SET R5 $9022 84 POP @R4 ;Move byte from 95 STP @R5 ;$A033 to $9021 84 POP @R4 ;Move byte from 95 STP @R5 ;$A032 to $9020 ADD: ADD Rn [ An ] The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) and R1 11 27 42 SET R1 $4227 A1 ADD R1 ;Add R1 (sum=B85B, C clear) A0 ADD R0 ;Double ACC (R0) to $70B6 ;with carry set. SUBTRACT: SUB Rn [ Bn ] The contents of Rn are subtracted from the ACC contents by performing a two's complement addition: ACC = ACC + Rn + 1 The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. If the 16-bit unsigned ACC contents are greater than or equal to the 16-bit unsigned Rn contents, then the carry is set, otherwise it is cleared. Rn is not disturbed. EXAMPLE: 10 34 76 SET R0 $7634 ;Init R0 (ACC) 11 27 42 SET R1 $4227 ;and R1 B1 SUB R1 ;subtract R1 ;(diff=$340D with c set) B0 SUB R0 ;clears ACC. (R0) POP DOUBLE-BYTE INDIRECT: POPD @Rn [ Cn ] Rn is decremented by 1 and the high-order ACC byte is loaded from the memory location whose address now resides in Rn. Rn is again decremented by 1 and the low-order ACC byte is loaded from the corresponding memory location. Branch conditions reflect the final ACC contents. The carry is cleared. Because Rn is decremented prior to loading each of the ACC halves, double-byte stacks may be implemented with the STD @Rn and POPD @Rn ops (Rn is the stack pointer). EXAMPLE: 15 34 A0 SET R5 $A034 ;Init stack pointer 10 12 AA SET R0 $AA12 ;Load $AA12 into ACC 75 STD @R5 ;Push $AA12 onto stack 10 34 BB SET R0 $BB34 ;Load $BB34 into ACC 75 STD @R5 ;Push $BB34 onto stack C5 POPD @R5 ;Pop $BB34 off stack C5 POPD @R5 ;Pop $AA12 off stack COMPARE: CPR Rn [ Dn ] The ACC (R0) contents are compared to Rn by performing the 16 bit binary subtraction ACC-Rn and storing the low order 16 difference bits in R13 for subsequent branch tests. If the 16 bit unsigned ACC contents are greater than or equal to the 16 bit unsigned Rn contents, then the carry is set, otherwise it is cleared. No other registers, including ACC and Rn, are disturbed. EXAMPLE: 15 34 A0 SET R5 $A034 ;Pointer to memory 16 BF A0 SET R6 $A0BF ;Limit address B0 LOOP1 SUB R0 ;Zero data 75 STD @R5 ;clear 2 locations ;increment R5 by 2 25 LD R5 ;Compare pointer R5 D6 CPR R6 ;to limit R6 02 FA BNC LOOP1 ;loop if C clear INCREMENT: INR Rn [ En ] The contents of Rn are incremented by 1. The carry is cleared and other branch conditions reflect the incremented value. EXAMPLE: 15 34 A0 SET R5 $A034 ;(Pointer) B0 SUB R0 ;Zero to R0 55 ST @R5 ;Clr Location $A034 E5 INR R5 ;Incr R5 to $A036 55 ST @R5 ;Clrs location $A036 ;(not $A035) DECREMENT: DCR Rn [ Fn ] The contents of Rn are decremented by 1. The carry is cleared and other branch conditions reflect the decremented value. EXAMPLE: (Clear 9 bytes beginning at location A034) 15 34 A0 SET R5 $A034 ;Init pointer 14 09 00 SET R4 9 ;Init counter B0 SUB R0 ;Zero ACC 55 LOOP2 ST @R5 ;Clear a mem byte F4 DCR R4 ;Decrement count 07 FC BNZ LOOP2 ;Loop until Zero Non-Register Instructions: -------------------------- RETURN TO 6502 MODE: RTN 00 Control is returned to the 6502 and program execution continues at the ECK BOTH BYTES FOR NO $FF F7E4: 49 FF 230 EOR #$FF F7E6: D0 B9 231 BNE BR1 ;BRANCH IF NOT MINUS 1 F7E8: 60 232 NUL RTS F7E9: A2 18 233 RS LDX #$18 ;12*2 FOR R12 AS STACK POINTER F7EB: 20 66 F7 234 JSR DCR ;DECR STACK POINTER F7EE: A1 00 235 LDA (R0L,X) ;POP HIGH RETURN ADDRESS TO PC F7F0: 85 1F 236 STA R15H F7F2: 20 66 F7 237 JSR DCR ;SAME FOR LOW-ORDER BYTE F7F5: A1 00 238 LDA (R0L,X) F7F7: 85 1E 239 STA R15L F7F9: 60 240 RTS F7FA: 4C C7 F6 241 RTN JMP RTNZ +-------------------------------------------------------------------n FP1 and FP2 respectively. Both should be normalized prior to calling FMUL to retain maximum precision. Uses: MD1, MD2, RTLOG1, ADD, MDEND. Exit: The signed normalized floating point product is left in FP1. M1 is truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is left in FP2. E, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG contains $FF upon exit. Cautions: An exit to location $3F5 is taken if the product is less than -2^128 or greater than +2^128-1. Notes: FMUL will run faster if the absolute value of the multiplier mantissa contains fewer '1's than the absolute value of the multiplicand mantissa. Example: Prior to calling FMUL, FP1 contains +12 and FP2 contains -5. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FMUL, FP1 contains -60 and FP2 contains +5. _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $88 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $50 | | 0 | | 0 | (+ 5) |_____| |_____| |_____| |_____| X2 M2 FDIV subroutine (addr $F4B2) Purpose: To perform division of floating point numbers. Entry: The normalized dividend is in FP2 and the normalized divisor is in FP1. Exit: The signed normalized floating point quotient is left in FP1. The mantissa (M1) is truncated to 24 bits. The 3-bit M1 extension (E) contains the absolute value of the divisor mantissa. MD2, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to location $3F5 is taken if the quotient is less than -2^128 or greater than +2^128-1 Notes: MD2 contains the remainder mantissa (equivalent to the MOD function). The remainder exponent is the same as the quotient exponent, or 1 less if the dividend mantissa magnitude is less than the divisor mantissa magnitude. Example: Prior to calling FDIV, FP1 contains -60 (dividend), and FP2 contains +12 (divisor). _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $80 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2 | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 After calling FMUL, FP1 contains -5 and M2 contains 0. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $B0 | | 0 | | 0 | (-5) |_____| |_____| |_____| |_____| X1 M1 FLOAT Subroutine (address $F451) Purpose: To convert integers to floating point representation. Entry: A signed (two's complement) 2-byte integer is stored in M1 (high-order byte) and M1+1 (low-order byte). M1+2 must be cleared by user prior to entry. Uses: NORM1. Exit: The normalized floating point equivalent is left in FP1. E, FP2, SIGN, and SCR are not disturbed. The A-REG contains a copy of the high-order mantissa byte upon exit but the X- and Y-REGs are not disturbed. The carry is cleared. Notes: To float a 1-byte integer, place it in M1+1 and clear M1 as well as M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other arguments. The user may check for zero prior to calling FLOAT and increase throughput. * * LOW-ORDER INT. BYTE IN A-REG * HIGH-ORDER BYTE IN Y-REG * 85 FA XFLOAT STA M1+1 84 F9 STY M1 INIT MANT1 A0 00 LDY #$0 84 FB STY M1+2 05 D9 ORA M1 CHK BOTH BYTES FOR D0 03 BNE TOFLOAT ZERO 85 F8 STA X1 IF SO CLR X1 60 RTS AND RETURN 4C 51 F4 TOFLOAT JMP FLOAT ELSE FLOAT INTEGER Example: Float +274 ($0112 hex) CALLING SEQUENCE A0 01 LDY #$01 HIGH-ORDER INTEGER BYTE A9 12 LDA #$12 LOW-ORDER INTEGER BYTE 84 F9 STY M1 85 FA STA M1+1 A9 00 LDA #$00 85 F8 STA M1+2 20 51 F4 JSR FLOAT Upon returning from FLOAT, FP1 contains the floating point representation of +274. _____ _____ _____ _____ | | | | | | | | FP1 | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 FIX subroutine (address $F640) Purpose: To extract the integer portion of a floating point number with truncation (ENTIER function). Entry: A floating point value is in FP1. It need not be normalized. Uses: RTAR. Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order byte). The floating point values +24.63 and -61.2 are converted to the integers +24 and -61 respectively. FP1 and E are altered but FP2, E, SIGN, and SCR are not. The A- and X-REGs are altered but the Y-REG is not. Example: The floating point value +274 is in FP1 prior to calling FIX. _____ _____ _____ _____ | | | | | | | | FP1: | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 After calling FIX, M1 (high-order byte) and M1+1 (low-order byte) contain the integer representation of +274 ($0112). _____ _____ _____ _____ | | | | | | | | FP1: | $8E | | $01 | | $12 | | 0 | |_____| |_____| |_____| |_____| X1 M1 Note: FP1 contains an unnormalized representation of +274 upon exit. NORM Subroutine (address $F463) Purpose: To normalize the value in FP1, thus insuring maximum precision. Entry: A normalized or unnormalized value is in FP1. Exit: The value in FP1 is normalized. A zero mantissa will exit with X1=0 (2 exponent). If the exponent on exit is -128 (X1=0) then the mantissa (M1) is not necessarily normalized (with the two high-order mantissa bits unequal). E, FP2, SIGN, AND SCR are not distubed. The A-REG is disturbed but the X- and Y-REGs are not. The carry is set. Example: FP1 contains +12 in unnormalized form (as .0011 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $86 | | $0C | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| x1 M1 Upon exit from NORM, FP1 contains +12 in normalized form (as 1.1 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1 when it is known the exponent is not -128 (X1=0) upon entry. Entry: An unnormalized number is in FP1. The exponent byte should not be 0 for normal use. Exit: The normalized value is in FP1. E, FP2, SIGN, and SCR are not not disturbed. The A-REG is altered but the X- and Y-REGs are not. ADD Subroutine (address $F425) Purpose: To add the two mantissas (M1 and M2) as 3-byte integers. Entry: Two mantissas are in M1 (through M1+2) and M2 (through M2+2). They should be alignen FP1 and FP2 respectively. Both should be normalized prior to calling FMUL to retain maximum precision. Uses: MD1, MD2, RTLOG1, ADD, MDEND. Exit: The signed normalized floating point product is left in FP1. M1 is truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is left in FP2. E, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG contains $FF upon exit. Cautions: An exit to location $3F5 is taken if the product is less than -2^128 or greater than +2^128-1. Notes: FMUL will run faster if the absolute value of the multiplier mantissa contains fewer '1's than the absolute value of the multiplicand mantissa. Example: Prior to calling FMUL, FP1 contains +12 and FP2 contains -5. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FMUL, FP1 contains -60 and FP2 contains +5. _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $88 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $50 | | 0 | | 0 | (+ 5) |_____| |_____| |_____| |_____| X2 M2 FDIV subroutine (addr $F4B2) Purpose: To perform division of floating point numbers. Entry: The normalized dividend is in FP2 and the normalized divisor is in FP1. Exit: The signed normalized floating point quotient is left in FP1. The mantissa (M1) is truncated to 24 bits. The 3-bit M1 extension (E) contains the absolute value of the divisor mantissa. MD2, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to location $3F5 is taken if the quotient is less than -2^128 or greater than +2^128-1 Notes: MD2 contains the remainder mantissa (equivalent to the MOD function). The remainder exponent is the same as the quotient exponent, or 1 less if the dividend mantissa magnitude is less than the divisor mantissa magnitude. Example: Prior to calling FDIV, FP1 contains -60 (dividend), and FP2 contains +12 (divisor). _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $80 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2 | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 After calling FMUL, FP1 contains -5 and M2 contains 0. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $B0 | | 0 | | 0 | (-5) |_____| |_____| |_____| |_____| X1 M1 FLOAT Subroutine (address $F451) Purpose: To convert integers to floating point representation. Entry: A signed (two's complement) 2-byte integer is stored in M1 (high-order byte) and M1+1 (low-order byte). M1+2 must be cleared by user prior to entry. Uses: NORM1. Exit: The normalized floating point equivalent is left in FP1. E, FP2, SIGN, and SCR are not disturbed. The A-REG contains a copy of the high-order mantissa byte upon exit but the X- and Y-REGs are not disturbed. The carry is cleared. Notes: To float a 1-byte integer, place it in M1+1 and clear M1 as well as M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other arguments. The user may check for zero prior to calling FLOAT and increase throughput. * * LOW-ORDER INT. BYTE IN A-REG * HIGH-ORDER BYTE IN Y-REG * 85 FA XFLOAT STA M1+1 84 F9 STY M1 INIT MANT1 A0 00 LDY #$0 84 FB STY M1+2 05 D9 ORA M1 CHK BOTH BYTES FOR D0 03 BNE TOFLOAT ZERO 85 F8 STA X1 IF SO CLR X1 60 RTS AND RETURN 4C 51 F4 TOFLOAT JMP FLOAT ELSE FLOAT INTEGER Example: Float +274 ($0112 hex) CALLING SEQUENCE A0 01 LDY #$01 HIGH-ORDER INTEGER BYTE A9 12 LDA #$12 LOW-ORDER INTEGER BYTE 84 F9 STY M1 85 FA STA M1+1 A9 00 LDA #$00 85 F8 STA M1+2 20 51 F4 JSR FLOAT Upon returning from FLOAT, FP1 contains the floating point representation of +274. _____ _____ _____ _____ | | | | | | | | FP1 | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 FIX subroutine (address $F640) Purpose: To extract the integer portion of a floating point number with truncation (ENTIER function). Entry: A floating point value is in FP1. It need not be normalized. Uses: RTAR. Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order byte). The floating point values +24.63 and -61.2 are converted to the integers +24 and -61 respectively. FP1 and E are altered but FP2, E, SIGN, and SCR are not. The A- and X-REGs are altered but the Y-REG is not. Example: The floating point value +274 is in FP1 prior to calling FIX. _____ _____ _____ _____ | | | | | | | | FP1: | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 After calling FIX, M1 (high-order byte) and M1+1 (low-order byte) contain the integer representation of +274 ($0112). _____ _____ _____ _____ | | | | | | | | FP1: | $8E | | $01 | | $12 | | 0 | |_____| |_____| |_____| |_____| X1 M1 Note: FP1 contains an unnormalized representation of +274 upon exit. NORM Subroutine (address $F463) Purpose: To normalize the value in FP1, thus insuring maximum precision. Entry: A normalized or unnormalized value is in FP1. Exit: The value in FP1 is normalized. A zero mantissa will exit with X1=0 (2 exponent). If the exponent on exit is -128 (X1=0) then the mantissa (M1) is not necessarily normalized (with the two high-order mantissa bits unequal). E, FP2, SIGN, AND SCR are not distubed. The A-REG is disturbed but the X- and Y-REGs are not. The carry is set. Example: FP1 contains +12 in unnormalized form (as .0011 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $86 | | $0C | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| x1 M1 Upon exit from NORM, FP1 contains +12 in normalized form (as 1.1 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1 when it is known the exponent is not -128 (X1=0) upon entry. Entry: An unnormalized number is in FP1. The exponent byte should not be 0 for normal use. Exit: The normalized value is in FP1. E, FP2, SIGN, and SCR are not not disturbed. The A-REG is altered but the X- and Y-REGs are not. ADD Subroutine (address $F425) Purpose: To add the two mantissas (M1 and M2) as 3-byte integers. Entry: Two mantissas are in M1 (through M1+2) and M2 (through M2+2). They should be alignelocation immediately following the RTN instruction. the 6502 registers and status conditions are restored to their original contents (prior to entering SWEET 16 mode). BRANCH ALWAYS: BR ea [ 01 d ] An effective address (ea) is calculated by adding the signed displacement byte (d) to the PC. The PC contains the address of the instruction immediately following the BR, or the address of the BR op plus 2. The displacement is a signed two's complement value from -128 to +127. Branch conditions are not changed. NOTE: The effective address calculation is identical to that for 6502 relative branches. The Hex add & Subtract features of the APPLE ][ monitor may be used to calculate displacements. d = $80 ea = PC + 2 - 128 d = $81 ea = PC + 2 - 127 d = $FF ea = PC + 2 - 1 d = $00 ea = PC + 2 + 0 d = $01 ea = PC + 2 + 1 d = $7E ea = PC + 2 + 126 d = $7F ea = PC + 2 + 127 EXAMPLE: $300: 01 50 BR $352 BRANCH IF NO CARRY: BNC ea [ 02 d ] A branch to the effective address is taken only is the carry is clear, otherwise execution resumes as normal with the next instruction. Branch conditions are not changed. BRANCH IF CARRY SET: BC ea [ 03 d ] A branch is effected only if the carry is set. Branch conditions are not changed. BRANCH IF PLUS: BP ea [ 04 d ] A branch is effected only if the prior 'result' (or most recently transferred dat) was positive. Branch conditions are not changed. EXAMPLE: (Clear mem from A034 to A03F) 15 34 A0 SET R5 $A034 ;Init pointer 14 3F A0 SET R4 $A03F ;Init limit B0 LOOP3 SUB R0 55 ST @R5 ;Clear mem byte ;Increment R5 24 LD R4 ;Compare limit D5 CPR R5 ;to pointer 04 FA BP LOOP3 ;Loop until done BRANCH IF MINUS: BM ea [ 05 d ] A branch is effected only if prior 'result' was minus (negative, MSB = 1). Branch conditions are not changed. BRANCH IF ZERO: BZ ea [ 06 d ] A Branch is effected only if the prior 'result' was zero. Branch conditions are not changed. BRANCH IF NONZERO BNZ ea [ 07 d ] A branch is effected only if the priot 'result' was non-zero Branch conditions are not changed. BRANCH IF MINUS ONE BM1 ea [ 08 d ] A branch is effected only if the prior 'result' was minus one ($FFFF Hex). Branch conditions are not changed. BRANCH IF NOT MINUS ONE BNM1 ea [ 09 d ] A branch effected only if the prior 'result' was not minus 1. Branch conditions are not changed. BREAK: BK [ 0A ] A 6502 BRK (break) instruction is executed. SWEET 16 may be re-entered non destructively at SW16d after correcting the stack pointer to its value prior to executing the BRK. RETURN FROM SWEET 16 SUBROUTINE: RS [ 0B ] RS terminates execution of a SWEET 16 subroutine and returns to the SWEET 16 calling program which resumes execution (in SWEET 16 mode). R12, which is the SWEET 16 subroutine return stack pointer, is decremented twice. Branch conditions are not changed. BRANCH TO SWEET 16 SUBROUTINE: BS ea [ 0c d ] A branch to the effective address (PC + 2 + d) is taken and execution is resumed in SWEET 16 mode. The current PC is pushed onto a SWEET 16 subroutine return address stack whose pointer is R12, and R12 is incremented by 2. The carry is cleared and branch conditions set to indicate the current ACC contents. EXAMPLE: (Calling a 'memory move' subroutine to move A034-A03B to 3000-3007) 15 34 A0 SET R5 $A034 ;Init pointer 1 14 3B A0 SET R4 $A03B ;Init limit 1 16 00 30 SET R6 $3000 ;Init pointer 2 0C 15 BS MOVE ;Call move subroutine 45 MOVE LD @R5 ;Move one 56 ST @R6 ;byte 24 LD R4 D5 CPR R5 ;Test if done 04 FA BP MOVE 0B RS ;Return Theory of Operation: -------------------- SWEET 16 execution mode begins with a subroutine call to SW16. All 6502 registers are saved at this time, to be restored when a SWEET 16 RTN instruction returns control to the 6502. If you can tolerate indefinate 6502 register contents upon exit, approximately 30 usec may be saved by entering at SW16 + 3. Because this might cause an inadvertant switch from Hex to Decimal mode, it is advisable to enter at SW16 the first time through. After saving the 6502 registers, SWEET 16 initializes its PC (R15) with the subroutine return address off the 6502 stack. SWEET 16's PC points to the location preceding the next instruction to be executed. Following the subroutine call are 1-,2-, and 3-byte SWEET 16 instructions, stored in ascending memory like 6502 instructions. the main loop at SW16B repeatedly calls the 'execute instruction' routine to execute it. Subroutine SW16C increments the PC (R15) and fetches the next opcode, which is either a register op of the form OP REG with OP between 1 and 15 or a non-register op of the form 0 OP with OP between 0 and 13. Assuming a register op, the register specification is doubled to account for the 3 byte SWEET 16 registers and placed in the X-reg for indexing. Then the instruction type is determined. Register ops place the doubled register specification in the high order byte of R14 indicating the 'prior result register' to subsequent branch instructions. Non-register ops treat the register specifcation (right-hand half-byte) as their opcode, increment the SWEET 16 PC to point at the displacement byte of branch instructions, load the A-reg with the 'prior result register' index for branch condition testing, and clear the Y-reg. When is an RTS really a JSR? ---------------------------- Each instruction type has a corresponding subroutine. The subroutine entry points are stored in a table which is directly indexed into by the opcode. By assigning all the entries to a common page, only a single byte to address need be stored per routine. The 6502 indirect jump might have been used as follows to transfer control to the appropriate subroutine. LDA #ADRH ;High-order byte. STA IND+1 LDA OPTBL,X ;Low-order byte. STA IND JMP (IND) To save code, the subroutine entry address (minus 1) is pushed onto the stack, high-order byte first. A 6502 RTS (return from subroutine) is used to pop the address off the stack and into the 6502 PC (after incrementing by 1). The net result is that the desired subroutine is reached by executing a subroutine return instruction! Opcode Subroutines: ------------------- The register op routines make use of the 6502 'zero page indexed by X' and 'indexed by X direct' addressing modes to access the specified registers and indirect data. The 'result' of most register ops is left in the specified register and can be sensed by subsequent branch instructions, since the register specification is saved in the high- order byte of R14. This specification is changed to indicate R0 (ACC) for ADD and SUB instructions and R13 for the CPR (compare) instruction. Normally the high-order R14 byte holds the 'prior result register' index times 2 to account for the 2-byte SWEET 16 registers and the LSB is zero. If ADD, SUB, or CPR instructions generate carries, then this index is incremented, setting the LSB. The SET instruction increments the PC twice, picking up data bytes in the specified register. In accordance with 6502 convention, the low-order data byte precedes the high-order byte. Most SWEET 16 non-register ops are relative branches. The corresponding subroutines determine whether or not the 'prior result' meets the specified branch condition and if so, update the SWEET 16 PC by adding the displacement value (-128 to +127 bytes). The RTN op restores the 6502 register contents, pops the subroutine return stack and jumps indirect through the SWEET 16 PC. This transfers control to the 6502 at the instruction immediately following the RTN instruction. The BK op actually executes a 6502 break instruction (BRK), transferring control to the interrupt handler. Any number of subroutine levels may be implemented within SWEET 16 code via the BS (Branch to Subroutine) and RS (Return from Subroutine) instructions. The user must initialize and otherwise not disturb R12 if the SWEET 16 subroutine capability is used since it is utilized as the automatic return stack pointer. Memory Allocation: ------------------ The only storage that must be allocated for SWEET 16 variables are 32 consecutive locations in page zero for the SWEET 16 registers, four locations to save the 6502 register contents, and a few levels of the 6502 subroutine return address stack. if you don't need to preserve the 6502 register contents, delete the SAVE and RESTORE subroutines and the corresponding subroutine calls. This will free the four page zero locations ASAV, XSAV, YSAV, and PSAV. User Modifications: ------------------- You may wish to add some of your own instructions to this implementation of SWEET 16. If you use the unassigned opcodes $0E and $0F, remember that SWEET 16 treats these as 2-byte instructions. You may wish to handle the break instruction as a SWEET 16 call, saving two bytes of code each time you transfer into SWEET 16 mode. Or you may wish to use the SWEET 16 BK (break) op as a 'CHAROUT' call in the interrupt handler. You can perform absolute jumps within SWEET 16 by loading the ACC (R0) with the address you wish to jump to (minus 1) and executing a ST R15 instruction. +------------------------------------------------------------------------ | TOPIC -- Apple II -- WOZPAK Sweet-16 article by Dick Sedgewick +------------------------------------------------------------------------ SWEET 16 - INTRODUCTION by Dick Sedgewick Sweet 16 is probably the least used and least understood seed in the Apple ][. In exactly the same sense that Integer and Applesoft Basics are languages, SWEET 16 is a language. Compared to the Basics, however, it would be classed as low level with a strong likeness to conventional 6502 Assembly language. To use SWEET 16, you must learn the language - and to quote "WOZ", "The opcode list is short and uncomplicated". "WOZ" (Steve Wozniak), of course is Mr. Apple, and the creator of SWEET 16. SWEET 16 is ROM based in every Apple ][ from $F689 to $F7FC. It has it's own set of opcodes and instruction sets, and uses the SAVE and RESTORE routines from the Apple Monitor to preserve the 6502 registers when in use, allowing SWEET 16 to be used as a subroutine. It uses the first 32 locations on zero page to set up its 16 double byte registers, and is therefore not compatible with Applesoft Basic without some additional efforts. The original article, "SWEET 16: The 6502 Dream Machine", first appeared in Byte Magazine, November 1977 and later in the original "WOZ PAK". The article is included here and again as test material to help understand the use and implementation of SWEET 16. Examples of the use of SWEET 16 are found in the Programmer's Aid #1, in the Renumber, Append, and Relocate programs. The Programmer's Aid Operating Manual contains complete source assembly listings, indexed on page 65. The demonstration program is written to be introductory and simple, consisting of three parts: 1. Integer Basic Program 2. Machine Language Subroutine 3. SWEET 16 Subroutine The task of the program will be to move data. Parameters of the move will be entered in the Integer Basic Program. The "CALL 768" ($300) at line 120, enters a 6502 machine language subroutine having the single purpose of entering SWEET 16 and subsequently returning to BASIC (addresses $300, $301, $302, and $312 respectively). The SWEET 16 subroutine of course performs the move, and is entered at Hex locations $303 to $311 (see listing Number 3). After the move, the screen will display three lines of data, each 8 bytes long, and await entry of a new set of parameters. The three lines of data displayed on the screen are as follows: Line 1: The first 8 bytes of data starting at $800, which is the fixed source data to be moved (in this case, the string A$). Line 2: The first 8 bytes of data starting at the hex address entered as the destination of the move (high order byte only). Line 3: The first 8 bytes of data starting at $0000 (the first four SWEET 16 registers). The display of 8 bytes of data was chosen to simplify the illustration of what goes on. Integer Basic has its own way of recording the string A$. Because the name chosen for the string "A$" is stored in 2 bytes, a total of five housekeeping bytes precede the data entered as A$, leaving only three additional bytes available for display. Integer Basic also adds a housekeeping byte at the end of a string, known as the "string terminator". Consequently, for convenience purposes of the display, and to see the string terminator as the 8th byte, the string data entered via the keyboard should be limited to two characters, and will appear as the 6th and 7th bytes. Additionally, parameters to be entered include the number of bytes to be moved. A useful range for this demonstration would be 1-8 inclusive, but of course 1-255 will work. Finally, the starting address of the destination of the move must be entered. Again, for simplicity, only the high-order byte is entered, and the program allows a choice between Decimal 9 and high-order byte of program pointer 1, to avoid unnecessary problems (in this demonstration enter a decimal number between 9 and 144 for a 48K APPLE). The 8 bytes of data displayed starting at $00 will enable one to observe the condition of the SWEET 16 registers after a move has been accomplished, and thereby understand how the SWEET 16 program works. From the article "SWEET 16: A 6502 Dream Machine", remember that SWEET 16 can establish 16 double byte registers starting at $00. This means that SWEET 16 can use the first 32 addresses on zero page. The "events" occurring in this demonstration program can be studied in the first four SWEET 16 registers. Therefore, the 8 byte display starting at $0000 is large enough for this purpose. These four registers are established as R0, R1, R2, R3: R0 $0000 & 0001 -SWEET 16 accumulator R1 $0002 & 0003 -Source address R2 $0004 & 0005 -Destination address R3 $0006 & 0007 -Number of bytes to move . . . R14 $001C & 001D -Prior result register R15 $001E & 001F -SWEET 16 Program counter Additionally, an examination of registers R14 and R15 will extend and understanding of SWEET 16, as fully explained in the "WOZ" text. Notice that the high order byte of R14, (located at $1D) contains $06, and is the doubled register specification (3X2=$06). R15, the SWEET 16 program counter contains the address of the next operation as it did for each step during execution of the program, which was $0312 when execution ended and the 6502 code resumed. To try a sample run, enter the Integer Basic program as shown in Listing #1. Of course, REM statements can be omitted, and line 10 is only helpful if the machine code is to be stored on disk. Listing #2 must also be entered starting at $300. NOTE: An FP1 and FP2 respectively. Both should be normalized prior to calling FMUL to retain maximum precision. Uses: MD1, MD2, RTLOG1, ADD, MDEND. Exit: The signed normalized floating point product is left in FP1. M1 is truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is left in FP2. E, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG contains $FF upon exit. Cautions: An exit to location $3F5 is taken if the product is less than -2^128 or greater than +2^128-1. Notes: FMUL will run faster if the absolute value of the multiplier mantissa contains fewer '1's than the absolute value of the multiplicand mantissa. Example: Prior to calling FMUL, FP1 contains +12 and FP2 contains -5. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FMUL, FP1 contains -60 and FP2 contains +5. _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $88 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $50 | | 0 | | 0 | (+ 5) |_____| |_____| |_____| |_____| X2 M2 FDIV subroutine (addr $F4B2) Purpose: To perform division of floating point numbers. Entry: The normalized dividend is in FP2 and the normalized divisor is in FP1. Exit: The signed normalized floating point quotient is left in FP1. The mantissa (M1) is truncated to 24 bits. The 3-bit M1 extension (E) contains the absolute value of the divisor mantissa. MD2, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to location $3F5 is taken if the quotient is less than -2^128 or greater than +2^128-1 Notes: MD2 contains the remainder mantissa (equivalent to the MOD function). The remainder exponent is the same as the quotient exponent, or 1 less if the dividend mantissa magnitude is less than the divisor mantissa magnitude. Example: Prior to calling FDIV, FP1 contains -60 (dividend), and FP2 contains +12 (divisor). _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $80 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2 | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 After calling FMUL, FP1 contains -5 and M2 contains 0. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $B0 | | 0 | | 0 | (-5) |_____| |_____| |_____| |_____| X1 M1 FLOAT Subroutine (address $F451) Purpose: To convert integers to floating point representation. Entry: A signed (two's complement) 2-byte integer is stored in M1 (high-order byte) and M1+1 (low-order byte). M1+2 must be cleared by user prior to entry. Uses: NORM1. Exit: The normalized floating point equivalent is left in FP1. E, FP2, SIGN, and SCR are not disturbed. The A-REG contains a copy of the high-order mantissa byte upon exit but the X- and Y-REGs are not disturbed. The carry is cleared. Notes: To float a 1-byte integer, place it in M1+1 and clear M1 as well as M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other arguments. The user may check for zero prior to calling FLOAT and increase throughput. * * LOW-ORDER INT. BYTE IN A-REG * HIGH-ORDER BYTE IN Y-REG * 85 FA XFLOAT STA M1+1 84 F9 STY M1 INIT MANT1 A0 00 LDY #$0 84 FB STY M1+2 05 D9 ORA M1 CHK BOTH BYTES FOR D0 03 BNE TOFLOAT ZERO 85 F8 STA X1 IF SO CLR X1 60 RTS AND RETURN 4C 51 F4 TOFLOAT JMP FLOAT ELSE FLOAT INTEGER Example: Float +274 ($0112 hex) CALLING SEQUENCE A0 01 LDY #$01 HIGH-ORDER INTEGER BYTE A9 12 LDA #$12 LOW-ORDER INTEGER BYTE 84 F9 STY M1 85 FA STA M1+1 A9 00 LDA #$00 85 F8 STA M1+2 20 51 F4 JSR FLOAT Upon returning from FLOAT, FP1 contains the floating point representation of +274. _____ _____ _____ _____ | | | | | | | | FP1 | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 FIX subroutine (address $F640) Purpose: To extract the integer portion of a floating point number with truncation (ENTIER function). Entry: A floating point value is in FP1. It need not be normalized. Uses: RTAR. Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order byte). The floating point values +24.63 and -61.2 are converted to the integers +24 and -61 respectively. FP1 and E are altered but FP2, E, SIEÜ`•@ÿÚcA/§J6€2Hà¸,)ÁõÊPHD{%´s are altered but the Y-REG is not. Example: The floating point value +274 is in FP1 prior to calling FIX. _____ _____ _____ _____ | | | | | | | | FP1: | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 After calling FIX, M1 (high-order byte) and M1+1 (low-order byte) contain the integer representation of +274 ($0112). _____ _____ _____ _____ | | | | | | | | FP1: | $8E | | $01 | | $12 | | 0 | |_____| |_____| |_____| |_____| X1 M1 Note: FP1 contains an unnormalized representation of +274 upon exit. NORM Subroutine (address $F463) Purpose: To normalize the value in FP1, thus insuring maximum precision. Entry: A normalized or unnormalized value is in FP1. Exit: The value in FP1 is normalized. A zero mantissa will exit with X1=0 (2 exponent). If the exponent on exit is -128 (X1=0) then the mantissa (M1) is not necessarily normalized (with the two high-order mantissa bits unequal). E, FP2, SIGN, AND SCR are not distubed. The A-REG is disturbed but the X- and Y-REGs are not. The carry is set. Example: FP1 contains +12 in unnormalized form (as .0011 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $86 | | $0C | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| x1 M1 Upon exit from NORM, FP1 contains +12 in normalized form (as 1.1 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1 when it is known the exponent is not -128 (X1=0) upon entry. Entry: An unnormalized number is in FP1. The exponent byte should not be 0 for normal use. Exit: The normalized value is in FP1. E, FP2, SIGN, and SCR are not not disturbed. The A-REG is altered but the X- and Y-REGs are not. ADD Subroutine (address $F425) Purpose: To add the two mantissas (M1 and M2) as 3-byte integers. Entry: Two mantissas are in M1 (through M1+2) and M2 (through M2+2). They should be alignen FP1 and FP2 respectively. Both should be normalized prior to calling FMUL to retain maximum precision. Uses: MD1, MD2, RTLOG1, ADD, MDEND. Exit: The signed normalized floating point product is left in FP1. M1 is truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is left in FP2. E, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG contains $FF upon exit. Cautions: An exit to location $3F5 is taken if the product is less than -2^128 or greater than +2^128-1. Notes: FMUL will run faster if the absolute value of the multiplier mantissa contains fewer '1's than the absolute value of the multiplicand mantissa. Example: Prior to calling FMUL, FP1 contains +12 and FP2 contains -5. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FMUL, FP1 contains -60 and FP2 contains +5. _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $88 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $50 | | 0 | | 0 | (+ 5) |_____| |_____| |_____| |_____| X2 M2 FDIV subroutine (addr $F4B2) Purpose: To perform division of floating point numbers. Entry: The normalized dividend is in FP2 and the normalized divisor is in FP1. Exit: The signed normalized floating point quotient is left in FP1. The mantissa (M1) is truncated to 24 bits. The 3-bit M1 extension (E) contains the absolute value of the divisor mantissa. MD2, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to location $3F5 is taken if the quotient is less than -2^128 or greater than +2^128-1 Notes: MD2 contains the remainder mantissa (equivalent to the MOD function). The remainder exponent is the same as the quotient exponent, or 1 less if the dividend mantissa magnitude is less than the divisor mantissa magnitude. Example: Prior to calling FDIV, FP1 contains -60 (dividend), and FP2 contains +12 (divisor). _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $80 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2 | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 After calling FMUL, FP1 contains -5 and M2 contains 0. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $B0 | | 0 | | 0 | (-5) |_____| |_____| |_____| |_____| X1 M1 FLOAT Subroutine (address $F451) Purpose: To convert integers to floating point representation. Entry: A signed (two's complement) 2-byte integer is stored in M1 (high-order byte) and M1+1 (low-order byte). M1+2 must be cleared by user prior to entry. Uses: NORM1. Exit: The normalized floating point equivalent is left in FP1. E, FP2, SIGN, and SCR are not disturbed. The A-REG contains a copy of the high-order mantissa byte upon exit but the X- and Y-REGs are not disturbed. The carry is cleared. Notes: To float a 1-byte integer, place it in M1+1 and clear M1 as well as M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other arguments. The user may check for zero prior to calling FLOAT and increase throughput. * * LOW-ORDER INT. BYTE IN A-REG * HIGH-ORDER BYTE IN Y-REG * 85 FA XFLOAT STA M1+1 84 F9 STY M1 INIT MANT1 A0 00 LDY #$0 84 FB STY M1+2 05 D9 ORA M1 CHK BOTH BYTES FOR D0 03 BNE TOFLOAT ZERO 85 F8 STA X1 IF SO CLR X1 60 RTS AND RETURN 4C 51 F4 TOFLOAT JMP FLOAT ELSE FLOAT INTEGER Example: Float +274 ($0112 hex) CALLING SEQUENCE A0 01 LDY #$01 HIGH-ORDER INTEGER BYTE A9 12 LDA #$12 LOW-ORDER INTEGER BYTE 84 F9 STY M1 85 FA STA M1+1 A9 00 LDA #$00 85 F8 STA M1+2 20 51 F4 JSR FLOAT Upon returning from FLOAT, FP1 contains the floating point representation of +274. _____ _____ _____ _____ | | | | | | | | FP1 | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 FIX subroutine (address $F640) Purpose: To extract the integer portion of a floating point number with truncation (ENTIER function). Entry: A floating point value is in FP1. It need not be normalized. Uses: RTAR. Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order byte). The floating point values +24.63 and -61.2 are converted to the integers +24 and -61 respectively. FP1 and E are altered but FP2, E, SIEÜ`•@ÿÚcA/§J6€2Hà¸,)ÁõÊPHD{%´s are altered but the Y-REG is not. Example: The floating point value +274 is in FP1 prior to calling FIX. _____ _____ _____ _____ | | | | | | | | FP1: | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 After calling FIX, M1 (high-order byte) and M1+1 (low-order byte) contain the integer representation of +274 ($0112). _____ _____ _____ _____ | | | | | | | | FP1: | $8E | | $01 | | $12 | | 0 | |_____| |_____| |_____| |_____| X1 M1 Note: FP1 contains an unnormalized representation of +274 upon exit. NORM Subroutine (address $F463) Purpose: To normalize the value in FP1, thus insuring maximum precision. Entry: A normalized or unnormalized value is in FP1. Exit: The value in FP1 is normalized. A zero mantissa will exit with X1=0 (2 exponent). If the exponent on exit is -128 (X1=0) then the mantissa (M1) is not necessarily normalized (with the two high-order mantissa bits unequal). E, FP2, SIGN, AND SCR are not distubed. The A-REG is disturbed but the X- and Y-REGs are not. The carry is set. Example: FP1 contains +12 in unnormalized form (as .0011 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $86 | | $0C | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| x1 M1 Upon exit from NORM, FP1 contains +12 in normalized form (as 1.1 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1 when it is known the exponent is not -128 (X1=0) upon entry. Entry: An unnormalized number is in FP1. The exponent byte should not be 0 for normal use. Exit: The normalized value is in FP1. E, FP2, SIGN, and SCR are not not disturbed. The A-REG is altered but the X- and Y-REGs are not. ADD Subroutine (address $F425) Purpose: To add the two mantissas (M1 and M2) as 3-byte integers. Entry: Two mantissas are in M1 (through M1+2) and M2 (through M2+2). They should be alignen FP1 and FP2 respectively. Both should be normalized prior to calling FMUL to retain maximum precision. Uses: MD1, MD2, RTLOG1, ADD, MDEND. Exit: The signed normalized floating point product is left in FP1. M1 is truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is left in FP2. E, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG contains $FF upon exit. Cautions: An exit to location $3F5 is taken if the product is less than -2^128 or greater than +2^128-1. Notes: FMUL will run faster if the absolute value of the multiplier mantissa contains fewer '1's than the absolute value of the multiplicand mantissa. Example: Prior to calling FMUL, FP1 contains +12 and FP2 contains -5. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FMUL, FP1 contains -60 and FP2 contains +5. _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $88 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $50 | | 0 | | 0 | (+ 5) |_____| |_____| |_____| |_____| X2 M2 FDIV subroutine (addr $F4B2) Purpose: To perform division of floating point numbers. Entry: The normalized dividend is in FP2 and the normalized divisor is in FP1. Exit: The signed normalized floating point quotient is left in FP1. The mantissa (M1) is truncated to 24 bits. The 3-bit M1 extension (E) contains the absolute value of the divisor mantissa. MD2, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to location $3F5 is taken if the quotient is less than -2^128 or greater than +2^128-1 Notes: MD2 contains the remainder mantissa (equivalent to the MOD function). The remainder exponent is the same as the quotient exponent, or 1 less if the dividend mantissa magnitude is less than the divisor mantissa magnitude. Example: Prior to calling FDIV, FP1 contains -60 (dividend), and FP2 contains +12 (divisor). _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $80 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2 | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 After calling FMUL, FP1 contains -5 and M2 contains 0. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $B0 | | 0 | | 0 | (-5) |_____| |_____| |_____| |_____| X1 M1 FLOAT Subroutine (address $F451) Purpose: To convert integers to floating point representation. Entry: A signed (two's complement) 2-byte integer is stored in M1 (high-order byte) and M1+1 (low-order byte). M1+2 must be cleared by user prior to entry. Uses: NORM1. Exit: The normalized floating point equivalent is left in FP1. E, FP2, SIGN, and SCR are not disturbed. The A-REG contains a copy of the high-order mantissa byte upon exit but the X- and Y-REGs are not disturbed. The carry is cleared. Notes: To float a 1-byte integer, place it in M1+1 and clear M1 as well as M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other arguments. The user may check for zero prior to calling FLOAT and increase throughput. * * LOW-ORDER INT. BYTE IN A-REG * HIGH-ORDER BYTE IN Y-REG * 85 FA XFLOAT STA M1+1 84 F9 STY M1 INIT MANT1 A0 00 LDY #$0 84 FB STY M1+2 05 D9 ORA M1 CHK BOTH BYTES FOR D0 03 BNE TOFLOAT ZERO 85 F8 STA X1 IF SO CLR X1 60 RTS AND RETURN 4C 51 F4 TOFLOAT JMP FLOAT ELSE FLOAT INTEGER Example: Float +274 ($0112 hex) CALLING SEQUENCE A0 01 LDY #$01 HIGH-ORDER INTEGER BYTE A9 12 LDA #$12 LOW-ORDER INTEGER BYTE 84 F9 STY M1 85 FA STA M1+1 A9 00 LDA #$00 85 F8 STA M1+2 20 51 F4 JSR FLOAT Upon returning from FLOAT, FP1 contains the floating point representation of +274. _____ _____ _____ _____ | | | | | | | | FP1 | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 FIX subroutine (address $F640) Purpose: To extract the integer portion of a floating point number with truncation (ENTIER function). Entry: A floating point value is in FP1. It need not be normalized. Uses: RTAR. Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order byte). The floating point values +24.63 and -61.2 are converted to the integers +24 and -61 respectively. FP1 and E are altered but FP2, E, SIEÜ`•@ÿÚcA/§J6€2Hà¸,)ÁõÊPHD{%´s are altered but the Y-REG is not. Example: The floating point value +274 is in FP1 prior to calling FIX. _____ _____ _____ _____ | | | | | | | | FP1: | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 After calling FIX, M1 (high-order byte) and M1+1 (low-order byte) contain the integer representation of +274 ($0112). _____ _____ _____ _____ | | | | | | | | FP1: | $8E | | $01 | | $12 | | 0 | |_____| |_____| |_____| |_____| X1 M1 Note: FP1 contains an unnormalized representation of +274 upon exit. NORM Subroutine (address $F463) Purpose: To normalize the value in FP1, thus insuring maximum precision. Entry: A normalized or unnormalized value is in FP1. Exit: The value in FP1 is normalized. A zero mantissa will exit with X1=0 (2 exponent). If the exponent on exit is -128 (X1=0) then the mantissa (M1) is not necessarily normalized (with the two high-order mantissa bits unequal). E, FP2, SIGN, AND SCR are not distubed. The A-REG is disturbed but the X- and Y-REGs are not. The carry is set. Example: FP1 contains +12 in unnormalized form (as .0011 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $86 | | $0C | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| x1 M1 Upon exit from NORM, FP1 contains +12 in normalized form (as 1.1 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1 when it is known the exponent is not -128 (X1=0) upon entry. Entry: An unnormalized number is in FP1. The exponent byte should not be 0 for normal use. Exit: The normalized value is in FP1. E, FP2, SIGN, and SCR are not not disturbed. The A-REG is altered but the X- and Y-REGs are not. ADD Subroutine (address $F425) Purpose: To add the two mantissas (M1 and M2) as 3-byte integers. Entry: Two mantissas are in M1 (through M1+2) and M2 (through M2+2). They should be alignen FP1 and FP2 respectively. Both should be normalized prior to calling FMUL to retain maximum precision. Uses: MD1, MD2, RTLOG1, ADD, MDEND. Exit: The signed normalized floating point product is left in FP1. M1 is truncated to contain the 24 most significant mantissa bits (including sign). The absolute value of the multiplier mantissa (M2) is left in FP2. E, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG contains $FF upon exit. Cautions: An exit to location $3F5 is taken if the product is less than -2^128 or greater than +2^128-1. Notes: FMUL will run faster if the absolute value of the multiplier mantissa contains fewer '1's than the absolute value of the multiplicand mantissa. Example: Prior to calling FMUL, FP1 contains +12 and FP2 contains -5. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FMUL, FP1 contains -60 and FP2 contains +5. _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $88 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $50 | | 0 | | 0 | (+ 5) |_____| |_____| |_____| |_____| X2 M2 FDIV subroutine (addr $F4B2) Purpose: To perform division of floating point numbers. Entry: The normalized dividend is in FP2 and the normalized divisor is in FP1. Exit: The signed normalized floating point quotient is left in FP1. The mantissa (M1) is truncated to 24 bits. The 3-bit M1 extension (E) contains the absolute value of the divisor mantissa. MD2, SIGN, and SCR are altered. The A- and X-REGs are altered and the Y-REG is cleared. Uses: MD1, MD2, MDEND. Cautions: An exit to location $3F5 is taken if the quotient is less than -2^128 or greater than +2^128-1 Notes: MD2 contains the remainder mantissa (equivalent to the MOD function). The remainder exponent is the same as the quotient exponent, or 1 less if the dividend mantissa magnitude is less than the divisor mantissa magnitude. Example: Prior to calling FDIV, FP1 contains -60 (dividend), and FP2 contains +12 (divisor). _____ _____ _____ _____ | | | | | | | | FP1: | $85 | | $80 | | 0 | | 0 | (-60) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2 | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 After calling FMUL, FP1 contains -5 and M2 contains 0. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $B0 | | 0 | | 0 | (-5) |_____| |_____| |_____| |_____| X1 M1 FLOAT Subroutine (address $F451) Purpose: To convert integers to floating point representation. Entry: A signed (two's complement) 2-byte integer is stored in M1 (high-order byte) and M1+1 (low-order byte). M1+2 must be cleared by user prior to entry. Uses: NORM1. Exit: The normalized floating point equivalent is left in FP1. E, FP2, SIGN, and SCR are not disturbed. The A-REG contains a copy of the high-order mantissa byte upon exit but the X- and Y-REGs are not disturbed. The carry is cleared. Notes: To float a 1-byte integer, place it in M1+1 and clear M1 as well as M1+2 prior to calling FLOAT. FLOAT takes approximately 3 msec. lonqer to convert zero to floating point form than other arguments. The user may check for zero prior to calling FLOAT and increase throughput. * * LOW-ORDER INT. BYTE IN A-REG * HIGH-ORDER BYTE IN Y-REG * 85 FA XFLOAT STA M1+1 84 F9 STY M1 INIT MANT1 A0 00 LDY #$0 84 FB STY M1+2 05 D9 ORA M1 CHK BOTH BYTES FOR D0 03 BNE TOFLOAT ZERO 85 F8 STA X1 IF SO CLR X1 60 RTS AND RETURN 4C 51 F4 TOFLOAT JMP FLOAT ELSE FLOAT INTEGER Example: Float +274 ($0112 hex) CALLING SEQUENCE A0 01 LDY #$01 HIGH-ORDER INTEGER BYTE A9 12 LDA #$12 LOW-ORDER INTEGER BYTE 84 F9 STY M1 85 FA STA M1+1 A9 00 LDA #$00 85 F8 STA M1+2 20 51 F4 JSR FLOAT Upon returning from FLOAT, FP1 contains the floating point representation of +274. _____ _____ _____ _____ | | | | | | | | FP1 | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 FIX subroutine (address $F640) Purpose: To extract the integer portion of a floating point number with truncation (ENTIER function). Entry: A floating point value is in FP1. It need not be normalized. Uses: RTAR. Exit: The two-byte signed two's complement representation of the integer portion is left in M1 (high-order byte) and M1+1 (low-order byte). The floating point values +24.63 and -61.2 are converted to the integers +24 and -61 respectively. FP1 and E are altered but FP2, E, SIEÜ`•@ÿÚcA/§J6€2Hà¸,)ÁõÊPHD{%´s are altered but the Y-REG is not. Example: The floating point value +274 is in FP1 prior to calling FIX. _____ _____ _____ _____ | | | | | | | | FP1: | $88 | | $44 | | $80 | | 0 | (+274) |_____| |_____| |_____| |_____| X1 M1 After calling FIX, M1 (high-order byte) and M1+1 (low-order byte) contain the integer representation of +274 ($0112). _____ _____ _____ _____ | | | | | | | | FP1: | $8E | | $01 | | $12 | | 0 | |_____| |_____| |_____| |_____| X1 M1 Note: FP1 contains an unnormalized representation of +274 upon exit. NORM Subroutine (address $F463) Purpose: To normalize the value in FP1, thus insuring maximum precision. Entry: A normalized or unnormalized value is in FP1. Exit: The value in FP1 is normalized. A zero mantissa will exit with X1=0 (2 exponent). If the exponent on exit is -128 (X1=0) then the mantissa (M1) is not necessarily normalized (with the two high-order mantissa bits unequal). E, FP2, SIGN, AND SCR are not distubed. The A-REG is disturbed but the X- and Y-REGs are not. The carry is set. Example: FP1 contains +12 in unnormalized form (as .0011 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $86 | | $0C | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| x1 M1 Upon exit from NORM, FP1 contains +12 in normalized form (as 1.1 x 2 ). _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 NORM1 subroutine (address $F455) Purpose: To normalize a floating point value in FP1 when it is known the exponent is not -128 (X1=0) upon entry. Entry: An unnormalized number is in FP1. The exponent byte should not be 0 for normal use. Exit: The normalized value is in FP1. E, FP2, SIGN, and SCR are not not disturbed. The A-REG is altered but the X- and Y-REGs are not. ADD Subroutine (address $F425) Purpose: To add the two mantissas (M1 and M2) as 3-byte integers. Entry: Two mantissas are in M1 (through M1+2) and M2 (through M2+2). They should be alignered and the X-REG is cleared. The Y-REG is not disturbed. Cautions: An exit to location S3F5 is taken if the result is less than -2^128 or greater than +2^128-1. or if the subtrahend is -2^128. Example: Prior to calling FSUB, FP1 contains +7 (minuend) and FP2 contalns -5 (subtrahend). _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $70 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $B0 | | 0 | | 0 | (- 5) |_____| |_____| |_____| |_____| X2 M2 After calling FSUB, FP1 contains +12 and FP2 contains +7. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $60 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| X1 M1 FMUL subroutine (address $F48C) Purpose: To multiply floating point numbers. Entry: The multiplicand and multiplier must reside i TECHO .BLOCK 1 ;TERMINAL ECHO LAG 0046 A654 ; BIT7 =CRT IN, 6 =TTY IN, 5 = TTY OUT, 4 = CRT OUT 0047 A654 TOUTFL .BLOCK 1 ;OUTPUT FLAGS 0048 A655 KSHFL .BLOCK 1 ;KEYBOARD SHIFT FLAG 0049 A656 TV .BLOCK 1 ;TRACE VELOCITY (0=SINGLE STEP) 0050 A657 LSTCOM .BLOCK 1 ;STORE LAST MONITOR COMMAND 0051 A658 MAXRC .BLOCK 1 ;MAXIMUM REC LENGTH FOR MEM DUMP 0052 A659 ; 0053 A659 ; USER REG'S FOLLOW 0054 A659 ; 0055 A659 PCLR .BLOCK 1 ;PROG CTR 0056 A65A PCHR .BLOCK 1 0057 A65B SR .BLOCK 1 ;STACK 0058 A65C FR .BLOCK 1 ;FLAGS 0059 A65D AR .BLOCK 1 ;AREG 0060 A65E XR .BLOCK 1 ;XREG 0061 A65F YR .BLOCK 1 ;YREG 0062 A660 ; 0063 A660 ; I/O VECTORS FOLLOW 0064 A660 ; 0065 A660 INVEC .BLOCK 3 ;IN CHAR 0066 A663 OUTVEC .BLOCK 3 ;OUT CHAR 0067 A666 INSVEC .BLOCK 3 ;IN STATUS 0068 A669 URSVEC .BLOCK 3 ;UNRECOGNIZED SYNTAX VECTOR 0069 A66C URCVEC .BLOCK 3 ;UNRECOGNIZED CMD/ERROR VECTOR 0070 A66F SCNVEC .BLOCK 3 ;SCAN ON-BOARD DISPLAY 0071 A672 ; 0072 A672 ; TRACE, INTERRUPT VECTORS 0073 A672 ; 0074 A672 EXEVEC .BLOCK 2 ; EXEC CMD ALTERNATE INVEC 0075 A674 TRCVEC .BLOCK 2 ;TRACE 0076 A676 UBRKVC .BLOCK 2 ;USER BRK AFTER MONITOR 0077 A678 UBRKV =UBRKVC 0078 A678 UIRQVC .BLOCK 2 ;USER NON-BRK IRQ AFTER MONITOR 0079 A67A UIRQV =UIRQVC 0080 A67A NMIVEC .BLOCK 2 ;NMI 0081 A67C RSTVEC .BLOCK 2 ;RESET 0082 A67E IRQVEC .BLOCK 2 ;IRQ 0083 A680 ; 0084 A680 ; 0085 A680 ;I/O REG DEFINITIONS 0086 A680 PADA =$A400 ;KEYBOARD/DISPLAY 0087 A680 PBDA =$A402 ;SERIAL I/O 0088 A680 OR3A =$AC01 ;WP, DBON, DBOFF 0089 A680 DDR3A =OR3A+2 ;DATA DIRECTION FOR SAME 0090 A680 OR1B =$A000 0091 A680 DDR1B =$A002 0092 A680 PCR1 =$A00C ; POR/TAPE REMOTE 0093 A680 ; 0094 A680 ; MONITOR MAINLINE 0095 A680 ; 0096 8000 *=$8000 0097 8000 4C 7C 8B MONITR JMP MONENT ;INIT S, CLD, GET ACCESS 0098 8003 20 FF 80 WARM JSR GETCOM ;GET COMMAND + PARMS (0-3) 0099 8006 20 4A 81 JSR DISPAT ;DISPATCH CMD,PARMS TO EXEC BLKS 0100 8009 20 71 81 JSR ERMSG ;DISP ER MSG IF CARRY SET 0101 800C 4C 03 80 JMP WARM ;AND CONTINUE 0102 800F ; 0103 800F ; TRACE AND INTERRUPT ROUTINES 0104 800F ; 0105 800F 08 IRQBRK PHP ;IRQ OR BRK ? 0106 8010 48 PHA 0107 8011 8A TXA 0108 8012 48 PHA 0109 8013 BA TSX 0110 8014 BD 04 01 LDA $0104,X ;PICK UP FLAGS 0111 8017 29 10 AND #$10 0112 8019 F0 07 BEQ DETIRQ 0113 801B 68 PLA ;BRK 0114 801C AA TAX 0115 801D 68 PLA 0116 801E 28 PLP 0117 801F 6C F6 FF JMP ($FFF6) 0118 8022 68 DETIRQ PLA ;IRQ (NON BRK) 0119 8023 AA TAX 0120 8024 68 PLA 0121 8025 28 PLP 0122 8026 6C F8 FF JMP ($FFF8) 0123 8029 20 86 8B SVIRQ JSR ACCESS ;SAVE REGS AND DISPLAY CODE 0124 802C 38 SEC 0125 802D 20 64 80 JSR SAVINT 0126 8030 A9 31 LDA #'1' 0127 8032 4C 53 80 JMP IDISP 0128 8035 08 USRENT PHP ;USER ENTRY 0129 8036 20 86 8B JSR ACCESS 0130 8039 38 SEC 0131 803A 20 64 80 JSR SAVINT 0132 803D EE 59 A6 INC PCLR 0133 8040 D0 03 BNE *+5 0134 8042 EE 5A A6 INC PCHR 0135 8045 A9 33 LDA #'3' 0136 8047 4C 53 80 JMP IDISP 0137 804A 20 86 8B SVBRK JSR ACCESS 0138 804D 18 CLC 0139 804E 20 64 80 JSR SAVINT 0140 8051 A9 30 LDA #'0' 0141 8053 ; INTRPT CODES 0 = BRK 0142 8053 ; 1 = IRQ 0143 8053 ; 2 = NMI 0144 8053 ; 3 = USER ENTRY 0145 8053 48 IDISP PHA ;OUT PC, INTRPT CODE (FROM A) 0146 8054 20 D3 80 JSR DBOFF ;STOP NMI'S 0147 8057 20 4D 83 JSR CRLF 0148 805A 20 37 83 JSR OPCCOM 0149 805D 68 PLA 0150 805E 20 47 8A JSR OUTCHR 0151 8061 4C 03 80 JMP WARM 0152 8064 8D 5D A6 SAVINT STA AR ;SAVE USER REGS AFTER INTRPT 0153 8067 8E 5E A6 STX XR 0154 806A 8C 5F A6 STY YR 0155 806D BA TSX 0156 806E D8 CLD 0157 806F BD 04 01 LDA $104,X 0158 8072 69 FF ADC #$FF 0159 8074 8D 59 A6 STA PCLR 0160 8077 BD 05 01 LDA $105,X 0161 807A 69 FF ADC #$FF 0162 807C 8D 5A A6 STA PCHR 0163 807F BD 03 01 LDA $103,X 0164 8082 8D 5C A6 STA FR 0165 8085 BD 02 01 LDA $102,X 0166 8088 9D 05 01 STA $105,X 0167 808B BD 01 01 LDA $101,X 0168 808E 9D 04 01 STA $104,X 0169 8091 E8 INX 0170 8092 E8 INX 0171 8093 E8 INX 0172 8094 9A TXS 0173 8095 E8 INX 0174 8096 E8 INX 0175 8097 8E 5B A6 STX SR 0176 809A 60 RTS 0177 809B 20 86 8B SVNMI JSR ACCESS ;TRACE IF TV NE 0 0178 809E 38 SEC 0179 809F 20 64 80 JSR SAVINT 0180 80A2 20 D3 80 JSR DBOFF ;STOP NMI'S 0181 80A5 AD 56 A6 LDA TV 0182 80A8 D0 05 BNE TVNZ 0183 80AA A9 32 LDA #'2' 0184 80AC 4C 53 80 JMP IDISP 0185 80AF 20 37 83 TVNZ JSR OPCCOM ;TRACE WITH DELAY 0186 80B2 AD 5D A6 LDA AR 0187 80B5 20 4A 83 JSR OBCRLF ;DISPLAY ACC 0188 80B8 20 5A 83 JSR DELAY 0189 80BB 90 10 BCC TRACON ;STOP IF KEY ENTERED 0190 80BD 4C 03 80 JMP WARM 0191 80C0 20 86 8B TRCOFF JSR ACCESS ;DISABLE NMIS 0192 80C3 38 SEC 0193 80C4 20 64 80 JSR SAVINT 0194 80C7 20 D3 80 JSR DBOFF 0195 80CA 6C 74 A6 JMP (TRCVEC) ;AND GO TO SPECIAL TRACE 0196 80CD 20 E4 80 TRACON JSR DBON ;ENABLE NMI'S 0197 80D0 4C FD 83 JMP GO1ENT+3 ;AND RESUME (NO WRITE PROT) 0198 80D3 AD 01 AC DBOFF LDA OR3A ;PULSE DEBUG OFF 0199 80D6 29 DF AND #$DF 0200 80D8 09 10 ORA #$10 0201 80DA 8D 01 AC STA OR3A 0202 80DD AD 03 AC LDA DDR3A 0203 80E0 09 30 ORA #$30 0204 80E2 D0 0F BNE DBNEW-3 ;RELEASE FLIP FLOP SO KEY WORKS 0205 80E4 AD 01 AC DBON LDA OR3A ;PULSE DEBUG ON 0206 80E7 29 EF AND #$EF 0207 80E9 09 20 ORA #$20 0208 80EB 8D 01 AC STA OR3A 0209 80EE AD 03 AC LDA DDR3A 0210 80F1 09 30 ORA #$30 0211 80F3 8D 03 AC STA DDR3A 0212 80F6 AD 03 AC DBNEW LDA DDR3A ;RELEASE FLIP FLOP 0213 80F9 29 CF AND #$CF 0214d, that is with identical exponents, for use in the FADD and FSUB subroutines. Exit: the 24-bit integer sum is in M1 (high-order byte in M1, low-order byte in M1+2). FP2, X1, E, SIGN and SCR are not disturbed. The A-REG contains the high-order byte of the sum, the X-REG contains $FF and the Y-REG is not altered. The carry is the '25th' sum bit. Example: FP1 contains +5 and FP2 contains +7 prior to calling ADD. _____ _____ _____ _____ | | | | | | | | FP1: | $82 | | $50 | | 0 | | 0 | (+5) |_____| |_____| |_____| |_____| X1 M1 _____ _____ _____ _____ | | | | | | | | FP2: | $82 | | $70 | | 0 | | 0 | (+7) |_____| |_____| |_____| |_____| Upon exit, M1 contains the overflow value for +12. Note that the sign bit is incorrect. This is taken care of with a call to the right shift routine. _____ _____ _____ _____ | | | | | | | | FP: | $82 | | $C0 | | 0 | | 0 | (+12) |_____| |_____| |_____| |_____| ABSWAP Subroutine (address $F437) Purpose: To take the absolute value of FP1 and then swap FP1 with FP2. Note that two sequential calls to ABSWAP will take the absolute values of both FP1 and FP2 in preparation for a multiply or divide. Entry: FP1 and FP2 contain floating point values. Exit: The absolute value of the original FP1 contents are in FP2 and the original FP2 contents are in FP1. The least significant bit of SIGN is complemented if a negation takes place (if the original FP1 contents are negative) by means of an increment. SCR and E are used. The A-REG contains a copy of X2, the X-REG is cleared, and the Y-REG is not altered. RTAR Subroutine (address $F47D) Purpose: To shift M1 right one bit position while incrementing X1 to compensate for scale. This is roughly the opposite of the NORM subroutine. Entry: A normalized or unnormalized floating point value is in FP1. Exit: The 6-byte field MANT1 and E is shifted right one bit arithmetically and X1 is incremented by 1 to retain proper scale. The sign bit of MANT1 (MSB of M1) is unchanged. FP2, SIGN, and SCR are not disturbed. The A-REG contains the least significant byte of E (E+2), the X-REG is cleared, and the Y-REG is not disturbed. Caution: If X1 increments of 0 (overflow) then an exit to location $3F5 is taken, the A-REG contains the high-order MANT1 byte, M1 and X1 is cleared. FP2, SIGN, SCR, and the X- and Y-REGs are not disturbed. Uses: RTLOG Example: Prior to calling RTAR, FP1 contains the normalized value -7. _____ _____ _____ _____ | | | | | | | | FP1 | $83 | | $A0 | | 0 | | 0 | (-7) |_____| |_____| |_____| |_____| X1 M1 After calling RTAR, FP1 contains the unnormalized value -7 (note that precision is lost off the low-order end of M1). _____ _____ _____ _____ | | | | | | | | FP1 | $84 | | $D0 | | 0 | | 0 | (-7) |_____| |_____| |_____| |_____| X1 M1 Note: M1 sign bit is unchanged. RTLOG subroutine (address $F480) Purpose: To shift the 6-byte field MANT1 and E one bit to the right (toward the least significant bit). The 6502 carry bit is shifted into the high-order M1 bit. This is useful in correcting binary sum overflows. Entry: A normalized or unnormalized floating point value is in FP1. The carry must be cleared or set by the user since it is shifted Into the sign bit of M1. Exit: Same as RTAR except that the sign of M1 is not preserved (it is set to the value of the carry bit on entry) Caution: Same as RTAR. Example: Prior to calling RTLOG, FP1 contains the normalized value -12 and the carry is clear. _____ _____ _____ _____ | | | | | | | | FP1: | $83 | | $A0 | | 0 | | 0 | (-12) |_____| |_____| |_____| |_____| X1 M1 After calling RTLOG, M1 is shifted one bit to the right and the sign bit is clear. X1 is incremented by 1. _____ _____ _____ _____ | | | | | | | | FP1: | $84 | | $50 | | 0 | | 0 | (+20) |_____| |_____| |_____| |_____| X1 M1 Note: The bit shifted off the end of MANT1 is rotated into the high-order bit of the 3-byte extension E. The 3-byte E field is also shifted one bit to the right. RTLOG1 subroutine (address $F484) Purpose: To shift MANT1 and E right one bit without adjusting X1. This is used by the multiply loop. The carry is shifted into the sign bit of MANT1. Entry: M1 and E contain a 6-byte unsigned field. E is the 3-byte low-order extension of MANT1. Exit: Same as RTLOG except that X1 is not altered and an overflow exit cannot occur. MD2 subroutine (address $F4E2) Purpose: To clear the 3-byte MANT1 field for FMUL and FDIV, check for inital result exponent overflow (and underflow), and initialize the X-REG to $17 for loop counting. Entry: the X-REG is cleared by the user since it is placed in the 3 bytes of MANT1. The A-REG contains the result of an exponent addition (FMUL) or subtraction (FDIV). The carry and sign status bits should be set according to this addition or subtraction for overflow and underflow determination. Exit: The 3 bytes of M1 are cleared (or all set to the contents of the X-REG on Entry) and the Y-REG is loaded with $17. The sign bit of the A-REG is complemented and a copy of the A-REG is stored in X1. FP2, SIGN, SCR, and the X-REG are not disturbed. Uses: NORM. Caution: Exponent overflow results in an exit to location $3F5. Exponent underflow results in an early return from the calling subroutine (FDIV or FMUL) with a floating point zero in FP1. Because MD2 pops a return address off the stack, it may only be called by another subroutine. +------------------------------------------------------------------------ | TOPIC -- Apple II -- DDJ Floating point article +------------------------------------------------------------------------ Dr. Dobb's Journal, August 1976, pages 17-19. Floating Point Routines for the 6502 by Roy Rankin, Department of Mechanical Engineering, Stanford University, Stanford, CA 94305 (415) 497-1822 and Steve Wozniak, Apple Computer Company 770 Welch Road, Suite 154 Palo Alto, CA 94304 (415) 326-4248 Editor's Note: Although these routines are for the 6502, it would appear that one could generate equivalent routines for most of the "traditional" microprocessors, relatively easily, by following the flow of the algorithms given in the excellent comments included in the program listing. This is particularly true of the transcendental functions, which were directly modeled after well-known and proven algorithms, and for which, the comments are relatively machine independent. These floating point routines allow 6502 users to perform most of the more popular and desired floating point and transcendental functions, namely: Natural Log - LOG Common Log - LOG10 Exponential - EXP Floating Add - FADD Floating Subtract - FSUB Floating Multiply - FMUL Floating Divide - FDIV Convert Floating to Fixed - FIX Convert Fixed to Floating - FLOAT They presume a four-byte floating point operand consisting of a one-byte exponent ranging from -128 to +127 and a 24-bit two's complement mantissa between 1.0 and 2.0. The floating point routines were done by Steve Wozniak, one of the principals in Apple Computer Company. The transcendental functions were patterned after those offered by Hewlett-Packard for their HP2100 minicomputer (with some modifications), and were done by Roy Rankin, a Ph.D. student at Stanford University. There are three error traps; two for overflow, and one for prohibited logarithm argument. ERROR (1D06) is the error exit used in the event of a non-positive log argument. OVFLW (1E3B) TECHO .BLOCK 1 ;TERMINAL ECHO LAG 0046 A654 ; BIT7 =CRT IN, 6 =TTY IN, 5 = TTY OUT, 4 = CRT OUT 0047 A654 TOUTFL .BLOCK 1 ;OUTPUT FLAGS 0048 A655 KSHFL .BLOCK 1 ;KEYBOARD SHIFT FLAG 0049 A656 TV .BLOCK 1 ;TRACE VELOCITY (0=SINGLE STEP) 0050 A657 LSTCOM .BLOCK 1 ;STORE LAST MONITOR COMMAND 0051 A658 MAXRC .BLOCK 1 ;MAXIMUM REC LENGTH FOR MEM DUMP 0052 A659 ; 0053 A659 ; USER REG'S FOLLOW 0054 A659 ; 0055 A659 PCLR .BLOCK 1 ;PROG CTR 0056 A65A PCHR .BLOCK 1 0057 A65B SR .BLOCK 1 ;STACK 0058 A65C FR .BLOCK 1 ;FLAGS 0059 A65D AR .BLOCK 1 ;AREG 0060 A65E XR .BLOCK 1 ;XREG 0061 A65F YR .BLOCK 1 ;YREG 0062 A660 ; 0063 A660 ; I/O VECTORS FOLLOW 0064 A660 ; 0065 A660 INVEC .BLOCK 3 ;IN CHAR 0066 A663 OUTVEC .BLOCK 3 ;OUT CHAR 0067 A666 INSVEC .BLOCK 3 ;IN STATUS 0068 A669 URSVEC .BLOCK 3 ;UNRECOGNIZED SYNTAX VECTOR 0069 A66C URCVEC .BLOCK 3 ;UNRECOGNIZED CMD/ERROR VECTOR 0070 A66F SCNVEC .BLOCK 3 ;SCAN ON-BOARD DISPLAY 0071 A672 ; 0072 A672 ; TRACE, INTERRUPT VECTORS 0073 A672 ; 0074 A672 EXEVEC .BLOCK 2 ; EXEC CMD ALTERNATE INVEC 0075 A674 TRCVEC .BLOCK 2 ;TRACE 0076 A676 UBRKVC .BLOCK 2 ;USER BRK AFTER MONITOR 0077 A678 UBRKV =UBRKVC 0078 A678 UIRQVC .BLOCK 2 ;USER NON-BRK IRQ AFTER MONITOR 0079 A67A UIRQV =UIRQVC 0080 A67A NMIVEC .BLOCK 2 ;NMI 0081 A67C RSTVEC .BLOCK 2 ;RESET 0082 A67E IRQVEC .BLOCK 2 ;IRQ 0083 A680 ; 0084 A680 ; 0085 A680 ;I/O REG DEFINITIONS 0086 A680 PADA =$A400 ;KEYBOARD/DISPLAY 0087 A680 PBDA =$A402 ;SERIAL I/O 0088 A680 OR3A =$AC01 ;WP, DBON, DBOFF 0089 A680 DDR3A =OR3A+2 ;DATA DIRECTION FOR SAME 0090 A680 OR1B =$A000 0091 A680 DDR1B =$A002 0092 A680 PCR1 =$A00C ; POR/TAPE REMOTE 0093 A680 ; 0094 A680 ; MONITOR MAINLINE 0095 A680 ; 0096 8000 *=$8000 0097 8000 4C 7C 8B MONITR JMP MONENT ;INIT S, CLD, GET ACCESS 0098 8003 20 FF 80 WARM JSR GETCOM ;GET COMMAND + PARMS (0-3) 0099 8006 20 4A 81 JSR DISPAT ;DISPATCH CMD,PARMS TO EXEC BLKS 0100 8009 20 71 81 JSR ERMSG ;DISP ER MSG IF CARRY SET 0101 800C 4C 03 80 JMP WARM ;AND CONTINUE 0102 800F ; 0103 800F ; TRACE AND INTERRUPT ROUTINES 0104 800F ; 0105 800F 08 IRQBRK PHP ;IRQ OR BRK ? 0106 8010 48 PHA 0107 8011 8A TXA 0108 8012 48 PHA 0109 8013 BA TSX 0110 8014 BD 04 01 LDA $0104,X ;PICK UP FLAGS 0111 8017 29 10 AND #$10 0112 8019 F0 07 BEQ DETIRQ 0113 801B 68 PLA ;BRK 0114 801C AA TAX 0115 801D 68 PLA 0116 801E 28 PLP 0117 801F 6C F6 FF JMP ($FFF6) 0118 8022 68 DETIRQ PLA ;IRQ (NON BRK) 0119 8023 AA TAX 0120 8024 68 PLA 0121 8025 28 PLP 0122 8026 6C F8 FF JMP ($FFF8) 0123 8029 20 86 8B SVIRQ JSR ACCESS ;SAVE REGS AND DISPLAY CODE 0124 802C 38 SEC 0125 802D 20 64 80 JSR SAVINT 0126 8030 A9 31 LDA #'1' 0127 8032 4C 53 80 JMP IDISP 0128 8035 08 USRENT PHP ;USER ENTRY 0129 8036 20 86 8B JSR ACCESS 0130 8039 38 SEC 0131 803A 20 64 80 JSR SAVINT 0132 803D EE 59 A6 INC PCLR 0133 8040 D0 03 BNE *+5 0134 8042 EE 5A A6 INC PCHR 0135 8045 A9 33 LDA #'3' 0136 8047 4C 53 80 JMP IDISP 0137 804A 20 86 8B SVBRK JSR ACCESS 0138 804D 18 CLC 0139 804E 20 64 80 JSR SAVINT 0140 8051 A9 30 LDA #'0' 0141 8053 ; INTRPT CODES 0 = BRK 0142 8053 ; 1 = IRQ 0143 8053 ; 2 = NMI 0144 8053 ; 3 = USER ENTRY 0145 8053 48 IDISP PHA ;OUT PC, INTRPT CODE (FROM A) 0146 8054 20 D3 80 JSR DBOFF ;STOP NMI'S 0147 8057 20 4D 83 JSR CRLF 0148 805A 20 37 83 JSR OPCCOM 0149 805D 68 PLA 0150 805E 20 47 8A JSR OUTCHR 0151 8061 4C 03 80 JMP WARM 0152 8064 8D 5D A6 SAVINT STA AR ;SAVE USER REGS AFTER INTRPT 0153 8067 8E 5E A6 STX XR 0154 806A 8C 5F A6 STY YR 0155 806D BA TSX 0156 806E D8 CLD 0157 806F BD 04 01 LDA $104,X 0158 8072 69 FF ADC #$FF 0159 8074 8D 59 A6 STA PCLR 0160 8077 BD 05 01 LDA $105,X 0161 807A 69 FF ADC #$FF 0162 807C 8D 5A A6 STA PCHR 0163 807F BD 03 01 LDA $103,X 0164 8082 8D 5C A6 STA FR 0165 8085 BD 02 01 LDA $102,X 0166 8088 9D 05 01 STA $105,X 0167 808B BD 01 01 LDA $101,X 0168 808E 9D 04 01 STA $104,X 0169 8091 E8 INX 0170 8092 E8 INX 0171 8093 E8 INX 0172 8094 9A TXS 0173 8095 E8 INX 0174 8096 E8 INX 0175 8097 8E 5B A6 STX SR 0176 809A 60 RTS 0177 809B 20 86 8B SVNMI JSR ACCESS ;TRACE IF TV NE 0 0178 809E 38 SEC 0179 809F 20 64 80 JSR SAVINT 0180 80A2 20 D3 80 JSR DBOFF ;STOP NMI'S 0181 80A5 AD 56 A6 LDA TV 0182 80A8 D0 05 BNE TVNZ 0183 80AA A9 32 LDA #'2' 0184 80AC 4C 53 80 JMP IDISP 0185 80AF 20 37 83 TVNZ JSR OPCCOM ;TRACE WITH DELAY 0186 80B2 AD 5D A6 LDA AR 0187 80B5 20 4A 83 JSR OBCRLF ;DISPLAY ACC 0188 80B8 20 5A 83 JSR DELAY 0189 80BB 90 10 BCC TRACON ;STOP IF KEY ENTERED 0190 80BD 4C 03 80 JMP WARM 0191 80C0 20 86 8B TRCOFF JSR ACCESS ;DISABLE NMIS 0192 80C3 38 SEC 0193 80C4 20 64 80 JSR SAVINT 0194 80C7 20 D3 80 JSR DBOFF 0195 80CA 6C 74 A6 JMP (TRCVEC) ;AND GO TO SPECIAL TRACE 0196 80CD 20 E4 80 TRACON JSR DBON ;ENABLE NMI'S 0197 80D0 4C FD 83 JMP GO1ENT+3 ;AND RESUME (NO WRITE PROT) 0198 80D3 AD 01 AC DBOFF LDA OR3A ;PULSE DEBUG OFF 0199 80D6 29 DF AND #$DF 0200 80D8 09 10 ORA #$10 0201 80DA 8D 01 AC STA OR3A 0202 80DD AD 03 AC LDA DDR3A 0203 80E0 09 30 ORA #$30 0204 80E2 D0 0F BNE DBNEW-3 ;RELEASE FLIP FLOP SO KEY WORKS 0205 80E4 AD 01 AC DBON LDA OR3A ;PULSE DEBUG ON 0206 80E7 29 EF AND #$EF 0207 80E9 09 20 ORA #$20 0208 80EB 8D 01 AC STA OR3A 0209 80EE AD 03 AC LDA DDR3A 0210 80F1 09 30 ORA #$30 0211 80F3 8D 03 AC STA DDR3A 0212 80F6 AD 03 AC DBNEW LDA DDR3A ;RELEASE FLIP FLOP 0213 80F9 29 CF AND #$CF 0214 LOAD EXP/MANT2 WITH 1/LN(10) 1DC6 CA DEX 1DC7 10 F8 BPL L10 1DC9 20 77 1F JSR FMUL LOG10(X)=LN(X)/LN(10) 1DCC 60 RTS * 1DCD 7E 6F LN10 DCM 0.4342945 2D ED 1DD1 80 5A R22 DCM 1.4142136 SQRT(2) 02 7A 1DD5 7F 58 LE2 DCM 0.69314718 LOG BASE E OF 2 B9 0C 1DD9 80 52 A1 DCM 1.2920074 80 40 1DDD 81 AB MB DCM -2.6398577 86 49 1DE1 80 6A C DCM 1.6567626 08 66 1DE5 7F 40 MHLF DCM 0.5 00 00 * 1E00 ORG $1E00 STARTING LOCATION FOR EXP * * EXP OF MANT/EXP1 RESULT IN MANT/EXP1 * 1E00 A2 03 EXP LDX =3 4 BYTE TRANSFER 1E02 BD D8 1E LDA L2E,X 1E05 95 04 STA X2,X LOAD EXP/MANT2 WITH LOG BASE 2 OF E 1E07 CA DEX 1E08 10 F8 BPL EXP+2 1E0A 20 77 1F JSR FMUL LOG2(3)*X 1E0D A2 03 LDX =3 4 BYTE TRANSFER 1E0F B5 08 FSA LDA X1,X 1E11 95 10 STA Z,X STORE EXP/MANT1 IN Z 1E13 CA DEX 1E14 10 F9 BPL FSA SAVE Z=LN(2)*X 1E16 20 E8 1F JSR FIX CONVERT CONTENTS OF EXP/MANT1 TO AN INTEGER 1E19 A5 0A LDA M1+1 1E1B 85 1C STA INT SAVE RESULT AS INT 1E1D 38 SEC SET CARRY FOR SUBTRACTION 1E1E E9 7C SBC =124 INT-124 1E20 A5 09 LDA M1 1E22 E9 00 SBC =0 1E24 10 15 BPL OVFLW OVERFLOW INT>=124 1E26 18 CLC CLEAR CARRY FOR ADD 1E27 A5 0A LDA M1+1 1E29 69 78 ADC =120 ADD 120 TO INT 1E2B A5 09 LDA M1 1E2D 69 00 ADC =0 1E2F 10 0B BPL CONTIN IF RESULT POSITIVE CONTINUE 1E31 A9 00 LDA =0 INT<-120 SET RESULT TO ZERO AND RETURN 1E33 A2 03 LDX =3 4 BYTE MOVE 1E35 95 08 ZERO STA X1,X SET EXP/MANT1 TO ZERO 1E37 CA DEX 1E38 10 FB BPL ZERO 1E3A 60 RTS RETURN * 1E3B 00 OVFLW BRK OVERFLOW * 1E3C 20 2C 1F CONTIN JSR FLOAT FLOAT INT 1E3F A2 03 LDX =3 1E41 B5 10 ENTD LDA Z,X 1E43 95 04 STA X2,X LOAD EXP/MANT2 WITH Z 1E45 CA DEX 1E46 10 F9 BPL ENTD 1E48 20 4A 1F JSR FSUB Z*Z-FLOAT(INT) 1E4B A2 03 LDX =3 4 BYTE MOVE 1E4D B5 08 ZSAV LDA X1,X 1E4F 95 10 STA Z,X SAVE EXP/MANT1 IN Z 1E51 95 04 STA X2,X COPY EXP/MANT1 TO EXP/MANT2 1E53 CA DEX 1E54 10 F7 BPL ZSAV 1E56 20 77 1F JSR FMUL Z*Z 1E59 A2 03 LDX =3 4 BYTE MOVE 1E5B BD DC 1E LA2 LDA A2,X 1E5E 95 04 STA X2,X LOAD EXP/MANT2 WITH A2 1E60 B5 08 LDA X1,X 1E62 95 18 STA SEXP,X SAVE EXP/MANT1 AS SEXP 1E64 CA DEX 1E65 10 F4 BPL LA2 1E67 20 50 1F JSR FADD Z*Z+A2 1E6A A2 03 LDX =3 4 BYTE MOVE 1E6C BD E0 1E LB2 LDA B2,X 1E6F 95 04 STA X2,X LOAD EXP/MANT2 WITH B2 1E71 CA DEX 1E72 10 F8 BPL LB2 1E74 20 9D 1F JSR FDIV T=B/(Z*Z+A2) 1E77 A2 03 LDX =3 4 BYTE MOVE 1E79 B5 08 DLOAD LDA X1,X 1E7B 95 14 STA T,X SAVE EXP/MANT1 AS T 1E7D BD E4 1E LDA C2,X 1E80 95 08 STA X1,X LOAD EXP/MANT1 WITH C2 1E82 B5 18 LDA SEXP,X 1E84 95 04 STA X2,X LOAD EXP/MANT2 WITH SEXP 1E86 CA DEX 1E87 10 F0 BPL DLOAD 1E89 20 77 1F JSR FMUL Z*Z*C2 1E8C 20 1C 1F JSR SWAP MOVE EXP/MANT1 TO EXP/MANT2 1E8F A2 03 LDX =3 4 BYTE TRANSFER 1E91 B5 14 LTMP LDA T,X 1E93 95 08 STA X1,X LOAD EXP/MANT1 WITH T 1E95 CA DEX 1E96 10 F9 BPL LTMP 1E98 20 4A 1F JSR FSUB C2*Z*Z-B2/(Z*Z+A2) 1E9B A2 03 LDX =3 4 BYTE TRANSFER 1E9D BD E8 1E LDD LDA D,X 1EA0 95 04 STA X2,X LOAD EXP/MANT2 WITH D 1EA2 CA DEX 1EA3 10 F8 BPL LDD 1EA5 20 50 1F JSR FADD D+C2*Z*Z-B2/(Z*Z+A2) 1EA8 20 1C 1F JSR SWAP MOVE EXP/MANT1 TO EXP/MANT2 1EAB A2 03 LDX =3 4 BYTE TRANSFER 1EAD B5 10 LFA LDA Z,X 1EAF 95 08 STA X1,X LOAD EXP/MANT1 WITH Z 1EB1 CA DEX 1EB2 10 F9 BPL LFA 1EB4 20 4A 1F JSR FSUB -Z+D+C2*Z*Z-B2/(Z*Z+A2) 1EB7 A2 03 LDX =3 4 BYTE TRANSFER 1EB9 B5 10 LF3 LDA Z,X 1EBB 95 04 STA X2,X LOAD EXP/MANT2 WITH Z 1EBD CA DEX 1EBE 10 F9 BPL LF3 1EC0 20 9D 1F JSR FDIV Z/(**** ) 1EC3 A2 03 LDX =3 4 BYTE TRANSFER 1EC5 BD E5 1D LD12 LDA MHLF,X 1EC8 95 04 STA X2,X LOAD EXP/MANT2 WITH .5 1ECA CA DEX 1ECB 10 F8 BPL LD12 1ECD 20 50 1F JSR FADD +Z/(***)+.5 1ED0 38 SEC ADD INT TO EXPONENT WITH CARRY SET 1ED1 A5 1C LDA INT TO MULTIPLY BY 1ED3 65 08 ADC X1 2**(INT+1) 1ED5 85 08 STA X1 RETURN RESULT TO EXPONENT 1ED7 60 RTS RETURN ANS=(.5+Z/(-Z+D+C2*Z*Z-B2/(Z*Z+A2))*2**(INT+1) 1ED8 80 5C L2E DCM 1.4426950409 LOG BASE 2 OF E 55 1E 1EDC 86 57 A2 DCM 87.417497202 6A E1 1EE0 89 4D B2 DCM 617.9722695 3F 1D 1EE4 7B 46 C2 DCM .03465735903 FA 70 1EE8 83 4F D DCM 9.9545957821 A3 03 * * * BASIC FLOATING POINT ROUTINES * 1F00 ORG $1F00 START OF BASIC FLOATING POINT ROUTINES 1F00 18 ADD CLC CLEAR CARRY 1F01 A2 02 LDX =$02 INDEX FOR 3-BYTE ADD 1F03 B5 09 ADD1 LDA M1,X 1F05 75 05 ADC M2,X ADD A BYTE OF MANT2 TO MANT1 1F07 95 09 STA M1,X 1F09 CA DEX ADVANCE INDEX TO NEXT MORE SIGNIF.BYTE 1F0A 10 F7 BPL ADD1 LOOP UNTIL DONE. 1F0C 60 RTS RETURN 1F0D 06 03 MD1 ASL SIGN CLEAR LSB OF SIGN 1F0F 20 12 1F JSR ABSWAP ABS VAL OF MANT1, THEN SWAP MANT2 1F12 24 09 ABSWAP BIT M1 MANT1 NEG? 1F14 10 05 BPL ABSWP1 NO,SWAP WITH MANT2 AND RETURN 1F16 20 8F 1F JSR FCOMPL YES, COMPLIMENT IT. 1F19 E6 03 INC SIGN INCR SIGN, COMPLEMENTING LSB 1F1B 38 ABSWP1 SEC SET CARRY FOR RETURN TO MUL/DIV * * SWAP EXP/MANT1 WITH EXP/MANT2 * 1F1C A2 04 SWAP LDX =$04 INDEX FOR 4-BYTE SWAP. 1F1E 94 0B SWAP1 STY E-1,X 1F20 B5 07 LDA X1-1,X SWAP A BYTE OF EXP/MANT1 WITH 1F22 B4 03 LDY X2-1,X EXP/MANT2 AND LEAVEA COPY OF 1F24 94 07 STY X1-1,X MANT1 IN E(3BYTES). E+3 USED. 1F26 95 03 STA X2-1,X 1F28 CA DEX ADVANCE INDEX TO NEXT BYTE 1F29 D0 F3 BNE SWAP1 LOOP UNTIL DONE. 1F2B 60 RTS * * * * CONVERT 16 BIT INTEGER IN M1(HIGH) AND M1+1(LOW) TO F.P. * RESULT IN EXP/MANT1. EXP/MANT2 UNEFFECTED * * 1F2C A9 8E FLOAT LDA =$8E 1F2E 85 08 STA X1 SET EXPN TO 14 DEC 1F30 A9 00 LDA =0 CLEAR LOW ORDER BYTE 1F32 85 0B STA M1+2 1F34 F0 08 BEQ NORM NORMALIZE RESULT 1F36 C6 08 NORM1 DEC X1 DECREMENT EXP1 1F38 06 0B ASL M1+2 1F3A 26 0A ROL M1+1 SHIFT MANT1 (3 BYTES) LEFT 1F3C 26 09 ROL M1 1F3E A5 09 NORM LDA M1 HIGH ORDER MANT1 BYTE 1F40 0A ASL UPPER TWO BITS UNEQUAL? 1F41 45 09 EOR M1 1F43 30 04 BMI RTS1 YES,RETURN WITH MANT1 NORMALIZED 1F45 A5 08 LDA X1 EXP1 ZERO? 1F47 D0 ED BNE NORM1 NO, CONTINUE NORMALIZING 1F49 60 RTS1 RTS RETURN * * * EXP/MANT2-EXP/MANT1 RESULT IN EXP/MANT1 * 1F4A 20 8F 1F FSUB JSR FCOMPL CMPL MANT1 CLEARS CARRY UNLESS ZERO 1F4D 20 5D 1F SWPALG JSR ALGNSW RIGHT SHIFT MANT1 OR SWAP WITH MANT2 ON CARRY * * ADD EXP/MANT1 AND EXP/MANT2 RESULT IN EXP/MANT1 * 1F50 A5 04 FADD LDA X2 1F52 C5 08 CMP X1 COMPARE EXP1 WITH EXP2 1F54 D0 F7 BNE SWPALG IF UNEQUAL, SWAP ADDENDS OR ALIGN MANTISSAS 1F56 20 00 1F JSR ADD ADD ALIGNED MANTISSAS 1F59 50 E3 ADDEND BVC NORM NO OVERFLOW, NORMALIZE RESULTS 1F5B 70 05 BVS RTLOG OV: SHIFT MANT1 RIGHT. NOTE CARRY IS CORRECT SIGN 1F5D 90 BD ALGNSW BCC SWAP SWAP IF CARRY CLEAR, ELSE SHIFT RIGHT ARITH. 1F5F A5 09 RTAR LDA M1 SIGN OF MANT1 INTO CARRY FOR 1F61 0A ASL RIGHT ARITH SHIFT 1F62 E6 08 RTLOG INC X1 INCR EXP1 TO COMPENSATE FOR RT SHIFT 1F64 F0 7E BEQ OVFL EXP1 OUT OF RANGE. 1F66 A2 FA RTLOG1 LDX =$FA INDEX FOR 6 BYTE RIGHT SHIFT 1F68 A9 80 ROR1 LDA =$80 1F6A B0 01 BCS ROR2 1F6C 0A ASL 1F6D 56 0F ROR2 LSR E+3,X SIMULATE ROR E+3,X 1F6F 15 0F ORA E+3,X 1F71 95 0F STA E+3,X 1F73 E8 INX NEXT BYTE OF SHIFT 1F74 D0 F2 BNE ROR1 LOOP UNTIL DONE 1F76 60 RTS RETURN * * * EXP/MANT1 X EXP/MANT2 RESULT IN EXP/MANT1 * 1F77 20 0D 1F FMUL JSR MD1 ABS. VAL OF MANT1, MANT2 1F7A 65 08 ADC X1 ADD EXP1 TO EXP2 FOR PRODUCT EXPONENT 1F7C 20 CD 1F JSR MD2 CHECK PRODUCT EXP AND PREPARE FOR MUL 1F7F 18 CLC CLEAR CARRY 1F80 20 66 1F MUL1 JSR RTLOG1 MANT1 AND E RIGHT.(PRODUCT AND MPLIER) 1F83 90 03 BCC MUL2 IF CARRY CLEAR, SKIP PARTIAL PRODUCT 1F85 20 00 1F JSR ADD ADD MULTIPLICAN TO PRODUCT 1F88 88 MUL2 DEY NEXT MUL ITERATION 1F89 10 F5 BPL MUL1 LOOP UNTIL DONE 1F8B 46 03 MDEND LSR SIGN TEST SIGN (EVEN/ODD) 1F8D 90 AF NORMX BCC NORM IF EXEN, NORMALIZE PRODUCT, ELSE COMPLEMENT 1F8F 38 FCOMPL SEC SET CARRY FOR SUBTRACT 1F90 A2 03 LDX =$03 INDEX FOR 3 BYTE SUBTRACTION 1F92 A9 00 COMPL1 LDA =$00 CLEAR A 1F94 F5 08 SBC X1,X SUBTRACT BYTE OF EXP1 1F96 95 08 STA X1,X RESTORE IT 1F98 CA DEX NEXT MORE SIGNIFICANT BYTE 1F99 D0 F7 BNE COMPL1 LOOP UNTIL DONE 1F9B F0 BC BEQ ADDEND NORMALIZE (OR SHIFT RIGHT IF OVERFLOW) * * * EXP/MANT2 / EXP/MANT1 RESULT IN EXP/MANT1 * 1F9D 20 0D 1F FDIV JSR MD1 TAKE ABS VAL OF MANT1, MANT2 1FA0 E5 08 SBC X1 SUBTRACT EXP1 FROM EXP2 1FA2 20 CD 1F JSR MD2 SAVE AS QUOTIENT EXP 1FA5 38 DIV1 SEC SET CARRY FOR SUBTRACT 1FA6 A2 02 LDX =$02 INDEX FOR 3-BYTE INSTRUCTION 1FA8 B5 05 DIV2 LDA M2,X 1FAA F5 0C SBC E,X SUBTRACT A BYTE OF E FROM MANT2 1FAC 48 PHA SAVE ON STACK 1FAD CA DEX NEXT MORE SIGNIF BYTE 1FAE 10 F8 BPL DIV2 LOOP UNTIL DONE 1FB0 A2 FD LDX =$FD INDEX FOR 3-BYTE CONDITIONAL MOVE 1FB2 68 DIV3 PLA PULL A BYTE OF DIFFERENCE OFF STACK 1FB3 90 02 BCC DIV4 IF MANT2/< 1583 8BE9 D0 .DB $D0 ;SHIFT 1584 8BEA 20 .DB $20 ;GO/LP 1585 8BEB 60 .DB $60 ;REG/SP 1586 8BEC A0 .DB $A0 ;MEM/WP 1587 8BED 00 .DB $00 ;L2/L1 1588 8BEE 40 .DB $40 ;S2/S1 1589 8BEF ASCIM1 =*-1 1590 8BEF ASCII =* ;ASCII CODES AND HASH CODES 1591 8BEF 30 .DB $30 ;ZERO 1592 8BF0 31 .DB $31 ;ONE 1593 8BF1 32 .DB $32 ;TWO 1594 8BF2 33 .DB $33 ;THREE 1595 8BF3 34 .DB $34 ;FOUR 1596 8BF4 35 .DB $35 ;FIVE 1597 8BF5 36 .DB $36 ;SIX 1598 8BF6 37 .DB $37 ;SEVEN 1599 8BF7 38 .DB $38 ;EIGHT 1600 8BF8 39 .DB $39 ;NINE 1601 8BF9 41 .DB $41 ;A 1602 8BFA 42 .DB $42 ;B 1603 8BFB 43 .DB $43 ;C 1604 8BFC 44 .DB $44 ;D 1605 8BFD 45 .DB $45 ;E 1606 8BFE 46 .DB $46 ;F 1607 8BFF 0D .DB $0D ;CR 1608 8C00 2D .DB $2D ;DASH 1609 8C01 3E .DB $3E ;> 1610 8C02 FF .DB $FF ;SHIFT 1611 8C03 47 .DB $47 ;G 1612 8C04 52 .DB $52 ;R 1613 8C05 4D .DB $4D ;M 1614 8C06 13 .DB $13 ;L2 1615 8C07 1E .DB $1E ;S2 1616 8C08 ; KB UPPER CASE 1617 8C08 14 .DB $14 ;U0 1618 8C09 15 .DB $15 ;U1 1619 8C0A 16 .DB $16 ;U2 1620 8C0B 17 .DB $17 ;U3 1621 8C0C 18 .DB $18 ;U4 1622 8C0D 19 .DB $19 ;U5 1623 8C0E 1A .DB $1A ;U6 1624 8C0F 1B .DB $1B ;U7 1625 8C10 4A .DB $4A ;J 1626 8C11 56 .DB $56 ;V 1627 8C12 FE .DB $FE ;ASCII 1628 8C13 42 .DB $42 ;B 1629 8C14 43 .DB $43 ;C 1630 8C15 44 .DB $44 ;D 1631 8C16 45 .DB $45 ;E 1632 8C17 46 .DB $46 ;F 1633 8C18 10 .DB $10 ;SD 1634 8C19 2B .DB $2B ;+ 1635 8C1A 3C .DB $3C ;< 1636 8C1B 00 .DB $00 ;SHIFT 1637 8C1C 11 .DB $11 ;LP 1638 8C1D 1C .DB $1C ;SP 1639 8C1E 57 .DB $57 ;W 1640 8C1F 12 .DB $12 ;L1 1641 8C20 1D .DB $1D ;S1 1642 8C21 2E .DB $2E ;. 1643 8C22 20 .DB $20 ;BLANK 1644 8C23 3F .DB $3F ;? 1645 8C24 50 .DB $50 ;P 1646 8C25 07 .DB $07 ;BELL 1647 8C26 53 .DB $53 ;S 1648 8C27 58 .DB $58 ;X 1649 8C28 59 .DB $59 ;Y 1650 8C29 ; SEGMENT CODES FOR ON-BOARD DISPLAY 1651 8C29 SEGSM1 =*-1 1652 8C29 3F .DB $3F ;ZERO 1653 8C2A 06 .DB $06 ;ONE 1654 8C2B 5B .DB $5B ;TWO 1655 8C2C 4F .DB $4F ;THREE 1656 8C2D 66 .DB $66 ;FOUR 1657 8C2E 6D .DB $6D ;FIVE 1658 8C2F 7D .DB $7D ;SIX 1659 8C30 07 .DB $07 ;SEVEN 1660 8C31 7F .DB $7F ;EIGHT 1661 8C32 67 .DB $67 ;NINE 1662 8C33 77 F 1504 8B52 A9 04 LDA #4 1505 8B54 48 PHA 1506 8B55 28 PLP ;INIT F, DISABLE IRQ DURING DFTXFR 1507 8B56 20 86 8B JSR ACCESS ;UN WRITE PROT SYS RAM 1508 8B59 A2 5F DFTXFR LDX #$5F ;INIT SYS RAM (EXCPT SCPBUF) 1509 8B5B BD A0 8F LDA DFTBLK,X 1510 8B5E 9D 20 A6 STA RAM,X 1511 8B61 CA DEX 1512 8B62 10 F7 BPL DFTXFR+2 1513 8B64 A9 07 NEWDEV LDA #7 ;CHANGE DEVC/BAUD RATE 1514 8B66 20 47 8A JSR OUTCHR ;BEEP 1515 8B69 20 A3 89 SWITCH JSR KSCONF ;KEYBOARD OR TERMINAL? 1516 8B6C 20 26 89 SWLP JSR KEYQ+3 1517 8B6F D0 0B BNE MONENT 1518 8B71 2C 02 A4 BIT PBDA 1519 8B74 10 F6 BPL SWLP 1520 8B76 20 B7 8B JSR VECSW ;SWITCH VECTORS 1521 8B79 20 FF 8A JSR BAUD 1522 8B7C A2 FF MONENT LDX #$FF ;MONITOR ENTRY 1523 8B7E 9A TXS 1524 8B7F D8 CLD 1525 8B80 20 86 8B JSR ACCESS ;UNWRITE PROT MONITOR RAM 1526 8B83 4C 03 80 JMP WARM 1527 8B86 20 88 81 ACCESS JSR SAVER ;UN WRITE PROT SYS RAM 1528 8B89 AD 01 AC LDA OR3A 1529 8B8C 09 01 ORA #1 1530 8B8E 8D 01 AC ACC1 STA OR3A 1531 8B91 AD 03 AC LDA DDR3A 1532 8B94 09 01 ORA #1 1533 8B96 8D 03 AC STA DDR3A 1534 8B99 4C C4 81 JMP RESALL 1535 8B9C 20 88 81 NACCES JSR SAVER ;WRITE PROT SYS RAM 1536 8B9F AD 01 AC LDA OR3A 1537 8BA2 29 FE AND #$FE 1538 8BA4 18 CLC 1539 8BA5 90 E7 BCC ACC1 1540 8BA7 20 86 8B TTY JSR ACCESS ;UN WRITE PROT RAM 1541 8BAA A9 D5 LDA #$D5 ;110 BAUD 1542 8BAC 8D 51 A6 STA SDBYT 1543 8BAF AD 54 A6 LDA TOUTFL 1544 8BB2 09 40 ORA #$40 1545 8BB4 8D 54 A6 STA TOUTFL 1546 8BB7 20 86 8B VECSW JSR ACCESS ;UN WRITE PROT RAM 1547 8BBA A2 08 LDX #$8 1548 8BBC BD 6F 8C SWLP2 LDA TRMTBL,X 1549 8BBF 9D 60 A6 STA INVEC,X 1550 8BC2 CA DEX 1551 8BC3 10 F7 BPL SWLP2 1552 8BC5 60 RTS 1553 8BC6 ; 1554 8BC6 ;*** 1555 8BC6 ;*** TABLES (I/O CONFIGURATIONS, KEY CODES, ASCII CODES) 1556 8BC6 ;*** 1557 8BC6 00 80 08 37 VALS .DB $00,$80,$08,$37 ;KB SENSE, A=1 1558 8BCA 00 7F 00 30 .DB $00,$7F,$00,$30 ;KB LRN, A=5 1559 8BCE 00 FF 00 3F .DB $00,$FF,$00,$3F ;SCAN DSP, A=9 1560 8BD2 00 00 07 3F .DB $00,$00,$07,$3F ;BEEP, A=D 1561 8BD6 VALSP2 =VALS+2 1562 8BD6 SYM =* ;KEY CODES RETURNED BY LRNKEY 1563 8BD6 TABLE =* 1564 8BD6 01 .DB $01 ;0/U0 1565 8BD7 41 .DB $41 ;1/U1 1566 8BD8 81 .DB $81 ;2/U2 1567 8BD9 C1 .DB $C1 ;3/U3 1568 8BDA 02 .DB $02 ;4/U4 1569 8BDB 42 .DB $42 ;5/U5 1570 8BDC 82 .DB $82 ;6/U6 1571 8BDD C2 .DB $C2 ;7/U7 1572 8BDE 04 .DB $04 ;8/JMP 1573 8BDF 44 .DB $44 ;9/VER 1574 8BE0 84 .DB $84 ;A/ASCII 1575 8BE1 C4 .DB $C4 ;B/BLK MOV 1576 8BE2 08 .DB $08 ;C/CALC 1577 8BE3 48 .DB $48 ;D/DEP 1578 8BE4 88 .DB $88 ;E/EXEC 1579 8BE5 C8 .DB $C8 ;F/FILL 1580 8BE6 10 .DB $10 ;CR/SD 1581 8BE7 50 .DB $50 ;-/+ 1582 8BE8 90 .DB $90 ;>/< 1583 8BE9 D0 .DB $D0 ;SHIFT 1584 8BEA 20 .DB $20 ;GO/LP 1585 8BEB 60 .DB $60 ;REG/SP 1586 8BEC A0 .DB $A0 ;MEM/WP 1587 8BED 00 .DB $00 ;L2/L1 1588 8BEE 40 .DB $40 ;S2/S1 1589 8BEF ASCIM1 =*-1 1590 8BEF ASCII =* ;ASCII CODES AND HASH CODES 1591 8BEF 30 .DB $30 ;ZERO 1592 8BF0 31 .DB $31 ;ONE 1593 8BF1 32 .DB $32 ;TWO 1594 8BF2 33 .DB $33 ;THREE 1595 8BF3 34 .DB $34 ;FOUR 1596 8BF4 35 .DB $35 ;FIVE 1597 8BF5 36 .DB $36 ;SIX 1598 8BF6 37 .DB $37 ;SEVEN 1599 8BF7 38 .DB $38 ;EIGHT 1600 8BF8 39 .DB $39 ;NINE 1601 8BF9 41 .DB $41 ;A 1602 8BFA 42 .DB $42 ;B 1603 8BFB 43 .DB $43 ;C 1604 8BFC 44 .DB $44 ;D 1605 8BFD 45 .DB $45 ;E 1606 8BFE 46 .DB $46 ;F 1607 8BFF 0D .DB $0D ;CR 1608 8C00 2D .DB $2D ;DASH 1609 8C01 3E .DB $3E ;> 1610 8C02 FF .DB $FF ;SHIFT 1611 8C03 47 .DB $47 ;G 1612 8C04 52 .DB $52 ;R 1613 8C05 4D .DB $4D ;M 1614 8C06 13 .DB $13 ;L2 1615 8C07 1E .DB $1E ;S2 1616 8C08 ; KB UPPER CASE 1617 8C08 14 .DB $14 ;U0 1618 8C09 15 .DB $15 ;U1 1619 8C0A 16 .DB $16 ;U2 1620 8C0B 17 .DB $17 ;U3 1621 8C0C 18 .DB $18 ;U4 1622 8C0D 19 .DB $19 ;U5 1623 8C0E 1A .DB $1A ;U6 1624 8C0F 1B .DB $1B ;U7 1625 8C10 4A .DB $4A ;J 1626 8C11 56 .DB $56 ;V 1627 8C12 FE .DB $FE ;ASCII 1628 8C13 42 .DB $42 ;B 1629 8C14 43 .DB $43 ;C 1630 8C15 44 .DB $44 ;D 1631 8C16 45 .DB $45 ;E 1632 8C17 46 .DB $46 ;F 1633 8C18 10 .DB $10 ;SD 1634 8C19 2B .DB $2B ;+ 1635 8C1A 3C .DB $3C ;< 1636 8C1B 00 .DB $00 ;SHIFT 1637 8C1C 11 .DB $11 ;LP 1638 8C1D 1C .DB $1C ;SP 1639 8C1E 57 .DB $57 ;W 1640 8C1F 12 .DB $12 ;L1 1641 8C20 1D .DB $1D ;S1 1642 8C21 2E .DB $2E ;. 1643 8C22 20 .DB $20 ;BLANK 1644 8C23 3F .DB $3F ;? 1645 8C24 50 .DB $50 ;P 1646 8C25 07 .DB $07 ;BELL 1647 8C26 53 .DB $53 ;S 1648 8C27 58 .DB $58 ;X 1649 8C28 59 .DB $59 ;Y 1650 8C29 ; SEGMENT CODES FOR ON-BOARD DISPLAY 1651 8C29 SEGSM1 =*-1 1652 8C29 3F .DB $3F ;ZERO 1653 8C2A 06 .DB $06 ;ONE 1654 8C2B 5B .DB $5B ;TWO 1655 8C2C 4F .DB $4F ;THREE 1656 8C2D 66 .DB $66 ;FOUR 1657 8C2E 6D .DB $6D ;FIVE 1658 8C2F 7D .DB $7D ;SIX 1659 8C30 07 .DB $07 ;SEVEN 1660 8C31 7F .DB $7F ;EIGHT 1661 8C32 67 .DB $67 ;NINE 1662 8C33 77 F 1504 8B52 A9 04 LDA #4 1505 8B54 48 PHA 1506 8B55 28 PLP ;INIT F, DISABLE IRQ DURING DFTXFR 1507 8B56 20 86 8B JSR ACCESS ;UN WRITE PROT SYS RAM 1508 8B59 A2 5F DFTXFR LDX #$5F ;INIT SYS RAM (EXCPT SCPBUF) 1509 8B5B BD A0 8F LDA DFTBLK,X 1510 8B5E 9D 20 A6 STA RAM,X 1511 8B61 CA DEX 1512 8B62 10 F7 BPL DFTXFR+2 1513 8B64 A9 07 NEWDEV LDA #7 ;CHANGE DEVC/BAUD RATE 1514 8B66 20 47 8A JSR OUTCHR ;BEEP 1515 8B69 20 A3 89 SWITCH JSR KSCONF ;KEYBOARD OR TERMINAL? 1516 8B6C 20 26 89 SWLP JSR KEYQ+3 1517 8B6F D0 0B BNE MONENT 1518 8B71 2C 02 A4 BIT PBDA 1519 8B74 10 F6 BPL SWLP 1520 8B76 20 B7 8B JSR VECSW ;SWITCH VECTORS 1521 8B79 20 FF 8A JSR BAUD 1522 8B7C A2 FF MONENT LDX #$FF ;MONITOR ENTRY 1523 8B7E 9A TXS 1524 8B7F D8 CLD 1525 8B80 20 86 8B JSR ACCESS ;UNWRITE PROT MONITOR RAM 1526 8B83 4C 03 80 JMP WARM 1527 8B86 20 88 81 ACCESS JSR SAVER ;UN WRITE PROT SYS RAM 1528 8B89 AD 01 AC LDA OR3A 1529 8B8C 09 01 ORA #1 1530 8B8E 8D 01 AC ACC1 STA OR3A 1531 8B91 AD 03 AC LDA DDR3A 1532 8B94 09 01 ORA #1 1533 8B96 8D 03 AC STA DDR3A 1534 8B99 4C C4 81 JMP RESALL 1535 8B9C 20 88 81 NACCES JSR SAVER ;WRITE PROT SYS RAM 1536 8B9F AD 01 AC LDA OR3A 1537 8BA2 29 FE AND #$FE 1538 8BA4 18 CLC 1539 8BA5 90 E7 BCC ACC1 1540 8BA7 20 86 8B TTY JSR ACCESS ;UN WRITE PROT RAM 1541 8BAA A9 D5 LDA #$D5 ;110 BAUD 1542 8BAC 8D 51 A6 STA SDBYT 1543 8BAF AD 54 A6 LDA TOUTFL 1544 8BB2 09 40 ORA #$40 1545 8BB4 8D 54 A6 STA TOUTFL 1546 8BB7 20 86 8B VECSW JSR ACCESS ;UN WRITE PROT RAM 1547 8BBA A2 08 LDX #$8 1548 8BBC BD 6F 8C SWLP2 LDA TRMTBL,X 1549 8BBF 9D 60 A6 STA INVEC,X 1550 8BC2 CA DEX 1551 8BC3 10 F7 BPL SWLP2 1552 8BC5 60 RTS 1553 8BC6 ; 1554 8BC6 ;*** 1555 8BC6 ;*** TABLES (I/O CONFIGURATIONS, KEY CODES, ASCII CODES) 1556 8BC6 ;*** 1557 8BC6 00 80 08 37 VALS .DB $00,$80,$08,$37 ;KB SENSE, A=1 1558 8BCA 00 7F 00 30 .DB $00,$7F,$00,$30 ;KB LRN, A=5 1559 8BCE 00 FF 00 3F .DB $00,$FF,$00,$3F ;SCAN DSP, A=9 1560 8BD2 00 00 07 3F .DB $00,$00,$07,$3F ;BEEP, A=D 1561 8BD6 VALSP2 =VALS+2 1562 8BD6 SYM =* ;KEY CODES RETURNED BY LRNKEY 1563 8BD6 TABLE =* 1564 8BD6 01 .DB $01 ;0/U0 1565 8BD7 41 .DB $41 ;1/U1 1566 8BD8 81 .DB $81 ;2/U2 1567 8BD9 C1 .DB $C1 ;3/U3 1568 8BDA 02 .DB $02 ;4/U4 1569 8BDB 42 .DB $42 ;5/U5 1570 8BDC 82 .DB $82 ;6/U6 1571 8BDD C2 .DB $C2 ;7/U7 1572 8BDE 04 .DB $04 ;8/JMP 1573 8BDF 44 .DB $44 ;9/VER 1574 8BE0 84 .DB $84 ;A/ASCII 1575 8BE1 C4 .DB $C4 ;B/BLK MOV 1576 8BE2 08 .DB $08 ;C/CALC 1577 8BE3 48 .DB $48 ;D/DEP 1578 8BE4 88 .DB $88 ;E/EXEC 1579 8BE5 C8 .DB $C8 ;F/FILL 1580 8BE6 10 .DB $10 ;CR/SD 1581 8BE7 50 .DB $50 ;-/+ 1582 8BE8 90 .DB $90 ;>/< 1583 8BE9 D0 .DB $D0 ;SHIFT 1584 8BEA 20 .DB $20 ;GO/LP 1585 8BEB 60 .DB $60 ;REG/SP 1586 8BEC A0 .DB $A0 ;MEM/WP 1587 8BED 00 .DB $00 ;L2/L1 1588 8BEE 40 .DB $40 ;S2/S1 1589 8BEF ASCIM1 =*-1 1590 8BEF ASCII =* ;ASCII CODES AND HASH CODES 1591 8BEF 30 .DB $30 ;ZERO 1592 8BF0 31 .DB $31 ;ONE 1593 8BF1 32 .DB $32 ;TWO 1594 8BF2 33 .DB $33 ;THREE 1595 8BF3 34 .DB $34 ;FOUR 1596 8BF4 35 .DB $35 ;FIVE 1597 8BF5 36 .DB $36 ;SIX 1598 8BF6 37 .DB $37 ;SEVEN 1599 8BF7 38 .DB $38 ;EIGHT 1600 8BF8 39 .DB $39 ;NINE 1601 8BF9 41 .DB $41 ;A 1602 8BFA 42 .DB $42 ;B 1603 8BFB 43 .DB $43 ;C 1604 8BFC 44 .DB $44 ;D 1605 8BFD 45 .DB $45 ;E 1606 8BFE 46 .DB $46 ;F 1607 8BFF 0D .DB $0D ;CR 1608 8C00 2D .DB $2D ;DASH 1609 8C01 3E .DB $3E ;> 1610 8C02 FF .DB $FF ;SHIFT 1611 8C03 47 .DB $47 ;G 1612 8C04 52 .DB $52 ;R 1613 8C05 4D .DB $4D ;M 1614 8C06 13 .DB $13 ;L2 1615 8C07 1E .DB $1E ;S2 1616 8C08 ; KB UPPER CASE 1617 8C08 14 .DB $14 ;U0 1618 8C09 15 .DB $15 ;U1 1619 8C0A 16 .DB $16 ;U2 1620 8C0B 17 .DB $17 ;U3 1621 8C0C 18 .DB $18 ;U4 1622 8C0D 19 .DB $19 ;U5 1623 8C0E 1A .DB $1A ;U6 1624 8C0F 1B .DB $1B ;U7 1625 8C10 4A .DB $4A ;J 1626 8C11 56 .DB $56 ;V 1627 8C12 FE .DB $FE ;ASCII 1628 8C13 42 .DB $42 ;B 1629 8C14 43 .DB $43 ;C 1630 8C15 44 .DB $44 ;D 1631 8C16 45 .DB $45 ;E 1632 8C17 46 .DB $46 ;F 1633 8C18 10 .DB $10 ;SD 1634 8C19 2B .DB $2B ;+ 1635 8C1A 3C .DB $3C ;< 1636 8C1B 00 .DB $00 ;SHIFT 1637 8C1C 11 .DB $11 ;LP 1638 8C1D 1C .DB $1C ;SP 1639 8C1E 57 .DB $57 ;W 1640 8C1F 12 .DB $12 ;L1 1641 8C20 1D .DB $1D ;S1 1642 8C21 2E .DB $2E ;. 1643 8C22 20 .DB $20 ;BLANK 1644 8C23 3F .DB $3F ;? 1645 8C24 50 .DB $50 ;P 1646 8C25 07 .DB $07 ;BELL 1647 8C26 53 .DB $53 ;S 1648 8C27 58 .DB $58 ;X 1649 8C28 59 .DB $59 ;Y 1650 8C29 ; SEGMENT CODES FOR ON-BOARD DISPLAY 1651 8C29 SEGSM1 =*-1 1652 8C29 3F .DB $3F ;ZERO 1653 8C2A 06 .DB $06 ;ONE 1654 8C2B 5B .DB $5B ;TWO 1655 8C2C 4F .DB $4F ;THREE 1656 8C2D 66 .DB $66 ;FOUR 1657 8C2E 6D .DB $6D ;FIVE 1658 8C2F 7D .DB $7D ;SIX 1659 8C30 07 .DB $07 ;SEVEN 1660 8C31 7F .DB $7F ;EIGHT 1661 8C32 67 .DB $67 ;NINE 1662 8C33 77 #0 0584 83CA C8 M35 INY 0585 83CB C0 06 CPY #6 0586 83CD F0 CA BEQ RGBACK 0587 83CF 20 4D 83 JSR CRLF 0588 83D2 B9 99 8F LDA RGNAM-1,Y ;GET REG NAME 0589 83D5 ; OUTPUT 3 SPACES TO LINE UP DISPLAY 0590 83D5 20 47 8A JSR OUTCHR 0591 83D8 20 42 83 JSR SPACE 0592 83DB 20 3F 83 JSR SPC2 0593 83DE B9 5A A6 LDA PCHR,Y 0594 83E1 20 D3 81 JSR OBCMIN 0595 83E4 B0 05 BCS M36 0596 83E6 99 5A A6 STA PCHR,Y 0597 83E9 90 DF BCC M35 0598 83EB F0 D4 M36 BEQ EXITRG 0599 83ED 20 CB 81 JSR ADVCK 0600 83F0 F0 D8 BEQ M35 0601 83F2 60 RTS 0602 83F3 C9 47 GOZ CMP #'G' 0603 83F5 D0 20 BNE LPZB 0604 83F7 20 4D 83 JSR CRLF 0605 83FA 20 9C 8B GO1ENT JSR NACCES ;WRITE PROT MONITOR RAM 0606 83FD AE 5B A6 LDX SR ;RESTORE REGS 0607 8400 9A TXS 0608 8401 AD 5A A6 LDA PCHR 0609 8404 48 PHA 0610 8405 AD 59 A6 LDA PCLR 0611 8408 48 NR10 PHA 0612 8409 AD 5C A6 LDA FR 0613 840C 48 PHA 0614 840D AC 5F A6 LDY YR 0615 8410 AE 5E A6 LDX XR 0616 8413 AD 5D A6 LDA AR 0617 8416 40 RTI 0618 8417 C9 11 LPZB CMP #$11 ;LOAD PAPER TAPE 0619 8419 F0 03 BEQ *+5 0620 841B 4C A7 84 JMP DEPZ 0621 841E 20 88 81 JSR SAVER 0622 8421 20 4D 83 JSR CRLF 0623 8424 A9 00 LDA #0 0624 8426 8D 52 A6 STA ERCNT 0625 8429 20 2E 83 LPZ JSR ZERCK 0626 842C 20 1B 8A LP1 JSR INCHR 0627 842F C9 3B CMP #$3B ;SEMI COLON 0628 8431 D0 F9 BNE LP1 0629 8433 20 A1 84 JSR LDBYTE 0630 8436 B0 56 BCS TAPERR 0631 8438 D0 09 BNE NUREC 0632 843A AD 52 A6 LDA ERCNT ;ERRORS ? 0633 843D F0 01 BEQ *+3 0634 843F 38 SEC 0635 8440 4C B8 81 JMP RESXAF 0636 8443 8D 3D A6 NUREC STA SCRD 0637 8446 20 A1 84 JSR LDBYTE 0638 8449 B0 43 BCS TAPERR 0639 844B 85 FF STA $FF 0640 844D 20 A1 84 JSR LDBYTE 0641 8450 B0 D7 BCS LPZ 0642 8452 85 FE STA $FE 0643 8454 20 A1 84 MORED JSR LDBYTE 0644 8457 B0 35 BCS TAPERR 0645 8459 A0 00 LDY #0 0646 845B 91 FE STA ($FE),Y 0647 845D D1 FE CMP ($FE),Y 0648 845F F0 0C BEQ LPGD 0649 8461 AD 52 A6 LDA ERCNT 0650 8464 29 0F AND #$0F 0651 8466 C9 0F CMP #$0F 0652 8468 F0 03 BEQ *+5 0653 846A EE 52 A6 INC ERCNT 0654 846D 20 B2 82 LPGD JSR INCCMP 0655 8470 CE 3D A6 DEC SCRD 0656 8473 D0 DF BNE MORED 0657 8475 20 D9 81 JSR INBYTE 0658 8478 B0 14 BCS TAPERR 0659 847A CD 37 A6 CMP SCR7 0660 847D D0 0C BNE BADDY 0661 847F 20 D9 81 JSR INBYTE 0662 8482 B0 0A BCS TAPERR 0663 8484 CD 36 A6 CMP SCR6 0664 8487 F0 A0 BEQ LPZ 0665 8489 D0 03 BNE TAPERR ;(ALWAYS) 0666 848B 20 D9 81 BADDY JSR INBYTE 0667 848E AD 52 A6 TAPERR LDA ERCNT 0668 8491 29 F0 AND #$F0 0669 8493 C9 F0 CMP #$F0 0670 8495 F0 92 BEQ LPZ 0671 8497 AD 52 A6 LDA ERCNT 0672 849A 69 10 ADC #$10 0673 849C 8D 52 A6 STA ERCNT 0674 849F D0 88 BNE LPZ 0675 84A1 20 D9 81 LDBYTE JSR INBYTE 0676 84A4 4C DD 82 JMP CHKSAD 0677 84A7 C9 44 DEPZ CMP #'D' ;DEPOSIT, 0 PARM - USE (OLD) 0678 84A9 D0 03 BNE MEMZ 0679 84AB 4C E1 84 JMP NEWLN 0680 84AE C9 4D MEMZ CMP #'M' ;MEM, 0 PARM - USE (OLD) 0681 84B0 D0 03 BNE VERZ 0682 84B2 4C 17 85 JMP NEWLOC 0683 84B5 C9 56 VERZ CMP #'V' ;VERIFY, 0 PARM - USE (OLD) 0684 84B7 D0 0D BNE L1ZB ; ... DO 8 BYTES (LIKE VER 1 PARM) 0685 84B9 A5 FE LDA $FE 0686 84BB 8D 4A A6 STA P3L 0687 84BE A5 FF LDA $FF 0688 84C0 8D 4B A6 STA P3H 0689 84C3 4C 9A 85 JMP VER1+4 0690 84C6 C9 12 L1ZB CMP #$12 ;LOAD KIM, ZERO PARM 0691 84C8 D0 05 BNE L2ZB 0692 84CA A0 00 LDY #0 ;MODE = KIM 0693 84CC 4C 78 8C L1J JMP LENTRY ;GO TO CASSETTE ROUTINE 0694 84CF C9 13 L2ZB CMP #$13 ;LOAD HS, ZERO PARM 0695 84D1 D0 04 BNE EZPARM 0696 84D3 A0 80 LDY #$80 ;MODE - HS 0697 84D5 D0 F5 BNE L1J ;(ALWAYS) 0698 84D7 6C 6D A6 EZPARM JMP (URCVEC+1) ;ELSE UNREC COMMAND 0699 84DA B1PARM =* 0700 84DA ; 0701 84DA ; 1 PARAMETER COMMAND EXEC BLOCKS 0702 84DA ; 0703 84DA C9 44 DEP1 CMP #'D' ;DEPOSIT, 1 PARM 0704 84DC D0 32 BNE MEM1 0705 84DE 20 A7 82 JSR P3SCR 0706 84E1 20 16 83 NEWLN JSR CRLFSZ 0707 84E4 A0 00 LDY #0 0708 84E6 A2 08 LDX #8 0709 84E8 20 42 83 DEPBYT JSR SPACE 0710 84EB 20 D9 81 JSR INBYTE 0711 84EE B0 11 BCS NH41 0712 84F0 91 FE STA ($FE),Y 0713 84F2 D1 FE CMP ($FE),Y ;VERIFY 0714 84F4 F0 03 BEQ DEPN 0715 84F6 20 20 83 JSR OUTQM ;TYPE "?" IF NG 0716 84F9 20 B2 82 DEPN JSR INCCMP 0717 84FC CA DEX 0718 84FD D0 E9 BNE DEPBYT 0719 84FF F0 E0 BEQ NEWLN 0720 8501 F0 0B NH41 BEQ DEPEC 0721 8503 C9 20 CMP #$20 ;SPACE = FWD 0722 8505 D0 4C BNE DEPES 0723 8507 70 F0 BVS DEPN 0724 8509 20 42 83 JSR SPACE 0725 850C 10 EB BPL DEPN 0726 850E 18 DEPEC CLC 0727 850F 60 RTS 0728 8510 C9 4D MEM1 CMP #'M' ;MEMORY, 1 PARM 0729 8512 D0 65 BNE GO1 0730 8514 20 A7 82 JSR P3SCR 0731 8517 20 16 83 NEWLOC JSR CRLFSZ 0732 851A 20 3A 83 JSR COMMA 0733 851D A0 00 LDY #0 0734 851F B1 FE LDA ($FE),Y 0735 8521 20 D3 81 JSR OBCMIN 0736 8524 B0 11 BCS NH42 0737 8526 A0 00 LDY #$00 0738 8528 91 FE STA ($FE),Y 0739 852A D1 FE CMP ($FE),Y ;VERIFY MEM 0740 852C F0 03 BEQ NXTLOC 0741 852E 20 20 83 JSR OUTQM ;TYPE ? AND CONTINUE 0742 8531 20 B2 82 NXTLOC JSR INCCMP 0743 8534 18 CLC 0744 8535 90 E0 BCC NEWLOC 0745 8537 F0 3E NH42 BEQ EXITM1 0746 8539 50 04 BVC *+6 0747 853B C9 3C CMP #'<' 0748 853D F0 D8 BEQ NEWLOC 0749 853F C9 20 CMP #$20 ;SPACE ? 0750 8541 F0 EE BEQ NXTLOC 0751 8543 C9 3E CMP #'>' 0752 8545 F0 EA BEQ NXTLOC 0753 8547 C9 2B CMP #'+' 0754 8549 F0 10 BEQ LOCP8 0755 854B C9 3C CMP #'<' 0756 854D F0 06 BEQ PRVLOC 0757 854F C9 2D CMP #'-' 0758 8551 F0 16 BEQ LOCM8 0759 8553 38 DEPES SEC 0760 8554 60 RTS 0761 8555 20 BE 82 PRVLOC JSR DECCMP ;BACK ONE BYT 0762 8558 18 CLC 0763 8559 90 BC BCC NEWLOC 0764 855B A5 FE LOCP8 LDA $FE ;GO FWD 8 BYTES 0765 855D 18 CLC 0766 855E 69 08 ADC #$08 0767 8560 85 FE STA $FE 0768 8562 90 02 BCC M42 0769 8564 E6 FF INC $FF 0770 8566 18 M42 CLC 0771 8567 90 AE BCC NEWLOC 0772 8569 A5 FE LOCM8 LDA $FE ;GO BACKWD 8 BYTES 0773 856B 38 SEC 0774 856C E9 08 SBC #$08 0775 856E 85 FE STA $FE 0776 8570 B0 02 BCS M43 0777 8572 C6 FF DEC $FF 0778 8574 18 M43 CLC 0779 8575 90 A0 BCC NEWLOC 0780 8577 18 EXITM1 CLC 0781 8578 60 RTS 0782 8579 C9 47 GO1 CMP #'G' ;GO, 1 PARM (RTRN ADDR ON STK) 0783 857B D0 19 BNE VER1 ; ... PARM IS ADDR TO GO TO 0784 857D 20 4D 83 JSR CRLF 0785 8580 20 9C 8B JSR NACCES ;WRITE PROT MONITR RAM 0786 8583 A2 FF LDX #$FF ;PUSH RETURN ADDR 0787 8585 9A TXS 0788 8586 A9 7F LDA #$7F 0789 8588 48 PHA 0790 8589 A9 FF LDA #$FF 0791 858B 48 PHA 0792 858C AD 4B A6 LDA P3H 0793 858F 48 PHA 0794 8590 AD 4A A6 LDA P3L 0795 8593 4C 08 84 JMP NR10 0796 8596 C9 56 VER1 CMP #'V' ;VERIFY, 1 PARM (8 BYTES, CKSUM) 0797 8598 D0 1A BNE JUMP1 0798 859A AD 4A A6 LDA P3L 0799 859D 8D 4C A6 STA P2L 0800 85A0 18 CLC 0801 85A1 69 07 ADC #$07 0802 85A3 8D 4A A6 STA P3L 0803 85A6 AD 4B A6 LDA P3H 0804 85A9 8D 4D A6 STA P2H 0805 85AC 69 00 ADC #0 0806 85AE 8D 4B A6 STA P3H 0807 85B1 4C 40 86 JMP VER2+4 0808 85B4 C9 4A JUMP1 CMP #'J' ;JUMP (JUMP TABLE IN SYS RAM) 0809 85B6 D0 1F BNE L11B 0810 85B8 AD 4A A6 LDA P3L 0811 85BB C9 08 CMP #8 ;0-7 ONLY VALID 0812 85BD B0 26 BCS JUM2 0813 85BF 20 9C 8B JSR NACCES ;WRITE PROT SYS RAM 0814 85C2 0A ASL A 0815 85C3 A8 TAY 0816 85C4 A2 FF LDX #$FF ;INIT STK PTR 0817 85C6 9A TXS 0818 85C7 A9 7F LDA #$7F ;PUSH COLD RETURN 0819 85C9 48 PHA 0820 85CA A9 FF LDA #$FF 0821 85CC 48 PHA 0822 85CD B9 21 A6 LDA JTABLE+1,Y ;GET ADDR FROM TABLE 0823 85D0 48 PHA ;PUSH ON STACK 0824 85D1 B9 20 A6 LDA JTABLE,Y 0825 85D4 4C 08 84 JMP NR10 ;LOAD UP USER REG'S AND RTI 0826 85D7 C9 12 L11B CMP #$12 ;LOAD KIM FMT, 1 PARM 0827 85D9 D0 14 BNE L21B 0828 85DB A0 00 LDY #0 ;MODE = KIM 0829 85DD AD 4A A6 L11C LDA P3L 0830 85E0 C9 FF CMP #$FF ;ID MUST NOT BE FF 0831 85E2 D0 02 BNE *+4 0832 85E4 38 SEC 0833 85E5 60 JUM2 RTS 0834 85E6 20 08 82 JSR PSHOVE ;FIX PARM POSITION 0835 85E9 20 08 82 L11D JSR PSHOVE 0836 85EC 4C 78 8C JMP LENTRY 0837 85EF C9 13 L21B CMP #$13 ;LOAD TAPE, HS FMT, 1 PARM 0838 85F1 D0 04 BNE WPR1B 0839 85F3 A0 80 LDY #$80 ;MODE = HS 0840 85F5 D0 E6 BNE L11C 0841 85F7 C9 57 WPR1B CMP #'W' ;WRITE PROT USER RAM 0842 85F9 D0 1B BNE E1PARM 0843 85FB AD 4A A6 LDA P3L ; FIRST DIG IS 1K ABOVE 0, 0844 85FE 29 11 AND #$11 ; SECOND IS 2K ABOVE 0 0845 8600 C9 08 CMP #8 ; THIRD IS 3K ABOVE 0. 0846 8602 2A ROL A 0847 8603 4E 4B A6 LSR P3H 0848 8606 2A ROL A 0849 8607 0A ASL A 0850 8608 29 0F AND #$0F 0851 860A 49 0F EOR #$0F ;0 IS PROTECT 0852 860C 8D 01 AC STA OR3A 0853 860F A9 0F LDA #$0F 0854 8611 8D 03 AC STA DDR3A 0855 8614 18 CLC 0856 8615 60 RTS 0857 8616 4C 27 88 E1PARM JMP CALC3 0858 8619 B2PARM =* 0859 8619 ; 0860 8619 ; 2 PARAMETER EXEC BLOCKS 0861 8619 ; 0862 8619 C9 10 STD2 CMP #$10 ;STORE DOUBLE BYTE 0863 861B D0 12 BNE MEM2 0864 861D 20 A7 82 JSR P3SCR 0865 8620 AD 4D A6 LDA P2H 0866 8623 A0 01 LDY #1 0867 8625 91 FE STA ($FE),Y 0868 8627 88 DEY 0869 8628 AD 4C A6 LDA P2L 0870 862B 91 FE STA ($FE),Y 0871 862D 18 CLC 0872 862E 60 RTS 0873 862F C9 4D MEM2 CMP #'M' ;CONTINUE MEM SEARCH W/OLD PTR 0874 8631 D0 09 BNE VER2 0875 8633 AD 4C A6 LDA P2L 0876 8636 8D 4E A6 STA P1L 0877 8639 4C 08 88 JMP MEM3C 0878 863C C9 56 VER2 CMP #'V' ;VERIFY MEM W/CHKSUMS , 2 PARM 0879 863E D0 48 BNE L12B 0880 8640 20 9C 82 JSR P2SCR 0881 8643 20 2E 83 JSR ZERCK 0882 8646 20 16 83 VADDR JSR CRLFSZ 0883 8649 A2 08 LDX #8 0884 864B 20 42 83 V2 JSR SPACE 0885 864E A0 00 LDY #0 0886 8650 B1 FE LDA ($FE),Y 0887 8652 20 DD 82 JSR CHKSAD 0888 8655 20 FA 82 JSR OUTBYT 0889 8658 20 B2 82 JSR INCCMP 0890 865B 70 11 BVS V1 0891 865D F0 02 BEQ *+4 0892 865F B0 0D BCS V1 0893 8661 CA DEX 0894 8662 D0 E7 BNE V2 0895 8664 20 25 83 JSR OCMCK 0896 8667 20 86 83 JSR INSTAT 0897 866A 90 DA BCC VADDR 0898 866C 18 CLC 0899 866D 60 RTS 0900 866E 20 BE 82 V1 JSR DECCMP 0901 8671 E0 08 CPX #8 0902 8673 F0 03 BEQ *+5 0903 8675 E8 INX 0904 8676 10 F6 BPL V1 0905 8678 20 25 83 JSR OCMCK 0906 867B 20 4D 83 JSR CRLF 0907 867E 20 42 83 JSR SPACE 0908 8681 AE 37 A6 LDX SCR7 0909 8684 20 F4 82 JSR OUTXAH 0910 8687 60 RTS 0911 8688 C9 12 L12B CMP #$12 ;LOAD KIM FMT TAPE, 2 PARMS 0912 868A D0 0C BNE SP2B 0913 868C AD 4C A6 LDA P2L 0914 868F C9 FF CMP #$FF ;ID MUST BE FF 0915 8691 D0 F4 BNE L12B-1 ;ERR 0916 8693 A0 00 LDY #0 ;MODE = HS 0917 8695 4C E9 85 JMP L11D 0918 8698 C9 1C SP2B CMP #$1C ;SAVE PAPER TAPE, 2 PARMS 0919 869A D0 75 BNE E2PARM 0920 869C 18 CLC 0921 869D 20 88 81 JSR SAVER 0922 86A0 20 9C 82 JSR P2SCR 0923 86A3 20 FA 86 SP2C JSR DIFFZ 0924 86A6 B0 03 BCS SP2D 0925 86A8 4C C4 81 SPEXIT JMP RESALL 0926 86AB 20 4D 83 SP2D JSR CRLF 0927 86AE CD 58 A6 CMP MAXRC 0928 86B1 90 05 BCC SP2E 0929 86B3 AD 58 A6 LDA MAXRC 0930 86B6 B0 02 BCS SP2F 0931 86B8 69 01 SP2E ADC #1 0932 86BA 8D 3D A6 SP2F STA RC 0933 86BD A9 3B LDA #$3B ;SEMI COLON 0934 86BF 20 47 8A JSR OUTCHR 0935 86C2 AD 3D A6 LDA RC 0936 86C5 20 F4 86 JSR SVBYTE 0937 86C8 A5 FF LDA $FF 0938 86CA 20 F4 86 JSR SVBYTE 0939 86CD A5 FE LDA $FE 0940 86CF 20 F4 86 JSR SVBYTE 0941 86D2 A0 00 MORED2 LDY #$00 0942 86D4 B1 FE LDA ($FE),Y 0943 86D6 20 F4 86 JSR SVBYTE 0944 86D9 20 86 83 JSR INSTAT ;STOP IF KEY DEPRESSED 0945 86DC B0 CA BCS SPEXIT 0946 86DE 20 B2 82 F 1504 8B52 A9 04 LDA #4 1505 8B54 48 PHA 1506 8B55 28 PLP ;INIT F, DISABLE IRQ DURING DFTXFR 1507 8B56 20 86 8B JSR ACCESS ;UN WRITE PROT SYS RAM 1508 8B59 A2 5F DFTXFR LDX #$5F ;INIT SYS RAM (EXCPT SCPBUF) 1509 8B5B BD A0 8F LDA DFTBLK,X 1510 8B5E 9D 20 A6 STA RAM,X 1511 8B61 CA DEX 1512 8B62 10 F7 BPL DFTXFR+2 1513 8B64 A9 07 NEWDEV LDA #7 ;CHANGE DEVC/BAUD RATE 1514 8B66 20 47 8A JSR OUTCHR ;BEEP 1515 8B69 20 A3 89 SWITCH JSR KSCONF ;KEYBOARD OR TERMINAL? 1516 8B6C 20 26 89 SWLP JSR KEYQ+3 1517 8B6F D0 0B BNE MONENT 1518 8B71 2C 02 A4 BIT PBDA 1519 8B74 10 F6 BPL SWLP 1520 8B76 20 B7 8B JSR VECSW ;SWITCH VECTORS 1521 8B79 20 FF 8A JSR BAUD 1522 8B7C A2 FF MONENT LDX #$FF ;MONITOR ENTRY 1523 8B7E 9A TXS 1524 8B7F D8 CLD 1525 8B80 20 86 8B JSR ACCESS ;UNWRITE PROT MONITOR RAM 1526 8B83 4C 03 80 JMP WARM 1527 8B86 20 88 81 ACCESS JSR SAVER ;UN WRITE PROT SYS RAM 1528 8B89 AD 01 AC LDA OR3A 1529 8B8C 09 01 ORA #1 1530 8B8E 8D 01 AC ACC1 STA OR3A 1531 8B91 AD 03 AC LDA DDR3A 1532 8B94 09 01 ORA #1 1533 8B96 8D 03 AC STA DDR3A 1534 8B99 4C C4 81 JMP RESALL 1535 8B9C 20 88 81 NACCES JSR SAVER ;WRITE PROT SYS RAM 1536 8B9F AD 01 AC LDA OR3A 1537 8BA2 29 FE AND #$FE 1538 8BA4 18 CLC 1539 8BA5 90 E7 BCC ACC1 1540 8BA7 20 86 8B TTY JSR ACCESS ;UN WRITE PROT RAM 1541 8BAA A9 D5 LDA #$D5 ;110 BAUD 1542 8BAC 8D 51 A6 STA SDBYT 1543 8BAF AD 54 A6 LDA TOUTFL 1544 8BB2 09 40 ORA #$40 1545 8BB4 8D 54 A6 STA TOUTFL 1546 8BB7 20 86 8B VECSW JSR ACCESS ;UN WRITE PROT RAM 1547 8BBA A2 08 LDX #$8 1548 8BBC BD 6F 8C SWLP2 LDA TRMTBL,X 1549 8BBF 9D 60 A6 STA INVEC,X 1550 8BC2 CA DEX 1551 8BC3 10 F7 BPL SWLP2 1552 8BC5 60 RTS 1553 8BC6 ; 1554 8BC6 ;*** 1555 8BC6 ;*** TABLES (I/O CONFIGURATIONS, KEY CODES, ASCII CODES) 1556 8BC6 ;*** 1557 8BC6 00 80 08 37 VALS .DB $00,$80,$08,$37 ;KB SENSE, A=1 1558 8BCA 00 7F 00 30 .DB $00,$7F,$00,$30 ;KB LRN, A=5 1559 8BCE 00 FF 00 3F .DB $00,$FF,$00,$3F ;SCAN DSP, A=9 1560 8BD2 00 00 07 3F .DB $00,$00,$07,$3F ;BEEP, A=D 1561 8BD6 VALSP2 =VALS+2 1562 8BD6 SYM =* ;KEY CODES RETURNED BY LRNKEY 1563 8BD6 TABLE =* 1564 8BD6 01 .DB $01 ;0/U0 1565 8BD7 41 .DB $41 ;1/U1 1566 8BD8 81 .DB $81 ;2/U2 1567 8BD9 C1 .DB $C1 ;3/U3 1568 8BDA 02 .DB $02 ;4/U4 1569 8BDB 42 .DB $42 ;5/U5 1570 8BDC 82 .DB $82 ;6/U6 1571 8BDD C2 .DB $C2 ;7/U7 1572 8BDE 04 .DB $04 ;8/JMP 1573 8BDF 44 .DB $44 ;9/VER 1574 8BE0 84 .DB $84 ;A/ASCII 1575 8BE1 C4 .DB $C4 ;B/BLK MOV 1576 8BE2 08 .DB $08 ;C/CALC 1577 8BE3 48 .DB $48 ;D/DEP 1578 8BE4 88 .DB $88 ;E/EXEC 1579 8BE5 C8 .DB $C8 ;F/FILL 1580 8BE6 10 .DB $10 ;CR/SD 1581 8BE7 50 .DB $50 ;-/+ 1582 8BE8 90 .DB $90 ;>/< 1583 8BE9 D0 .DB $D0 ;SHIFT 1584 8BEA 20 .DB $20 ;GO/LP 1585 8BEB 60 .DB $60 ;REG/SP 1586 8BEC A0 .DB $A0 ;MEM/WP 1587 8BED 00 .DB $00 ;L2/L1 1588 8BEE 40 .DB $40 ;S2/S1 1589 8BEF ASCIM1 =*-1 1590 8BEF ASCII =* ;ASCII CODES AND HASH CODES 1591 8BEF 30 .DB $30 ;ZERO 1592 8BF0 31 .DB $31 ;ONE 1593 8BF1 32 .DB $32 ;TWO 1594 8BF2 33 .DB $33 ;THREE 1595 8BF3 34 .DB $34 ;FOUR 1596 8BF4 35 .DB $35 ;FIVE 1597 8BF5 36 .DB $36 ;SIX 1598 8BF6 37 .DB $37 ;SEVEN 1599 8BF7 38 .DB $38 ;EIGHT 1600 8BF8 39 .DB $39 ;NINE 1601 8BF9 41 .DB $41 ;A 1602 8BFA 42 .DB $42 ;B 1603 8BFB 43 .DB $43 ;C 1604 8BFC 44 .DB $44 ;D 1605 8BFD 45 .DB $45 ;E 1606 8BFE 46 .DB $46 ;F 1607 8BFF 0D .DB $0D ;CR 1608 8C00 2D .DB $2D ;DASH 1609 8C01 3E .DB $3E ;> 1610 8C02 FF .DB $FF ;SHIFT 1611 8C03 47 .DB $47 ;G 1612 8C04 52 .DB $52 ;R 1613 8C05 4D .DB $4D ;M 1614 8C06 13 .DB $13 ;L2 1615 8C07 1E .DB $1E ;S2 1616 8C08 ; KB UPPER CASE 1617 8C08 14 .DB $14 ;U0 1618 8C09 15 .DB $15 ;U1 1619 8C0A 16 .DB $16 ;U2 1620 8C0B 17 .DB $17 ;U3 1621 8C0C 18 .DB $18 ;U4 1622 8C0D 19 .DB $19 ;U5 1623 8C0E 1A .DB $1A ;U6 1624 8C0F 1B .DB $1B ;U7 1625 8C10 4A .DB $4A ;J 1626 8C11 56 .DB $56 ;V 1627 8C12 FE .DB $FE ;ASCII 1628 8C13 42 .DB $42 ;B 1629 8C14 43 .DB $43 ;C 1630 8C15 44 .DB $44 ;D 1631 8C16 45 .DB $45 ;E 1632 8C17 46 .DB $46 ;F 1633 8C18 10 .DB $10 ;SD 1634 8C19 2B .DB $2B ;+ 1635 8C1A 3C .DB $3C ;< 1636 8C1B 00 .DB $00 ;SHIFT 1637 8C1C 11 .DB $11 ;LP 1638 8C1D 1C .DB $1C ;SP 1639 8C1E 57 .DB $57 ;W 1640 8C1F 12 .DB $12 ;L1 1641 8C20 1D .DB $1D ;S1 1642 8C21 2E .DB $2E ;. 1643 8C22 20 .DB $20 ;BLANK 1644 8C23 3F .DB $3F ;? 1645 8C24 50 .DB $50 ;P 1646 8C25 07 .DB $07 ;BELL 1647 8C26 53 .DB $53 ;S 1648 8C27 58 .DB $58 ;X 1649 8C28 59 .DB $59 ;Y 1650 8C29 ; SEGMENT CODES FOR ON-BOARD DISPLAY 1651 8C29 SEGSM1 =*-1 1652 8C29 3F .DB $3F ;ZERO 1653 8C2A 06 .DB $06 ;ONE 1654 8C2B 5B .DB $5B ;TWO 1655 8C2C 4F .DB $4F ;THREE 1656 8C2D 66 .DB $66 ;FOUR 1657 8C2E 6D .DB $6D ;FIVE 1658 8C2F 7D .DB $7D ;SIX 1659 8C30 07 .DB $07 ;SEVEN 1660 8C31 7F .DB $7F ;EIGHT 1661 8C32 67 .DB $67 ;NINE 1662 8C33 77 ; SEE IF VECTOR ALREADY MOVED 1128 8855 AD 62 A6 LDA INVEC+2 ;INVEC MOVED TO SCRA, SCRB 1129 8858 ; HI BYTE OF EXEVEC MUST BE DIFFERENT FROM INVEC 1130 8858 CD 73 A6 CMP EXEVEC+1 ;$FA, $FB USED AS RAM PTR 1131 885B F0 15 BEQ PTRIN 1132 885D 8D 3B A6 STA SCRA+1 ;SAVE INVEC IN SCRA,B 1133 8860 AD 61 A6 LDA INVEC+1 1134 8863 8D 3A A6 STA SCRA 1135 8866 AD 72 A6 LDA EXEVEC ;PUT ADDR OF RIN IN INVEC 1136 8869 8D 61 A6 STA INVEC+1 1137 886C AD 73 A6 LDA EXEVEC+1 1138 886F 8D 62 A6 STA INVEC+2 1139 8872 AD 4B A6 PTRIN LDA P3H ;INIT RAM PTR IN $FA, $FB 1140 8875 85 FB STA $FB 1141 8877 AD 4A A6 LDA P3L 1142 887A 85 FA STA $FA 1143 887C 18 CLC 1144 887D 60 RTS 1145 887E 20 88 81 RIN JSR SAVER ;GET INPUT FROM RAM 1146 8881 A0 00 LDY #$0 ;RAM PTR IN $FA, $FB 1147 8883 B1 FA LDA ($FA),Y 1148 8885 F0 12 BEQ RESTIV ;IF 00 BYTE, RESTORE INVEC 1149 8887 E6 FA INC $FA 1150 8889 D0 02 BNE *+4 1151 888B E6 FB INC $FB 1152 888D 2C 53 A6 BIT TECHO ;ECHO CHARS IN ? 1153 8890 10 03 BPL *+5 1154 8892 20 47 8A JSR OUTCHR 1155 8895 18 CLC 1156 8896 4C B8 81 JMP RESXAF 1157 8899 AD 3A A6 RESTIV LDA SCRA ;RESTORE INVEC 1158 889C 8D 61 A6 STA INVEC+1 1159 889F AD 3B A6 LDA SCRA+1 1160 88A2 8D 62 A6 STA INVEC+2 1161 88A5 18 CLC 1162 88A6 20 1B 8A JSR INCHR 1163 88A9 4C B8 81 JMP RESXAF 1164 88AC 6C 6D A6 E3PARM JMP (URCVEC+1) ;... ELSE UNREC CMD 1165 88AF ; *** 1166 88AF ; *** HEX KEYBOARD I/O 1167 88AF ; *** 1168 88AF 20 88 81 GETKEY JSR SAVER ;FIND KEY 1169 88B2 20 CF 88 JSR GK 1170 88B5 C9 FE CMP #$FE 1171 88B7 D0 13 BNE EXITGK 1172 88B9 20 CF 88 JSR GK 1173 88BC 8A TXA 1174 88BD 0A ASL A 1175 88BE 0A ASL A 1176 88BF 0A ASL A 1177 88C0 0A ASL A 1178 88C1 8D 3E A6 STA SCRE 1179 88C4 20 CF 88 JSR GK 1180 88C7 8A TXA 1181 88C8 18 CLC 1182 88C9 6D 3E A6 ADC SCRE 1183 88CC 4C B8 81 EXITGK JMP RESXAF 1184 88CF A9 00 GK LDA #0 1185 88D1 8D 55 A6 STA KSHFL 1186 88D4 20 03 89 GK1 JSR IJSCNV ;SCAN KB 1187 88D7 F0 FB BEQ GK1 1188 88D9 20 2C 89 JSR LRNKEY ;WHAT KEY IS IT? 1189 88DC F0 F6 BEQ GK1 1190 88DE 48 PHA 1191 88DF 8A TXA 1192 88E0 48 PHA 1193 88E1 20 72 89 JSR BEEP 1194 88E4 20 23 89 GK2 JSR KEYQ 1195 88E7 D0 FB BNE GK2 ;Z=1 IF KEY DOWN 1196 88E9 20 9B 89 JSR NOBEEP ;DELAY (DEBOUNCE) W/O BEEP 1197 88EC 20 23 89 JSR KEYQ 1198 88EF D0 F3 BNE GK2 1199 88F1 68 PLA 1200 88F2 AA TAX 1201 88F3 68 PLA 1202 88F4 C9 FF CMP #$FF ;IF SHIFT, SET FLAG + GET NEXT KEY 1203 88F6 D0 07 BNE EXITG 1204 88F8 A9 19 LDA #$19 1205 88FA 8D 55 A6 STA KSHFL 1206 88FD D0 D5 BNE GK1 1207 88FF 60 EXITG RTS 1208 8900 20 C1 89 HDOUT JSR OUTDSP ;CHAR OUT, SCAN KB 1209 8903 6C 70 A6 IJSCNV JMP (SCNVEC+1) 1210 8906 A9 09 SCAND LDA #$9 ;SCAN DISPLAY FROM DISBUF 1211 8908 20 A5 89 JSR CONFIG 1212 890B A2 05 LDX #5 1213 890D A0 00 SC1 LDY #0 1214 890F BD 40 A6 LDA DISBUF,X 1215 8912 8C 00 A4 STY PADA 1216 8915 8E 02 A4 STX PBDA 1217 8918 8D 00 A4 STA PADA 1218 891B A0 10 LDY #$10 1219 891D 88 SC2 DEY 1220 891E D0 FD BNE SC2 1221 8920 CA DEX 1222 8921 10 EA BPL SC1 1223 8923 20 A3 89 KEYQ JSR KSCONF ; KEY DOWN ? (YES THEN Z=1) 1224 8926 AD 00 A4 H8926 LDA PADA 1225 8929 49 7F EOR #$7F 1226 892B 60 RTS 1227 892C 29 3F LRNKEY AND #$3F ;DETERMINE WHAT KEY IS DOWN 1228 892E 8D 3F A6 STA SCRF 1229 8931 A9 05 LDA #$05 1230 8933 20 A5 89 JSR CONFIG 1231 8936 AD 02 A4 LDA PBDA 1232 8939 29 07 AND #$07 1233 893B 49 07 EOR #$07 1234 893D D0 05 BNE LK1 1235 893F 2C 00 A4 BIT PADA 1236 8942 30 1A BMI NOKEY 1237 8944 C9 04 LK1 CMP #$04 1238 8946 90 02 BCC LK2 1239 8948 A9 03 LDA #$03 1240 894A 0A LK2 ASL A 1241 894B 0A ASL A 1242 894C 0A ASL A 1243 894D 0A ASL A 1244 894E 0A ASL A 1245 894F 0A ASL A 1246 8950 18 CLC 1247 8951 6D 3F A6 ADC SCRF 1248 8954 A2 19 LDX #$19 1249 8956 DD D6 8B LK3 CMP SYM,X 1250 8959 F0 05 BEQ FOUND 1251 895B CA DEX 1252 895C 10 F8 BPL LK3 1253 895E E8 NOKEY INX 1254 895F 60 RTS 1255 8960 8A FOUND TXA 1256 8961 18 CLC 1257 8962 6D 55 A6 ADC KSHFL 1258 8965 AA TAX 1259 8966 BD EF 8B LDA ASCII,X 1260 8969 60 RTS 1261 896A 20 23 89 KYSTAT JSR KEYQ ;KEY DOWN? RETURN IN CARRY 1262 896D 18 CLC 1263 896E F0 01 BEQ *+3 1264 8970 38 SEC 1265 8971 60 RTS 1266 8972 20 88 81 BEEP JSR SAVER ;DELAY (BOUNCE) W/BEEP 1267 8975 A9 0D BEEPP3 LDA #$0D 1268 8977 20 A5 89 BEEPP5 JSR CONFIG 1269 897A A2 70 LDX #$70 ;DURATION CONSTANT 1270 897C A9 08 BE1 LDA #8 1271 897E 8D 02 A4 STA PBDA 1272 8981 20 95 89 JSR BE2 1273 8984 A9 06 LDA #6 1274 8986 8D 02 A4 STA PBDA 1275 8989 20 95 89 JSR BE2 1276 898C CA DEX 1277 898D D0 ED BNE BE1 1278 898F 20 A3 89 JSR KSCONF 1279 8992 4C C4 81 JMP RESALL 1280 8995 A0 1A BE2 LDY #$1A 1281 8997 88 BE3 DEY 1282 8998 D0 FD BNE BE3 1283 899A 60 RTS 1284 899B 20 88 81 NOBEEP JSR SAVER ;DELAY W/O BEEP 1285 899E A9 01 LDA #$01 1286 89A0 4C 77 89 JMP BEEPP5 ;(BNE BEEPP5, $FF) 1287 89A3 A9 01 KSCONF LDA #$1 ;CONFIGURE FOR KEYBOARD 1288 89A5 20 88 81 CONFIG JSR SAVER ;CONFIGURE I/O FROM TABLE VAL 1289 89A8 A0 01 LDY #$01 1290 89AA AA TAX 1291 89AB BD C8 8B CON1 LDA VALSP2,X 1292 89AE 99 02 A4 STA PBDA,Y 1293 89B1 BD C6 8B LDA VALS,X 1294 89B4 99 00 A4 STA PADA,Y 1295 89B7 CA DEX 1296 89B8 88 DEY 1297 89B9 10 F0 BPL CON1 1298 89BB 4C C4 81 JMP RESALL 1299 89BE 20 AF 88 HKEY JSR GETKEY ;GET KEY FROM KB AND ECHO ON KB 1300 89C1 20 88 81 OUTDSP JSR SAVER ;DISPLAY OUT 1301 89C4 29 7F AND #$7F 1302 89C6 C9 07 CMP #$07 ;BELL? 1303 89C8 D0 03 BNE NBELL 1304 89CA 4C 75 89 JMP BEEPP3 ;YES - BEEP 1305 89CD 20 06 8A NBELL JSR TEXT ;PUSH INTO SCOPE BUFFER 1306 89D0 C9 2C CMP #$2C ;COMMA? 1307 89D2 D0 0A BNE OUD1 1308 89D4 AD 45 A6 LDA RDIG 1309 89D7 09 80 ORA #$80 ;TURN ON DECIMAL PT 1310 89D9 8D 45 A6 STA RDIG 1311 89DC D0 25 BNE EXITOD 1312 89DE A2 3A OUD1 LDX #$3A 1313 89E0 DD EE 8B OUD2 CMP ASCIM1,X 1314 89E3 F0 05 BEQ GETSGS 1315 89E5 CA DEX 1316 89E6 D0 F8 BNE OUD2 1317 89E8 F0 19 BEQ EXITOD 1318 89EA BD 28 8C GETSGS LDA SEGSM1,X ;GET CORR SEG CODE FROM TABLE 1319 89ED C9 F0 CMP #$F0 1320 89EF F0 12 BEQ EXITOD 1321 89F1 A2 00 LDX #0 1322 89F3 48 PHA 1323 89F4 BD 41 A6 OUD3 LDA DISBUF+1,X ;SHOVE DOWN DISPLAY BUFFER 1324 89F7 9D 40 A6 STA DISBUF,X 1325 89FA E8 INX 1326 89FB E0 05 CPX #5 1327 JSR OUTDD1 0432 E14D 68 PLA 0433 E14E AA TAX 0434 E14F CA DEX 0435 E150 10 F4 BPL RS8 0436 E152 30 EA BMI RS6 0437 E154 0438 E154 ;BRK INSTR (00) OR IRQ ENTRY POINT 0439 E154 8D 21 A4 IRQV3 STA SAVA 0440 E157 68 PLA 0441 E158 48 PHA ;GET STATUS 0442 E159 29 10 AND #$10 ;SEE IF 'BRK' , ISOLATE B FLG 0443 E15B D0 06 BNE IRQ1 ;TRAP WAS CAUSED BY "BRK" INSTRUC 0444 E15D AD 21 A4 LDA SAVA ;TRAP CAUSED BY IRQ SO TRANSFER 0445 E160 6C 00 A4 JMP (MONRAM) ;CONTROL TO USER THRU VECTOR 0446 E163 ;IS 'BRK' INSTR ,SHOW PC & DATA 0447 E163 ;PC IS OFF BY ONE , SO ADJUST IT 0448 E163 68 IRQ1 PLA 0449 E164 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0450 E167 8E 22 A4 STX SAVX 0451 E16A 8C 23 A4 STY SAVY 0452 E16D D8 CLD 0453 E16E 68 PLA ;PROGR CNTR 0454 E16F 38 SEC ;SUBTRACT ONE FROM RETURN ADDR 0455 E170 E9 01 SBC #1 0456 E172 8D 25 A4 STA SAVPC 0457 E175 68 PLA 0458 E176 E9 00 SBC #0 0459 E178 8D 26 A4 STA SAVPC+1 0460 E17B BA TSX ;GET STACK PTR & SAVE IT 0461 E17C 8E 24 A4 STX SAVS 0462 E17F ;SHOW PC AND DATA 0463 E17F 20 61 F4 IRQ2 JSR REGQ ;SHOW NEXT INSTRUCTION & CONTINUE 0464 E182 0465 E182 ;THIS ROUTINE WILL GET A CHR WITH "( )" FROM 0466 E182 ;KB/TTY & THEN WILL GO TO THE RESPECTIVE COMMAND 0467 E182 4C 59 FF START JMP PAT19 ;CLEAR DEC MODE & 0468 E185 A9 BC STA1 LDA #'<'+$80 ;"<" CHR WITH MSB=1 FOR DISP 0469 E187 20 7A E9 JSR OUTPUT 0470 E18A 20 96 FE JSR RED1 ;GET CHR & ECHO FROM KB/TTY 0471 E18D 48 PHA 0472 E18E A9 3E LDA #'>' 0473 E190 20 7A E9 JSR OUTPUT 0474 E193 68 PLA ;SCAN LIST OF CMDS FOR ENTERED CHR 0475 E194 A2 20 LDX #MCNT ;COUNT OF COMMANDS 0476 E196 DD C4 E1 MCM2 CMP COMB,X ;CHECK NEXT COMMAND IN LIST 0477 E199 F0 11 BEQ MCM3 ;MATCH , SO PROCESS THIS COMMAND 0478 E19B CA DEX 0479 E19C 10 F8 BPL MCM2 0480 E19E ;IS BAD COMMAND 0481 E19E 20 D4 E7 JSR QM 0482 E1A1 D8 COMIN CLD 0483 E1A2 20 FE E8 JSR LL 0484 E1A5 AE 24 A4 LDX SAVS 0485 E1A8 9A TXS 0486 E1A9 4C 82 E1 JMP START 0487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL A ;2 BYTES (ADDR) 0490 E1AE AA TAX 0491 E1AF BD E5 E1 LDA MONCOM,X ;GET ADDRESS OF COMMAND PROCESSOR 0492 E1B2 8D 7D A4 STA JUMP 0493 E1B5 BD E6 E1 LDA MONCOM+1,X 0494 E1B8 8D 7E A4 STA JUMP+1 0495 E1BB 20 C1 E1 JSR JMPR ;CMD PROCESSORS CAN EXIT WITH 'RTS' 0496 E1BE 4C 82 E1 JMP START 0497 E1C1 6C 7D A4 JMPR JMP (JUMP) ;GO TO COMMAND 0498 E1C4 0499 E1C4 ;VALID COMMANDS 0500 E1C4 MCNT =32 ;COUNT 0501 E1C4 4554524D472FCOMB .DB "ETRMG/LDN*AXYPS " 0501 E1CA 4C444E2A415859505320 0502 E1D4 423F2348565A .DB "B?#HVZIK123456[]",$5E 0502 E1DA 494B3132333435365B5D5E 0503 E1E5 0504 E1E5 39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO 0504 E1EB 48E261E2 0505 E1EF A0E2E6E23BE4 .DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA 0505 E1F5 00D0D4E5EEE5 0506 E1FB F2E5F6E5EAE5 .DW CGX,CGY,CGPS,CGS,NXT5,BRKA 0506 E201 FAE50DE61BE6 0507 E207 4DE6FEE665E6 .DW SHOW,CLRBK,SHIS,REGT,TRACE 0507 E20D D9E6DDE6 0508 E211 9EFB0AE7BDE6 .DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM 0508 E217 CBE694E6 0509 E21B E5E600B003B0 .DW BRKK,BASIEN,BASIRE 0510 E221 ;USER DEFINED FUNCTIONS 0511 E221 0C010F011201 .DW KEYF1,KEYF2,KEYF3 0512 E227 0513 E227 ;***** R COMMAND-DISPLAY REGISTERS ***** 0514 E227 20 13 EA REG JSR CRLOW ;CLEAR DISP IF KB 0515 E22A A0 08 LDY #M4-M1 ;MESSAG & 0516 E22C 20 AF E7 JSR KEP 0517 E22F 20 24 EA JSR CRCK 0518 E232 20 3E E8 REG1 JSR BLANK 0519 E235 A0 09 LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC) 0520 E237 20 DD E2 JSR WRITAD 0521 E23A A9 20 LDA #SAVPS ;NOW THE OTHER 5 REGS 0522 E23C 8D 1C A4 STA ADDR 0523 E23F A9 A4 LDA #SAVPS/256 0524 E241 8D 1D A4 STA ADDR+1 0525 E244 A2 05 LDX #5 ;COUNT 0526 E246 D0 07 BNE MEM1 ;SHARE CODE 0527 E248 0528 E248 ;***** M COMMAND-DISPLAY MEMORY ***** 0529 E248 20 AE EA MEM JSR ADDIN ;GET START ADDDRESS IN ADDR 0530 E24B B0 13 BCS MEM3 0531 E24D A2 04 MEIN LDX #4 0532 E24F A0 00 MEM1 LDY #0 0533 E251 20 3E E8 MEM2 JSR BLANK 0534 E254 A9 1C LDA #ADDR 0535 E256 20 58 EB JSR LDAY ;LOAD CONTENTS OF CURR LOCATION 0536 E259 20 46 EA JSR NUMA ;AND DISPLAY IT AS 2 HEX DIGITS 0537 E25C C8 INY 0538 E25D CA DEX ;DECR COUNTER 0539 E25E D0 F1 BNE MEM2 0540 E260 60 MEM3 RTS ;GET NEXT COMMAND 0541 E261 0542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85 E7 JSR GCNT ;GET COUNT 0545 E267 20 F0 E9 JSR CRLF 0546 E26A 4C 86 E2 JMP GOBK1 ;RESUME EXECUTION 0547 E26D AD 0E A4 GOBK LDA REGF ;DISPLAY REGISTERS ? 0548 E270 F0 06 BEQ GOBK0 ;NO,BRANCH 0549 E272 20 32 E2 JSR REG1 ;SHOW THE SIX REG 0550 E275 20 24 EA JSR CRCK ; 0551 E278 20 07 E9 GOBK0 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 0552 E27B AD 0F A4 LDA DISFLG ;DISASSEMBLE CURRENT INSTR ? 0553 E27E F0 06 BEQ GOBK1 ;NO,BRANCH 0554 E280 20 6C F4 JSR DISASM ;DISASM THIS INSTRUCTION 0555 E283 20 13 EA JSR CRLOW 0556 E286 AE 24 A4 GOBK1 LDX SAVS ;RESTORE SAVED REGS FOR RTI 0557 E289 9A TXS 0558 E28A AC 23 A4 LDY SAVY 0559 E28D AE 22 A4 LDX SAVX 0560 E290 AD 26 A4 LDA SAVPC+1 0561 E293 48 PHA ;PUT PC ON STACK 0562 E294 AD 25 A4 LDA SAVPC 0563 E297 48 PHA 0564 E298 AD 20 A4 LDA SAVPS ;STATUS ALSO 0565 E29B 48 PHA 0566 E29C AD 21 A4 LDA SAVA 0567 E29F 40 RTI ;AND AWAY WE GO... 0568 E2A0 0569 E2A0 ;***** / COMMAND-ALTER MEMORY ***** 0570 E2A0 20 3E E8 CHNGG JSR BLANK 0571 E2A3 20 DB E2 JSR WRITAZ ;WRITE ADDR 0572 E2A6 20 3E E8 CHNG1 JSR BLANK 0573 E2A9 20 5D EA JSR RD2 ;GET VALUE 0574 E2AC 90 0A BCC CH2 ;ISN'T SKIP OR DONE 0575 E2AE C9 20 CMP #' ' 0576 E2B0 D0 13 BNE CH3 ;NOT BLANK SO MUST BE DONE 0577 E2B2 ;SKIP THIS LOCATION 0578 E2B2 20 3E E8 JSR BLANK 0579 E2B5 4C C0 E2 JMP CH4 0580 E2B8 ;IS ALTER 0581 E2B8 20 78 EB CH2 JSR SADDR ;STORE ENTERED VALUE INTO MEMORY 0582 E2BB F0 03 BEQ CH4 ;NO ERROR IN STORE 0583 E2BD 4C 33 EB JMP MEMERR ;MEMORY WRITE ERROR 0584 E2C0 C8 JSR OUTDD1 0432 E14D 68 PLA 0433 E14E AA TAX 0434 E14F CA DEX 0435 E150 10 F4 BPL RS8 0436 E152 30 EA BMI RS6 0437 E154 0438 E154 ;BRK INSTR (00) OR IRQ ENTRY POINT 0439 E154 8D 21 A4 IRQV3 STA SAVA 0440 E157 68 PLA 0441 E158 48 PHA ;GET STATUS 0442 E159 29 10 AND #$10 ;SEE IF 'BRK' , ISOLATE B FLG 0443 E15B D0 06 BNE IRQ1 ;TRAP WAS CAUSED BY "BRK" INSTRUC 0444 E15D AD 21 A4 LDA SAVA ;TRAP CAUSED BY IRQ SO TRANSFER 0445 E160 6C 00 A4 JMP (MONRAM) ;CONTROL TO USER THRU VECTOR 0446 E163 ;IS 'BRK' INSTR ,SHOW PC & DATA 0447 E163 ;PC IS OFF BY ONE , SO ADJUST IT 0448 E163 68 IRQ1 PLA 0449 E164 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0450 E167 8E 22 A4 STX SAVX 0451 E16A 8C 23 A4 STY SAVY 0452 E16D D8 CLD 0453 E16E 68 PLA ;PROGR CNTR 0454 E16F 38 SEC ;SUBTRACT ONE FROM RETURN ADDR 0455 E170 E9 01 SBC #1 0456 E172 8D 25 A4 STA SAVPC 0457 E175 68 PLA 0458 E176 E9 00 SBC #0 0459 E178 8D 26 A4 STA SAVPC+1 0460 E17B BA TSX ;GET STACK PTR & SAVE IT 0461 E17C 8E 24 A4 STX SAVS 0462 E17F ;SHOW PC AND DATA 0463 E17F 20 61 F4 IRQ2 JSR REGQ ;SHOW NEXT INSTRUCTION & CONTINUE 0464 E182 0465 E182 ;THIS ROUTINE WILL GET A CHR WITH "( )" FROM 0466 E182 ;KB/TTY & THEN WILL GO TO THE RESPECTIVE COMMAND 0467 E182 4C 59 FF START JMP PAT19 ;CLEAR DEC MODE & 0468 E185 A9 BC STA1 LDA #'<'+$80 ;"<" CHR WITH MSB=1 FOR DISP 0469 E187 20 7A E9 JSR OUTPUT 0470 E18A 20 96 FE JSR RED1 ;GET CHR & ECHO FROM KB/TTY 0471 E18D 48 PHA 0472 E18E A9 3E LDA #'>' 0473 E190 20 7A E9 JSR OUTPUT 0474 E193 68 PLA ;SCAN LIST OF CMDS FOR ENTERED CHR 0475 E194 A2 20 LDX #MCNT ;COUNT OF COMMANDS 0476 E196 DD C4 E1 MCM2 CMP COMB,X ;CHECK NEXT COMMAND IN LIST 0477 E199 F0 11 BEQ MCM3 ;MATCH , SO PROCESS THIS COMMAND 0478 E19B CA DEX 0479 E19C 10 F8 BPL MCM2 0480 E19E ;IS BAD COMMAND 0481 E19E 20 D4 E7 JSR QM 0482 E1A1 D8 COMIN CLD 0483 E1A2 20 FE E8 JSR LL 0484 E1A5 AE 24 A4 LDX SAVS 0485 E1A8 9A TXS 0486 E1A9 4C 82 E1 JMP START 0487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL A ;2 BYTES (ADDR) 0490 E1AE AA TAX 0491 E1AF BD E5 E1 LDA MONCOM,X ;GET ADDRESS OF COMMAND PROCESSOR 0492 E1B2 8D 7D A4 STA JUMP 0493 E1B5 BD E6 E1 LDA MONCOM+1,X 0494 E1B8 8D 7E A4 STA JUMP+1 0495 E1BB 20 C1 E1 JSR JMPR ;CMD PROCESSORS CAN EXIT WITH 'RTS' 0496 E1BE 4C 82 E1 JMP START 0497 E1C1 6C 7D A4 JMPR JMP (JUMP) ;GO TO COMMAND 0498 E1C4 0499 E1C4 ;VALID COMMANDS 0500 E1C4 MCNT =32 ;COUNT 0501 E1C4 4554524D472FCOMB .DB "ETRMG/LDN*AXYPS " 0501 E1CA 4C444E2A415859505320 0502 E1D4 423F2348565A .DB "B?#HVZIK123456[]",$5E 0502 E1DA 494B3132333435365B5D5E 0503 E1E5 0504 E1E5 39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO 0504 E1EB 48E261E2 0505 E1EF A0E2E6E23BE4 .DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA 0505 E1F5 00D0D4E5EEE5 0506 E1FB F2E5F6E5EAE5 .DW CGX,CGY,CGPS,CGS,NXT5,BRKA 0506 E201 FAE50DE61BE6 0507 E207 4DE6FEE665E6 .DW SHOW,CLRBK,SHIS,REGT,TRACE 0507 E20D D9E6DDE6 0508 E211 9EFB0AE7BDE6 .DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM 0508 E217 CBE694E6 0509 E21B E5E600B003B0 .DW BRKK,BASIEN,BASIRE 0510 E221 ;USER DEFINED FUNCTIONS 0511 E221 0C010F011201 .DW KEYF1,KEYF2,KEYF3 0512 E227 0513 E227 ;***** R COMMAND-DISPLAY REGISTERS ***** 0514 E227 20 13 EA REG JSR CRLOW ;CLEAR DISP IF KB 0515 E22A A0 08 LDY #M4-M1 ;MESSAG & 0516 E22C 20 AF E7 JSR KEP 0517 E22F 20 24 EA JSR CRCK 0518 E232 20 3E E8 REG1 JSR BLANK 0519 E235 A0 09 LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC) 0520 E237 20 DD E2 JSR WRITAD 0521 E23A A9 20 LDA #SAVPS ;NOW THE OTHER 5 REGS 0522 E23C 8D 1C A4 STA ADDR 0523 E23F A9 A4 LDA #SAVPS/256 0524 E241 8D 1D A4 STA ADDR+1 0525 E244 A2 05 LDX #5 ;COUNT 0526 E246 D0 07 BNE MEM1 ;SHARE CODE 0527 E248 0528 E248 ;***** M COMMAND-DISPLAY MEMORY ***** 0529 E248 20 AE EA MEM JSR ADDIN ;GET START ADDDRESS IN ADDR 0530 E24B B0 13 BCS MEM3 0531 E24D A2 04 MEIN LDX #4 0532 E24F A0 00 MEM1 LDY #0 0533 E251 20 3E E8 MEM2 JSR BLANK 0534 E254 A9 1C LDA #ADDR 0535 E256 20 58 EB JSR LDAY ;LOAD CONTENTS OF CURR LOCATION 0536 E259 20 46 EA JSR NUMA ;AND DISPLAY IT AS 2 HEX DIGITS 0537 E25C C8 INY 0538 E25D CA DEX ;DECR COUNTER 0539 E25E D0 F1 BNE MEM2 0540 E260 60 MEM3 RTS ;GET NEXT COMMAND 0541 E261 0542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85 E7 JSR GCNT ;GET COUNT 0545 E267 20 F0 E9 JSR CRLF 0546 E26A 4C 86 E2 JMP GOBK1 ;RESUME EXECUTION 0547 E26D AD 0E A4 GOBK LDA REGF ;DISPLAY REGISTERS ? 0548 E270 F0 06 BEQ GOBK0 ;NO,BRANCH 0549 E272 20 32 E2 JSR REG1 ;SHOW THE SIX REG 0550 E275 20 24 EA JSR CRCK ; 0551 E278 20 07 E9 GOBK0 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 0552 E27B AD 0F A4 LDA DISFLG ;DISASSEMBLE CURRENT INSTR ? 0553 E27E F0 06 BEQ GOBK1 ;NO,BRANCH 0554 E280 20 6C F4 JSR DISASM ;DISASM THIS INSTRUCTION 0555 E283 20 13 EA JSR CRLOW 0556 E286 AE 24 A4 GOBK1 LDX SAVS ;RESTORE SAVED REGS FOR RTI 0557 E289 9A TXS 0558 E28A AC 23 A4 LDY SAVY 0559 E28D AE 22 A4 LDX SAVX 0560 E290 AD 26 A4 LDA SAVPC+1 0561 E293 48 PHA ;PUT PC ON STACK 0562 E294 AD 25 A4 LDA SAVPC 0563 E297 48 PHA 0564 E298 AD 20 A4 LDA SAVPS ;STATUS ALSO 0565 E29B 48 PHA 0566 E29C AD 21 A4 LDA SAVA 0567 E29F 40 RTI ;AND AWAY WE GO... 0568 E2A0 0569 E2A0 ;***** / COMMAND-ALTER MEMORY ***** 0570 E2A0 20 3E E8 CHNGG JSR BLANK 0571 E2A3 20 DB E2 JSR WRITAZ ;WRITE ADDR 0572 E2A6 20 3E E8 CHNG1 JSR BLANK 0573 E2A9 20 5D EA JSR RD2 ;GET VALUE 0574 E2AC 90 0A BCC CH2 ;ISN'T SKIP OR DONE 0575 E2AE C9 20 CMP #' ' 0576 E2B0 D0 13 BNE CH3 ;NOT BLANK SO MUST BE DONE 0577 E2B2 ;SKIP THIS LOCATION 0578 E2B2 20 3E E8 JSR BLANK 0579 E2B5 4C C0 E2 JMP CH4 0580 E2B8 ;IS ALTER 0581 E2B8 20 78 EB CH2 JSR SADDR ;STORE ENTERED VALUE INTO MEMORY 0582 E2BB F0 03 BEQ CH4 ;NO ERROR IN STORE 0583 E2BD 4C 33 EB JMP MEMERR ;MEMORY WRITE ERROR 0584 E2C0 C8 .DB $77 ;A 1663 8C34 7C .DB $7C ;B 1664 8C35 39 .DB $39 ;C 1665 8C36 5E .DB $5E ;D 1666 8C37 79 .DB $79 ;E 1667 8C38 71 .DB $71 ;F 1668 8C39 F0 .DB $F0 ;CR 1669 8C3A 40 .DB $40 ;DASH 1670 8C3B 70 .DB $70 ;> 1671 8C3C 00 .DB $00 ;SHIFT 1672 8C3D 6F .DB $6F ;G 1673 8C3E 50 .DB $50 ;R 1674 8C3F 54 .DB $54 ;M 1675 8C40 38 .DB $38 ;L2 1676 8C41 6D .DB $6D ;S2 1677 8C42 01 .DB $01 ;U0 1678 8C43 08 .DB $08 ;U1 1679 8C44 09 .DB $09 ;U2 1680 8C45 30 .DB $30 ;U3 1681 8C46 36 .DB $36 ;U4 1682 8C47 5C .DB $5C ;U5 1683 8C48 63 .DB $63 ;U6 1684 8C49 03 .DB $03 ;U7 1685 8C4A 1E .DB $1E ;J 1686 8C4B 72 .DB $72 ;V 1687 8C4C 77 .DB $77 ;A 1688 8C4D 7C .DB $7C ;B 1689 8C4E 39 .DB $39 ;C 1690 8C4F 5E .DB $5E ;D 1691 8C50 79 .DB $79 ;E 1692 8C51 71 .DB $71 ;F 1693 8C52 6D .DB $6D ;SD 1694 8C53 76 .DB $76 ;+ 1695 8C54 46 .DB $46 ;< 1696 8C55 00 .DB $00 ;SHIFT 1697 8C56 38 .DB $38 ;LP 1698 8C57 6D .DB $6D ;SP 1699 8C58 1C .DB $1C ;W 1700 8C59 38 .DB $38 ;L1 1701 8C5A 6D .DB $6D ;S1 1702 8C5B 80 .DB $80 ;. 1703 8C5C 00 .DB $00 ;SPACE 1704 8C5D 53 .DB $53 ;? 1705 8C5E 73 .DB $73 ;P 1706 8C5F 49 .DB $49 ;BELL 1707 8C60 6D .DB $6D ;S 1708 8C61 64 .DB $64 ;X 1709 8C62 6E .DB $6E ;Y 1710 8C63 973D1F100800DECPTS .DB $97,$3D,$1F,$10,$08,$00 ; TO DETERMINE BAUD RATE 1711 8C69 .MSFIRST 1712 8C69 D54C24100601STDVAL .DW $D54C,$2410,$0601 ;STD VALS FOR BAUD RATES 1713 8C6F .LSFIRST 1714 8C6F ; 110,300,600,1200,2400,4800 BAUD 1715 8C6F 4C 58 8A TRMTBL JMP INTCHR 1716 8C72 4C A0 8A JMP TOUT 1717 8C75 4C 3C 8B JMP TSTAT 1718 8C78 ; 1719 8C78 1720 8C78 ;****** VERSION 2 4/13/79 "SY1.1" 1721 8C78 ;****** COPYRIGHT 1978 SYNERTEK SYSTEMS CORPORATION 1722 8C78 ;****** 1723 8C78 BDRY =$F8 ;0/1 BDRY FOR READ TIMING 1724 8C78 OLD =$F9 ;HOLD PREV INPUT LEVEL IN GETTR 1725 8C78 CHAR =$FC ;CHAR ASSY AND DISASSY 1726 8C78 MODE =$FD ;BIT7=1 IS HS, 0 IS KIM 1727 8C78 ;... BIT6=1 - IGNORE DATA 1728 8C78 BUFADL =$FE ;RUNNING BUFFER ADR 1729 8C78 BUFADH =$FF 1730 8C78 ;TAPDEL =$A630 ;HI SPEED TAPE DELAY 1731 8C78 ;KMBDRY =$A631 ;KIM READ BDRY 1732 8C78 ;HSBDRY =$A632 ;HS READ BDRY 1733 8C78 ;TAPET1 =$A635 ;HS FIRST 1/2 BIT 1734 8C78 ;TAPET2 =$A63C ;HS SECOND 1/2 BIT 1735 8C78 ;SCR6 =$A636 ;SCR6 1736 8C78 ;SCR7 =$8637 ;SCR7 1737 8C78 ;SCR8 =$A638 ;SCR8 1738 8C78 ;SCR9 =$A639 ;SCR9 1739 8C78 1740 A64A *=$A64A 1741 A64A EAL .BLOCK 1 ;P3L - END ADDR +1 (LO) 1742 A64B EAH .BLOCK 1 ;P3H - (HI) 1743 A64C SAL .BLOCK 1 ;P2L - START ADDR (LO) 1744 A64D SAH .BLOCK 1 ;P2H - (HI) 1745 A64E ID .BLOCK 1 ;P1L - ID 1746 A64F 1747 A64F EOT = $04 1748 A64F SYN = $16 1749 A64F TPBIT =%1000 ;BIT 3 IS ENABLE/DISABLE TO DECODER 1750 A64F FRAME =$FF ;ERROR MSG # FOR FRAME ERROR 1751 A64F CHECK =$CC ;ERROR # FOR CHECKSUM ERROR 1752 A64F LSTCHR =$2F ;LAST CHAR NOT '/' 1753 A64F NONHEX =$FF ;NON HEX CHAR IN KIM REC 1754 A64F 1755 A64F ;ACCESS =$8BB6 ;UNRITE PROTECT SYSTEM RAM 1756 A64F ;P2SCR =$829C ;MOVE P2 TO $FF,$FE IN PAGE ZERO 1757 A64F ;ZERCK =$832E ;MOVE ZERO TO CHECK SUM 1758 A64F ;CONFIG =$89A5 ;CONFIGURE I/O 1759 A64F 1760 A64F ; I/O - TAPE ON/OFF IS CB2 ON VIA 1 (A000) 1761 A64F ; TAPE IN IS PB6 ON VIA 1 (A000) 1762 A64F ; TAPE OUT IS CODE 7 TO DISPLAY DECODER, THRU 6532, 1763 A64F ; PB0-PB3 (A400) 1764 A64F 1765 A64F VIAACR =$A00B 1766 A64F VIAPCR =$A00C ;CONTROL CB2 TAPE ON/OFF, POR 1767 A64F TPOUT =$A402 1768 A64F TAPOUT =TPOUT 1769 A64F DDROUT =$A403 1770 A64F TAPIN =$A000 1771 A64F DDRIN =$A002 1772 A64F TIMER =$A406 ;6532 TIMER READ 1773 A64F TIM8 =$A415 ;6532 TIMER SET (8US) 1774 A64F DDRDIG =$A401 1775 A64F DIG =$A400 1776 A64F 1777 A64F ; LOADT ENTER W/ID IN PARM 2, MODE IN [Y] 1778 A64F 1779 8C78 *=$8C78 1780 8C78 20 A9 8D LOADT JSR START ;INITIALIZE 1781 8C7B 20 52 8D LOADT2 JSR SYNC ;GET IN SYNC 1782 8C7E 20 E1 8D LOADT4 JSR RDCHTX 1783 8C81 C9 2A CMP #'*' ;START OF DATA? 1784 8C83 F0 06 BEQ LOAD11 1785 8C85 C9 16 CMP #SYN ;NO - SYN? 1786 8C87 D0 F2 BNE LOADT2 ;IF NOT, RESTART SYNC SEARCH 1787 8C89 F0 F3 BEQ LOADT4 ;IF YES, KEEP LOOKING FOR * 1788 8C8B 1789 8C8B 06 FD LOAD11 ASL MODE ;GET MODE IN A, CLEAR BIT6 1790 8C8D 6A ROR A 1791 8C8E 85 FD STA MODE 1792 8C90 20 26 8E JSR RDBYTX ;READ ID BYTE ON TAPE 1793 8C93 8D 00 A4 STA DIG ;DISPLAY ON LED (NOT DECODED) 1794 8C96 CD 4E A6 CMP ID ;COMPARE WITH REQUESTED ID 1795 8C99 F0 29 BEQ LOADT5 ;LOAD IF EQUAL 1796 8C9B AD 4E A6 LDA ID ;COMPARE WITH 0 1797 8C9E C9 00 CMP #0 1798 8CA0 F0 22 BEQ LOADT5 ;IF 0, LOAD ANYWAY 1799 8CA2 C9 FF CMP #$FF ;COMPARE WITH FF 1800 8CA4 F0 07 BEQ LOADT6 ;IF FF, USE REQUEST SA TO LOAD 1801 8CA6 1802 8CA6 24 FD BIT MODE ;UNWANTED RECORD, KIM OR HS? 1803 8CA8 30 16 BMI HWRONG 1804 8CAA 4C 7B 8C JMP LOADT2 ;IF KIM, RESTART SEARCH 1805 8CAD 1806 8CAD ; SA (&EA IF USED) COME FROM REQUEST. DISCARD TAPE VALUES 1807 8CAD ; (BUFAD ALREADY SET TO SA BY 'START') 1808 8CAD ; 1809 8CAD 20 74 8E LOADT6 JSR RDCHK ;GET SAL FROM TAPE 1810 8CB0 20 74 8E JSR RDCHK ;GET SAH FROM TAPE 1811 8CB3 24 FD BIT MODE ;HS OR KIM? 1812 8CB5 10 52 BPL LOADT7 ;IF KIM, START READING DATA 1813 8CB7 20 74 8E JSR RDCHK ;HS, GET EAH, EAL FROM TAPE 1814 8CBA 20 74 8E JSR RDCHK ; ... BUT IGNORE 1815 8CBD 4C DE 8C JMP LT7H ;START READING HS DATA 1816 8CC0 1817 8CC0 ; SA ( & EA IF USED) COME FROM TAPE. SA REPLACES BUFAD 1818 8CC0 1819 8CC0 A9 C0 HWRONG LDA #$C0 ;READ THRU TO GE TO NEXT REC 1820 8CC2 85 FD STA MODE ;BUT DON'T CHECK CKSUM, NO FRAME ERR 1821 8CC4 1822 8CC4 20 74 8E LOADT5 JSR RDCHK ;GET SAL FROM TAPE 1823 8CC7 85 FE STA BUFADL ;PUT IN BUF START L 1824 8CC9 20 74 8E JSR RDCHK ;SAME FOR SAH 1825 8CCC 85 FF STA BUFADH 1826 8CCE ;(SAL - H STILL HAVE REQUEST VALUE) 1827 8CCE 24 FD BIT MODE ;HS OR KIM? 1828 8CD0 10 37 BPL LOADT7 ;IF KIM, START READING RECORD 1829 8CD2 20 74 8E JSR RDCHK ;HS. GET & SAVE EAL,EAH 1830 8CD5 8D 4A A6 STA EAL 1831 8CD8 20 74 8E JSR RDCHK 1832 8CDB 8D 4B A6 STA EAH 1833 8CDE 1834 8CDE ; READ HS DATA 1835 8CDE 1836 8CDE 20 E5 8D LT7H JSR RDBYTH ;GET NEXT BYTE 1837 8CE1 A6 FE LDX BUFADL ;CHECK FOR END OF DATA + 1 1838 8CE3 EC 4A A6 CPX EAL 1839 8CE6 D0 07 BNE LT7HA 1840 8CE8 A6 FF LDX BUFADH 1841 8CEA EC 4B A6 CPX EAH 1842 8CED F0 14 BEQ LT7HB 1843 8CEF 20 77 8E LT7HA JSR CHKT ;NOT END, UPDATE CHECKSUM 1844 8CF2 24 FD BIT MODE ;WRONG RECORD? 1845 8CF4 70 04 BVS LT7HC ;IF SO, DONT STORE BYTE 1846 8CF6 A0 00 LDY #0 ;STORE BYTE 1847 8CF8 91 FE STA (BUFADL),Y 1848 8CFA E6 FE LT7HC INC BUFADL ;BUMP BUFFER ADDR 1849 8CFC D0 E0 BNE LT7H 1850 8CFE E6 FF INC BUFADH ;CARRY 1851 8D00 4C DE 8C JMP LT7H 1852 8D03 1853 8D03 C9 2F LT7HB CMP #'/' ;EA, MUST BE "/" 1854 8D05 D0 29 BNE LCERR ;LAST CHAR NOT '/' 1855 8D07 F0 15 BEQ LT8A ;(ALWAYS) 1856 8D09 1857 8D09 ; READ KIM DATA 1858 8D09 1859 8D09 20 2A 8E LOADT7 JSR RDBYT 1860 8D0C B0 26 BCS LDT7A ;NONHEX OR LAST CHAR 1861 8D0E 20 77 8E JSR CHKT ;UPDATE CHECKSUM (PACKED BYTE) 1862 8D11 A0 00 LDY #0 ;STORE BYTE 1863 8D13 91 FE STA (BUFADL),Y 1864 8D15 E6 FE INC BUFADL ;BUMP BUFFER ADR 1865 8D17 D0 F0 BNE LOADT7 ;CARRY? 1866 8D19 E6 FF INC BUFADH 1867 8D1B 4C 09 8D JMP LOADT7 1868 8D1E 1869 8D1E ; TEST CHECKSUM & FINISH 1870 8D1E 1871 8D1E LOADT8 =* 1872 8D1E 20 26 8E LT8A JSR RDBYTX ;CHECK SUM 1873 8D21 CD 36 A6 CMP SCR6 1874 8D24 D0 16 BNE CKERR 1875 8D26 20 26 8E JSR RDBYTX 1876 8D29 CD 37 A6 CMP SCR7 1877 8D2C D0 0E BNE CKERR ;CHECK SUM ERROR 1878 8D2E F0 11 BEQ OKEXIT ;(ALWAYS) 1879 8D30 1880 8D30 A9 2F LCERR LDA #LSTCHR ;LAST CHAR IS NOT '/' 1881 8D32 D0 0A BNE NGEXIT ;(ALWAYS) 1882 8D34 1883 8D34 C9 2F LDT7A CMP #'/' ;LAST OR NONHEX? 1884 8D36 F0 E6 BEQ LOADT8 ;LAST 1885 8D38 FRERR ;FRAMING ERROR 1886 8D38 A9 FF NHERR LDA #NONHEX ;KIM ONLY, NON HEX CHAR READ 1887 8D3A D0 02 BNE NGEXIT ;(ALWAYS) 1888 8D3C 1889 8D3C A9 CC CKERR LDA #CHECK ;CHECKSUM ERROR 1890 8D3E 1891 8D3E 38 NGEXIT SEC ;ERROR INDICATOR TO MONITOR IS CARRY 1892 8D3F B0 01 BCS EXIT ;(ALWAYS) 1893 8D41 1894 8D41 18 OKEXIT CLC ;NO ERROR 1895 8D42 1896 8D42 24 FD EXIT BIT MODE 1897 8D44 50 08 BVC EX10 ;READING WRONG REC? 1898 8D46 A0 80 LDY #$80 1899 8D48 4C 78 8C JMP LOADT ;RESTART SEARCH 1900 8D4B 1901 8D4B 68 USRREQ PLA ;USER REQUESTS EXIT 1902 8D4C 68 PLA 1903 8D4D 38 SEC 1904 8D4E A2 CC EX10 LDX #$CC 1905 8D50 D0 69 BNE STCC ;STOP TAPE, RETURN 1906 8D52 AD 02 A0 SYNC LDA DDRIN ;CHANGE DATA DIRECTION 1907 8D55 29 BF AND #$BF 1908 8D57 8D 02 A0 STA DDRIN 1909 8D5A A9 00 LDA #0 1910 8D5C 8D 0B A0 STA VIAACR 1911 8D5F AD 31 A6 LDA KMBDRY ;SET UP BOUNDARY 1912 8D62 24 FD BIT MODE 1913 8D64 10 03 BPL SY100 1914 8D66 AD 32 A6 LDA HSBDRY 1915 8D69 85 F8 SY100 STA BDRY 1916 8D6B A9 6D LDA #$6D 1917 8D6D 8D 00 A4 STA DIG ;INDICATE NO SYNC ON LEDS 1918 8D70 A5 FD LDA MODE ;TURN ON OUT OF SYNC MODE 1919 8D72 09 40 ORA #$40 ;BIT6 1920 8D74 85 FD STA MODE 1921 8D76 A9 7F SYNC5 LDA #$7F ;TEST FOR CR DOWN ON HKB 1922 8D78 8D 01 A4 STA DDRDIG 1923 8D7B 2C 00 A4 BIT DIG 1924 8D7E 10 CB BPL USRREQ ;CR KEY DOWN - EXIT (ERRORS) 1925 8D80 20 9F 8D JSR SYNBIT 1926 8D83 66 FC ROR CHAR 1927 8D85 A5 FC LDA CHAR 1928 8D87 C9 16 CMP #SYN 1929 8D89 D0 EB BNE SYNC5 1930 8D8B A2 0A SYNC10 LDX #10 ;NOW MAKE SURE CAN GET 10 SYNS 1931 8D8D 20 E1 8D JSR RDCHTX 1932 8D90 C9 16 CMP #SYN 1933 8D92 D0 E2 BNE SYNC5 1934 8D94 CA DEX 1935 8D95 D0 F6 BNE SYNC10+2 1936 8D97 8E 00 A4 STX DIG ;TURN OFF DISPLAY 1937 8D9A CA DEX ;X=$FF 1938 8D9B 8E 01 A4 STX DDRDIG 1939 8D9E 60 RTS 1940 8D9F ;SYNBIT - GET BIT IN SYN SEARCH. IF HS, ENTER WITH 1941 8D9F ; TIMER STARTED BY PREV BIT, BIT RETURNED IN CARRY. 1942 8D9F 1943 8D9F 24 FD SYNBIT BIT MODE ;KIM OR HS? 1944 8DA1 10 69 BPL RDBITK ;KIM 1945 8DA3 20 CA 8D JSR GETTR ;HS 1946 8DA6 B0 22 BCS GETTR ;IF SHORT, GET NEXT TRANS 1947 8DA8 60 RTS ;BIT IS ZERO 1948 8DA9 1949 8DA9 84 FD START STY MODE ;MODE PARM PASSED IN [Y] 1950 8DAB 20 86 8B JSR ACCESS ;FIX BASIC WARM START BUG 1951 8DAE A9 09 LDA #9 1952 8DB0 20 A5 89 JSR CONFIG ;PARTIAL I/O CONFIGURATION 1953 8DB3 20 2E 83 JSR ZERCK ;ZERO THE CHECK SUM 1954 8DB6 20 9C 82 JSR P2SCR ;MOVE SA TO FE,FF IN PAGE ZERO 1955 8DB9 A2 EC LDX #$EC 1956 8DBB 8E 0C A0 STCC STX VIAPCR ;TAPE ON 1957 8DBE 60 RTS 1958 8DBF 1959 8DBF ; GETTR - GET TRANSITION TIME FROM 6532 CLOCK 1960 8DBF ; DESTROYS A,Y 1961 8DBF 1962 8DBF A9 00 KGETTR LDA #0 ;KIM GETTR - GET FULL CYCLE 1963 8DC1 85 F9 STA OLD ;FORCE GETTR POLARITY 1964 8DC3 AD 00 A0 KG100 LDA TAPIN ;WAIT TIL INPUT LO 1965 8DC6 29 40 AND #$40 1966 8DC8 D0 F9 BNE KG100 1967 8DCA 1968 8DCA A0 FF GETTR LDY #$FF 1969 8DCC AD 00 A0 NOTR LDA TAPIN 1970 8DCF 29 40 AND #$40 1971 8DD1 C5 F9 CMP OLD 1972 8DD3 F0 F7 BEQ NOTR ;NO CHANGE 1973 8DD5 85 F9 STA OLD 1974 8DD7 AD 06 A4 LDA TIMER 1975 8DDA 8C 15 A4 STY TIM8 ;RESTART CLOCK 1976 8DDD 18 CLC 1977 8DDE 65 F8 ADC BDRY 1978 8DE0 60 RTS 1979 8DE1 1980 8DE1 24 FD RDCHTX BIT MODE ;READ HS O JSR OUTDD1 0432 E14D 68 PLA 0433 E14E AA TAX 0434 E14F CA DEX 0435 E150 10 F4 BPL RS8 0436 E152 30 EA BMI RS6 0437 E154 0438 E154 ;BRK INSTR (00) OR IRQ ENTRY POINT 0439 E154 8D 21 A4 IRQV3 STA SAVA 0440 E157 68 PLA 0441 E158 48 PHA ;GET STATUS 0442 E159 29 10 AND #$10 ;SEE IF 'BRK' , ISOLATE B FLG 0443 E15B D0 06 BNE IRQ1 ;TRAP WAS CAUSED BY "BRK" INSTRUC 0444 E15D AD 21 A4 LDA SAVA ;TRAP CAUSED BY IRQ SO TRANSFER 0445 E160 6C 00 A4 JMP (MONRAM) ;CONTROL TO USER THRU VECTOR 0446 E163 ;IS 'BRK' INSTR ,SHOW PC & DATA 0447 E163 ;PC IS OFF BY ONE , SO ADJUST IT 0448 E163 68 IRQ1 PLA 0449 E164 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0450 E167 8E 22 A4 STX SAVX 0451 E16A 8C 23 A4 STY SAVY 0452 E16D D8 CLD 0453 E16E 68 PLA ;PROGR CNTR 0454 E16F 38 SEC ;SUBTRACT ONE FROM RETURN ADDR 0455 E170 E9 01 SBC #1 0456 E172 8D 25 A4 STA SAVPC 0457 E175 68 PLA 0458 E176 E9 00 SBC #0 0459 E178 8D 26 A4 STA SAVPC+1 0460 E17B BA TSX ;GET STACK PTR & SAVE IT 0461 E17C 8E 24 A4 STX SAVS 0462 E17F ;SHOW PC AND DATA 0463 E17F 20 61 F4 IRQ2 JSR REGQ ;SHOW NEXT INSTRUCTION & CONTINUE 0464 E182 0465 E182 ;THIS ROUTINE WILL GET A CHR WITH "( )" FROM 0466 E182 ;KB/TTY & THEN WILL GO TO THE RESPECTIVE COMMAND 0467 E182 4C 59 FF START JMP PAT19 ;CLEAR DEC MODE & 0468 E185 A9 BC STA1 LDA #'<'+$80 ;"<" CHR WITH MSB=1 FOR DISP 0469 E187 20 7A E9 JSR OUTPUT 0470 E18A 20 96 FE JSR RED1 ;GET CHR & ECHO FROM KB/TTY 0471 E18D 48 PHA 0472 E18E A9 3E LDA #'>' 0473 E190 20 7A E9 JSR OUTPUT 0474 E193 68 PLA ;SCAN LIST OF CMDS FOR ENTERED CHR 0475 E194 A2 20 LDX #MCNT ;COUNT OF COMMANDS 0476 E196 DD C4 E1 MCM2 CMP COMB,X ;CHECK NEXT COMMAND IN LIST 0477 E199 F0 11 BEQ MCM3 ;MATCH , SO PROCESS THIS COMMAND 0478 E19B CA DEX 0479 E19C 10 F8 BPL MCM2 0480 E19E ;IS BAD COMMAND 0481 E19E 20 D4 E7 JSR QM 0482 E1A1 D8 COMIN CLD 0483 E1A2 20 FE E8 JSR LL 0484 E1A5 AE 24 A4 LDX SAVS 0485 E1A8 9A TXS 0486 E1A9 4C 82 E1 JMP START 0487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL A ;2 BYTES (ADDR) 0490 E1AE AA TAX 0491 E1AF BD E5 E1 LDA MONCOM,X ;GET ADDRESS OF COMMAND PROCESSOR 0492 E1B2 8D 7D A4 STA JUMP 0493 E1B5 BD E6 E1 LDA MONCOM+1,X 0494 E1B8 8D 7E A4 STA JUMP+1 0495 E1BB 20 C1 E1 JSR JMPR ;CMD PROCESSORS CAN EXIT WITH 'RTS' 0496 E1BE 4C 82 E1 JMP START 0497 E1C1 6C 7D A4 JMPR JMP (JUMP) ;GO TO COMMAND 0498 E1C4 0499 E1C4 ;VALID COMMANDS 0500 E1C4 MCNT =32 ;COUNT 0501 E1C4 4554524D472FCOMB .DB "ETRMG/LDN*AXYPS " 0501 E1CA 4C444E2A415859505320 0502 E1D4 423F2348565A .DB "B?#HVZIK123456[]",$5E 0502 E1DA 494B3132333435365B5D5E 0503 E1E5 0504 E1E5 39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO 0504 E1EB 48E261E2 0505 E1EF A0E2E6E23BE4 .DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA 0505 E1F5 00D0D4E5EEE5 0506 E1FB F2E5F6E5EAE5 .DW CGX,CGY,CGPS,CGS,NXT5,BRKA 0506 E201 FAE50DE61BE6 0507 E207 4DE6FEE665E6 .DW SHOW,CLRBK,SHIS,REGT,TRACE 0507 E20D D9E6DDE6 0508 E211 9EFB0AE7BDE6 .DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM 0508 E217 CBE694E6 0509 E21B E5E600B003B0 .DW BRKK,BASIEN,BASIRE 0510 E221 ;USER DEFINED FUNCTIONS 0511 E221 0C010F011201 .DW KEYF1,KEYF2,KEYF3 0512 E227 0513 E227 ;***** R COMMAND-DISPLAY REGISTERS ***** 0514 E227 20 13 EA REG JSR CRLOW ;CLEAR DISP IF KB 0515 E22A A0 08 LDY #M4-M1 ;MESSAG & 0516 E22C 20 AF E7 JSR KEP 0517 E22F 20 24 EA JSR CRCK 0518 E232 20 3E E8 REG1 JSR BLANK 0519 E235 A0 09 LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC) 0520 E237 20 DD E2 JSR WRITAD 0521 E23A A9 20 LDA #SAVPS ;NOW THE OTHER 5 REGS 0522 E23C 8D 1C A4 STA ADDR 0523 E23F A9 A4 LDA #SAVPS/256 0524 E241 8D 1D A4 STA ADDR+1 0525 E244 A2 05 LDX #5 ;COUNT 0526 E246 D0 07 BNE MEM1 ;SHARE CODE 0527 E248 0528 E248 ;***** M COMMAND-DISPLAY MEMORY ***** 0529 E248 20 AE EA MEM JSR ADDIN ;GET START ADDDRESS IN ADDR 0530 E24B B0 13 BCS MEM3 0531 E24D A2 04 MEIN LDX #4 0532 E24F A0 00 MEM1 LDY #0 0533 E251 20 3E E8 MEM2 JSR BLANK 0534 E254 A9 1C LDA #ADDR 0535 E256 20 58 EB JSR LDAY ;LOAD CONTENTS OF CURR LOCATION 0536 E259 20 46 EA JSR NUMA ;AND DISPLAY IT AS 2 HEX DIGITS 0537 E25C C8 INY 0538 E25D CA DEX ;DECR COUNTER 0539 E25E D0 F1 BNE MEM2 0540 E260 60 MEM3 RTS ;GET NEXT COMMAND 0541 E261 0542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85 E7 JSR GCNT ;GET COUNT 0545 E267 20 F0 E9 JSR CRLF 0546 E26A 4C 86 E2 JMP GOBK1 ;RESUME EXECUTION 0547 E26D AD 0E A4 GOBK LDA REGF ;DISPLAY REGISTERS ? 0548 E270 F0 06 BEQ GOBK0 ;NO,BRANCH 0549 E272 20 32 E2 JSR REG1 ;SHOW THE SIX REG 0550 E275 20 24 EA JSR CRCK ; 0551 E278 20 07 E9 GOBK0 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 0552 E27B AD 0F A4 LDA DISFLG ;DISASSEMBLE CURRENT INSTR ? 0553 E27E F0 06 BEQ GOBK1 ;NO,BRANCH 0554 E280 20 6C F4 JSR DISASM ;DISASM THIS INSTRUCTION 0555 E283 20 13 EA JSR CRLOW 0556 E286 AE 24 A4 GOBK1 LDX SAVS ;RESTORE SAVED REGS FOR RTI 0557 E289 9A TXS 0558 E28A AC 23 A4 LDY SAVY 0559 E28D AE 22 A4 LDX SAVX 0560 E290 AD 26 A4 LDA SAVPC+1 0561 E293 48 PHA ;PUT PC ON STACK 0562 E294 AD 25 A4 LDA SAVPC 0563 E297 48 PHA 0564 E298 AD 20 A4 LDA SAVPS ;STATUS ALSO 0565 E29B 48 PHA 0566 E29C AD 21 A4 LDA SAVA 0567 E29F 40 RTI ;AND AWAY WE GO... 0568 E2A0 0569 E2A0 ;***** / COMMAND-ALTER MEMORY ***** 0570 E2A0 20 3E E8 CHNGG JSR BLANK 0571 E2A3 20 DB E2 JSR WRITAZ ;WRITE ADDR 0572 E2A6 20 3E E8 CHNG1 JSR BLANK 0573 E2A9 20 5D EA JSR RD2 ;GET VALUE 0574 E2AC 90 0A BCC CH2 ;ISN'T SKIP OR DONE 0575 E2AE C9 20 CMP #' ' 0576 E2B0 D0 13 BNE CH3 ;NOT BLANK SO MUST BE DONE 0577 E2B2 ;SKIP THIS LOCATION 0578 E2B2 20 3E E8 JSR BLANK 0579 E2B5 4C C0 E2 JMP CH4 0580 E2B8 ;IS ALTER 0581 E2B8 20 78 EB CH2 JSR SADDR ;STORE ENTERED VALUE INTO MEMORY 0582 E2BB F0 03 BEQ CH4 ;NO ERROR IN STORE 0583 E2BD 4C 33 EB JMP MEMERR ;MEMORY WRITE ERROR 0584 E2C0 C8 JSR OUTDD1 0432 E14D 68 PLA 0433 E14E AA TAX 0434 E14F CA DEX 0435 E150 10 F4 BPL RS8 0436 E152 30 EA BMI RS6 0437 E154 0438 E154 ;BRK INSTR (00) OR IRQ ENTRY POINT 0439 E154 8D 21 A4 IRQV3 STA SAVA 0440 E157 68 PLA 0441 E158 48 PHA ;GET STATUS 0442 E159 29 10 AND #$10 ;SEE IF 'BRK' , ISOLATE B FLG 0443 E15B D0 06 BNE IRQ1 ;TRAP WAS CAUSED BY "BRK" INSTRUC 0444 E15D AD 21 A4 LDA SAVA ;TRAP CAUSED BY IRQ SO TRANSFER 0445 E160 6C 00 A4 JMP (MONRAM) ;CONTROL TO USER THRU VECTOR 0446 E163 ;IS 'BRK' INSTR ,SHOW PC & DATA 0447 E163 ;PC IS OFF BY ONE , SO ADJUST IT 0448 E163 68 IRQ1 PLA 0449 E164 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0450 E167 8E 22 A4 STX SAVX 0451 E16A 8C 23 A4 STY SAVY 0452 E16D D8 CLD 0453 E16E 68 PLA ;PROGR CNTR 0454 E16F 38 SEC ;SUBTRACT ONE FROM RETURN ADDR 0455 E170 E9 01 SBC #1 0456 E172 8D 25 A4 STA SAVPC 0457 E175 68 PLA 0458 E176 E9 00 SBC #0 0459 E178 8D 26 A4 STA SAVPC+1 0460 E17B BA TSX ;GET STACK PTR & SAVE IT 0461 E17C 8E 24 A4 STX SAVS 0462 E17F ;SHOW PC AND DATA 0463 E17F 20 61 F4 IRQ2 JSR REGQ ;SHOW NEXT INSTRUCTION & CONTINUE 0464 E182 0465 E182 ;THIS ROUTINE WILL GET A CHR WITH "( )" FROM 0466 E182 ;KB/TTY & THEN WILL GO TO THE RESPECTIVE COMMAND 0467 E182 4C 59 FF START JMP PAT19 ;CLEAR DEC MODE & 0468 E185 A9 BC STA1 LDA #'<'+$80 ;"<" CHR WITH MSB=1 FOR DISP 0469 E187 20 7A E9 JSR OUTPUT 0470 E18A 20 96 FE JSR RED1 ;GET CHR & ECHO FROM KB/TTY 0471 E18D 48 PHA 0472 E18E A9 3E LDA #'>' 0473 E190 20 7A E9 JSR OUTPUT 0474 E193 68 PLA ;SCAN LIST OF CMDS FOR ENTERED CHR 0475 E194 A2 20 LDX #MCNT ;COUNT OF COMMANDS 0476 E196 DD C4 E1 MCM2 CMP COMB,X ;CHECK NEXT COMMAND IN LIST 0477 E199 F0 11 BEQ MCM3 ;MATCH , SO PROCESS THIS COMMAND 0478 E19B CA DEX 0479 E19C 10 F8 BPL MCM2 0480 E19E ;IS BAD COMMAND 0481 E19E 20 D4 E7 JSR QM 0482 E1A1 D8 COMIN CLD 0483 E1A2 20 FE E8 JSR LL 0484 E1A5 AE 24 A4 LDX SAVS 0485 E1A8 9A TXS 0486 E1A9 4C 82 E1 JMP START 0487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL A ;2 BYTES (ADDR) 0490 E1AE AA TAX 0491 E1AF BD E5 E1 LDA MONCOM,X ;GET ADDRESS OF COMMAND PROCESSOR 0492 E1B2 8D 7D A4 STA JUMP 0493 E1B5 BD E6 E1 LDA MONCOM+1,X 0494 E1B8 8D 7E A4 STA JUMP+1 0495 E1BB 20 C1 E1 JSR JMPR ;CMD PROCESSORS CAN EXIT WITH 'RTS' 0496 E1BE 4C 82 E1 JMP START 0497 E1C1 6C 7D A4 JMPR JMP (JUMP) ;GO TO COMMAND 0498 E1C4 0499 E1C4 ;VALID COMMANDS 0500 E1C4 MCNT =32 ;COUNT 0501 E1C4 4554524D472FCOMB .DB "ETRMG/LDN*AXYPS " 0501 E1CA 4C444E2A415859505320 0502 E1D4 423F2348565A .DB "B?#HVZIK123456[]",$5E 0502 E1DA 494B3132333435365B5D5E 0503 E1E5 0504 E1E5 39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO 0504 E1EB 48E261E2 0505 E1EF A0E2E6E23BE4 .DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA 0505 E1F5 00D0D4E5EEE5 0506 E1FB F2E5F6E5EAE5 .DW CGX,CGY,CGPS,CGS,NXT5,BRKA 0506 E201 FAE50DE61BE6 0507 E207 4DE6FEE665E6 .DW SHOW,CLRBK,SHIS,REGT,TRACE 0507 E20D D9E6DDE6 0508 E211 9EFB0AE7BDE6 .DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM 0508 E217 CBE694E6 0509 E21B E5E600B003B0 .DW BRKK,BASIEN,BASIRE 0510 E221 ;USER DEFINED FUNCTIONS 0511 E221 0C010F011201 .DW KEYF1,KEYF2,KEYF3 0512 E227 0513 E227 ;***** R COMMAND-DISPLAY REGISTERS ***** 0514 E227 20 13 EA REG JSR CRLOW ;CLEAR DISP IF KB 0515 E22A A0 08 LDY #M4-M1 ;MESSAG & 0516 E22C 20 AF E7 JSR KEP 0517 E22F 20 24 EA JSR CRCK 0518 E232 20 3E E8 REG1 JSR BLANK 0519 E235 A0 09 LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC) 0520 E237 20 DD E2 JSR WRITAD 0521 E23A A9 20 LDA #SAVPS ;NOW THE OTHER 5 REGS 0522 E23C 8D 1C A4 STA ADDR 0523 E23F A9 A4 LDA #SAVPS/256 0524 E241 8D 1D A4 STA ADDR+1 0525 E244 A2 05 LDX #5 ;COUNT 0526 E246 D0 07 BNE MEM1 ;SHARE CODE 0527 E248 0528 E248 ;***** M COMMAND-DISPLAY MEMORY ***** 0529 E248 20 AE EA MEM JSR ADDIN ;GET START ADDDRESS IN ADDR 0530 E24B B0 13 BCS MEM3 0531 E24D A2 04 MEIN LDX #4 0532 E24F A0 00 MEM1 LDY #0 0533 E251 20 3E E8 MEM2 JSR BLANK 0534 E254 A9 1C LDA #ADDR 0535 E256 20 58 EB JSR LDAY ;LOAD CONTENTS OF CURR LOCATION 0536 E259 20 46 EA JSR NUMA ;AND DISPLAY IT AS 2 HEX DIGITS 0537 E25C C8 INY 0538 E25D CA DEX ;DECR COUNTER 0539 E25E D0 F1 BNE MEM2 0540 E260 60 MEM3 RTS ;GET NEXT COMMAND 0541 E261 0542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85 E7 JSR GCNT ;GET COUNT 0545 E267 20 F0 E9 JSR CRLF 0546 E26A 4C 86 E2 JMP GOBK1 ;RESUME EXECUTION 0547 E26D AD 0E A4 GOBK LDA REGF ;DISPLAY REGISTERS ? 0548 E270 F0 06 BEQ GOBK0 ;NO,BRANCH 0549 E272 20 32 E2 JSR REG1 ;SHOW THE SIX REG 0550 E275 20 24 EA JSR CRCK ; 0551 E278 20 07 E9 GOBK0 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 0552 E27B AD 0F A4 LDA DISFLG ;DISASSEMBLE CURRENT INSTR ? 0553 E27E F0 06 BEQ GOBK1 ;NO,BRANCH 0554 E280 20 6C F4 JSR DISASM ;DISASM THIS INSTRUCTION 0555 E283 20 13 EA JSR CRLOW 0556 E286 AE 24 A4 GOBK1 LDX SAVS ;RESTORE SAVED REGS FOR RTI 0557 E289 9A TXS 0558 E28A AC 23 A4 LDY SAVY 0559 E28D AE 22 A4 LDX SAVX 0560 E290 AD 26 A4 LDA SAVPC+1 0561 E293 48 PHA ;PUT PC ON STACK 0562 E294 AD 25 A4 LDA SAVPC 0563 E297 48 PHA 0564 E298 AD 20 A4 LDA SAVPS ;STATUS ALSO 0565 E29B 48 PHA 0566 E29C AD 21 A4 LDA SAVA 0567 E29F 40 RTI ;AND AWAY WE GO... 0568 E2A0 0569 E2A0 ;***** / COMMAND-ALTER MEMORY ***** 0570 E2A0 20 3E E8 CHNGG JSR BLANK 0571 E2A3 20 DB E2 JSR WRITAZ ;WRITE ADDR 0572 E2A6 20 3E E8 CHNG1 JSR BLANK 0573 E2A9 20 5D EA JSR RD2 ;GET VALUE 0574 E2AC 90 0A BCC CH2 ;ISN'T SKIP OR DONE 0575 E2AE C9 20 CMP #' ' 0576 E2B0 D0 13 BNE CH3 ;NOT BLANK SO MUST BE DONE 0577 E2B2 ;SKIP THIS LOCATION 0578 E2B2 20 3E E8 JSR BLANK 0579 E2B5 4C C0 E2 JMP CH4 0580 E2B8 ;IS ALTER 0581 E2B8 20 78 EB CH2 JSR SADDR ;STORE ENTERED VALUE INTO MEMORY 0582 E2BB F0 03 BEQ CH4 ;NO ERROR IN STORE 0583 E2BD 4C 33 EB JMP MEMERR ;MEMORY WRITE ERROR 0584 E2C0 C8 JSR OUTDD1 0432 E14D 68 PLA 0433 E14E AA TAX 0434 E14F CA DEX 0435 E150 10 F4 BPL RS8 0436 E152 30 EA BMI RS6 0437 E154 0438 E154 ;BRK INSTR (00) OR IRQ ENTRY POINT 0439 E154 8D 21 A4 IRQV3 STA SAVA 0440 E157 68 PLA 0441 E158 48 PHA ;GET STATUS 0442 E159 29 10 AND #$10 ;SEE IF 'BRK' , ISOLATE B FLG 0443 E15B D0 06 BNE IRQ1 ;TRAP WAS CAUSED BY "BRK" INSTRUC 0444 E15D AD 21 A4 LDA SAVA ;TRAP CAUSED BY IRQ SO TRANSFER 0445 E160 6C 00 A4 JMP (MONRAM) ;CONTROL TO USER THRU VECTOR 0446 E163 ;IS 'BRK' INSTR ,SHOW PC & DATA 0447 E163 ;PC IS OFF BY ONE , SO ADJUST IT 0448 E163 68 IRQ1 PLA 0449 E164 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0450 E167 8E 22 A4 STX SAVX 0451 E16A 8C 23 A4 STY SAVY 0452 E16D D8 CLD 0453 E16E 68 PLA ;PROGR CNTR 0454 E16F 38 SEC ;SUBTRACT ONE FROM RETURN ADDR 0455 E170 E9 01 SBC #1 0456 E172 8D 25 A4 STA SAVPC 0457 E175 68 PLA 0458 E176 E9 00 SBC #0 0459 E178 8D 26 A4 STA SAVPC+1 0460 E17B BA TSX ;GET STACK PTR & SAVE IT 0461 E17C 8E 24 A4 STX SAVS 0462 E17F ;SHOW PC AND DATA 0463 E17F 20 61 F4 IRQ2 JSR REGQ ;SHOW NEXT INSTRUCTION & CONTINUE 0464 E182 0465 E182 ;THIS ROUTINE WILL GET A CHR WITH "( )" FROM 0466 E182 ;KB/TTY & THEN WILL GO TO THE RESPECTIVE COMMAND 0467 E182 4C 59 FF START JMP PAT19 ;CLEAR DEC MODE & 0468 E185 A9 BC STA1 LDA #'<'+$80 ;"<" CHR WITH MSB=1 FOR DISP 0469 E187 20 7A E9 JSR OUTPUT 0470 E18A 20 96 FE JSR RED1 ;GET CHR & ECHO FROM KB/TTY 0471 E18D 48 PHA 0472 E18E A9 3E LDA #'>' 0473 E190 20 7A E9 JSR OUTPUT 0474 E193 68 PLA ;SCAN LIST OF CMDS FOR ENTERED CHR 0475 E194 A2 20 LDX #MCNT ;COUNT OF COMMANDS 0476 E196 DD C4 E1 MCM2 CMP COMB,X ;CHECK NEXT COMMAND IN LIST 0477 E199 F0 11 BEQ MCM3 ;MATCH , SO PROCESS THIS COMMAND 0478 E19B CA DEX 0479 E19C 10 F8 BPL MCM2 0480 E19E ;IS BAD COMMAND 0481 E19E 20 D4 E7 JSR QM 0482 E1A1 D8 COMIN CLD 0483 E1A2 20 FE E8 JSR LL 0484 E1A5 AE 24 A4 LDX SAVS 0485 E1A8 9A TXS 0486 E1A9 4C 82 E1 JMP START 0487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL A ;2 BYTES (ADDR) 0490 E1AE AA TAX 0491 E1AF BD E5 E1 LDA MONCOM,X ;GET ADDRESS OF COMMAND PROCESSOR 0492 E1B2 8D 7D A4 STA JUMP 0493 E1B5 BD E6 E1 LDA MONCOM+1,X 0494 E1B8 8D 7E A4 STA JUMP+1 0495 E1BB 20 C1 E1 JSR JMPR ;CMD PROCESSORS CAN EXIT WITH 'RTS' 0496 E1BE 4C 82 E1 JMP START 0497 E1C1 6C 7D A4 JMPR JMP (JUMP) ;GO TO COMMAND 0498 E1C4 0499 E1C4 ;VALID COMMANDS 0500 E1C4 MCNT =32 ;COUNT 0501 E1C4 4554524D472FCOMB .DB "ETRMG/LDN*AXYPS " 0501 E1CA 4C444E2A415859505320 0502 E1D4 423F2348565A .DB "B?#HVZIK123456[]",$5E 0502 E1DA 494B3132333435365B5D5E 0503 E1E5 0504 E1E5 39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO 0504 E1EB 48E261E2 0505 E1EF A0E2E6E23BE4 .DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA 0505 E1F5 00D0D4E5EEE5 0506 E1FB F2E5F6E5EAE5 .DW CGX,CGY,CGPS,CGS,NXT5,BRKA 0506 E201 FAE50DE61BE6 0507 E207 4DE6FEE665E6 .DW SHOW,CLRBK,SHIS,REGT,TRACE 0507 E20D D9E6DDE6 0508 E211 9EFB0AE7BDE6 .DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM 0508 E217 CBE694E6 0509 E21B E5E600B003B0 .DW BRKK,BASIEN,BASIRE 0510 E221 ;USER DEFINED FUNCTIONS 0511 E221 0C010F011201 .DW KEYF1,KEYF2,KEYF3 0512 E227 0513 E227 ;***** R COMMAND-DISPLAY REGISTERS ***** 0514 E227 20 13 EA REG JSR CRLOW ;CLEAR DISP IF KB 0515 E22A A0 08 LDY #M4-M1 ;MESSAG & 0516 E22C 20 AF E7 JSR KEP 0517 E22F 20 24 EA JSR CRCK 0518 E232 20 3E E8 REG1 JSR BLANK 0519 E235 A0 09 LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC) 0520 E237 20 DD E2 JSR WRITAD 0521 E23A A9 20 LDA #SAVPS ;NOW THE OTHER 5 REGS 0522 E23C 8D 1C A4 STA ADDR 0523 E23F A9 A4 LDA #SAVPS/256 0524 E241 8D 1D A4 STA ADDR+1 0525 E244 A2 05 LDX #5 ;COUNT 0526 E246 D0 07 BNE MEM1 ;SHARE CODE 0527 E248 0528 E248 ;***** M COMMAND-DISPLAY MEMORY ***** 0529 E248 20 AE EA MEM JSR ADDIN ;GET START ADDDRESS IN ADDR 0530 E24B B0 13 BCS MEM3 0531 E24D A2 04 MEIN LDX #4 0532 E24F A0 00 MEM1 LDY #0 0533 E251 20 3E E8 MEM2 JSR BLANK 0534 E254 A9 1C LDA #ADDR 0535 E256 20 58 EB JSR LDAY ;LOAD CONTENTS OF CURR LOCATION 0536 E259 20 46 EA JSR NUMA ;AND DISPLAY IT AS 2 HEX DIGITS 0537 E25C C8 INY 0538 E25D CA DEX ;DECR COUNTER 0539 E25E D0 F1 BNE MEM2 0540 E260 60 MEM3 RTS ;GET NEXT COMMAND 0541 E261 0542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85 E7 JSR GCNT ;GET COUNT 0545 E267 20 F0 E9 JSR CRLF 0546 E26A 4C 86 E2 JMP GOBK1 ;RESUME EXECUTION 0547 E26D AD 0E A4 GOBK LDA REGF ;DISPLAY REGISTERS ? 0548 E270 F0 06 BEQ GOBK0 ;NO,BRANCH 0549 E272 20 32 E2 JSR REG1 ;SHOW THE SIX REG 0550 E275 20 24 EA JSR CRCK ; 0551 E278 20 07 E9 GOBK0 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 0552 E27B AD 0F A4 LDA DISFLG ;DISASSEMBLE CURRENT INSTR ? 0553 E27E F0 06 BEQ GOBK1 ;NO,BRANCH 0554 E280 20 6C F4 JSR DISASM ;DISASM THIS INSTRUCTION 0555 E283 20 13 EA JSR CRLOW 0556 E286 AE 24 A4 GOBK1 LDX SAVS ;RESTORE SAVED REGS FOR RTI 0557 E289 9A TXS 0558 E28A AC 23 A4 LDY SAVY 0559 E28D AE 22 A4 LDX SAVX 0560 E290 AD 26 A4 LDA SAVPC+1 0561 E293 48 PHA ;PUT PC ON STACK 0562 E294 AD 25 A4 LDA SAVPC 0563 E297 48 PHA 0564 E298 AD 20 A4 LDA SAVPS ;STATUS ALSO 0565 E29B 48 PHA 0566 E29C AD 21 A4 LDA SAVA 0567 E29F 40 RTI ;AND AWAY WE GO... 0568 E2A0 0569 E2A0 ;***** / COMMAND-ALTER MEMORY ***** 0570 E2A0 20 3E E8 CHNGG JSR BLANK 0571 E2A3 20 DB E2 JSR WRITAZ ;WRITE ADDR 0572 E2A6 20 3E E8 CHNG1 JSR BLANK 0573 E2A9 20 5D EA JSR RD2 ;GET VALUE 0574 E2AC 90 0A BCC CH2 ;ISN'T SKIP OR DONE 0575 E2AE C9 20 CMP #' ' 0576 E2B0 D0 13 BNE CH3 ;NOT BLANK SO MUST BE DONE 0577 E2B2 ;SKIP THIS LOCATION 0578 E2B2 20 3E E8 JSR BLANK 0579 E2B5 4C C0 E2 JMP CH4 0580 E2B8 ;IS ALTER 0581 E2B8 20 78 EB CH2 JSR SADDR ;STORE ENTERED VALUE INTO MEMORY 0582 E2BB F0 03 BEQ CH4 ;NO ERROR IN STORE 0583 E2BD 4C 33 EB JMP MEMERR ;MEMORY WRITE ERROR 0584 E2C0 C8 JSR OUTDD1 0432 E14D 68 PLA 0433 E14E AA TAX 0434 E14F CA DEX 0435 E150 10 F4 BPL RS8 0436 E152 30 EA BMI RS6 0437 E154 0438 E154 ;BRK INSTR (00) OR IRQ ENTRY POINT 0439 E154 8D 21 A4 IRQV3 STA SAVA 0440 E157 68 PLA 0441 E158 48 PHA ;GET STATUS 0442 E159 29 10 AND #$10 ;SEE IF 'BRK' , ISOLATE B FLG 0443 E15B D0 06 BNE IRQ1 ;TRAP WAS CAUSED BY "BRK" INSTRUC 0444 E15D AD 21 A4 LDA SAVA ;TRAP CAUSED BY IRQ SO TRANSFER 0445 E160 6C 00 A4 JMP (MONRAM) ;CONTROL TO USER THRU VECTOR 0446 E163 ;IS 'BRK' INSTR ,SHOW PC & DATA 0447 E163 ;PC IS OFF BY ONE , SO ADJUST IT 0448 E163 68 IRQ1 PLA 0449 E164 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0450 E167 8E 22 A4 STX SAVX 0451 E16A 8C 23 A4 STY SAVY 0452 E16D D8 CLD 0453 E16E 68 PLA ;PROGR CNTR 0454 E16F 38 SEC ;SUBTRACT ONE FROM RETURN ADDR 0455 E170 E9 01 SBC #1 0456 E172 8D 25 A4 STA SAVPC 0457 E175 68 PLA 0458 E176 E9 00 SBC #0 0459 E178 8D 26 A4 STA SAVPC+1 0460 E17B BA TSX ;GET STACK PTR & SAVE IT 0461 E17C 8E 24 A4 STX SAVS 0462 E17F ;SHOW PC AND DATA 0463 E17F 20 61 F4 IRQ2 JSR REGQ ;SHOW NEXT INSTRUCTION & CONTINUE 0464 E182 0465 E182 ;THIS ROUTINE WILL GET A CHR WITH "( )" FROM 0466 E182 ;KB/TTY & THEN WILL GO TO THE RESPECTIVE COMMAND 0467 E182 4C 59 FF START JMP PAT19 ;CLEAR DEC MODE & 0468 E185 A9 BC STA1 LDA #'<'+$80 ;"<" CHR WITH MSB=1 FOR DISP 0469 E187 20 7A E9 JSR OUTPUT 0470 E18A 20 96 FE JSR RED1 ;GET CHR & ECHO FROM KB/TTY 0471 E18D 48 PHA 0472 E18E A9 3E LDA #'>' 0473 E190 20 7A E9 JSR OUTPUT 0474 E193 68 PLA ;SCAN LIST OF CMDS FOR ENTERED CHR 0475 E194 A2 20 LDX #MCNT ;COUNT OF COMMANDS 0476 E196 DD C4 E1 MCM2 CMP COMB,X ;CHECK NEXT COMMAND IN LIST 0477 E199 F0 11 BEQ MCM3 ;MATCH , SO PROCESS THIS COMMAND 0478 E19B CA DEX 0479 E19C 10 F8 BPL MCM2 0480 E19E ;IS BAD COMMAND 0481 E19E 20 D4 E7 JSR QM 0482 E1A1 D8 COMIN CLD 0483 E1A2 20 FE E8 JSR LL 0484 E1A5 AE 24 A4 LDX SAVS 0485 E1A8 9A TXS 0486 E1A9 4C 82 E1 JMP START 0487 E1AC ;HAVE VALID COMMAND 0488 E1AC 8A MCM3 TXA ;CONVERT TO WORD (MULT BY 2) 0489 E1AD 0A ASL A ;2 BYTES (ADDR) 0490 E1AE AA TAX 0491 E1AF BD E5 E1 LDA MONCOM,X ;GET ADDRESS OF COMMAND PROCESSOR 0492 E1B2 8D 7D A4 STA JUMP 0493 E1B5 BD E6 E1 LDA MONCOM+1,X 0494 E1B8 8D 7E A4 STA JUMP+1 0495 E1BB 20 C1 E1 JSR JMPR ;CMD PROCESSORS CAN EXIT WITH 'RTS' 0496 E1BE 4C 82 E1 JMP START 0497 E1C1 6C 7D A4 JMPR JMP (JUMP) ;GO TO COMMAND 0498 E1C4 0499 E1C4 ;VALID COMMANDS 0500 E1C4 MCNT =32 ;COUNT 0501 E1C4 4554524D472FCOMB .DB "ETRMG/LDN*AXYPS " 0501 E1CA 4C444E2A415859505320 0502 E1D4 423F2348565A .DB "B?#HVZIK123456[]",$5E 0502 E1DA 494B3132333435365B5D5E 0503 E1E5 0504 E1E5 39F6CFF627E2MONCOM .DW EDIT,REENTR,REG,MEM,GO 0504 E1EB 48E261E2 0505 E1EF A0E2E6E23BE4 .DW CHNGG,LOAD,DUMP,ASSEM,CGPC,CGA 0505 E1F5 00D0D4E5EEE5 0506 E1FB F2E5F6E5EAE5 .DW CGX,CGY,CGPS,CGS,NXT5,BRKA 0506 E201 FAE50DE61BE6 0507 E207 4DE6FEE665E6 .DW SHOW,CLRBK,SHIS,REGT,TRACE 0507 E20D D9E6DDE6 0508 E211 9EFB0AE7BDE6 .DW MNEENT,KDISA,TOGTA1,TOGTA2,VECKSM 0508 E217 CBE694E6 0509 E21B E5E600B003B0 .DW BRKK,BASIEN,BASIRE 0510 E221 ;USER DEFINED FUNCTIONS 0511 E221 0C010F011201 .DW KEYF1,KEYF2,KEYF3 0512 E227 0513 E227 ;***** R COMMAND-DISPLAY REGISTERS ***** 0514 E227 20 13 EA REG JSR CRLOW ;CLEAR DISP IF KB 0515 E22A A0 08 LDY #M4-M1 ;MESSAG & 0516 E22C 20 AF E7 JSR KEP 0517 E22F 20 24 EA JSR CRCK 0518 E232 20 3E E8 REG1 JSR BLANK 0519 E235 A0 09 LDY #SAVPC-ADDR ;OUTPUT PGR CNTR (SAVEPC+1,SAVEPC) 0520 E237 20 DD E2 JSR WRITAD 0521 E23A A9 20 LDA #SAVPS ;NOW THE OTHER 5 REGS 0522 E23C 8D 1C A4 STA ADDR 0523 E23F A9 A4 LDA #SAVPS/256 0524 E241 8D 1D A4 STA ADDR+1 0525 E244 A2 05 LDX #5 ;COUNT 0526 E246 D0 07 BNE MEM1 ;SHARE CODE 0527 E248 0528 E248 ;***** M COMMAND-DISPLAY MEMORY ***** 0529 E248 20 AE EA MEM JSR ADDIN ;GET START ADDDRESS IN ADDR 0530 E24B B0 13 BCS MEM3 0531 E24D A2 04 MEIN LDX #4 0532 E24F A0 00 MEM1 LDY #0 0533 E251 20 3E E8 MEM2 JSR BLANK 0534 E254 A9 1C LDA #ADDR 0535 E256 20 58 EB JSR LDAY ;LOAD CONTENTS OF CURR LOCATION 0536 E259 20 46 EA JSR NUMA ;AND DISPLAY IT AS 2 HEX DIGITS 0537 E25C C8 INY 0538 E25D CA DEX ;DECR COUNTER 0539 E25E D0 F1 BNE MEM2 0540 E260 60 MEM3 RTS ;GET NEXT COMMAND 0541 E261 0542 E261 ;***** G COMMAND-RESTART PROCESSOR ***** 0543 E261 20 37 E8 GO JSR PSL1 ;"/" 0544 E264 20 85 E7 JSR GCNT ;GET COUNT 0545 E267 20 F0 E9 JSR CRLF 0546 E26A 4C 86 E2 JMP GOBK1 ;RESUME EXECUTION 0547 E26D AD 0E A4 GOBK LDA REGF ;DISPLAY REGISTERS ? 0548 E270 F0 06 BEQ GOBK0 ;NO,BRANCH 0549 E272 20 32 E2 JSR REG1 ;SHOW THE SIX REG 0550 E275 20 24 EA JSR CRCK ; 0551 E278 20 07 E9 GOBK0 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 0552 E27B AD 0F A4 LDA DISFLG ;DISASSEMBLE CURRENT INSTR ? 0553 E27E F0 06 BEQ GOBK1 ;NO,BRANCH 0554 E280 20 6C F4 JSR DISASM ;DISASM THIS INSTRUCTION 0555 E283 20 13 EA JSR CRLOW 0556 E286 AE 24 A4 GOBK1 LDX SAVS ;RESTORE SAVED REGS FOR RTI 0557 E289 9A TXS 0558 E28A AC 23 A4 LDY SAVY 0559 E28D AE 22 A4 LDX SAVX 0560 E290 AD 26 A4 LDA SAVPC+1 0561 E293 48 PHA ;PUT PC ON STACK 0562 E294 AD 25 A4 LDA SAVPC 0563 E297 48 PHA 0564 E298 AD 20 A4 LDA SAVPS ;STATUS ALSO 0565 E29B 48 PHA 0566 E29C AD 21 A4 LDA SAVA 0567 E29F 40 RTI ;AND AWAY WE GO... 0568 E2A0 0569 E2A0 ;***** / COMMAND-ALTER MEMORY ***** 0570 E2A0 20 3E E8 CHNGG JSR BLANK 0571 E2A3 20 DB E2 JSR WRITAZ ;WRITE ADDR 0572 E2A6 20 3E E8 CHNG1 JSR BLANK 0573 E2A9 20 5D EA JSR RD2 ;GET VALUE 0574 E2AC 90 0A BCC CH2 ;ISN'T SKIP OR DONE 0575 E2AE C9 20 CMP #' ' 0576 E2B0 D0 13 BNE CH3 ;NOT BLANK SO MUST BE DONE 0577 E2B2 ;SKIP THIS LOCATION 0578 E2B2 20 3E E8 JSR BLANK 0579 E2B5 4C C0 E2 JMP CH4 0580 E2B8 ;IS ALTER 0581 E2B8 20 78 EB CH2 JSR SADDR ;STORE ENTERED VALUE INTO MEMORY 0582 E2BB F0 03 BEQ CH4 ;NO ERROR IN STORE 0583 E2BD 4C 33 EB JMP MEMERR ;MEMORY WRITE ERROR 0584 E2C0 C8 ;.FILE A1 0264 AC04 0265 AC04 ; E=ENTER EDITOR 0266 AC04 ; T=RE-ENTER EDITOR TO RE-EDIT SOURCE 0267 AC04 ; R=SHOW REGISTERS 0268 AC04 ; M=DISPLAY MEMORY 0269 AC04 ; =SHOW NEXT 4 ADDRESSES 0270 AC04 ; G=GO AT CURRENT P.C. (COUNT) 0271 AC04 ; /=ALTER CURRENT MEMORY 0272 AC04 ; L=LOAD OBJECT 0273 AC04 ; D=DUMP OBJECT 0274 AC04 ; N=ASSEMBLE 0275 AC04 ; *=ALTER P.C. 0276 AC04 ; A=ALTER ACCUMULATOR 0277 AC04 ; X=ALTER X REGISTER 0278 AC04 ; Y=ALTER Y REGISTER 0279 AC04 ; P=ALTER PROCESSOR STATUS 0280 AC04 ; S=ALTER STACK POINTER 0281 AC04 ; B=SET BREAK ADDR 0282 AC04 ; ?=SHOW BREAK ADDRESSES 0283 AC04 ; #=CLEAR BREAK ADDRESSES 0284 AC04 ; H=SHOW TRACE HISTORY STACK 0285 AC04 ; V=TOGGLE REGISTER PRINT WITH DIS. 0286 AC04 ; Z=TOGGLE DISASSEMBLER TRACE 0287 AC04 ; \=TURN ON/OFF PRINTER 0288 AC04 ; =ADV PAPER 0289 AC04 ; I=MNEMONIC ENTRY 0290 AC04 ; K=DISASSEMBLE MEMORY 0291 AC04 ; 1=TOGGLE TAPE 1 CONTRL (ON OR OFF) 0292 AC04 ; 2=TOGGLE TAPE 2 CONTRL 0293 AC04 ; 3=VERIFY CKSUM FOR TAPES 0294 AC04 ; 4=ENABLE BREAKS 0295 AC04 ; 5=BASIC ENTRY (COLD) 0296 AC04 ; 6=BASIC REENTRY (WARM) 0297 AC04 0298 AC04 ;FOLLOWING KEYS ARE UNUSED BUT 'HOOKS' 0299 AC04 ;ARE PROVIDED IN LOCATIONS 010C-0114 0300 AC04 ; 0301 AC04 ; KEYF1,KEYF2,KEYF3 0302 AC04 0303 E000 *=$E000 0304 E000 ;ALL MSGS HAVE MSB=1 OF LAST CHAR TO END IT 0305 E000 46524F4DBD M1 .DB "FROM",EQS 0306 E005 54 4F BD M3 .DB "TO",EQS 0307 E008 202A2A2A2A20M4 .DB " **** PS AA XX YY S",$D3 0307 E00E 50532041412058582059592053D3 0308 E01C 4D4F5245BF M5 .DB "MORE",$BF 0309 E021 4F 4E A0 M6 .DB "ON",$A0 ;"ON " 0310 E024 4F 46 C6 M7 .DB "OF",$C6 ;"OFF" 0311 E027 42 52 CB M8 .DB "BR",$CB ;"BRK" 0312 E02A 49 4E BD M9 .DB "IN",EQS 0313 E02D 4F 55 54 BD M10 .DB "OUT",EQS 0314 E031 204D454D2046M11 .DB " MEM FAIL",$A0 0314 E037 41494CA0 0315 E03B 205052494E54M12 .DB " PRINTER DOW",$CE 0315 E041 455220444F57CE 0316 E048 2053524348 TMSG0 .DB " SRCH" 0317 E04D 20 46 BD TMSG1 .DB " F",EQS 0318 E050 54 BD TMSG2 .DB "T",EQS 0319 E052 A0 C5 D2 D2 TMSG3 .DB $A0,$C5,$D2,$D2 ;PRINT " ERROR" ,MSB=1 0320 E056 CFD2A0A0A0A0 .DB $CF,$D2,$A0,$A0,$A0,$A0,$A0,$A0,";" 0320 E05C A0A03B 0321 E05F 41 BD TMSG5 .DB "A",EQS 0322 E061 424C4B3DA0 TMSG6 .DB "BLK=",$A0 0323 E066 A0CCCFC1C43BTMSG7 .DB $A0,$CC,$CF,$C1,$C4,";" 0324 E06C 454449544FD2EMSG1 .DB "EDITO",$D2 ;EDITOR MESSAGES 0325 E072 45 4E C4 EMSG2 .DB "EN",$C4 0326 E075 0327 E075 ;VECTORS COME HERE FIRST AFTER JUMP THRU FFFA-FFFF 0328 E075 6C 02 A4 NMIV1 JMP (NMIV2) ;NMIV2 IS A VECTOR TO NMIV3 0329 E078 6C 04 A4 IRQV1 JMP (IRQV2) ;IRQV2 IS A VECTOR TO IRQV3 0330 E07B 0331 E07B ;SINGLE STEP ENTRY POINT (NMI) 0332 E07B 8D 21 A4 NMIV3 STA SAVA ;SAVE ACCUM 0333 E07E 68 PLA 0334 E07F 8D 20 A4 STA SAVPS ;SAVE PROCESSOR STATUS 0335 E082 D8 CLD 0336 E083 8E 22 A4 STX SAVX ;SAVE X 0337 E086 8C 23 A4 STY SAVY 0338 E089 68 PLA 0339 E08A 8D 25 A4 STA SAVPC ;PROGRAM COUNTER 0340 E08D 68 PLA 0341 E08E 8D 26 A4 STA SAVPC+1 0342 E091 BA TSX ;GET STACK PTR & SAVE IT 0343 E092 8E 24 A4 STX SAVS 0344 E095 ;TRACE THE ADDRESS 0345 E095 AC 14 A4 LDY HISTP ;GET POINTER TO HISTORY STACK 0346 E098 AD 26 A4 LDA SAVPC+1 ;SAVE HALT ADDR IN HISTORY STACK 0347 E09B 99 2E A4 STA HIST,Y 0348 E09E AD 25 A4 LDA SAVPC 0349 E0A1 99 2F A4 STA HIST+1,Y 0350 E0A4 20 88 E6 JSR NHIS ;UPDATE POINTER 0351 E0A7 AD 10 A4 LDA BKFLG ;SOFT BREAKS ON? 0352 E0AA F0 08 BEQ NMI5 ;NO ,DONT CHCK BRKPOINT LIST 0353 E0AC 20 6B E7 JSR CKB ;CHECK BREAKPOINT LIST 0354 E0AF 90 03 BCC NMI5 ;DID NOT HIT BREAKPOINT 0355 E0B1 4C 7F E1 NMI4 JMP IRQ2 ;HIT A BREAK-TRAP TO MONITOR 0356 E0B4 20 90 E7 NMI5 JSR DONE ;COUNT =0 ? 0357 E0B7 F0 F8 BEQ NMI4 ;YES,TRAP TO MONITOR 0358 E0B9 20 07 E9 JSR RCHEK ;CHK IF HE WANTS TO INTERR 0359 E0BC 4C 6D E2 JMP GOBK ;NOT DONE-RESUME EXECUTION 0360 E0BF 0361 E0BF ;POWER UP AND RESET ENTRY POINT (RST TRANSFERS HERE) 0362 E0BF D8 RSET CLD ;CLEAR DEC MODE 0363 E0C0 78 SEI ;DISABLE INTERRUPT 0364 E0C1 A2 FF LDX #$FF ;INIT STACK PTR 0365 E0C3 9A TXS 0366 E0C4 8E 24 A4 STX SAVS ;ALSO INIT SAVED STACK PTR 0367 E0C7 ;INITIALIZE 6522 0368 E0C7 A2 0E LDX #14 0369 E0C9 BD 43 E7 RS1 LDA INTAB1,X ;PB1-PB0,PA7-PA0 FOR PRNTR 0370 E0CC 9D 00 A8 STA DRB,X ;PB2=TTO,PB6=TTI 0371 E0CF CA DEX ;PB4-PB5=TAPE CONTROL,PB7=DATA 0372 E0D0 10 F7 BPL RS1 ;PB3 =SWITCH KB/TTY 0373 E0D2 ;INITIALIZE 6532 0374 E0D2 A2 03 LDX #3 ;PORTS USED FOR KB 0375 E0D4 BD 52 E7 RS2 LDA INTAB2,X ;PA0-PA7 AS OUTPUT 0376 E0D7 9D 80 A4 STA DRA2,X ;PB0-PB7 AS INPUT 0377 E0DA CA DEX 0378 E0DB 10 F7 BPL RS2 0379 E0DD ;INITIALIZE MONITOR RAM (6532) 0380 E0DD AD 56 E7 LDA INTAB3 ;CHECK IF NMIV2 HAS BEEN CHANGED 0381 E0E0 CD 02 A4 CMP NMIV2 ;IF IT HAS THEN ASSUME A COLD 0382 E0E3 D0 0C BNE RS3A ;START AND INITIALIZE EVERYTHING 0383 E0E5 AD 57 E7 LDA INTAB3+1 0384 E0E8 CD 03 A4 CMP NMIV2+1 0385 E0EB D0 04 BNE RS3A 0386 E0ED A2 10 LDX #16 ;THEY ARE EQUAL ,IT'S A WARM RESET 0387 E0EF D0 02 BNE RS3 0388 E0F1 A2 00 RS3A LDX #0 ;INIT EVERYTHING (POWER UP) 0389 E0F3 BD 56 E7 RS3 LDA INTAB3,X 0390 E0F6 9D 02 A4 STA NMIV2,X 0391 E0F9 E8 INX 0392 E0FA E0 15 CPX #21 0393 E0FC 90 F5 BCC RS3 0394 E0FE ;INITIALIZE DISPLAY (6520) 0395 E0FE A9 00 LDA #0 ;SET CONTR REG FOR DATA DIR REG 0396 E100 A2 01 LDX #1 0397 E102 20 13 E1 JSR SETREG 0398 E105 A9 FF LDA #$FF ;SET DATA DIR REG FOR OUTPUT 0399 E107 CA DEX 0400 E108 20 13 E1 JSR SETREG 0401 E10B A9 04 LDA #$04 ;SET CONTR REG FOR PORTS 0402 E10D E8 INX 0403 E10E 20 13 E1 JSR SETREG 0404 E111 D0 07 BNE RS3B 0405 E113 9D 00 AC SETREG STA RA,X 0406 E116 9D 02 AC STA RB,X 0407 E119 60 RTS 0408 E11A 58 RS3B CLI ;CLEAR INTERRUPT 0409 E11B 0410 E11B ;KB/TTY SWITCH TEST AND BIT RATE MEASUREMENT 0411 E11B A9 08 LDA #$08 ;PB3=SWITCH KB/TTY 0412 E11D 2C 00 A8 RS4 BIT DRB ;A^M ,PB6-> V (OVERFLOW FLG) 0413 E120 D0 22 BNE RS7 ;BRANCH ON KB 0414 E122 70 F9 BVS RS4 ;START BIT=PB6=0? 0415 E124 A9 FF LDA #$FF ;YES ,INITIALIZE TIMER T2 0416 E126 8D 09 A8 STA T2H 0417 E129 2C 00 A8 RS5 BIT DRB ;END OF START BIT ? 0418 E12C 50 FB BVC RS5 ;NO ,WAIT UNTIL PB6 BACK TO 1 0419 E12E AD 09 A8 LDA T2H ;STORE TIMING 0420 E131 49 FF EOR #$FF ;COMPLEMENT 0421 E133 8D 17 A4 STA CNTH30 0422 E136 AD 08 A8 LDA T2L 0423 E139 49 FF EOR #$FF 0424 E13B 20 7C FE JSR PATCH1 ;ADJUST IT 0425 E13E 20 13 EA RS6 JSR CRLOW ;CLEAR DISPLAY 0426 E141 4C 72 FF JMP PAT21 0427 E144 A2 13 RS7 LDX #19 ;CLEAR HARDWARE CURSORS 0428 E146 8A RS8 TXA 0429 E147 48 PHA 0430 E148 A9 00 LDA #0 0431 E14A 20 7B EF 3E 20 DB E2 JSR WRITAZ ;PRINT ADDR+1 , ADDR 1740 EB41 4C A1 E1 JMP COMIN 1741 EB44 1742 EB44 ;CLEAR DISPLAY & PRINTER POINTERS 1743 EB44 A9 00 CLR LDA #0 1744 EB46 8D 15 A4 STA CURPO2 ;DISP PNTR 1745 EB49 8D 16 A4 STA CURPOS ;PRINTR PNTR 1746 EB4C 60 RTS 1747 EB4D 1748 EB4D ;CLEAR CKSUM 1749 EB4D A9 00 CLRCK LDA #0 1750 EB4F 8D 1F A4 STA CKSUM+1 1751 EB52 8D 1E A4 STA CKSUM 1752 EB55 60 RTS 1753 EB56 1754 EB56 ;CODE FOR PAGE ZERO SIMULATION 1755 EB56 ;SUBR LDAY-SIMULATES LDA (N),Y INSTR WITHOUT PAG 0 1756 EB56 ;BY PUTTING INDIR ADDR INTO RAM & THEN EXEC LDA NM,Y 1757 EB56 A9 25 PCLLD LDA #SAVPC ;FOR DISASSEMBLER 1758 EB58 8C 2D A4 LDAY STY CPIY+3 ;SAVE Y 1759 EB5B A8 TAY 1760 EB5C B9 00 A4 LDA MONRAM,Y ;MONRAM=MONITOR RAM 1761 EB5F 8D 2B A4 STA LDIY+1 1762 EB62 B9 01 A4 LDA MONRAM+1,Y 1763 EB65 8D 2C A4 STA LDIY+2 1764 EB68 AC 2D A4 LDY CPIY+3 ;REST Y 1765 EB6B A9 B9 LDA #$B9 ;INST FOR LDA NM,Y 1766 EB6D 8D 2A A4 STA LDIY 1767 EB70 A9 60 LDA #$60 ;RTS 1768 EB72 8D 2D A4 STA LDIY+3 1769 EB75 4C 2A A4 JMP LDIY ;START EXECUTING LDA (),Y 1770 EB78 1771 EB78 ;SUBR STORE AT ADDR & CMP WITHOUT PAG 0 1772 EB78 ;REPLACES STA (ADDR),Y & CMP (ADDR),Y 1773 EB78 ;LOOK THAT ADDR & ADDR+1 ARE NOT ON PAG 0 1774 EB78 48 SADDR PHA 1775 EB79 AD 1C A4 LDA ADDR 1776 EB7C 8D 28 A4 STA STIY+1 1777 EB7F 8D 2B A4 STA CPIY+1 1778 EB82 AD 1D A4 LDA ADDR+1 1779 EB85 8D 29 A4 STA STIY+2 1780 EB88 8D 2C A4 STA CPIY+2 1781 EB8B A9 99 LDA #$99 ;STA INSTR 1782 EB8D 8D 27 A4 STA STIY 1783 EB90 A9 D9 LDA #$D9 ;CMP INSTR 1784 EB92 8D 2A A4 STA CPIY 1785 EB95 A9 60 LDA #$60 ;RTS 1786 EB97 8D 2D A4 STA LDIY+3 1787 EB9A 68 PLA 1788 EB9B 4C 27 A4 JMP STIY ;START EXECUTING STA (),Y 1789 EB9E 1790 EB9E ;PUSH X & Y WITHOUT CHANGING THE REGS 1791 EB9E 8D 2D A4 PHXY STA CPIY+3 ;SAVE ACC 1792 EBA1 98 TYA 1793 EBA2 48 PHA ;PUSH Y 1794 EBA3 8A TXA 1795 EBA4 48 PHA ;PUSH X 1796 EBA5 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM S` 1797 EBA8 AD 2D A4 LDA CPIY+3 1798 EBAB 60 RTS 1799 EBAC 1800 EBAC ;PULL X & Y WITHOUT CHANGING ACC 1801 EBAC ;IT HAS TO BE CALLED BY JSR & NOT BY JMP INSTR 1802 EBAC ;SINCE IT SWAPS THE STACK 1803 EBAC 8D 2D A4 PLXY STA CPIY+3 1804 EBAF 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM` 1805 EBB2 68 PLA 1806 EBB3 AA TAX ;PULL X 1807 EBB4 68 PLA 1808 EBB5 A8 TAY ;PULL Y 1809 EBB6 AD 2D A4 LDA CPIY+3 1810 EBB9 60 RTS 1811 EBBA 1812 EBBA ;SWAP STACK 1813 EBBA BA SWSTAK TSX 1814 EBBB A9 02 LDA #2 1815 EBBD 48 SWST1 PHA 1816 EBBE BD 06 01 LDA $0106,X ;GET PCH OR PCL 1817 EBC1 BC 04 01 LDY $0104,X ;GET Y OR X REGS 1818 EBC4 9D 04 01 STA $0104,X 1819 EBC7 98 TYA 1820 EBC8 9D 06 01 STA $0106,X 1821 EBCB CA DEX 1822 EBCC 68 PLA 1823 EBCD 38 SEC 1824 EBCE E9 01 SBC #1 1825 EBD0 D0 EB BNE SWST1 1826 EBD2 BD 08 01 LDA $0108,X ;RESTORE Y & X FROM STACK 1827 EBD5 A8 TAY 1828 EBD6 BD 07 01 LDA $0107,X 1829 EBD9 AA TAX 1830 EBDA 60 RTS 1831 EBDB 1832 EBDB ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1833 EBDB ;GET A CHAR FROM TTY SUBR INTO ACC ,SAVES X 1834 EBDB 8A GETTTY TXA ;SAVE X 1835 EBDC 48 PHA 1836 EBDD A2 07 LDX #$07 ;SET UP FOR 8 BIT CNT 1837 EBDF 8E 2A A4 STX CPIY ;CLR MSB 1838 EBE2 2C 00 A8 GET1 BIT DRB ;A^M , PB6->V 1839 EBE5 70 FB BVS GET1 ;WAIT FOR START BIT 1840 EBE7 20 0F EC JSR DELAY ;DELAY 1 BIT 1841 EBEA 20 23 EC JSR DEHALF ;DELAY 1/2 BIT TIME 1842 EBED AD 00 A8 GET3 LDA DRB ;GET 8 BITS 1843 EBF0 29 40 AND #$40 ;MASK OFF OTHER BITS,ONLY PB6 1844 EBF2 4E 2A A4 LSR CPIY ;SHIFT RIGHT CHARACTER 1845 EBF5 0D 2A A4 ORA CPIY 1846 EBF8 8D 2A A4 STA CPIY 1847 EBFB 20 0F EC JSR DELAY ;DELAY 1 BIT TIME 1848 EBFE CA DEX 1849 EBFF D0 EC BNE GET3 ;GET NEXT BIT 1850 EC01 20 0F EC JSR DELAY ;DO NOT CARE FOR PARITY BIT 1851 EC04 20 23 EC JSR DEHALF ;UNTIL WE GET BACK TO ONE AGAIN 1852 EC07 68 PLA ;RESTORE X 1853 EC08 AA TAX 1854 EC09 AD 2A A4 LDA CPIY 1855 EC0C 29 7F AND #$7F ;CLEAR PARITY BIT 1856 EC0E 60 RTS 1857 EC0F 1858 EC0F ;DELAY 1 BIT TIME AS GIVEN BY BAUD RATE 1859 EC0F AD 18 A4 DELAY LDA CNTL30 ;START TIMER T2 1860 EC12 8D 08 A8 STA T2L 1861 EC15 AD 17 A4 LDA CNTH30 1862 EC18 8D 09 A8 DE1 STA T2H 1863 EC1B AD 0D A8 DE2 LDA IFR ;GET INT FLG FOR T2 1864 EC1E 29 20 AND #MT2 1865 EC20 F0 F9 BEQ DE2 ;TIME OUT ? 1866 EC22 60 RTS 1867 EC23 1868 EC23 ;DELAY HALF BIT TIME 1869 EC23 ;TOTAL TIME DIVIDED BY 2 1870 EC23 AD 17 A4 DEHALF LDA CNTH30 1871 EC26 4A LSR A ;LSB TO CARRY 1872 EC27 AD 18 A4 LDA CNTL30 1873 EC2A 6A ROR A ;SHIFT WITH CARRY 1874 EC2B 8D 08 A8 STA T2L 1875 EC2E AD 17 A4 LDA CNTH30 1876 EC31 4A LSR A 1877 EC32 8D 09 A8 STA T2H 1878 EC35 4C 1B EC JMP DE2 1879 EC38 1880 EC38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1881 EC38 A9 00 GETKD0 LDA #0 1882 EC3A 8D 77 A4 STA IDOT ;GO ANOTHER 90 DOTS 1883 EC3D 20 50 F0 JSR IPO0 ;OUTPUT 90 DOTS TO PRI (ZEROS) 1884 EC40 1885 EC40 ;GET A CHAR FROM KB SUBROUTINE 1886 EC40 ;FROM KB Y=ROW ,STBKEY=COLUMNS (STROBE) 1887 EC40 ;X=CTRL OR SHIFT ,OTHERWISE X=0 1888 EC40 20 EF EC GETKEY JSR ROONEK ;WAIT IF LAST KEY STILL DOWN 1889 EC43 20 2A ED GETKY JSR DEBKEY ;DEBOUNCE KEY (5 MSEC) 1890 EC46 ;CTRL OR SHIFT ? 1891 EC46 A9 8F LDA #$8F ;CHCK CLMN 5,6,7 1892 EC48 8D 80 A4 STA DRA2 1893 EC4B AD 82 A4 LDA DRB2 ;CHCK ROW 1 1894 EC4E 4A LSR A 1895 EC4F B0 20 BCS GETK1 ;IF=1 ,NO CTRL OR SHIFT 1896 EC51 A2 03 LDX #3 ;CLMN 5,6,7 (CNTRL,SHIFTL,SHIFTR) 1897 EC53 A9 7F LDA #$7F ;CTRL OR SHIFT ,SO WHICH ONE? 1898 EC55 38 GETK0 SEC 1899 EC56 6A ROR A 1900 EC57 48 PHA 1901 EC58 20 0B ED JSR ONEK2 ;LETS GET CTRL OR SHIFT INTO X 1902 EC5B AD 82 A4 LDA DRB2 1903 EC5E 4A LSR A ;ONLY ROW 1 1904 EC5F 90 06 3E 20 DB E2 JSR WRITAZ ;PRINT ADDR+1 , ADDR 1740 EB41 4C A1 E1 JMP COMIN 1741 EB44 1742 EB44 ;CLEAR DISPLAY & PRINTER POINTERS 1743 EB44 A9 00 CLR LDA #0 1744 EB46 8D 15 A4 STA CURPO2 ;DISP PNTR 1745 EB49 8D 16 A4 STA CURPOS ;PRINTR PNTR 1746 EB4C 60 RTS 1747 EB4D 1748 EB4D ;CLEAR CKSUM 1749 EB4D A9 00 CLRCK LDA #0 1750 EB4F 8D 1F A4 STA CKSUM+1 1751 EB52 8D 1E A4 STA CKSUM 1752 EB55 60 RTS 1753 EB56 1754 EB56 ;CODE FOR PAGE ZERO SIMULATION 1755 EB56 ;SUBR LDAY-SIMULATES LDA (N),Y INSTR WITHOUT PAG 0 1756 EB56 ;BY PUTTING INDIR ADDR INTO RAM & THEN EXEC LDA NM,Y 1757 EB56 A9 25 PCLLD LDA #SAVPC ;FOR DISASSEMBLER 1758 EB58 8C 2D A4 LDAY STY CPIY+3 ;SAVE Y 1759 EB5B A8 TAY 1760 EB5C B9 00 A4 LDA MONRAM,Y ;MONRAM=MONITOR RAM 1761 EB5F 8D 2B A4 STA LDIY+1 1762 EB62 B9 01 A4 LDA MONRAM+1,Y 1763 EB65 8D 2C A4 STA LDIY+2 1764 EB68 AC 2D A4 LDY CPIY+3 ;REST Y 1765 EB6B A9 B9 LDA #$B9 ;INST FOR LDA NM,Y 1766 EB6D 8D 2A A4 STA LDIY 1767 EB70 A9 60 LDA #$60 ;RTS 1768 EB72 8D 2D A4 STA LDIY+3 1769 EB75 4C 2A A4 JMP LDIY ;START EXECUTING LDA (),Y 1770 EB78 1771 EB78 ;SUBR STORE AT ADDR & CMP WITHOUT PAG 0 1772 EB78 ;REPLACES STA (ADDR),Y & CMP (ADDR),Y 1773 EB78 ;LOOK THAT ADDR & ADDR+1 ARE NOT ON PAG 0 1774 EB78 48 SADDR PHA 1775 EB79 AD 1C A4 LDA ADDR 1776 EB7C 8D 28 A4 STA STIY+1 1777 EB7F 8D 2B A4 STA CPIY+1 1778 EB82 AD 1D A4 LDA ADDR+1 1779 EB85 8D 29 A4 STA STIY+2 1780 EB88 8D 2C A4 STA CPIY+2 1781 EB8B A9 99 LDA #$99 ;STA INSTR 1782 EB8D 8D 27 A4 STA STIY 1783 EB90 A9 D9 LDA #$D9 ;CMP INSTR 1784 EB92 8D 2A A4 STA CPIY 1785 EB95 A9 60 LDA #$60 ;RTS 1786 EB97 8D 2D A4 STA LDIY+3 1787 EB9A 68 PLA 1788 EB9B 4C 27 A4 JMP STIY ;START EXECUTING STA (),Y 1789 EB9E 1790 EB9E ;PUSH X & Y WITHOUT CHANGING THE REGS 1791 EB9E 8D 2D A4 PHXY STA CPIY+3 ;SAVE ACC 1792 EBA1 98 TYA 1793 EBA2 48 PHA ;PUSH Y 1794 EBA3 8A TXA 1795 EBA4 48 PHA ;PUSH X 1796 EBA5 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM S` 1797 EBA8 AD 2D A4 LDA CPIY+3 1798 EBAB 60 RTS 1799 EBAC 1800 EBAC ;PULL X & Y WITHOUT CHANGING ACC 1801 EBAC ;IT HAS TO BE CALLED BY JSR & NOT BY JMP INSTR 1802 EBAC ;SINCE IT SWAPS THE STACK 1803 EBAC 8D 2D A4 PLXY STA CPIY+3 1804 EBAF 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM` 1805 EBB2 68 PLA 1806 EBB3 AA TAX ;PULL X 1807 EBB4 68 PLA 1808 EBB5 A8 TAY ;PULL Y 1809 EBB6 AD 2D A4 LDA CPIY+3 1810 EBB9 60 RTS 1811 EBBA 1812 EBBA ;SWAP STACK 1813 EBBA BA SWSTAK TSX 1814 EBBB A9 02 LDA #2 1815 EBBD 48 SWST1 PHA 1816 EBBE BD 06 01 LDA $0106,X ;GET PCH OR PCL 1817 EBC1 BC 04 01 LDY $0104,X ;GET Y OR X REGS 1818 EBC4 9D 04 01 STA $0104,X 1819 EBC7 98 TYA 1820 EBC8 9D 06 01 STA $0106,X 1821 EBCB CA DEX 1822 EBCC 68 PLA 1823 EBCD 38 SEC 1824 EBCE E9 01 SBC #1 1825 EBD0 D0 EB BNE SWST1 1826 EBD2 BD 08 01 LDA $0108,X ;RESTORE Y & X FROM STACK 1827 EBD5 A8 TAY 1828 EBD6 BD 07 01 LDA $0107,X 1829 EBD9 AA TAX 1830 EBDA 60 RTS 1831 EBDB 1832 EBDB ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1833 EBDB ;GET A CHAR FROM TTY SUBR INTO ACC ,SAVES X 1834 EBDB 8A GETTTY TXA ;SAVE X 1835 EBDC 48 PHA 1836 EBDD A2 07 LDX #$07 ;SET UP FOR 8 BIT CNT 1837 EBDF 8E 2A A4 STX CPIY ;CLR MSB 1838 EBE2 2C 00 A8 GET1 BIT DRB ;A^M , PB6->V 1839 EBE5 70 FB BVS GET1 ;WAIT FOR START BIT 1840 EBE7 20 0F EC JSR DELAY ;DELAY 1 BIT 1841 EBEA 20 23 EC JSR DEHALF ;DELAY 1/2 BIT TIME 1842 EBED AD 00 A8 GET3 LDA DRB ;GET 8 BITS 1843 EBF0 29 40 AND #$40 ;MASK OFF OTHER BITS,ONLY PB6 1844 EBF2 4E 2A A4 LSR CPIY ;SHIFT RIGHT CHARACTER 1845 EBF5 0D 2A A4 ORA CPIY 1846 EBF8 8D 2A A4 STA CPIY 1847 EBFB 20 0F EC JSR DELAY ;DELAY 1 BIT TIME 1848 EBFE CA DEX 1849 EBFF D0 EC BNE GET3 ;GET NEXT BIT 1850 EC01 20 0F EC JSR DELAY ;DO NOT CARE FOR PARITY BIT 1851 EC04 20 23 EC JSR DEHALF ;UNTIL WE GET BACK TO ONE AGAIN 1852 EC07 68 PLA ;RESTORE X 1853 EC08 AA TAX 1854 EC09 AD 2A A4 LDA CPIY 1855 EC0C 29 7F AND #$7F ;CLEAR PARITY BIT 1856 EC0E 60 RTS 1857 EC0F 1858 EC0F ;DELAY 1 BIT TIME AS GIVEN BY BAUD RATE 1859 EC0F AD 18 A4 DELAY LDA CNTL30 ;START TIMER T2 1860 EC12 8D 08 A8 STA T2L 1861 EC15 AD 17 A4 LDA CNTH30 1862 EC18 8D 09 A8 DE1 STA T2H 1863 EC1B AD 0D A8 DE2 LDA IFR ;GET INT FLG FOR T2 1864 EC1E 29 20 AND #MT2 1865 EC20 F0 F9 BEQ DE2 ;TIME OUT ? 1866 EC22 60 RTS 1867 EC23 1868 EC23 ;DELAY HALF BIT TIME 1869 EC23 ;TOTAL TIME DIVIDED BY 2 1870 EC23 AD 17 A4 DEHALF LDA CNTH30 1871 EC26 4A LSR A ;LSB TO CARRY 1872 EC27 AD 18 A4 LDA CNTL30 1873 EC2A 6A ROR A ;SHIFT WITH CARRY 1874 EC2B 8D 08 A8 STA T2L 1875 EC2E AD 17 A4 LDA CNTH30 1876 EC31 4A LSR A 1877 EC32 8D 09 A8 STA T2H 1878 EC35 4C 1B EC JMP DE2 1879 EC38 1880 EC38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1881 EC38 A9 00 GETKD0 LDA #0 1882 EC3A 8D 77 A4 STA IDOT ;GO ANOTHER 90 DOTS 1883 EC3D 20 50 F0 JSR IPO0 ;OUTPUT 90 DOTS TO PRI (ZEROS) 1884 EC40 1885 EC40 ;GET A CHAR FROM KB SUBROUTINE 1886 EC40 ;FROM KB Y=ROW ,STBKEY=COLUMNS (STROBE) 1887 EC40 ;X=CTRL OR SHIFT ,OTHERWISE X=0 1888 EC40 20 EF EC GETKEY JSR ROONEK ;WAIT IF LAST KEY STILL DOWN 1889 EC43 20 2A ED GETKY JSR DEBKEY ;DEBOUNCE KEY (5 MSEC) 1890 EC46 ;CTRL OR SHIFT ? 1891 EC46 A9 8F LDA #$8F ;CHCK CLMN 5,6,7 1892 EC48 8D 80 A4 STA DRA2 1893 EC4B AD 82 A4 LDA DRB2 ;CHCK ROW 1 1894 EC4E 4A LSR A 1895 EC4F B0 20 BCS GETK1 ;IF=1 ,NO CTRL OR SHIFT 1896 EC51 A2 03 LDX #3 ;CLMN 5,6,7 (CNTRL,SHIFTL,SHIFTR) 1897 EC53 A9 7F LDA #$7F ;CTRL OR SHIFT ,SO WHICH ONE? 1898 EC55 38 GETK0 SEC 1899 EC56 6A ROR A 1900 EC57 48 PHA 1901 EC58 20 0B ED JSR ONEK2 ;LETS GET CTRL OR SHIFT INTO X 1902 EC5B AD 82 A4 LDA DRB2 1903 EC5E 4A LSR A ;ONLY ROW 1 1904 EC5F 90 06 3E 20 DB E2 JSR WRITAZ ;PRINT ADDR+1 , ADDR 1740 EB41 4C A1 E1 JMP COMIN 1741 EB44 1742 EB44 ;CLEAR DISPLAY & PRINTER POINTERS 1743 EB44 A9 00 CLR LDA #0 1744 EB46 8D 15 A4 STA CURPO2 ;DISP PNTR 1745 EB49 8D 16 A4 STA CURPOS ;PRINTR PNTR 1746 EB4C 60 RTS 1747 EB4D 1748 EB4D ;CLEAR CKSUM 1749 EB4D A9 00 CLRCK LDA #0 1750 EB4F 8D 1F A4 STA CKSUM+1 1751 EB52 8D 1E A4 STA CKSUM 1752 EB55 60 RTS 1753 EB56 1754 EB56 ;CODE FOR PAGE ZERO SIMULATION 1755 EB56 ;SUBR LDAY-SIMULATES LDA (N),Y INSTR WITHOUT PAG 0 1756 EB56 ;BY PUTTING INDIR ADDR INTO RAM & THEN EXEC LDA NM,Y 1757 EB56 A9 25 PCLLD LDA #SAVPC ;FOR DISASSEMBLER 1758 EB58 8C 2D A4 LDAY STY CPIY+3 ;SAVE Y 1759 EB5B A8 TAY 1760 EB5C B9 00 A4 LDA MONRAM,Y ;MONRAM=MONITOR RAM 1761 EB5F 8D 2B A4 STA LDIY+1 1762 EB62 B9 01 A4 LDA MONRAM+1,Y 1763 EB65 8D 2C A4 STA LDIY+2 1764 EB68 AC 2D A4 LDY CPIY+3 ;REST Y 1765 EB6B A9 B9 LDA #$B9 ;INST FOR LDA NM,Y 1766 EB6D 8D 2A A4 STA LDIY 1767 EB70 A9 60 LDA #$60 ;RTS 1768 EB72 8D 2D A4 STA LDIY+3 1769 EB75 4C 2A A4 JMP LDIY ;START EXECUTING LDA (),Y 1770 EB78 1771 EB78 ;SUBR STORE AT ADDR & CMP WITHOUT PAG 0 1772 EB78 ;REPLACES STA (ADDR),Y & CMP (ADDR),Y 1773 EB78 ;LOOK THAT ADDR & ADDR+1 ARE NOT ON PAG 0 1774 EB78 48 SADDR PHA 1775 EB79 AD 1C A4 LDA ADDR 1776 EB7C 8D 28 A4 STA STIY+1 1777 EB7F 8D 2B A4 STA CPIY+1 1778 EB82 AD 1D A4 LDA ADDR+1 1779 EB85 8D 29 A4 STA STIY+2 1780 EB88 8D 2C A4 STA CPIY+2 1781 EB8B A9 99 LDA #$99 ;STA INSTR 1782 EB8D 8D 27 A4 STA STIY 1783 EB90 A9 D9 LDA #$D9 ;CMP INSTR 1784 EB92 8D 2A A4 STA CPIY 1785 EB95 A9 60 LDA #$60 ;RTS 1786 EB97 8D 2D A4 STA LDIY+3 1787 EB9A 68 PLA 1788 EB9B 4C 27 A4 JMP STIY ;START EXECUTING STA (),Y 1789 EB9E 1790 EB9E ;PUSH X & Y WITHOUT CHANGING THE REGS 1791 EB9E 8D 2D A4 PHXY STA CPIY+3 ;SAVE ACC 1792 EBA1 98 TYA 1793 EBA2 48 PHA ;PUSH Y 1794 EBA3 8A TXA 1795 EBA4 48 PHA ;PUSH X 1796 EBA5 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM S` 1797 EBA8 AD 2D A4 LDA CPIY+3 1798 EBAB 60 RTS 1799 EBAC 1800 EBAC ;PULL X & Y WITHOUT CHANGING ACC 1801 EBAC ;IT HAS TO BE CALLED BY JSR & NOT BY JMP INSTR 1802 EBAC ;SINCE IT SWAPS THE STACK 1803 EBAC 8D 2D A4 PLXY STA CPIY+3 1804 EBAF 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM` 1805 EBB2 68 PLA 1806 EBB3 AA TAX ;PULL X 1807 EBB4 68 PLA 1808 EBB5 A8 TAY ;PULL Y 1809 EBB6 AD 2D A4 LDA CPIY+3 1810 EBB9 60 RTS 1811 EBBA 1812 EBBA ;SWAP STACK 1813 EBBA BA SWSTAK TSX 1814 EBBB A9 02 LDA #2 1815 EBBD 48 SWST1 PHA 1816 EBBE BD 06 01 LDA $0106,X ;GET PCH OR PCL 1817 EBC1 BC 04 01 LDY $0104,X ;GET Y OR X REGS 1818 EBC4 9D 04 01 STA $0104,X 1819 EBC7 98 TYA 1820 EBC8 9D 06 01 STA $0106,X 1821 EBCB CA DEX 1822 EBCC 68 PLA 1823 EBCD 38 SEC 1824 EBCE E9 01 SBC #1 1825 EBD0 D0 EB BNE SWST1 1826 EBD2 BD 08 01 LDA $0108,X ;RESTORE Y & X FROM STACK 1827 EBD5 A8 TAY 1828 EBD6 BD 07 01 LDA $0107,X 1829 EBD9 AA TAX 1830 EBDA 60 RTS 1831 EBDB 1832 EBDB ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1833 EBDB ;GET A CHAR FROM TTY SUBR INTO ACC ,SAVES X 1834 EBDB 8A GETTTY TXA ;SAVE X 1835 EBDC 48 PHA 1836 EBDD A2 07 LDX #$07 ;SET UP FOR 8 BIT CNT 1837 EBDF 8E 2A A4 STX CPIY ;CLR MSB 1838 EBE2 2C 00 A8 GET1 BIT DRB ;A^M , PB6->V 1839 EBE5 70 FB BVS GET1 ;WAIT FOR START BIT 1840 EBE7 20 0F EC JSR DELAY ;DELAY 1 BIT 1841 EBEA 20 23 EC JSR DEHALF ;DELAY 1/2 BIT TIME 1842 EBED AD 00 A8 GET3 LDA DRB ;GET 8 BITS 1843 EBF0 29 40 AND #$40 ;MASK OFF OTHER BITS,ONLY PB6 1844 EBF2 4E 2A A4 LSR CPIY ;SHIFT RIGHT CHARACTER 1845 EBF5 0D 2A A4 ORA CPIY 1846 EBF8 8D 2A A4 STA CPIY 1847 EBFB 20 0F EC JSR DELAY ;DELAY 1 BIT TIME 1848 EBFE CA DEX 1849 EBFF D0 EC BNE GET3 ;GET NEXT BIT 1850 EC01 20 0F EC JSR DELAY ;DO NOT CARE FOR PARITY BIT 1851 EC04 20 23 EC JSR DEHALF ;UNTIL WE GET BACK TO ONE AGAIN 1852 EC07 68 PLA ;RESTORE X 1853 EC08 AA TAX 1854 EC09 AD 2A A4 LDA CPIY 1855 EC0C 29 7F AND #$7F ;CLEAR PARITY BIT 1856 EC0E 60 RTS 1857 EC0F 1858 EC0F ;DELAY 1 BIT TIME AS GIVEN BY BAUD RATE 1859 EC0F AD 18 A4 DELAY LDA CNTL30 ;START TIMER T2 1860 EC12 8D 08 A8 STA T2L 1861 EC15 AD 17 A4 LDA CNTH30 1862 EC18 8D 09 A8 DE1 STA T2H 1863 EC1B AD 0D A8 DE2 LDA IFR ;GET INT FLG FOR T2 1864 EC1E 29 20 AND #MT2 1865 EC20 F0 F9 BEQ DE2 ;TIME OUT ? 1866 EC22 60 RTS 1867 EC23 1868 EC23 ;DELAY HALF BIT TIME 1869 EC23 ;TOTAL TIME DIVIDED BY 2 1870 EC23 AD 17 A4 DEHALF LDA CNTH30 1871 EC26 4A LSR A ;LSB TO CARRY 1872 EC27 AD 18 A4 LDA CNTL30 1873 EC2A 6A ROR A ;SHIFT WITH CARRY 1874 EC2B 8D 08 A8 STA T2L 1875 EC2E AD 17 A4 LDA CNTH30 1876 EC31 4A LSR A 1877 EC32 8D 09 A8 STA T2H 1878 EC35 4C 1B EC JMP DE2 1879 EC38 1880 EC38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1881 EC38 A9 00 GETKD0 LDA #0 1882 EC3A 8D 77 A4 STA IDOT ;GO ANOTHER 90 DOTS 1883 EC3D 20 50 F0 JSR IPO0 ;OUTPUT 90 DOTS TO PRI (ZEROS) 1884 EC40 1885 EC40 ;GET A CHAR FROM KB SUBROUTINE 1886 EC40 ;FROM KB Y=ROW ,STBKEY=COLUMNS (STROBE) 1887 EC40 ;X=CTRL OR SHIFT ,OTHERWISE X=0 1888 EC40 20 EF EC GETKEY JSR ROONEK ;WAIT IF LAST KEY STILL DOWN 1889 EC43 20 2A ED GETKY JSR DEBKEY ;DEBOUNCE KEY (5 MSEC) 1890 EC46 ;CTRL OR SHIFT ? 1891 EC46 A9 8F LDA #$8F ;CHCK CLMN 5,6,7 1892 EC48 8D 80 A4 STA DRA2 1893 EC4B AD 82 A4 LDA DRB2 ;CHCK ROW 1 1894 EC4E 4A LSR A 1895 EC4F B0 20 BCS GETK1 ;IF=1 ,NO CTRL OR SHIFT 1896 EC51 A2 03 LDX #3 ;CLMN 5,6,7 (CNTRL,SHIFTL,SHIFTR) 1897 EC53 A9 7F LDA #$7F ;CTRL OR SHIFT ,SO WHICH ONE? 1898 EC55 38 GETK0 SEC 1899 EC56 6A ROR A 1900 EC57 48 PHA 1901 EC58 20 0B ED JSR ONEK2 ;LETS GET CTRL OR SHIFT INTO X 1902 EC5B AD 82 A4 LDA DRB2 1903 EC5E 4A LSR A ;ONLY ROW 1 1904 EC5F 90 06 3E 20 DB E2 JSR WRITAZ ;PRINT ADDR+1 , ADDR 1740 EB41 4C A1 E1 JMP COMIN 1741 EB44 1742 EB44 ;CLEAR DISPLAY & PRINTER POINTERS 1743 EB44 A9 00 CLR LDA #0 1744 EB46 8D 15 A4 STA CURPO2 ;DISP PNTR 1745 EB49 8D 16 A4 STA CURPOS ;PRINTR PNTR 1746 EB4C 60 RTS 1747 EB4D 1748 EB4D ;CLEAR CKSUM 1749 EB4D A9 00 CLRCK LDA #0 1750 EB4F 8D 1F A4 STA CKSUM+1 1751 EB52 8D 1E A4 STA CKSUM 1752 EB55 60 RTS 1753 EB56 1754 EB56 ;CODE FOR PAGE ZERO SIMULATION 1755 EB56 ;SUBR LDAY-SIMULATES LDA (N),Y INSTR WITHOUT PAG 0 1756 EB56 ;BY PUTTING INDIR ADDR INTO RAM & THEN EXEC LDA NM,Y 1757 EB56 A9 25 PCLLD LDA #SAVPC ;FOR DISASSEMBLER 1758 EB58 8C 2D A4 LDAY STY CPIY+3 ;SAVE Y 1759 EB5B A8 TAY 1760 EB5C B9 00 A4 LDA MONRAM,Y ;MONRAM=MONITOR RAM 1761 EB5F 8D 2B A4 STA LDIY+1 1762 EB62 B9 01 A4 LDA MONRAM+1,Y 1763 EB65 8D 2C A4 STA LDIY+2 1764 EB68 AC 2D A4 LDY CPIY+3 ;REST Y 1765 EB6B A9 B9 LDA #$B9 ;INST FOR LDA NM,Y 1766 EB6D 8D 2A A4 STA LDIY 1767 EB70 A9 60 LDA #$60 ;RTS 1768 EB72 8D 2D A4 STA LDIY+3 1769 EB75 4C 2A A4 JMP LDIY ;START EXECUTING LDA (),Y 1770 EB78 1771 EB78 ;SUBR STORE AT ADDR & CMP WITHOUT PAG 0 1772 EB78 ;REPLACES STA (ADDR),Y & CMP (ADDR),Y 1773 EB78 ;LOOK THAT ADDR & ADDR+1 ARE NOT ON PAG 0 1774 EB78 48 SADDR PHA 1775 EB79 AD 1C A4 LDA ADDR 1776 EB7C 8D 28 A4 STA STIY+1 1777 EB7F 8D 2B A4 STA CPIY+1 1778 EB82 AD 1D A4 LDA ADDR+1 1779 EB85 8D 29 A4 STA STIY+2 1780 EB88 8D 2C A4 STA CPIY+2 1781 EB8B A9 99 LDA #$99 ;STA INSTR 1782 EB8D 8D 27 A4 STA STIY 1783 EB90 A9 D9 LDA #$D9 ;CMP INSTR 1784 EB92 8D 2A A4 STA CPIY 1785 EB95 A9 60 LDA #$60 ;RTS 1786 EB97 8D 2D A4 STA LDIY+3 1787 EB9A 68 PLA 1788 EB9B 4C 27 A4 JMP STIY ;START EXECUTING STA (),Y 1789 EB9E 1790 EB9E ;PUSH X & Y WITHOUT CHANGING THE REGS 1791 EB9E 8D 2D A4 PHXY STA CPIY+3 ;SAVE ACC 1792 EBA1 98 TYA 1793 EBA2 48 PHA ;PUSH Y 1794 EBA3 8A TXA 1795 EBA4 48 PHA ;PUSH X 1796 EBA5 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM S` 1797 EBA8 AD 2D A4 LDA CPIY+3 1798 EBAB 60 RTS 1799 EBAC 1800 EBAC ;PULL X & Y WITHOUT CHANGING ACC 1801 EBAC ;IT HAS TO BE CALLED BY JSR & NOT BY JMP INSTR 1802 EBAC ;SINCE IT SWAPS THE STACK 1803 EBAC 8D 2D A4 PLXY STA CPIY+3 1804 EBAF 20 BA EB JSR SWSTAK ;SWAP X , Y WITH RTRN ADDR FROM` 1805 EBB2 68 PLA 1806 EBB3 AA TAX ;PULL X 1807 EBB4 68 PLA 1808 EBB5 A8 TAY ;PULL Y 1809 EBB6 AD 2D A4 LDA CPIY+3 1810 EBB9 60 RTS 1811 EBBA 1812 EBBA ;SWAP STACK 1813 EBBA BA SWSTAK TSX 1814 EBBB A9 02 LDA #2 1815 EBBD 48 SWST1 PHA 1816 EBBE BD 06 01 LDA $0106,X ;GET PCH OR PCL 1817 EBC1 BC 04 01 LDY $0104,X ;GET Y OR X REGS 1818 EBC4 9D 04 01 STA $0104,X 1819 EBC7 98 TYA 1820 EBC8 9D 06 01 STA $0106,X 1821 EBCB CA DEX 1822 EBCC 68 PLA 1823 EBCD 38 SEC 1824 EBCE E9 01 SBC #1 1825 EBD0 D0 EB BNE SWST1 1826 EBD2 BD 08 01 LDA $0108,X ;RESTORE Y & X FROM STACK 1827 EBD5 A8 TAY 1828 EBD6 BD 07 01 LDA $0107,X 1829 EBD9 AA TAX 1830 EBDA 60 RTS 1831 EBDB 1832 EBDB ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1833 EBDB ;GET A CHAR FROM TTY SUBR INTO ACC ,SAVES X 1834 EBDB 8A GETTTY TXA ;SAVE X 1835 EBDC 48 PHA 1836 EBDD A2 07 LDX #$07 ;SET UP FOR 8 BIT CNT 1837 EBDF 8E 2A A4 STX CPIY ;CLR MSB 1838 EBE2 2C 00 A8 GET1 BIT DRB ;A^M , PB6->V 1839 EBE5 70 FB BVS GET1 ;WAIT FOR START BIT 1840 EBE7 20 0F EC JSR DELAY ;DELAY 1 BIT 1841 EBEA 20 23 EC JSR DEHALF ;DELAY 1/2 BIT TIME 1842 EBED AD 00 A8 GET3 LDA DRB ;GET 8 BITS 1843 EBF0 29 40 AND #$40 ;MASK OFF OTHER BITS,ONLY PB6 1844 EBF2 4E 2A A4 LSR CPIY ;SHIFT RIGHT CHARACTER 1845 EBF5 0D 2A A4 ORA CPIY 1846 EBF8 8D 2A A4 STA CPIY 1847 EBFB 20 0F EC JSR DELAY ;DELAY 1 BIT TIME 1848 EBFE CA DEX 1849 EBFF D0 EC BNE GET3 ;GET NEXT BIT 1850 EC01 20 0F EC JSR DELAY ;DO NOT CARE FOR PARITY BIT 1851 EC04 20 23 EC JSR DEHALF ;UNTIL WE GET BACK TO ONE AGAIN 1852 EC07 68 PLA ;RESTORE X 1853 EC08 AA TAX 1854 EC09 AD 2A A4 LDA CPIY 1855 EC0C 29 7F AND #$7F ;CLEAR PARITY BIT 1856 EC0E 60 RTS 1857 EC0F 1858 EC0F ;DELAY 1 BIT TIME AS GIVEN BY BAUD RATE 1859 EC0F AD 18 A4 DELAY LDA CNTL30 ;START TIMER T2 1860 EC12 8D 08 A8 STA T2L 1861 EC15 AD 17 A4 LDA CNTH30 1862 EC18 8D 09 A8 DE1 STA T2H 1863 EC1B AD 0D A8 DE2 LDA IFR ;GET INT FLG FOR T2 1864 EC1E 29 20 AND #MT2 1865 EC20 F0 F9 BEQ DE2 ;TIME OUT ? 1866 EC22 60 RTS 1867 EC23 1868 EC23 ;DELAY HALF BIT TIME 1869 EC23 ;TOTAL TIME DIVIDED BY 2 1870 EC23 AD 17 A4 DEHALF LDA CNTH30 1871 EC26 4A LSR A ;LSB TO CARRY 1872 EC27 AD 18 A4 LDA CNTL30 1873 EC2A 6A ROR A ;SHIFT WITH CARRY 1874 EC2B 8D 08 A8 STA T2L 1875 EC2E AD 17 A4 LDA CNTH30 1876 EC31 4A LSR A 1877 EC32 8D 09 A8 STA T2H 1878 EC35 4C 1B EC JMP DE2 1879 EC38 1880 EC38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1881 EC38 A9 00 GETKD0 LDA #0 1882 EC3A 8D 77 A4 STA IDOT ;GO ANOTHER 90 DOTS 1883 EC3D 20 50 F0 JSR IPO0 ;OUTPUT 90 DOTS TO PRI (ZEROS) 1884 EC40 1885 EC40 ;GET A CHAR FROM KB SUBROUTINE 1886 EC40 ;FROM KB Y=ROW ,STBKEY=COLUMNS (STROBE) 1887 EC40 ;X=CTRL OR SHIFT ,OTHERWISE X=0 1888 EC40 20 EF EC GETKEY JSR ROONEK ;WAIT IF LAST KEY STILL DOWN 1889 EC43 20 2A ED GETKY JSR DEBKEY ;DEBOUNCE KEY (5 MSEC) 1890 EC46 ;CTRL OR SHIFT ? 1891 EC46 A9 8F LDA #$8F ;CHCK CLMN 5,6,7 1892 EC48 8D 80 A4 STA DRA2 1893 EC4B AD 82 A4 LDA DRB2 ;CHCK ROW 1 1894 EC4E 4A LSR A 1895 EC4F B0 20 BCS GETK1 ;IF=1 ,NO CTRL OR SHIFT 1896 EC51 A2 03 LDX #3 ;CLMN 5,6,7 (CNTRL,SHIFTL,SHIFTR) 1897 EC53 A9 7F LDA #$7F ;CTRL OR SHIFT ,SO WHICH ONE? 1898 EC55 38 GETK0 SEC 1899 EC56 6A ROR A 1900 EC57 48 PHA 1901 EC58 20 0B ED JSR ONEK2 ;LETS GET CTRL OR SHIFT INTO X 1902 EC5B AD 82 A4 LDA DRB2 1903 EC5E 4A LSR A ;ONLY ROW 1 1904 EC5F 90 06 1054 E66D 20 13 EA JSR CRLOW 1055 E670 20 3E E8 JSR BLANK 1056 E673 B9 2E A4 LDA HIST,Y ;OUTPUT ADDRESS OF ENTRY 1057 E676 20 46 EA JSR NUMA 1058 E679 B9 2F A4 LDA HIST+1,Y 1059 E67C 20 46 EA JSR NUMA 1060 E67F 20 88 E6 JSR NHIS ;UPDATE POINTER 1061 E682 CE 29 A4 DEC STIY+2 1062 E685 D0 E3 BNE SH11 1063 E687 60 RTS 1064 E688 1065 E688 ;UPDATE HISTORY POINTER (PART OF H) 1066 E688 C8 NHIS INY 1067 E689 C8 INY 1068 E68A C0 0A CPY #10 1069 E68C D0 02 BNE NH1 1070 E68E A0 00 LDY #0 ;WRAPAROUND AT 10 1071 E690 8C 14 A4 NH1 STY HISTP 1072 E693 60 RTS 1073 E694 1074 E694 ;***** 3 COMMAND-VERIFY TAPES ***** 1075 E694 ;VERIFY CKSUM OF BLOCKS 1076 E694 20 48 E8 VECKSM JSR WHEREI ;GET THE FILE 1077 E697 20 93 E9 JSR INALL ;CHCK OBJ OR SOURCE 1078 E69A C9 0D CMP #CR ;FIRST CHR IS IF OBJ 1079 E69C D0 0E BNE VECK2 ;ASSUME SOURCE CODE 1080 E69E 20 93 E9 VECK1 JSR INALL ;OBJECT FILE 1081 E6A1 C9 3B CMP #SEMICOLON 1082 E6A3 D0 F9 BNE VECK1 ;IGNORE ALL CHARS BEFORE ';' 1083 E6A5 20 93 E9 JSR INALL 1084 E6A8 4C 60 FF JMP PAT20 1085 E6AB EA NOP 1086 E6AC 20 93 E9 VECK2 JSR INALL ;IT IS TEXT 1087 E6AF C9 0D CMP #CR 1088 E6B1 D0 F9 BNE VECK2 1089 E6B3 20 93 E9 JSR INALL ;NEED TO TO FINISH 1090 E6B6 C9 0D CMP #CR 1091 E6B8 D0 F2 BNE VECK2 1092 E6BA 4C 20 E5 JMP DU13 ;CLOSE FILE, IT IS OKAY 1093 E6BD 1094 E6BD ;***** 1 COMMAND-TOGGLE TAPE 1 CONTROL ***** 1095 E6BD AD 00 A8 TOGTA1 LDA DRB 1096 E6C0 49 10 EOR #$10 ;INVERT PB4 1097 E6C2 8D 00 A8 STA DRB 1098 E6C5 29 10 AND #$10 1099 E6C7 F0 28 BEQ BRK3 ;IF 0 TAPE CNTRL IS ON 1100 E6C9 D0 2F BNE BRK4 ;IF $10 TAPE CNTRL IS OFF 1101 E6CB 1102 E6CB ;***** 2 COMMAND-TOGGLE TAPE 2 CONTROL ***** 1103 E6CB AD 00 A8 TOGTA2 LDA DRB 1104 E6CE 49 20 EOR #$20 ;INVERT PB5 1105 E6D0 8D 00 A8 STA DRB 1106 E6D3 29 20 AND #$20 1107 E6D5 F0 1A BEQ BRK3 1108 E6D7 D0 21 BNE BRK4 1109 E6D9 1110 E6D9 ;***** V COMMAND-TOGGLE REGISTER DISP FLG ***** 1111 E6D9 ;DISPLAY REGIST BEFORE EXEC 1112 E6D9 A2 0E REGT LDX #REGF 1113 E6DB D0 0A BNE TOGL 1114 E6DD 1115 E6DD ;****** Z COMMAND-TOGGLE DIS TRACE FLG ***** 1116 E6DD ;DISPL NEXT INSTR BEFORE EXEC 1117 E6DD A2 0F TRACE LDX #DISFLG 1118 E6DF D0 06 BNE TOGL 1119 E6E1 1120 E6E1 ;***** \ COMMAND-TOGGLE PRINTER FLAG ***** 1121 E6E1 A2 11 PRITR LDX #PRIFLG 1122 E6E3 D0 02 BNE TOGL 1123 E6E5 1124 E6E5 ;***** 4 COMMAND-TOGGLE SOFT BRK ENABL FLG ***** 1125 E6E5 A2 10 BRKK LDX #BKFLG 1126 E6E7 1127 E6E7 BD 00 A4 TOGL LDA MONRAM,X ;LOAD FLAG 1128 E6EA F0 0A BEQ TOGL1 ;FLAG IS OFF ,SO TURN ON 1129 E6EC A9 00 LDA #0 ;FLAG IS ON ,SO TURN OFF 1130 E6EE 9D 00 A4 STA MONRAM,X 1131 E6F1 A0 24 BRK3 LDY #M7-M1 ;PRINT "OFF" 1132 E6F3 4C AF E7 BRK2 JMP KEP 1133 E6F6 38 TOGL1 SEC ;TURN FLAG ON BY SETTING NON-ZERO 1134 E6F7 7E 00 A4 ROR MONRAM,X ;FLAG IS ON MSB 1135 E6FA A0 21 BRK4 LDY #M6-M1 ;PRINT "ON" 1136 E6FC D0 F5 BNE BRK2 1137 E6FE 1138 E6FE ;***** # COMMAND-CLEAR ALL BREAKS ***** 1139 E6FE A9 00 CLRBK LDA #0 ;STORE ZEROS INTO BRKPT LIST 1140 E700 A2 07 LDX #7 1141 E702 9D 00 01 RS20 STA BKS,X 1142 E705 CA DEX 1143 E706 10 FA BPL RS20 1144 E708 30 E7 BMI BRK3 ;PRINT "OFF" 1145 E70A 1146 E70A ;***** K COMMAND-DISASSEMBLE MEMORY ***** 1147 E70A A9 2A KDISA LDA #'*' ;GET START ADDRESS 1148 E70C 20 7A E9 JSR OUTPUT 1149 E70F 20 AE EA JSR ADDIN 1150 E712 B0 F6 BCS KDISA ;IF ERROR DO IT AGAIN 1151 E714 20 D7 E5 JSR CGPC0 ;GET IT INTO PROG CNTR 1152 E717 20 37 E8 JSR PSL1 ;PRINT "/" 1153 E71A 20 85 E7 JSR GCNT ;GET COUNT 1154 E71D 20 24 EA JSR CRCK 1155 E720 4C 2B E7 JMP JD2 1156 E723 20 07 E9 JD1 JSR RCHEK ;SEE IF HE WANTS TO INTERRUPT 1157 E726 20 90 E7 JSR DONE 1158 E729 F0 17 BEQ JD4 1159 E72B 20 6C F4 JD2 JSR DISASM ;GO TO DISASSEMBLER 1160 E72E AD 25 A4 LDA SAVPC ;POINT TO NEXT INSTRUC LOCAT 1161 E731 38 SEC ;ONE MORE TO PROG CNTR 1162 E732 65 EA ADC LENGTH 1163 E734 8D 25 A4 STA SAVPC 1164 E737 90 03 BCC JD3 1165 E739 EE 26 A4 INC SAVPC+1 1166 E73C 20 24 EA JD3 JSR CRCK ; 1167 E73F 4C 23 E7 JMP JD1 1168 E742 60 JD4 RTS 1169 E743 1170 E743 ;INITIALIZATION TABLE FOR 6522 1171 E743 340037FF25FFINTAB1 .DB $34,$00,$37,$FF,$25,$FF,$25,$FF 1171 E749 25FF 1172 E74B FF FF 00 00 .DB $FF,$FF,$00,T1I+T2I 1173 E74F E1 FF 7F .DB MOFF+PRST+SP12,$FF,$7F 1174 E752 ;INITIALIZATION TABLE FOR 6532 1175 E752 FF FF 00 00 INTAB2 .DB $FF,$FF,$00,$00 1176 E756 ;INITIALIZATION TABLE FOR MONITOR RAM 1177 E756 7BE054E105EFINTAB3 .DW NMIV3,IRQV3,OUTDIS 1178 E75C C70802CA0380 .DB $C7,$08,$02,$CA,$03,$80,$00,$00 1178 E762 0000 1179 E764 00800D0D0000 .DB $00,$80,$0D,$0D,$00,$00,$00 1179 E76A 00 1180 E76B ;SEE IF WE HIT A SOFT BREAKPOINT (PART OF NMV3) 1181 E76B A2 07 CKB LDX #7 ;COMPARE BRKPT LIST TO TRAP ADDR 1182 E76D BD 00 01 CKB2 LDA BKS,X ;GET ADDRESS OF NEXT BREAKPOINT 1183 E770 CA DEX 1184 E771 CD 26 A4 CMP SAVPC+1 ;COMPARE TO SAVED PROGRAM COUNTER 1185 E774 D0 0A BNE CKB1 1186 E776 BD 00 01 LDA BKS,X 1187 E779 CD 25 A4 CMP SAVPC 1188 E77C D0 02 BNE CKB1 ;NO MATCH SO TRY NEXT BREAKPOINT 1189 E77E 38 SEC ;MATCH-SET MATCH FLAG 1190 E77F 60 RTS 1191 E780 CA CKB1 DEX 1192 E781 10 EA BPL CKB2 ;MORE TO GO 1193 E783 18 CLC ;NO MATCH -RESET MATCH FLAG 1194 E784 60 RTS 1195 E785 1196 E785 ;GET # OF LINES COUNT FOR GO-COMMAND,LIST-COMM 1197 E785 20 5D EA GCNT JSR RD2 1198 E788 90 02 BCC GCN1 1199 E78A 49 0C EOR #$0C ;---> $2C ,---> $01 1200 E78C 8D 19 A4 GCN1 STA COUNT 1201 E78F 60 RTS 1202 E790 1203 E790 ;CHECK IF COUNT HAS REACHED ZERO 1204 E790 ;COUNT=$2C MEANS FOREVER 1205 E790 AD 19 A4 DONE LDA COUNT ;IF COUNT=0 WE ARE DONE 1206 E793 C9 2C CMP #$2C ;THIS MEANS FOR EVER 1207 E795 F0 09 BEQ DON1 ;SET ACC DIFF FROM ZERO 1208 E797 F8 SED ;DECREMENT COUNT IN DECIMAL 1209 E798 38 SEC 1210 E799 E9 01 SBC #1 1211 E79B D8 CLD 1212 E79C 8D 19 A4 STA COUNT 1213 E79F 60 RTS 1214 E7A0 A9 2C DON1 LDA #$2C 1215 E7A2 60 RTS 1216 E7A3 1217 E7A3 A0 00 FROM LDY #0 ;PRINT "FR=" 1218 E7A5 F0 02 BEQ TO1 1219 E7A7 1220 E7A7 A0 05 TO LDY #M3-M1 ;PRINT "TO=" 1221 E7A9 20 AF E7 TO1 JSR KEP 1222 E7AC 4C B1 EA JMP ADDNE ;GET ADDRESS 1223 E7AF 1224 E7AF ;PRINT MSG POINTED TO BY Y REG 1225 E7AF B9 00 E0 KEP LDA M1,Y 1226 E7B2 48 PHA 1227 E7B3 29 7F AND #$7F ;STRIP OFF MSB 1228 E7B5 20 7A E9 JSR OUTPUT 1229 E7B8 C8 INY 1230 E7B9 68 PLA 1231 E7BA 10 F3 BPL KEP ;MSB =1 ? 1232 E7BC 60 RTS 1233 E7BD 1234 E7BD ;PRINT "*" ,BUT NOT TO TAPE RECORDER, NOR LOADING.... 1235 E7BD ;PAPER TAPE OR TO DISPLAY 1236 E7BD AD 12 A4 PROMPT LDA INFLG ;WHICH DEV (FOR EDITOR) 1237 E7C0 C9 54 CMP #'T' ;NO PROMPT IF "T" OR "L" 1238 E7C2 4C EF FE JMP PATC11 1239 E7C5 20 42 E8 PROMP1 JSR TTYTST ;PROMPT ONLY TO TTY 1240 E7C8 D0 05 BNE PR2 ;BRANCH ON KB 1241 E7CA A9 2A LDA #'*' 1242 E7CC 4C 7A E9 PR1 JMP OUTPUT ;ONLY TO TERMIN 1243 E7CF A9 0D PR2 LDA #CR ;CLR DISP 1244 E7D1 4C 05 EF JMP OUTDIS 1245 E7D4 1246 E7D4 A9 3F QM LDA #'?' ;PRINT "?" 1247 E7D6 D0 F4 BNE PR1 1248 E7D8 1249 E7D8 A9 3D EQUAL LDA #'=' ;PRINT "=" 1250 E7DA D0 F0 BNE PR1 1251 E7DC 1252 E7DC ;ON DELETE KEY OUTPUT SLASH IF TTY & .... 1253 E7DC ;BACK UP CURSOR IF KB (MAY NEED SCROLLING) 1254 E7DC 20 42 E8 PSLS JSR TTYTST ;TTY OR KB ? 1255 E7DF F0 56 BEQ PSL1 ;BRANCH ON TTY 1256 E7E1 20 9E EB JSR PHXY ;SAVE X,Y 1257 E7E4 CE 15 A4 DEC CURPO2 ;DECR DISP PNTR 1258 E7E7 AE 15 A4 LDX CURPO2 1259 E7EA E0 14 CPX #20 ;IF MORE THAN 20 JUST SCROLL THEM 1260 E7EC B0 0D BCS PSL0 1261 E7EE A9 20 LDA #' ' ;< 20 ,SO CLR CUR 1262 E7F0 20 02 EF JSR OUTDP1 1263 E7F3 CE 15 A4 DEC CURPO2 1264 E7F6 4C 02 E8 JMP PSL00 1265 E7F9 EA NOP 1266 E7FA EA NOP 1267 E7FB 20 F8 FE PSL0 JSR PATC12 ;CLR PRIFLG 1268 E7FE CA DEX ;ONE CHR LESS 1269 E7FF 20 2F EF JSR OUTD2A ;SCROLL THEM 1270 E802 AD 15 A4 PSL00 LDA CURPO2 ;DISBUF---> PRIBUFF 1271 E805 C9 15 CMP #21 1272 E807 90 13 BCC PSL0B 1273 E809 C9 29 CMP #41 1274 E80B 90 07 BCC PSL0A 1275 E80D A0 28 LDY #40 ;CHR 40-59 1276 E80F E9 28 SBC #40 1277 E811 4C 1E E8 JMP PSL0C 1278 E814 A0 14 PSL0A LDY #20 ;CHR 20-39 1279 E816 38 SEC 1280 E817 E9 14 SBC #20 1281 E819 4C 1E E8 JMP PSL0C 1282 E81C A0 00 PSL0B LDY #0 ;CHR 00-19 1283 E81E 8D 16 A4 PSL0C STA CURPOS 1284 E821 A2 00 LDX #0 1285 E823 B9 38 A4 PSL0D LDA DIBUFF,Y ;TRANSFER THEM 1286 E826 9D 60 A4 STA IBUFM,X 1287 E829 E8 INX 1288 E82A C8 INY 1289 E82B EC 16 A4 CPX CURPOS ;PRI PNTR 1290 E82E 90 F3 BCC PSL0D 1291 E830 20 38 F0 JSR OUTPR ;CLR PRI BUFF TO THE RIGHT 1292 E833 20 AC EB JSR PLXY ;RESTORE X,Y 1293 E836 60 RTS 1294 E837 A9 2F PSL1 LDA #'/' ;PRINT "/" 1295 E839 D0 91 BNE PR1 1296 E83B 1297 E83B 20 3E E8 BLANK2 JSR BLANK ;TWO SPACES 1298 E83E A9 20 BLANK LDA #' ' 1299 E840 D0 8A BNE PR1 1300 E842 1301 E842 ;CHECK TTY/KBD SWITCH (Z=1 FOR TTY) 1302 E842 A9 08 TTYTST LDA #$08 ;CHECK IF TTY OR KB 1303 E844 2C 00 A8 BIT DRB ;TTY OR KB SWICTH =PB3 1304 E847 60 RTS 1305 E848 1306 E848 ;WHERE IS INPUT COMING FROM? 1307 E848 ;SET UP FOR INPUT ACTIVE DEVICE 1308 E848 A0 2A WHEREI LDY #M9-M1 ;PRINT "IN" 1309 E84A 20 70 E9 JSR KEPR ;OUTPUT MSG AND INPUT CHR 1310 E84D 8D 12 A4 STA INFLG 1311 E850 C9 54 CMP #'T' 1312 E852 D0 08 BNE WHE1 1313 E854 A2 00 LDX #0 ;FOR INPUT FILE FLG 1314 E856 20 A2 E8 JSR FNAM ;OPEN FILE FOR TAPE (1 OR 2) 1315 E859 4C 2F E3 JMP LOADTA ;GET FILE 1316 E85C C9 4B WHE1 CMP #'K' ;TAPE WITH KIM FORMAT 1317 E85E D0 08 BNE WHE2 1318 E860 A2 00 LDX #0 ;FOR INPUT FILE FLG 1319 E862 20 A2 E8 JSR FNAM ;OPEN FILE FOR TAP (1 OR 2) 1320 E865 4C A4 E3 JMP LOADKI ;THE WHOLE FILE 1321 E868 C9 55 WHE2 CMP #'U' ;USER RTN? 1322 E86A D0 04 BNE WHE3 1323 E86C 18 CLC ;SET FLG FOR INITIALIZATION 1324 E86D 6C 08 01 JMP (UIN) ;USER INPUT SETUP 1325 E870 60 WHE3 RTS 1326 E871 1327 E871 ;WHERE IS OUTPUT GOING TO? 1328 E871 ;SET UP FOR OUTPUT ACTIVE DEVICE 1329 E871 A0 2D WHEREO LDY #M10-M1 ;PRINT "OUT" 1330 E873 20 70 E9 JSR KEPR ;OUTPUT MSG & INPUT CHR 1331 E876 8D 13 A4 STA OUTFLG ;DEVICE FLG 1332 E879 ;TAPES 1333 E879 C9 54 CMP #'T' 1334 E87B D0 08 BNE WHRO1 1335 E87D A2 01 LDX #1 ;FOR OUTPUT FILE FLG 1336 E87F 20 A2 E8 JSR FNAM ;FILENAME & TAPE (1 OR 2) 1337 E882 4C 6F E5 JMP DUMPTA ;INITIALIZE FILE 1338 E885 C9 4B WHRO1 CMP #'K' ;TAPE WITH KIM FORMAT 1339 E887 D0 05 BNE WHRO2 1340 E889 A2 01 LDX #1 ;FOR OUTPUT FILE FLG 1341 E88B 4C A2 E8 JMP FNAM 1342 E88E ;PRINTER 1343 E88E C9 50 WHRO2 CMP #'P' ;PRINTER? 1344 E890 D0 05 BNE WHRO3 1345 E892 A9 0D LDA #CR ;OUTPUT LAST LINE IF ON 1346 E894 4C 00 F0 JMP OUTPRI ;& CLEAR PRINTER PTR 1347 E897 ;USER SET UP 1348 E897 C9 55 WHRO3 CMP #'U' ;USR RTN? 1349 E899 D0 04 BNE WHRO4 1350 E89B 18 CLC ;CLR FLG FOR INITIALIZATION 1351 E89C 6C 0A 01 JMP (UOUT) ;USER OUTPUT SETUP 1352 E89F ;ANY OTHER 1353 E89F 4C 13 EA WHRO4 JMP CRLOW 1354 E8A2 1355 E8A2 ;GET FILE NAME & TAPE UNIT 1356 E8A2 20 9E EB FNAM JSR PHXY ;SAVE IN/OUT FLG (X) 1357 E8A5 20 CF E8 JSR NAMO ;GET NAME 1358 E8A8 A0 50 WHICHT LDY #TMSG2-M1 ;PRINT "T=" 1359 E8AA 20 70 E9 JSR KEPR ;OUTPUT MSG & INPUT CHR 1360 E8AD C9 0D CMP #CR 1361 E8AF D0 02 BNE TAP1 1362 E8B1 A9 31 LDA #'1' ; ==> TAPE 1 1363 E8B3 38 TAP1 SEC 1364 E8B4 E9 31 SBC #'1' ;SUBTRACT 31 1365 E8B6 30 04 BMI TAP2 ;ONLY 1,2 OK 1366 E8B8 C9 02 CMP #2 1367 E8BA 30 06 BMI TAP3 ;OK 1368 E8BC 20 D4 E7 TAP2 JSR QM ;ERROR 1369 E8BF 4C A8 E8 JMP WHICHT 1370 E8C2 20 AC EB TAP3 JSR PLXY ;IN/OUT FLG 1371 E8C5 9D 34 A4 STA TAPIN,X ;IF X=0 --> TAPIN (TAPE 1 OR 2) 1372 E8C8 20 83 FE JSR CUREAD ;GET ANYTHING 1373 E8CB 20 24 EA JSR CRCK ; 1374 E8CE 60 RTS ;IF X=1 --> TAPOUT (TAPE 1 OR 2) 1375 E8CF 1376 E8CF ;GET FILE NAME 1377 E8CF A0 4D NAMO LDY #TMSG1-M1 ;PRINT "F=" 1378 E8D1 20 AF E7 3E 20 DB E2 JSR WRITAZ ;PRINT ADDR+1 , ADDR 1740 EB41 4C A1 E1 JMP COMIN 1741 EB44 1742 EB44 ;CLEAR DISPLAY & PRINTER POINTERS 1743 EB44 A9 00 CLR LDA #0 1744 EB46 8D 15 A4 STA CURPO2 ;DISP PNTR 1745 EB49 8D 16 A4 STA CURPOS ;PRINTR PNTR 1746 EB4C 60 RTS 1747 EB4D 1748 EB4D ;CLEAR CKSUM 1749 EB4D A9 00 CLRCK LDA #0 1750 EB4F 8D 1F A4 STA CKSUM+1 1751 EB52 8D 1E A4 STA CKSUM 1752 EB55 60 RTS 1753 EB56 1754 EB56 ;CODE FOR PAGE ZERO SIMULATION 1755 EB56 ;SUBR LDAY-SIMULATES LDA (N),Y INSTR WITHOUT PAG 0 1756 EB56 ;BY PUTTING INDIR ADDR INTO RAM & THEN EXEC LDA NM,Y 1757 EB56 A9 25 PCLLD LDA #SAVPC ;FOR DISASSEMBLER 1758 EB58 8C 2D A4 LDAY STY CPIY+3 ;SAVE Y 1759 EB5B A8 TAY 1760 EB5C B9 00 A4 LDA MONRAM,Y ;MONRAM=MONITOR RAM 1761 EB5F 8D 2B A4 STA LDIY+1 1762 EB62 B9 01 A4 LDA MONRAM+1,Y 1763 EB65 8D 2C A4 STA LDIY+2 1764 EB68 AC 2D A4 LDY CPIY+3 ;REST Y 1765 EB6B A9 B9 LDA #$B9 ;INST FOR LDA NM,Y 1766 EB6D 8D 2A A4 STA LDIY 1767 EB70 A9 60 LDA #$60 ;RTS 1768 EB72 8D 2D A4 STA LDIY+3 1769 EB75 4C 2A A4 JMP LD BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 STA T1CH ;START TIMER T1 2699 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 JSR OUTALL 1548 E9F5 20 42 E8 JSR TTYTST ;TTY OR KB ? 1549 E9F8 D0 29 BNE CR2J 1550 E9FA AD 13 A4 LDA OUTFLG ;LF ONLY TO TTY 1551 E9FD C9 54 CMP #'T' 1552 E9FF F0 22 BEQ CR2J 1553 EA01 C9 4B CMP #'K' 1554 EA03 F0 1E BEQ CR2J 1555 EA05 C9 50 CMP #'P' 1556 EA07 F0 1A BEQ CR2J 1557 EA09 A9 0A LDA #LF 1558 EA0B 20 BC E9 JSR OUTALL 1559 EA0E A9 FF LDA #NULLC 1560 EA10 4C BC E9 JMP OUTALL 1561 EA13 1562 EA13 ;CRLF TO TERMINAL (TTY OR D/P) ONLY 1563 EA13 48 CRLOW PHA ;SAVE A 1564 EA14 AD 13 A4 LDA OUTFLG 1565 EA17 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 STA T1CH ;START TIMER T1 2699 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 STA T1CH ;START TIMER T1 2699 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 BCC GETK00 ;GOT YOU 1905 EC61 68 PLA 1906 EC62 CA DEX 1907 EC63 D0 F0 BNE GETK0 1908 EC65 F0 DC BEQ GETKY ;THERE IS A MISTAKE CHECK AGAIN 1909 EC67 68 GETK00 PLA ;NOW GET STBKEY INTO X 1910 EC68 AD 2B A4 LDA STBKEY ;CLMN INTO X 1911 EC6B 49 FF EOR #$FF ;COMPLEMENT BECAUSE STRBS ARE 0 1912 EC6D AA TAX ;CTRL OR SHIFT TO X 1913 EC6E EE 2A A4 INC KMASK ;SET MSK=$01 1914 EC71 ;NOW GET ANY KEY 1915 EC71 20 05 ED GETK1 JSR ONEKEY ;GET A KEY 1916 EC74 88 DEY ;CHK THE ROW (1-8) 1917 EC75 D0 09 BNE GETK1B ;CHK IF CTRL OR SHIFT 1918 EC77 AD 2B A4 LDA STBKEY ;WERE ENTERED AT THE LAST MOMENT 1919 EC7A C9 F7 CMP #$F7 ;IF CLMN 5,6,7,8 TO IT AGAIN 1920 EC7C B0 04 BCS GETK2 1921 EC7E 90 C3 BCC GETKY ;SEND IT TO GET CTRL OR SHIFT 1922 EC80 30 C1 GETK1B BMI GETKY ;NO KEY ,CLEAR MSK 1923 EC82 ;WE HAVE A KEY ,DECODE IT 1924 EC82 20 2C ED GETK2 JSR DEBK1 ;DEBOUNCE KEY (5 MSEC) 1925 EC85 98 TYA ;MULT BY 8 1926 EC86 0A ASL A 1927 EC87 0A ASL A 1928 EC88 0A ASL A 1929 EC89 A8 TAY ;NOW Y HAS ROW ADDR FROM ROW 1 1930 EC8A AD 2B A4 LDA STBKEY ;ADD COLUMN TO Y 1931 EC8D 4A GETK3 LSR A 1932 EC8E 90 03 BCC GETK4 1933 EC90 C8 INY 1934 EC91 D0 FA BNE GETK3 1935 EC93 B9 21 F4 GETK4 LDA ROW1,Y ;GET THE CHR 1936 EC96 48 PHA 1937 EC97 8A TXA ;SEE IF CTRL OR SHIFT WAS USED 1938 EC98 F0 24 BEQ GETK7 ;BRCH IF NO CTRL OR SHIFT 1939 EC9A 29 10 AND #$10 ;CTRL ? 1940 EC9C F0 06 BEQ GETK5 ;NO ,GO GETKS 1941 EC9E 68 PLA 1942 EC9F 29 3F AND #$3F ;MSK OFF 2 MSB FOR CONTROL 1943 ECA1 4C BF EC JMP GETK8 ;EXIT 1944 ECA4 68 GETK5 PLA 1945 ECA5 48 PHA ;SAVE IT 1946 ECA6 29 40 AND #$40 ;IF ALPHA CHARS DO NOT SHIFT 1947 ECA8 D0 14 BNE GETK7 1948 ECAA 68 PLA 1949 ECAB 48 PHA 1950 ECAC 29 0F AND #$0F ;ONLY LSB 1951 ECAE F0 0E BEQ GETK7 ;DO NOT INTERCHANGE OR 0 1952 ECB0 C9 0C CMP #$0C ;ACC>=$0C ? 1953 ECB2 B0 05 BCS GETK6 ;YES ACC>=$0C 1954 ECB4 68 PLA ;NO, ACC<$0C 1955 ECB5 29 EF AND #$EF ;STRIP OFF BIT 4 1956 ECB7 D0 06 BNE GETK8 ;EXIT 1957 ECB9 68 GETK6 PLA ;ACC>=$0C 1958 ECBA 09 10 ORA #$10 ;BIT 4= 1 1959 ECBC D0 01 BNE GETK8 ;EXIT 1960 ECBE 68 GETK7 PLA 1961 ECBF ;CHECK FOR "ADV PAP","PRI LINE", OR "TOGL PRIFLG" 1962 ECBF ;IN THIS WAY WE DONT HAVE TO CHCK FOR THIS COMM 1963 ECBF C9 60 GETK8 CMP #$60 ;ADV PAPER COMM 1964 ECC1 D0 06 BNE GETK11 1965 ECC3 E0 00 CPX #0 ;IF SHIFT IS NOT ADV PAPER 1966 ECC5 F0 25 BEQ GETK10 ;NO SHIFT ,SO ADVPAPER 1967 ECC7 29 4F AND #$4F ;CONVRT TO "@" 1968 ECC9 C9 1C GETK11 CMP #$1C ;SEE IF TOGGL PRIFLG (CONTRL PRI) 1969 ECCB D0 14 BNE GETK13 1970 ECCD 20 E1 E6 JSR PRITR ;GO TOGGLE FLG 1971 ECD0 A0 01 LDY #1 ;GET THE PTRS BACK 3 SPACES 1972 ECD2 B9 15 A4 GETK12 LDA CURPO2,Y 1973 ECD5 38 SEC 1974 ECD6 E9 03 SBC #3 ;BECAUSE "ON ,OFF" MSGS 1975 ECD8 99 15 A4 STA CURPO2,Y 1976 ECDB 88 DEY 1977 ECDC 10 F4 BPL GETK12 1978 ECDE 4C 40 EC JMP GETKEY 1979 ECE1 C9 5C GETK13 CMP #BACKSLASH ;PRINT LINE COMMAND 1980 ECE3 D0 06 BNE GETK14 1981 ECE5 20 4A F0 JSR IPS0 ;PRINT WHATEVER IS IN BUFFER 1982 ECE8 4C 40 EC JMP GETKEY 1983 ECEB 60 GETK14 RTS 1984 ECEC 4C 38 EC GETK10 JMP GETKD0 1985 ECEF 1986 ECEF ;WAIT IF LAST KEY STILL DOWN (ROLLOVER) 1987 ECEF AD 82 A4 ROONEK LDA DRB2 ;SEE IF KEY STILL DOWN 1988 ECF2 C9 FF CMP #$FF 1989 ECF4 F0 0A BEQ ROO1 ;NO KEY AT ALL, CLR ROLLFL 1990 ECF6 0D 7F A4 ORA ROLLFL ;ACCEPT ONLY LAST KEY 1991 ECF9 49 FF EOR #$FF ;STRBS ARE ZEROS TO INVER 1992 ECFB D0 F2 BNE ROONEK 1993 ECFD 20 2A ED JSR DEBKEY ;CLR KMASK & DEBOUNCE RELEASE 1994 ED00 A9 00 ROO1 LDA #0 ;CLR KMASK 1995 ED02 8D 2A A4 STA KMASK 1996 ED05 ;GO THRU KB ONCE AND RTN ,IF ANY 1997 ED05 ;KEY Y=ROW (1-8) & STBKEY=CLMN 1998 ED05 ;IF NO KEY Y=0 ,STBKEY=$FF 1999 ED05 A9 7F ONEKEY LDA #$7F ;FIRST STROBE TO MSB 2000 ED07 D0 02 BNE ONEK2 ;START AT ONEK2 2001 ED09 38 ONEK1 SEC ;ONLY ONE PULSE (ZERO) 2002 ED0A 6A ROR A ;SHIFT TO RIGHT 2003 ED0B 8D 80 A4 ONEK2 STA DRA2 ;OUTPUT CLMN STROBE 2004 ED0E 8D 2B A4 STA STBKEY ;SAVE IT 2005 ED11 A0 08 LDY #8 ;CHECK 8 ROWS 2006 ED13 AD 82 A4 LDA DRB2 ;ANY KEY ? 2007 ED16 0D 2A A4 ORA KMASK ;DISABLE ROW 1 IF CTRL OR SHIFT 2008 ED19 8D 7F A4 STA ROLLFL ;SAVE WHICH KEY IT WAS 2009 ED1C 0A ONEK3 ASL A 2010 ED1D 90 0A BCC ONEK4 ;JUMP IF KEY (ZERO) 2011 ED1F 88 DEY 2012 ED20 D0 FA BNE ONEK3 2013 ED22 AD 2B A4 LDA STBKEY 2014 ED25 C9 FF CMP #$FF ;LAST CLMN ? 2015 ED27 D0 E0 BNE ONEK1 ;NO ,DO NEXT CLMN 2016 ED29 60 ONEK4 RTS 2017 ED2A 2018 ED2A A2 00 DEBKEY LDX #0 ;CLEAR CNTRL OR SHIFT 2019 ED2C A9 00 DEBK1 LDA #0 ;CLR KMASK 2020 ED2E 8D 2A A4 STA KMASK 2021 ED31 A9 88 LDA #DEBTIM ;DEBOUNCE TIME FOR KEYBOARD 2022 ED33 8D 08 A8 STA T2L 2023 ED36 A9 13 LDA #DEBTIM/256 2024 ED38 4C 18 EC JMP DE1 ;WAIT FOR 5 MSEC 2025 ED3B 2026 ED3B ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2027 ED3B ;GET A CHAR FROM TAPE SUBROUTINE 2028 ED3B ;A BUFFER IS USED TO GET BLOCKS OF DATA 2029 ED3B ;FROM TAPE ,EXCEPT WHEN FORMAT EQUAL TO 2030 ED3B ;KIM-1 (THE WHOLE FILE IS LOADED AT ONE TIME) 2031 ED3B 20 9E EB TIBYTE JSR PHXY ;PUSH X 2032 ED3E AE 36 A4 LDX TAPTR ;POINTER FOR BUFFER 2033 ED41 E0 50 CPX #80 ;IS BUFFER EMPTY ? 2034 ED43 D0 03 BNE TIB1 2035 ED45 20 53 ED JSR TIBY1 ;LOAD ANOTHER BLOCK 2036 ED48 BD 16 01 TIB1 LDA TABUFF,X 2037 ED4B E8 INX 2038 ED4C 8E 36 A4 STX TAPTR 2039 ED4F 20 AC EB JSR PLXY ;PULL X 2040 ED52 60 RTS 2041 ED53 ;LOAD A BLOCK FROM TAPE INTO BUFFER 2042 ED53 20 EA ED TIBY1 JSR TAISET ;SET TAPE FOR INPUT 2043 ED56 20 29 EE TIBY3 JSR GETTAP ;GET A CHAR FROM TAPE 2044 ED59 C9 23 CMP #'#' ;CHECK FIRST CHR FOR 2045 ED5B F0 06 BEQ TIBY4 ;START OF BLOCK 2046 ED5D C9 16 CMP #$16 ;IF NOT # SHOULD BE SYN 2047 ED5F D0 F2 BNE TIBY1 2048 ED61 F0 F3 BEQ TIBY3 2049 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 EÜaš@ÿÙ^A/§J6€2Hภ2ÕÁõÊPHÖ† 99 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 EÜaš@ÿÙ^A/§J6€2Hภ2ÕÁõÊPHÖ† 99 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 EÜaš@ÿÙ^A/§J6€2Hภ2ÕÁõÊPHÖ† 99 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 EÜaš@ÿÙ^A/§J6€2Hภ2ÕÁõÊPHÖ† 99 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 406 01 LDA BLKO ;PUT BLK CNT IN FIRST LOC (TABUFF) 2643 F1CB 20 8B F1 JSR TOBYTE 2644 F1CE 20 AC EB TABY3 JSR PLXY 2645 F1D1 60 RTS 2646 F1D2 2647 F1D2 ;CHCK ACTIVE BUFFER AND LOAD A CHR 2648 F1D2 ;CARRY=0 IF ONLY 1 BUFFER ,C=1 IF 2 BUFFERS 2649 F1D2 AD 12 A4 CKBUFF LDA INFLG 2650 F1D5 CD 13 A4 CMP OUTFLG 2651 F1D8 D0 08 BNE CBUFF1 2652 F1DA C9 54 CMP #'T' ;SEE IF INFLG=OUTFLG = T 2653 F1DC D0 04 BNE CBUFF1 2654 F1DE 38 SEC ;USE PAGE 1 FOR OUTPUT BUFFER 2655 F1DF B5 AD LDA TABUF2,X 2656 F1E1 60 RTS 2657 F1E2 18 CBUFF1 CLC ;USE SAME BUFFER FOR I/O 2658 F1E3 BD 16 01 LDA TABUFF,X 2659 F1E6 60 RTS 2660 F1E7 2661 F1E7 ;COMPUTE BLOCK CHECKSUM & PUT IT 2662 F1E7 ;AT THE END OF ACTIVE BUFFER 2663 F1E7 A9 00 BKCKSM LDA #0 ;CLEAR BLK CKSUM LOCAT 2664 F1E9 8D 66 01 STA TABUFF+80 2665 F1EC 8D 67 01 STA TABUFF+81 2666 F1EF A2 4F LDX #79 2667 F1F1 20 D2 F1 BKCK1 JSR CKBUFF ;GET CHR FROM EITHER BUFFER 2668 F1F4 18 CLC 2669 F1F5 6D 66 01 ADC TABUFF+80 ;ADD TO CKSUM 2670 F1F8 8D 66 01 STA TABUFF+80 2671 F1FB 90 03 BCC *+5 2672 F1FD EE 67 01 INC TABUFF+81 2673 F200 CA DEX 2674 F201 10 EE BPL BKCK1 ;DO THE WHOLE BUFFER 2675 F203 A2 50 LDX #80 2676 F205 AD 66 01 LDA TABUFF+80 ;PUT CKSUM INTO RIGHT BUFFER 2677 F208 20 0F F2 JSR BKCK2 2678 F20B E8 INX 2679 F20C AD 67 01 LDA TABUFF+81 2680 F20F 48 BKCK2 PHA ;OUTPUT A CHAR TO RIGHT BUFFER 2681 F210 20 D2 F1 JSR CKBUFF ;GET WHICH BUFFER 2682 F213 68 PLA 2683 F214 B0 04 BCS BKCK3 ;BRNCH TO SECOND BUFFER 2684 F216 9D 16 01 STA TABUFF,X 2685 F219 60 RTS 2686 F21A 95 AD BKCK3 STA TABUF2,X ;TO PAG 1 2687 F21C 60 RTS 2688 F21D 2689 F21D ;SET TAPE (1 OR 2) FOR OUTPUT 2690 F21D 20 C0 F2 TAOSET JSR SETSPD ;SET UP SPEED (# OF HALF PULSES) 2691 F220 AD 35 A4 LDA TAPOUT ;OUTPUT FLG (TAPE 1 OR 2) 2692 F223 20 1C EE JSR TIOSET ;SET PB4 OR PB5 TO ZERO 2693 F226 A9 EC LDA #DATOUT+MOFF ;SET CA2=0 (DATA OUT) 2694 F228 8D 0C A8 STA PCR 2695 F22B A9 C0 LDA #T1FR ;SET TIMER IN FREE RUNNING 2696 F22D 8D 0B A8 STA ACR 2697 F230 A9 00 LDA #00 2698 F232 8D 05 A8 EÜaš@ÿÙ^A/§J6€2Hภ2ÕÁõÊPHÖ† 99 F235 AE 09 A4 LDX GAP ;OUTPUT 4*GAP SYN BYTES 2700 F238 A9 16 TAOS1 LDA #$16 ;SYN CHAR 2701 F23A 20 4A F2 JSR OUTTAP ;TO TAPE 2702 F23D 20 4A F2 JSR OUTTAP 2703 F240 20 4A F2 JSR OUTTAP 2704 F243 20 4A F2 JSR OUTTAP 2705 F246 CA DEX 2706 F247 D0 EF BNE TAOS1 2707 F249 60 RTS 2708 F24A 2709 F24A ;OUTPUT ACC TO TAPE 2710 F24A 8E 2D A4 OUTTAP STX CPIY+3 ;SAVE X 2711 F24D A0 07 LDY #$07 ;FOR THE 8 BITS 2712 F24F 8C 27 A4 STY STIY 2713 F252 AE 08 A4 LDX TSPEED 2714 F255 30 39 BMI OUTTA1 ;IF ONE IS SUPER HIPER 2715 F257 48 PHA 2716 F258 A0 02 TRY LDY #2 ;SEND 3 UNITS 2717 F25A 8C 28 A4 STY STIY+1 ;STARTING AT 3700 HZ 2718 F25D BE 0A A4 ZON LDX NPUL,Y ;#OF HALF CYCLES 2719 F260 48 PHA 2720 F261 B9 0B A4 ZON1 LDA TIMG,Y ;SET UP LACTH FOR NEXT 2721 F264 8D 06 A8 STA T1LL ;PULSE (80 OR CA) (FREC) 2722 F267 A9 00 LDA #0 2723 F269 8D 07 A8 STA T1LH 2724 F26C 2C 0D A8 ZON2 BIT IFR ;WAIT FOR PREVIOUS 2725 F26F 50 FB BVC ZON2 ;CYCLE (T1 INT FLG) 2726 F271 AD 04 A8 LDA T1L ;CLR INTERR FLG 2727 F274 CA DEX 2728 F275 D0 EA BNE ZON1 ;SEND ALL CYCLES 2729 F277 68 PLA 2730 F278 CE 28 A4 DEC STIY+1 2731 F27B F0 05 BEQ SETZ ;BRCH IF LAST ONE 2732 F27D 30 07 BMI ROUT ;BRCH IF NO MORE 2733 F27F 4A LSR A ;TAKE NEXT BIT 2734 F280 90 DB BCC ZON ;...IF IT'S A ONE... 2735 F282 A0 00 SETZ LDY #0 ;SWITCH TO 2400 HZ 2736 F284 F0 D7 BEQ ZON ;UNCONDITIONAL BRCH 2737 F286 CE 27 A4 ROUT DEC STIY ;ONE LESS BIT 2738 F289 10 CD BPL TRY ;ANY MORE? GO BACK 2739 F28B 68 ROUT1 PLA ;RECOVER CHR 2740 F28C AE 2D A4 LDX CPIY+3 ;RESTORE X 2741 F28F 60 RTS 2742 F290 2743 F290 ;OUTPUT HALF PULSE FOR 0 (1200 HZ) & 2744 F290 ;TWO HALF PULSES FOR 1 (2400 HZ) (00 TSPEED) 2745 F290 48 OUTTA1 PHA 2746 F291 8D 28 A4 STA STIY+1 ;STORE ACC 2747 F294 A2 02 OUTTA2 LDX #2 ;# OF HALF PULSES 2748 F296 A9 D0 LDA #$D0 ;1/2 PULSE OF 2400 2749 F298 8D 06 A8 STA T1LL 2750 F29B A9 00 LDA #00 2751 F29D 8D 07 A8 STA T1LH 2752 F2A0 20 BC FF JSR PATC25 ;WAIT TILL COMPLETED 2753 F2A3 4E 28 A4 LSR STIY+1 ;GET BITS FROM CHR 2754 F2A6 B0 0A BCS OUTTA3 2755 F2A8 A9 A0 LDA #$A0 ;BIT=0 ,OUTPUT 1200 HZ 2756 F2AA 8D 06 A8 STA T1LL 2757 F2AD A9 01 LDA #$01 2758 F2AF 8D 07 A8 STA T1LH 2759 F2B2 20 BC FF OUTTA3 JSR PATC25 2760 F2B5 CA DEX 2761 F2B6 10 FA BPL OUTTA3 ;OUTPUT 3 HALF PULSES 2762 F2B8 88 DEY 2763 F2B9 10 D9 BPL OUTTA2 ;ALL BITS ? 2764 F2BB 4C 8B F2 JMP ROUT1 ;RESTORE REGS 2765 F2BE EA NOP 2766 F2BF EA NOP 2767 F2C0 2768 F2C0 ;SET SPEED FROM NORMAL TO 3 TIMES NORMAL 2769 F2C0 AD 08 A4 SETSPD LDA TSPEED ;SPEED FLG 2770 F2C3 6A ROR A ;NORMAL OR 3* NORM 2771 F2C4 A9 0C LDA #12 2772 F2C6 90 02 BCC SETSP1 2773 F2C8 A9 04 LDA #4 2774 F2CA 8D 0A A4 SETSP1 STA NPUL 2775 F2CD A9 12 LDA #18 2776 F2CF 90 02 BCC SETSP2 2777 F2D1 A9 06 LDA #6 2778 F2D3 8D 0C A4 SETSP2 STA TIMG+1 2779 F2D6 60 RTS 2780 F2D7 ;.FILE A3/2 2781 F2D7 2782 F2D7 ; ADDRESS TABLE FOR EACH PRINT COLUMN 2783 F2D7 ; EACH TBL CONTAINS DOT PATTERNS FOR 1 OF THE 5 COLUMNS. 2784 F2D7 ; DATA ARE STORED WITH EACH BYTE DEFINING ONE COLUMN... 2785 F2D7 ; OF A CHARACTER, WITH THE TOP DOT CORRESPONDING TO THE.. 2786 F2D7 ; LSB IN THE BYTE 2787 F2D7 E1F221F361F3MTBL .DW COL0,COL1,COL2,COL3,COL4 2787 F2DD A1F3E1F3 2788 F2E1 2789 F2E1 ;DOT PATTERNS FOR COLUMN ZERO (LEFTMOST COLUMN) 2790 F2E1 3E7E7F3E7F7FCOL0 .DB $3E,$7E,$7F,$3E,$7F,$7F,$7F,$3E ;@ -- G 2790 F2E7 7F3E 2791 F2E9 7F00207F7F7F .DB $7F,$00,$20,$7F,$7F,$7F,$7F,$3E ;H -- O 2791 F2EF 7F3E 2792 F2F1 7F3E7F46013F .DB $7F,$3E,$7F,$46,$01,$3F,$07,$7F ;P -- W 2792 F2F7 077F 2793 F2F9 6307617F0300 .DB $63,$07,$61,$7F,$03,$00,$02,$40 ;X -- ( 2793 F2FF 0240 2794 F301 000000142463 .DB $00,$00,$00,$14,$24,$63,$60,$00 ; -- ' 2794 F307 6000 2795 F309 000014084008 .DB $00,$00,$14,$08,$40,$08,$40,$60 ;( -- / 2795 F30F 4060 2796 F311 3E4462411827 .DB $3E,$44,$62,$41,$18,$27,$3C,$01 ;0 -- 7 2796 F317 3C01 2797 F319 364600400814 .DB $36,$46,$00,$40,$08,$14,$41,$02 ;8 -- ? 2797 F31F 4102 2798 F321 2799 F321 ;DOT PATTERNS FOR COLUMN 1 2800 F321 410949414149COL1 .DB $41,$09,$49,$41,$41,$49,$09,$41 ;@ -- G 2800 F327 0941 2801 F329 084140084002 .DB $08,$41,$40,$08,$40,$02,$06,$41 ;H -- O 2801 F32F 0641 2802 F331 094109490140 .DB $09,$41,$09,$49,$01,$40,$18,$20 ;P -- W 2802 F337 1820 2803 F339 140851410400 .DB $14,$08,$51,$41,$04,$00,$01,$40 ;X -- ( 2803 F33F 0140 2804 F341 0000077F2A13 .DB $00,$00,$07,$7F,$2A,$13,$4E,$04 ; -- ' 2804 F347 4E04 2805 F349 1C4108083008 .DB $1C,$41,$08,$08,$30,$08,$00,$10 ;( -- / 2805 F34F 0010 2806 F351 514251411445 .DB $51,$42,$51,$41,$14,$45,$4A,$71 ;0 -- 7 2806 F357 4A71 2807 F359 494900341414 .DB $49,$49,$00,$34,$14,$14,$41,$01 ;8 -- ? 2807 F35F 4101 2808 F361 2809 F361 ;DOT PATTERNS FOR COLUMN 2 2810 F361 5D0949414149COL2 .DB $5D,$09,$49,$41,$41,$49,$09,$41 ;@ -- G 2810 F367 0941 2811 F369 087F4114400C .DB $08,$7F,$41,$14,$40,$0C,$08,$41 ;H -- O 2811 F36F 0841 2812 F371 095119497F40 .DB $09,$51,$19,$49,$7F,$40,$60,$18 ;P -- W 2812 F377 6018 2813 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 F387 5902 2815 F389 22223E3E0008 .DB $22,$22,$3E,$3E,$00,$08,$00,$08 ;( -- / 2815 F38F 0008 2816 F391 497F51491245 .DB $49,$7F,$51,$49,$12,$45,$49,$09 ;0 -- 7 2816 F397 4909 2817 F399 494944002214 .DB $49,$49,$44,$00,$22,$14,$22,$51 ;8 -- ? 2817 F39F 2251 2818 F3A1 2819 F3A1 ;DOT PATTERNS FOR COLUMN 3 2820 F3A1 550949412249COL3 .DB $55,$09,$49,$41,$22,$49,$09,$49 ;@ -- G 2820 F3A7 0949 2821 F3A9 08413F224002 .DB $08,$41,$3F,$22,$40,$02,$30,$41 ;H -- O 2821 F3AF 3041 2822 F3B1 092129490140 .DB $09,$21,$29,$49,$01,$40,$18,$20 ;P -- W 2822 F3B7 1820 2823 F3B9 140845001041 .DB $14,$08,$45,$00,$10,$41,$01,$40 ;X -- ( 2823 F3BF 0140 2824 F3C1 0000077F2A64 .DB $00,$00,$07,$7F,$2A,$64,$26,$01 ; -- ' 2824 F3C7 2601 2825 F3C9 411C08080008 .DB $41,$1C,$08,$08,$00,$08,$00,$04 ;( -- / 2825 F3CF 0004 2826 F3D1 454049557F45 .DB $45,$40,$49,$55,$7F,$45,$49,$05 ;0 -- 7 2826 F3D7 4905 2827 F3D9 492900004114 .DB $49,$29,$00,$00,$41,$14,$14,$09 ;8 -- ? 2827 F3DF 1409 2828 F3E1 ;DOT PATTERNS FOR COLUMN 4 2829 F3E1 1E7E36221C41COL4 .DB $1E,$7E,$36,$22,$1C,$41,$01,$7A ;@ -- G 2829 F3E7 017A 2830 F3E9 7F000141407F .DB $7F,$00,$01,$41,$40,$7F,$7F,$3E ;H -- O 2830 F3EF 7F3E 2831 F3F1 065E4631013F .DB $06,$5E,$46,$31,$01,$3F,$07,$7F ;P -- W 2831 F3F7 077F 2832 F3F9 63074300607F .DB $63,$07,$43,$00,$60,$7F,$02,$40 ;X -- ( 2832 F3FF 0240 2833 F401 000000141263 .DB $00,$00,$00,$14,$12,$63,$50,$00 ; -- ' 2833 F407 5000 2834 F409 000014080008 .DB $00,$00,$14,$08,$00,$08,$00,$03 ;( -- / 2834 F40F 0003 2835 F411 3E4046221039 .DB $3E,$40,$46,$22,$10,$39,$31,$03 ;0 -- 7 2835 F417 3103 2836 F419 361E00004114 .DB $36,$1E,$00,$00,$41,$14,$08,$06 ;8 -- ? 2836 F41F 0806 2837 F421 2838 F421 ;ASCII CHARACTERS FOR KB 2839 F421 2008000D0000ROW1 .DB $20,$08,$00,$0D,$00,$00,$00,$00 2839 F427 0000 2840 F429 00605C000000ROW2 .DB $00,$60,'\',$00,$00,$00,$7F,$00 2840 F42F 7F00 2841 F431 2E4C502D3A30ROW3 .DB ".LP-:0;/" 2841 F437 3B2F 2842 F439 4D4A494F3938ROW4 .DB "MJIO98K," 2842 F43F 4B2C 2843 F441 424759553736ROW5 .DB "BGYU76HN" 2843 F447 484E 2844 F449 434452543534ROW6 .DB "CDRT54FV" 2844 F44F 4656 2845 F451 5A4157453332ROW7 .DB "ZAWE32SX" 2845 F457 5358 2846 F459 00001B51315EROW8 .DB $00,$00,$1B,"Q1",$5E,"][" 2846 F45F 5D5B 2847 F461 2848 F461 ;DISASSEMBLE INSTRUCTIONS AND SHOW REGS IS REGF SET 2849 F461 AD 0E A4 REGQ LDA REGF ;GET FLAG 2850 F464 F0 06 BEQ DISASM 2851 F466 20 32 E2 JSR REG1 ;SHOW THE SIX REGS 2852 F469 20 24 EA JSR CRCK ; 2853 F46C 2854 F46C 20 45 F5 DISASM JSR PRBL2 2855 F46F 20 3C F5 JSR PRPC ;OUTPUT PROG COUNTR 2856 F472 A0 00 LDY #0 2857 F474 20 56 EB JSR PCLLD 2858 F477 A8 TAY 2859 F478 4A LSR A 2860 F479 90 0B BCC IEVEN 2861 F47B 4A LSR A 2862 F47C B0 17 BCS ERR 2863 F47E C9 22 CMP #$22 2864 F480 F0 13 BEQ ERR 2865 F482 29 07 AND #7 2866 F484 09 80 ORA #$80 2867 F486 4A IEVEN LSR A 2868 F487 AA TAX 2869 F488 BD 5B F5 LDA MODE,X 2870 F48B B0 04 BCS RTMODE 2871 F48D 4A LSR A 2872 F48E 4A LSR A 2873 F48F 4A LSR A 2874 F490 4A LSR A 2875 F491 29 0F RTMODE AND #$F 2876 F493 D0 04 BNE GETFMT 2877 F495 A0 80 ERR LDY #$80 2878 F497 A9 00 LDA #0 2879 F499 AA GETFMT TAX 2880 F49A BD 9F F5 LDA MODE2,X 2881 F49D 8D 16 01 STA FORMA 2882 F4A0 29 03 AND #3 2883 F4A2 85 EA STA LENGTH 2884 F4A4 98 TYA ;OPCODE 2885 F4A5 29 8F AND #$8F 2886 F4A7 AA TAX 2887 F4A8 98 TYA ;OPCODE IN A AGAIN 2888 F4A9 A0 03 LDY #3 2889 F4AB E0 8A CPX #$8A 2890 F4AD F0 0B BEQ MNNDX3 2891 F4AF 4A MNNDX1 LSR A 2892 F4B0 90 08 BCC MNNDX3 2893 F4B2 4A LSR A 2894 F4B3 4A MNNDX2 LSR A 2895 F4B4 09 20 ORA #$20 2896 F4B6 88 DEY 2897 F4B7 D0 FA BNE MNNDX2 2898 F4B9 C8 INY 2899 F4BA 88 MNNDX3 DEY 2900 F4BB D0 F2 BNE MNNDX1 2901 F4BD 48 PHA ;SAVE MNEMONIC TABLE INDEX 2902 F4BE 20 56 EB JSR PCLLD 2903 F4C1 20 46 EA JSR NUMA 2904 F4C4 20 45 F5 JSR PRBL2 ;PRINT LAST BLANK 2905 F4C7 68 PLA 2906 F4C8 A8 TAY 2907 F4C9 B9 B9 F5 LDA MNEML,Y 2908 F4CC 8D 17 01 STA LMNEM 2909 F4CF B9 F9 F5 LDA MNEMR,Y 2910 F4D2 8D 18 01 STA RMNEM 2911 F4D5 A2 03 LDX #3 ;MUST BE 2912 F4D7 A9 00 PRMN1 LDA #0 2913 F4D9 A0 05 LDY #5 2914 F4DB 0E 18 01 PRMN2 ASL RMNEM 2915 F4DE 2E 17 01 ROL LMNEM 2916 F4E1 2A ROL A 2917 F4E2 88 DEY 2918 F4E3 D0 F6 BNE PRMN2 2919 F4E5 69 BF ADC #'?'+$80 ;ADD "?" OFFSET 2920 F4E7 20 BC E9 JSR OUTALL 2921 F4EA CA DEX 2922 F4EB D0 EA BNE PRMN1 2923 F4ED 20 45 F5 JSR PRBL2 2924 F4F0 A2 06 LDX #6 2925 F4F2 A9 00 LDA #0 2926 F4F4 8D 29 A4 STA STIY+2 ;FLAG 2927 F4F7 E0 03 PRADR1 CPX #3 2928 F4F9 D0 1E BNE PRADR3 ;IF X=3 PRINT ADDR VALUE 2929 F4FB A4 EA LDY LENGTH 2930 F4FD F0 1A BEQ PRADR3 ;1 BYTE INSTR 2931 F4FF AD 16 01 PRADR2 LDA FORMA 2932 F502 C9 E8 CMP #$E8 ;RELATIVE ADDRESSING 2933 F504 20 56 EB JSR PCLLD 2934 F507 B0 27 BCS RELADR 2935 F509 ;SE IF SYMBOL 2936 F509 48 PHA 2937 F50A AD 29 A4 LDA STIY+2 2938 F50D D0 03 BNE MR11A 2939 F50F EE 29 A4 INC STIY+2 ;SHOW WE WERE HERE 2940 F512 2941 F512 68 MR11A PLA 2942 F513 20 46 EA JSR NUMA 2943 F516 88 DEY 2944 F517 D0 E6 BNE PRADR2 2945 F519 0E 16 01 PRADR3 ASL FORMA 2946 F51C 90 0E BCC PRADR4 2947 F51E BD AC F5 LDA CHAR1-1,X 2948 F521 20 BC E9 JSR OUTALL 2949 F524 BD B2 F5 LDA CHAR2-1,X 2950 F527 F0 03 BEQ PRADR4 2951 F529 20 BC E9 JSR OUTALL 2952 F52C CA PRADR4 DEX 2953 F52D D0 C8 BNE PRADR1 2954 F52F 60 RTS 2955 F530 20 4D F5 RELADR JSR PCADJ3 2956 F533 AA TAX 2957 F534 E8 INX 2958 F535 D0 01 BNE PRNTXY 2959 F537 C8 INY 2960 F538 98 PRNTXY TYA 2961 F539 4C 42 EA JMP WRAX ;PRINT A &X 2962 F53C AD 26 A4 PRPC LDA SAVPC+1 ;PRINT PC 2963 F53F AE 25 A4 LDX SAVPC 2964 F542 20 42 EA JSR WRAX 2965 F545 A9 20 PRBL2 LDA #' ' 2966 F547 4C BC E9 JMP OUTALL 2967 F54A A5 EA LDA LENGTH 2968 F54C 38 SEC 2969 F54D AC 26 A4 PCADJ3 LDY SAVPC+1 ;PRG CNTR HIGH 2970 F550 AA TAX 2971 F551 10 01 BPL PCADJ4 2972 F553 88 DEY 2973 F554 6D 25 A4 PCADJ4 ADC SAVPC ;PROG CNTR LOW 2974 F557 90 01 BCC RTS1 2975 F559 C8 INY 2976 F55A 60 RTS1 RTS 2977 F55B 2978 F55B 40024503D008MODE .DB $40,2,$45,3,$D0,8,$40,9 2978 F561 4009 2979 F563 30224533D008 .DB $30,$22,$45,$33,$D0,8,$40,9 2979 F569 4009 2980 F56B 40024533D008 .DB $40,2,$45,$33,$D0,8,$40,9 2980 F571 4009 2981 F573 400245B3D008 .DB $40,2,$45,$B3,$D0,8,$40,9 2981 F579 4009 2982 F57B 00224433D08C .DB 0,$22,$44,$33,$D0,$8C,$44,0 2982 F581 4400 2983 F583 11224433D08C .DB $11,$22,$44,$33,$D0,$8C,$44,$9A 2983 F589 449A 2984 F58B 10 22 44 33 .DB $10,$22,$44,$33 2985 F58F D0 08 40 09 .DB $D0,8,$40,9 2986 F593 10224433D008 .DB $10,$22,$44,$33,$D0,8,$40,9 2986 F599 4009 2987 F59B 62 13 78 A9 .DB $62,$13,$78,$A9 2988 F59F 2989 F59F 002101020080MODE2 .DB 0,$21,1,2,0,$80,$59,$4D 2989 F5A5 594D 2990 F5A7 1112064A051D .DB $11,$12,6,$4A,5,$1D 2991 F5AD 2992 F5AD 2C292C23282ECHAR1 .DB ",",$29,",#(","." 2993 F5B3 590058000041CHAR2 .DB "Y",0,"X",0,0,"A" 2994 F5B9 2995 F5B9 1C8A1C235D8BMNEML .DB $1C,$8A,$1C,$23,$5D,$8B,$1B 2995 F5BF 1B 2996 F5C0 A1 .DB $A1 2997 F5C1 9D8A1D239D8B .DB $9D,$8A,$1D,$23,$9D,$8B,$1D,$A1 2997 F5C7 1DA1 2998 F5C9 002919AE69A8 .DB 0,$29,$19,$AE,$69,$A8,$19,$23 2998 F5CF 1923 2999 F5D1 24531B232453 .DB $24,$53,$1B,$23,$24,$53,$19,$A1 2999 F5D7 19A1 3000 F5D9 001A5B5BA569 .DB 0,$1A,$5B,$5B,$A5,$69,$24,$24 3000 F5DF 2424 3001 F5E1 AEAEA8AD2900 .DB $AE,$AE,$A8,$AD,$29,0,$7C,0 3001 F5E7 7C00 3002 F5E9 159C6D9CA569 .DB $15,$9C,$6D,$9C,$A5,$69,$29,$53 3002 F5EF 2953 3003 F5F1 84133411A569 .DB $84,$13,$34,$11,$A5,$69,$23,$A0 3003 F5F7 23A0 3004 F5F9 3005 F5F9 D8625A482662MNEMR .DB $D8,$62,$5A,$48,$26,$62,$94 3005 F5FF 94 3006 F600 88 .DB $88 3007 F601 5444C8546844 .DB $54,$44,$C8,$54,$68,$44,$E8,$94 3007 F607 E894 3008 F609 00B4088474B4 .DB 0,$B4,8,$84,$74,$B4,$28,$6E 3008 F60F 286E 3009 F611 74F4CC4A72F2 .DB $74,$F4,$CC,$4A,$72,$F2,$A4,$8A 3009 F617 A48A 3010 F619 00AAA2A27474 .DB 0,$AA,$A2,$A2,$74,$74,$74,$72 3010 F61F 7472 3011 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 $C4,$CA,$26,$48,$44,$44,$A2,$C8 3013 F637 A2C8 3014 F639 3015 F639 ;******************************* 3016 F639 ;*** AIM TEXT EDITOR *** 3017 F639 ;*** 05/01/78 *** 3018 F639 ;******************************* 3019 F639 3020 F639 ; R=READ FROM ANY INPUT DEVICE 3021 F639 ; I=INSERT A LINE FROM INPUT DEV 3022 F639 ; K=DELETE A LINE 3023 F639 ; U-GO UP ONE LINE 3024 F639 ; D=GO DOWN ONE LINE 3025 F639 ; L=LIST LINES TO OUTPUT DEV 3026 F639 ; T=GO TO TOP OF TEXT 3027 F639 ; B=GO TO BOTTOM OF TEXT 3028 F639 ; F=FIND STRING 3029 F639 ; C=CHANGE STRING TO NEW STRING 3030 F639 ; Q=QUIT EDITOR 3031 F639 ; =DISPLAY CURRENT LINE 3032 F639 3033 F639 ;***** E COMMAND-EDITOR ENTRY (FROM MONITOR) ***** 3034 F639 20 13 EA EDIT JSR CRLOW 3035 F63C A0 6C LDY #EMSG1-M1 3036 F63E 20 AF E7 JSR KEP ;START UP MSG 3037 F641 20 13 EA JSR CRLOW 3038 F644 20 A3 E7 EDI0 JSR FROM 3039 F647 B0 FB BCS EDI0 3040 F649 AD 1E A4 LDA CKSUM ;IS CLR IF ADDR WAS INPUTTED 3041 F64C F0 03 BEQ *+5 3042 F64E 20 DB E2 JSR WRITAZ ;OUTPUT DEFAULT ADDR (0200) 3043 F651 A2 01 LDX #1 3044 F653 BD 1C A4 EDI1 LDA ADDR,X 3045 F656 95 E3 STA TEXT,X 3046 F658 95 E1 STA BOTLN,X 3047 F65A 9D 1A A4 STA S1,X ;FOR MEMORY TEST 3048 F65D CA DEX 3049 F65E 10 F3 BPL EDI1 3050 F660 20 3B E8 JSR BLANK2 3051 F663 20 A7 E7 EDI2 JSR TO ;END 3052 F666 B0 FB BCS EDI2 3053 F668 20 BC F8 JSR TOPNO ;TRANSF TEXT TO ADDR FOR RAM CHECK 3054 F66B AD 1E A4 LDA CKSUM ;IS CLR IF ADDR WAS INPUTTED 3055 F66E F0 10 BEQ EDI4 ;BRNCH IF NOT DEFAULT VALUE 3056 F670 20 34 F9 JSR SAVNOW 3057 F673 20 B6 F6 EDI3 JSR EDI ;CARRY IS SET IF NO RAM THERE 3058 F676 90 FB BCC EDI3 3059 F678 A9 00 LDA #0 ;SET UPPER LIMIT TO BEGINNING... 3060 F67A 8D 1C A4 STA ADDR ;OF PAGE 3061 F67D 20 DB E2 JSR WRITAZ ;OUTPUT DEFAULT VALUE ,UPPER LIMIT 3062 F680 AD 1C A4 EDI4 LDA ADDR 3063 F683 85 E5 STA END 3064 F685 AD 1D A4 LDA ADDR+1 3065 F688 85 E6 STA END+1 3066 F68A 20 34 F9 JSR SAVNOW 3067 F68D ;NOW SEE IF MEMORY IS THERE 3068 F68D 20 B6 F6 EDI5 JSR EDI 3069 F690 90 FB BCC EDI5 3070 F692 A5 E6 LDA END+1 ;CMP WITH END 3071 F694 CD 1D A4 CMP ADDR+1 3072 F697 F0 11 BEQ EDI7 3073 F699 B0 13 BCS EDI8 3074 F69B 20 BC F8 EDI6 JSR TOPNO ;RESTORE NOWLN 3075 F69E A9 00 LDA #0 3076 F6A0 91 DF STA (NOWLN),Y ;END OF TEXT MARKER 3077 F6A2 20 13 EA JSR CRLOW 3078 F6A5 A9 52 LDA #'R' ;FORCE READ COMMAND 3079 F6A7 4C 8D FA JMP ENTRY 3080 F6AA A5 E5 EDI7 LDA END ;IF ZERO MEM IS OKAY 3081 F6AC F0 ED BEQ EDI6 3082 F6AE A9 00 EDI8 LDA #0 3083 F6B0 8D 1C A4 STA ADDR 3084 F6B3 4C 33 EB JMP MEMERR ;NO MEMORY FOR THOSE LIMITS 3085 F6B6 3086 F6B6 A0 00 EDI LDY #0 ;CHCK IF MEMORY WRITES 3087 F6B8 20 B7 FE JSR PATCH6 ;GET BYTE ADDR BY ADDR,ADDR+1 3088 F6BB 48 PHA ;SAVE IT 3089 F6BC A9 AA LDA #$AA ;SET THIS PATTERN 3090 F6BE 20 78 EB JSR SADDR ;CHCK IT 3091 F6C1 D0 09 BNE EDI2B 3092 F6C3 68 PLA 3093 F6C4 20 78 EB JSR SADDR ;RESTORE CHR 3094 F6C7 EE 1D A4 INC ADDR+1 ;NEXT PAG 3095 F6CA 18 CLC ;IT WROTE 3096 F6CB 60 RTS 3097 F6CC 38 EDI2B SEC ;DIDNT WRITE 3098 F6CD 68 PLA 3099 F6CE 60 RTS 3100 F6CF 3101 F6CF ;***** T COMMAND-REENTRY EDITOR ***** 3102 F6CF ;RE-ENTRY POINT,TEXT ALREADY THERE 3103 F6CF 20 24 EA REENTR JSR CRCK ; IF PRI ON 3104 F6D2 20 BC F8 TP JSR TOPNO ;GO TO TOP 3105 F6D5 4C B9 F7 JMP IN03A ;DISPLAY LINE 3106 F6D8 3107 F6D8 ;***** U COMMAND-UP LINE ***** 3108 F6D8 ;GO UP ONE LINE BUT... 3109 F6D8 ;DOWN IN ADDRESSING MEMORY 3110 F6D8 20 DB F8 DNNO JSR ATTOP ;THIS RTN DOESNT PRINT 3111 F6DB 90 06 GOBK E26D GOBK0 E278 GOBK1 E286 GETID E425 GID1 E427 GOERR E608 GCNT E785 GCN1 E78C GETTTY EBDB GET1 EBE2 GET3 EBED GETKD0 EC38 GETKEY EC40 GETKY EC43 GETK0 EC55 GETK00 EC67 GETK1 EC71 GETK1B EC80 GETK2 EC82 GETK3 EC8D GETK4 EC93 GETK5 ECA4 GETK6 ECB9 GETK7 ECBE GETK8 ECBF GETK11 ECC9 GETK12 ECD2 GETK13 ECE1 GETK14 ECEB GETK10 ECEC GETTAP EE29 GETA1 EE2B GETFMT F499 GOGO FA4A GOGO1 FA5B GOTIT FE5F HISTM A42E HISTP A414 HIST A42E HEX EA7D HATCJ FC3D HATCH FCB6 IRQV4 A400 IRQV2 A404 INFLG A412 IBUFM A460 IDIR A474 ICOL A475 IOFFST A476 IDOT A477 IOUTL A478 IOUTU A479 IBITL A47A IBITU A47B IMASK A47C IFR A80D IER A80E IRQV1 E078 IRQV3 E154 IRQ1 E163 IRQ2 E17F INCS2 E566 INTAB1 E743 INTAB2 E752 INTAB3 E756 INLOW E8F8 INALL E993 IPST F045 IPS0 F04A IPO0 F050 IPO2 F066 IPO3 F073 IPO4 F078 IPSU F0E3 IPS1 F0E8 IPS3 F105 IPS2 F10E INCP F121 IEVEN F486 IN F764 INL F76D IN02 F77A IN02A F785 IN03B F799 IN03 F7A8 IN03A F7B9 IN05 F7C5 INPU F7CB INPU1 F7D8 INDX FC81 IMMED1 FCC1 ISX FE03 INLUP FE35 JUMP A47D JMPR E1C1 JD1 E723 JD2 E72B JD3 E73C JD4 E742 JTBL FAB8 KEYF1 010C KEYF2 010F KEYF3 0112 KMASK A42A KDISA E70A KEP E7AF KEPR E970 KIFLG F8B6 KI2 F8B8 LENGTH 00EA LMNEM 0117 LDIY A42A LF 000A LOAD E2E6 LOAD1 E2E9 LOAD2 E306 LOAD4 E321 LOAD5 E323 LOADTA E32F LOAD1A E349 LOADT2 E364 LOADKI E3A4 LOADK1 E3A7 LOADK2 E3AA LOADK3 E3B7 LOADK5 E3D1 LOADK6 E3D3 LOADK7 E3E8 LL E8FE LT10 EA5A LDAY EB58 LST F7E1 LST01 F7F0 LST02 F7F8 LST3 F803 MOVAD 0126 MONRAM A400 MON 00C0 MOFF 00E0 MPRST 0010 MSP12 0002 MT2 0020 M1 E000 M3 E005 M4 E008 M5 E01C M6 E021 M7 E024 M8 E027 M9 E02A M10 E02D M11 E031 M12 E03B MCM2 E196 MCM3 E1AC MCNT 0020 MONCOM E1E5 MEM E248 MEIN E24D MEM1 E24F MEM2 E251 MEM3 E260 MEMERR EB33 MTBL F2D7 MNNDX1 F4AF MNNDX2 F4B3 MNNDX3 F4BA MR11A F512 MODE F55B MODE2 F59F MNEML F5B9 MNEMR F5F9 MREAD FAD0 MNEENT FB9E MODEM FBC1 MNEM FE06 MATCH FE51 MATCH1 FE5C NOWLN 00DF NMIV2 A402 NPUL A40A NAME A42E NULLC 00FF NMIV1 E075 NMIV3 E07B NMI4 E0B1 NMI5 E0B4 NXTADD E2CD NXTA1 E2DA NXT5 E60D NHIS E688 NH1 E690 NAMO E8CF NAMO1 E8D6 NAMO2 E8E9 NAMO3 E8EB NAMO4 E8F5 NUMA EA46 NOUT EA51 NEWROW F160 NEWCOL F163 NOWS1 F909 OLDLEN 00E9 OPCODE A434 OUTFLG A413 OUTCKS E531 OUTCK E538 OUTCK1 E53B OUTCK2 E547 OUTLOW E901 OUTL1 E906 OUTPUT E97A OUT1 E97B OUT1A E986 OUT2 E98F OUTALL E9BC OUTA1 E9C8 OUTA2 E9D0 OUTA3 E9E2 OUTA4 E9EA ONEKEY ED05 ONEK1 ED09 ONEK2 ED0B ONEK3 ED1C ONEK4 ED29 OUTTTY EEA8 OUTT1 EECB OUTT2 EEFB OUTDP EEFC OUTDP1 EF02 OUTDIS EF05 OUTD1 EF14 OUTD1A EF17 OUTD2 EF20 OUTD2A EF2F OUTD3 EF33 OUTD4 EF48 OUTD5 EF56 OUTD7 EF76 OUTDD1 EF7B OUTDD2 EF87 OUTDD3 EF8B OUTPRI F000 OUT01 F00F OUT04 F025 OUT05 F033 OUTPR F038 OUTPR1 F03A OUTPR2 F044 OP04 F130 OP07 F13F OP03 F144 OP05 F150 OP06 F15D OUTTAP F24A OUTTA1 F290 OUTTA2 F294 OUTTA3 F2B2 OPCOMP FCCB OPCMP1 FCD5 ONEBYT FD3E OK FDE7 OUTLUP FE30 PRIFLG A411 PCR A80C PRST 0000 PRTIME 06A4 PRITR E6E1 PROMPT E7BD PROMP1 E7C5 PR1 E7CC PR2 E7CF PSLS E7DC PSL0 E7FB PSL00 E802 PSL0A E814 PSL0B E81C PSL0C E81E PSL0D E823 PSL1 E837 PACK EA84 PAK1 EA96 PAK2 EA9F PCLLD EB56 PHXY EB9E PLXY EBAC PRIERR F079 PRNDOT F087 PRDOT0 F08C PINT F0CB PRMN1 F4D7 PRMN2 F4DB PRADR1 F4F7 PRADR2 F4FF PRADR3 F519 PRADR4 F52C PRNTXY F538 PRPC F53C PRBL2 F545 PCADJ3 F54D PCADJ4 F554 PLNE F727 P02 F729 P01 F73B P03 F73F P00 F749 PNTLUP FBD0 PAREN FC76 PATCH1 FE7C PAT2A FE91 PATCH4 FE9C PAT4A FEAE PATCH5 FEB1 PATCH6 FEB7 PATCH8 FEBC PATC8C FED1 PATCH9 FED8 PAT9A FEE2 PAT9B FEE8 PATC10 FEE9 PATC11 FEEF PATC12 FEF8 PATC13 FF03 PATC14 FF0D PATC15 FF17 PATC16 FF24 PATC17 FF2A PAT17A FF33 PAT17B FF3A PATC18 FF3D PAT18A FF48 PAT19 FF59 PAT20 FF60 PAT21 FF72 PAT21A FF74 PAT21B FF7F POMSG FF88 PAT22 FF9A PAT23 FFA0 PAT23A FFA5 PAT23B FFB2 PATC24 FFB5 PATC25 FFBC QM E7D4 RMNEM 0118 REGF A40E ROLLFL A47F RINT A485 RA AC00 RB AC02 RUB 0008 RSET E0BF RS1 E0C9 RS2 E0D4 RS3A E0F1 RS3 E0F3 RS3B E11A RS4 E11D RS5 E129 RS6 E13E RS7 E144 RS8 GOBK E26D GOBK0 E278 GOBK1 E286 GETID E425 GID1 E427 GOERR E608 GCNT E785 GCN1 E78C GETTTY EBDB GET1 EBE2 GET3 EBED GETKD0 EC38 GETKEY EC40 GETKY EC43 GETK0 EC55 GETK00 EC67 GETK1 EC71 GETK1B EC80 GETK2 EC82 GETK3 EC8D GETK4 EC93 GETK5 ECA4 GETK6 ECB9 GETK7 ECBE GETK8 ECBF GETK11 ECC9 GETK12 ECD2 GETK13 ECE1 GETK14 ECEB GETK10 ECEC GETTAP EE29 GETA1 EE2B GETFMT F499 GOGO FA4A GOGO1 FA5B GOTIT FE5F HISTM A42E HISTP A414 HIST A42E HEX EA7D HATCJ FC3D HATCH FCB6 IRQV4 A400 IRQV2 A404 INFLG A412 IBUFM A460 IDIR A474 ICOL A475 IOFFST A476 IDOT A477 IOUTL A478 IOUTU A479 IBITL A47A IBITU A47B IMASK A47C IFR A80D IER A80E IRQV1 E078 IRQV3 E154 IRQ1 E163 IRQ2 E17F INCS2 E566 INTAB1 E743 INTAB2 E752 INTAB3 E756 INLOW E8F8 INALL E993 IPST F045 IPS0 F04A IPO0 F050 IPO2 F066 IPO3 F073 IPO4 F078 IPSU F0E3 IPS1 F0E8 IPS3 F105 IPS2 F10E INCP F121 IEVEN F486 IN F764 INL F76D IN02 F77A IN02A F785 IN03B F799 IN03 F7A8 IN03A F7B9 IN05 F7C5 INPU F7CB INPU1 F7D8 INDX FC81 IMMED1 FCC1 ISX FE03 INLUP FE35 JUMP A47D JMPR E1C1 JD1 E723 JD2 E72B JD3 E73C JD4 E742 JTBL FAB8 KEYF1 010C KEYF2 010F KEYF3 0112 KMASK A42A KDISA E70A KEP E7AF KEPR E970 KIFLG F8B6 KI2 F8B8 LENGTH 00EA LMNEM 0117 LDIY A42A LF 000A LOAD E2E6 LOAD1 E2E9 LOAD2 E306 LOAD4 E321 LOAD5 E323 LOADTA E32F LOAD1A E349 LOADT2 E364 LOADKI E3A4 LOADK1 E3A7 LOADK2 E3AA LOADK3 E3B7 LOADK5 E3D1 LOADK6 E3D3 LOADK7 E3E8 LL E8FE LT10 EA5A LDAY EB58 LST F7E1 LST01 F7F0 LST02 F7F8 LST3 F803 MOVAD 0126 MONRAM A400 MON 00C0 MOFF 00E0 MPRST 0010 MSP12 0002 MT2 0020 M1 E000 M3 E005 M4 E008 M5 E01C M6 E021 M7 E024 M8 E027 M9 E02A M10 E02D M11 E031 M12 E03B MCM2 E196 MCM3 E1AC MCNT 0020 MONCOM E1E5 MEM E248 MEIN E24D MEM1 E24F MEM2 E251 MEM3 E260 MEMERR EB33 MTBL F2D7 MNNDX1 F4AF MNNDX2 F4B3 MNNDX3 F4BA MR11A F512 MODE F55B MODE2 F59F MNEML F5B9 MNEMR F5F9 MREAD FAD0 MNEENT FB9E MODEM FBC1 MNEM FE06 MATCH FE51 MATCH1 FE5C NOWLN 00DF NMIV2 A402 NPUL A40A NAME A42E NULLC 00FF NMIV1 E075 NMIV3 E07B NMI4 E0B1 NMI5 E0B4 NXTADD E2CD NXTA1 E2DA NXT5 E60D NHIS E688 NH1 E690 NAMO E8CF NAMO1 E8D6 NAMO2 E8E9 NAMO3 E8EB NAMO4 E8F5 NUMA EA46 NOUT EA51 NEWROW F160 NEWCOL F163 NOWS1 F909 OLDLEN 00E9 OPCODE A434 OUTFLG A413 OUTCKS E531 OUTCK E538 OUTCK1 E53B OUTCK2 E547 OUTLOW E901 OUTL1 E906 OUTPUT E97A OUT1 E97B OUT1A E986 OUT2 E98F OUTALL E9BC OUTA1 E9C8 OUTA2 E9D0 OUTA3 E9E2 OUTA4 E9EA ONEKEY ED05 ONEK1 ED09 ONEK2 ED0B ONEK3 ED1C ONEK4 ED29 OUTTTY EEA8 OUTT1 EECB OUTT2 EEFB OUTDP EEFC OUTDP1 EF02 OUTDIS EF05 OUTD1 EF14 OUTD1A EF17 OUTD2 EF20 OUTD2A EF2F OUTD3 EF33 OUTD4 EF48 OUTD5 EF56 OUTD7 EF76 OUTDD1 EF7B OUTDD2 EF87 OUTDD3 EF8B OUTPRI F000 OUT01 F00F OUT04 F025 OUT05 F033 OUTPR F038 OUTPR1 F03A OUTPR2 F044 OP04 F130 OP07 F13F OP03 F144 OP05 F150 OP06 F15D OUTTAP F24A OUTTA1 F290 OUTTA2 F294 OUTTA3 F2B2 OPCOMP FCCB OPCMP1 FCD5 ONEBYT FD3E OK FDE7 OUTLUP FE30 PRIFLG A411 PCR A80C PRST 0000 PRTIME 06A4 PRITR E6E1 PROMPT E7BD PROMP1 E7C5 PR1 E7CC PR2 E7CF PSLS E7DC PSL0 E7FB PSL00 E802 PSL0A E814 PSL0B E81C PSL0C E81E PSL0D E823 PSL1 E837 PACK EA84 PAK1 EA96 PAK2 EA9F PCLLD EB56 PHXY EB9E PLXY EBAC PRIERR F079 PRNDOT F087 PRDOT0 F08C PINT F0CB PRMN1 F4D7 PRMN2 F4DB PRADR1 F4F7 PRADR2 F4FF PRADR3 F519 PRADR4 F52C PRNTXY F538 PRPC F53C PRBL2 F545 PCADJ3 F54D PCADJ4 F554 PLNE F727 P02 F729 P01 F73B P03 F73F P00 F749 PNTLUP FBD0 PAREN FC76 PATCH1 FE7C PAT2A FE91 PATCH4 FE9C PAT4A FEAE PATCH5 FEB1 PATCH6 FEB7 PATCH8 FEBC PATC8C FED1 PATCH9 FED8 PAT9A FEE2 PAT9B FEE8 PATC10 FEE9 PATC11 FEEF PATC12 FEF8 PATC13 FF03 PATC14 FF0D PATC15 FF17 PATC16 FF24 PATC17 FF2A PAT17A FF33 PAT17B FF3A PATC18 FF3D PAT18A FF48 PAT19 FF59 PAT20 FF60 PAT21 FF72 PAT21A FF74 PAT21B FF7F POMSG FF88 PAT22 FF9A PAT23 FFA0 PAT23A FFA5 PAT23B FFB2 PATC24 FFB5 PATC25 FFBC QM E7D4 RMNEM 0118 REGF A40E ROLLFL A47F RINT A485 RA AC00 RB AC02 RUB 0008 RSET E0BF RS1 E0C9 RS2 E0D4 RS3A E0F1 RS3 E0F3 RS3B E11A RS4 E11D RS5 E129 RS6 E13E RS7 E144 RS8 GOBK E26D GOBK0 E278 GOBK1 E286 GETID E425 GID1 E427 GOERR E608 GCNT E785 GCN1 E78C GETTTY EBDB GET1 EBE2 GET3 EBED GETKD0 EC38 GETKEY EC40 GETKY EC43 GETK0 EC55 GETK00 EC67 GETK1 EC71 GETK1B EC80 GETK2 EC82 GETK3 EC8D GETK4 EC93 GETK5 ECA4 GETK6 ECB9 GETK7 ECBE GETK8 ECBF GETK11 ECC9 GETK12 ECD2 GETK13 ECE1 GETK14 ECEB GETK10 ECEC GETTAP EE29 GETA1 EE2B GETFMT F499 GOGO FA4A GOGO1 FA5B GOTIT FE5F HISTM A42E HISTP A414 HIST A42E HEX EA7D HATCJ FC3D HATCH FCB6 IRQV4 A400 IRQV2 A404 INFLG A412 IBUFM A460 IDIR A474 ICOL A475 IOFFST A476 IDOT A477 IOUTL A478 IOUTU A479 IBITL A47A IBITU A47B IMASK A47C IFR A80D IER A80E IRQV1 E078 IRQV3 E154 IRQ1 E163 IRQ2 E17F INCS2 E566 INTAB1 E743 INTAB2 E752 INTAB3 E756 INLOW E8F8 INALL E993 IPST F045 IPS0 F04A IPO0 F050 IPO2 F066 IPO3 F073 IPO4 F078 IPSU F0E3 IPS1 F0E8 IPS3 F105 IPS2 F10E INCP F121 IEVEN F486 IN F764 INL F76D IN02 F77A IN02A F785 IN03B F799 IN03 F7A8 IN03A F7B9 IN05 F7C5 INPU F7CB INPU1 F7D8 INDX FC81 IMMED1 FCC1 ISX FE03 INLUP FE35 JUMP A47D JMPR E1C1 JD1 E723 JD2 E72B JD3 E73C JD4 E742 JTBL FAB8 KEYF1 010C KEYF2 010F KEYF3 0112 KMASK A42A KDISA E70A KEP E7AF KEPR E970 KIFLG F8B6 KI2 F8B8 LENGTH 00EA LMNEM 0117 LDIY A42A LF 000A LOAD E2E6 LOAD1 E2E9 LOAD2 E306 LOAD4 E321 LOAD5 E323 LOADTA E32F LOAD1A E349 LOADT2 E364 LOADKI E3A4 LOADK1 E3A7 LOADK2 E3AA LOADK3 E3B7 LOADK5 E3D1 LOADK6 E3D3 LOADK7 E3E8 LL E8FE LT10 EA5A LDAY EB58 LST F7E1 LST01 F7F0 LST02 F7F8 LST3 F803 MOVAD 0126 MONRAM A400 MON 00C0 MOFF 00E0 MPRST 0010 MSP12 0002 MT2 0020 M1 E000 M3 E005 M4 E008 M5 E01C M6 E021 M7 E024 M8 E027 M9 E02A M10 E02D M11 E031 M12 E03B MCM2 E196 MCM3 E1AC MCNT 0020 MONCOM E1E5 MEM E248 MEIN E24D MEM1 E24F MEM2 E251 MEM3 E260 MEMERR EB33 MTBL F2D7 MNNDX1 F4AF MNNDX2 F4B3 MNNDX3 F4BA MR11A F512 MODE F55B MODE2 F59F MNEML F5B9 MNEMR F5F9 MREAD FAD0 MNEENT FB9E MODEM FBC1 MNEM FE06 MATCH FE51 MATCH1 FE5C NOWLN 00DF NMIV2 A402 NPUL A40A NAME A42E NULLC 00FF NMIV1 E075 NMIV3 E07B NMI4 E0B1 NMI5 E0B4 NXTADD E2CD NXTA1 E2DA NXT5 E60D NHIS E688 NH1 E690 NAMO E8CF NAMO1 E8D6 NAMO2 E8E9 NAMO3 E8EB NAMO4 E8F5 NUMA EA46 NOUT EA51 NEWROW F160 NEWCOL F163 NOWS1 F909 OLDLEN 00E9 OPCODE A434 OUTFLG A413 OUTCKS E531 OUTCK E538 OUTCK1 E53B OUTCK2 E547 OUTLOW E901 OUTL1 E906 OUTPUT E97A OUT1 E97B OUT1A E986 OUT2 E98F OUTALL E9BC OUTA1 E9C8 OUTA2 E9D0 OUTA3 E9E2 OUTA4 E9EA ONEKEY ED05 ONEK1 ED09 ONEK2 ED0B ONEK3 ED1C ONEK4 ED29 OUTTTY EEA8 OUTT1 EECB OUTT2 EEFB OUTDP EEFC OUTDP1 EF02 OUTDIS EF05 OUTD1 EF14 OUTD1A EF17 OUTD2 EF20 OUTD2A EF2F OUTD3 EF33 OUTD4 EF48 OUTD5 EF56 OUTD7 EF76 OUTDD1 EF7B OUTDD2 EF87 OUTDD3 EF8B OUTPRI F000 OUT01 F00F OUT04 F025 OUT05 F033 OUTPR F038 OUTPR1 F03A OUTPR2 F044 OP04 F130 OP07 F13F OP03 F144 OP05 F150 OP06 F15D OUTTAP F24A OUTTA1 F290 OUTTA2 F294 OUTTA3 F2B2 OPCOMP FCCB OPCMP1 FCD5 ONEBYT FD3E OK FDE7 OUTLUP FE30 PRIFLG A411 PCR A80C PRST 0000 PRTIME 06A4 PRITR E6E1 PROMPT E7BD PROMP1 E7C5 PR1 E7CC PR2 E7CF PSLS E7DC PSL0 E7FB PSL00 E802 PSL0A E814 PSL0B E81C PSL0C E81E PSL0D E823 PSL1 E837 PACK EA84 PAK1 EA96 PAK2 EA9F PCLLD EB56 PHXY EB9E PLXY EBAC PRIERR F079 PRNDOT F087 PRDOT0 F08C PINT F0CB PRMN1 F4D7 PRMN2 F4DB PRADR1 F4F7 PRADR2 F4FF PRADR3 F519 PRADR4 F52C PRNTXY F538 PRPC F53C PRBL2 F545 PCADJ3 F54D PCADJ4 F554 PLNE F727 P02 F729 P01 F73B P03 F73F P00 F749 PNTLUP FBD0 PAREN FC76 PATCH1 FE7C PAT2A FE91 PATCH4 FE9C PAT4A FEAE PATCH5 FEB1 PATCH6 FEB7 PATCH8 FEBC PATC8C FED1 PATCH9 FED8 PAT9A FEE2 PAT9B FEE8 PATC10 FEE9 PATC11 FEEF PATC12 FEF8 PATC13 FF03 PATC14 FF0D PATC15 FF17 PATC16 FF24 PATC17 FF2A PAT17A FF33 PAT17B FF3A PATC18 FF3D PAT18A FF48 PAT19 FF59 PAT20 FF60 PAT21 FF72 PAT21A FF74 PAT21B FF7F POMSG FF88 PAT22 FF9A PAT23 FFA0 PAT23A FFA5 PAT23B FFB2 PATC24 FFB5 PATC25 FFBC QM E7D4 RMNEM 0118 REGF A40E ROLLFL A47F RINT A485 RA AC00 RB AC02 RUB 0008 RSET E0BF RS1 E0C9 RS2 E0D4 RS3A E0F1 RS3 E0F3 RS3B E11A RS4 E11D RS5 E129 RS6 E13E RS7 E144 RS8 GOBK E26D GOBK0 E278 GOBK1 E286 GETID E425 GID1 E427 GOERR E608 GCNT E785 GCN1 E78C GETTTY EBDB GET1 EBE2 GET3 EBED GETKD0 EC38 GETKEY EC40 GETKY EC43 GETK0 EC55 GETK00 EC67 GETK1 EC71 GETK1B EC80 GETK2 EC82 GETK3 EC8D GETK4 EC93 GETK5 ECA4 GETK6 ECB9 GETK7 ECBE GETK8 ECBF GETK11 ECC9 GETK12 ECD2 GETK13 ECE1 GETK14 ECEB GETK10 ECEC GETTAP EE29 GETA1 EE2B GETFMT F499 GOGO FA4A GOGO1 FA5B GOTIT FE5F HISTM A42E HISTP A414 HIST A42E HEX EA7D HATCJ FC3D HATCH FCB6 IRQV4 A400 IRQV2 A404 INFLG A412 IBUFM A460 IDIR A474 ICOL A475 IOFFST A476 IDOT A477 IOUTL A478 IOUTU A479 IBITL A47A IBITU A47B IMASK A47C IFR A80D IER A80E IRQV1 E078 IRQV3 E154 IRQ1 E163 IRQ2 E17F INCS2 E566 INTAB1 E743 INTAB2 E752 INTAB3 E756 INLOW E8F8 INALL E993 IPST F045 IPS0 F04A IPO0 F050 IPO2 F066 IPO3 F073 IPO4 F078 IPSU F0E3 IPS1 F0E8 IPS3 F105 IPS2 F10E INCP F121 IEVEN F486 IN F764 INL F76D IN02 F77A IN02A F785 IN03B F799 IN03 F7A8 IN03A F7B9 IN05 F7C5 INPU F7CB INPU1 F7D8 INDX FC81 IMMED1 FCC1 ISX FE03 INLUP FE35 JUMP A47D JMPR E1C1 JD1 E723 JD2 E72B JD3 E73C JD4 E742 JTBL FAB8 KEYF1 010C KEYF2 010F KEYF3 0112 KMASK A42A KDISA E70A KEP E7AF KEPR E970 KIFLG F8B6 KI2 F8B8 LENGTH 00EA LMNEM 0117 LDIY A42A LF 000A LOAD E2E6 LOAD1 E2E9 LOAD2 E306 LOAD4 E321 LOAD5 E323 LOADTA E32F LOAD1A E349 LOADT2 E364 LOADKI E3A4 LOADK1 E3A7 LOADK2 E3AA LOADK3 E3B7 LOADK5 E3D1 LOADK6 E3D3 LOADK7 E3E8 LL E8FE LT10 EA5A LDAY EB58 LST F7E1 LST01 F7F0 LST02 F7F8 LST3 F803 MOVAD 0126 MONRAM A400 MON 00C0 MOFF 00E0 MPRST 0010 MSP12 0002 MT2 0020 M1 E000 M3 E005 M4 E008 M5 E01C M6 E021 M7 E024 M8 E027 M9 E02A M10 E02D M11 E031 M12 E03B MCM2 E196 MCM3 E1AC MCNT 0020 MONCOM E1E5 MEM E248 MEIN E24D MEM1 E24F MEM2 E251 MEM3 E260 MEMERR EB33 MTBL F2D7 MNNDX1 F4AF MNNDX2 F4B3 MNNDX3 F4BA MR11A F512 MODE F55B MODE2 F59F MNEML F5B9 MNEMR F5F9 MREAD FAD0 MNEENT FB9E MODEM FBC1 MNEM FE06 MATCH FE51 MATCH1 FE5C NOWLN 00DF NMIV2 A402 NPUL A40A NAME A42E NULLC 00FF NMIV1 E075 NMIV3 E07B NMI4 E0B1 NMI5 E0B4 NXTADD E2CD NXTA1 E2DA NXT5 E60D NHIS E688 NH1 E690 NAMO E8CF NAMO1 E8D6 NAMO2 E8E9 NAMO3 E8EB NAMO4 E8F5 NUMA EA46 NOUT EA51 NEWROW F160 NEWCOL F163 NOWS1 F909 OLDLEN 00E9 OPCODE A434 OUTFLG A413 OUTCKS E531 OUTCK E538 OUTCK1 E53B OUTCK2 E547 OUTLOW E901 OUTL1 E906 OUTPUT E97A OUT1 E97B OUT1A E986 OUT2 E98F OUTALL E9BC OUTA1 E9C8 OUTA2 E9D0 OUTA3 E9E2 OUTA4 E9EA ONEKEY ED05 ONEK1 ED09 ONEK2 ED0B ONEK3 ED1C ONEK4 ED29 OUTTTY EEA8 OUTT1 EECB OUTT2 EEFB OUTDP EEFC OUTDP1 EF02 OUTDIS EF05 OUTD1 EF14 OUTD1A EF17 OUTD2 EF20 OUTD2A EF2F OUTD3 EF33 OUTD4 EF48 OUTD5 EF56 OUTD7 EF76 OUTDD1 EF7B OUTDD2 EF87 OUTDD3 EF8B OUTPRI F000 OUT01 F00F OUT04 F025 OUT05 F033 OUTPR F038 OUTPR1 F03A OUTPR2 F044 OP04 F130 OP07 F13F OP03 F144 OP05 F150 OP06 F15D OUTTAP F24A OUTTA1 F290 OUTTA2 F294 OUTTA3 F2B2 OPCOMP FCCB OPCMP1 FCD5 ONEBYT FD3E OK FDE7 OUTLUP FE30 PRIFLG A411 PCR A80C PRST 0000 PRTIME 06A4 PRITR E6E1 PROMPT E7BD PROMP1 E7C5 PR1 E7CC PR2 E7CF PSLS E7DC PSL0 E7FB PSL00 E802 PSL0A E814 PSL0B E81C PSL0C E81E PSL0D E823 PSL1 E837 PACK EA84 PAK1 EA96 PAK2 EA9F PCLLD EB56 PHXY EB9E PLXY EBAC PRIERR F079 PRNDOT F087 PRDOT0 F08C PINT F0CB PRMN1 F4D7 PRMN2 F4DB PRADR1 F4F7 PRADR2 F4FF PRADR3 F519 PRADR4 F52C PRNTXY F538 PRPC F53C PRBL2 F545 PCADJ3 F54D PCADJ4 F554 PLNE F727 P02 F729 P01 F73B P03 F73F P00 F749 PNTLUP FBD0 PAREN FC76 PATCH1 FE7C PAT2A FE91 PATCH4 FE9C PAT4A FEAE PATCH5 FEB1 PATCH6 FEB7 PATCH8 FEBC PATC8C FED1 PATCH9 FED8 PAT9A FEE2 PAT9B FEE8 PATC10 FEE9 PATC11 FEEF PATC12 FEF8 PATC13 FF03 PATC14 FF0D PATC15 FF17 PATC16 FF24 PATC17 FF2A PAT17A FF33 PAT17B FF3A PATC18 FF3D PAT18A FF48 PAT19 FF59 PAT20 FF60 PAT21 FF72 PAT21A FF74 PAT21B FF7F POMSG FF88 PAT22 FF9A PAT23 FFA0 PAT23A FFA5 PAT23B FFB2 PATC24 FFB5 PATC25 FFBC QM E7D4 RMNEM 0118 REGF A40E ROLLFL A47F RINT A485 RA AC00 RB AC02 RUB 0008 RSET E0BF RS1 E0C9 RS2 E0D4 RS3A E0F1 RS3 E0F3 RS3B E11A RS4 E11D RS5 E129 RS6 E13E RS7 E144 RS8 FCB6 AD 2E 01 HATCH LDA TYPE 3782 FCB9 C9 01 CMP #01 3783 FCBB F0 04 BEQ IMMED1 3784 FCBD A2 07 LDX #07 3785 FCBF D0 0A BNE OPCOMP 3786 FCC1 A2 06 IMMED1 LDX #06 3787 FCC3 D0 06 BNE OPCOMP 3788 FCC5 20 94 E3 ERRORM JSR CKER00 ;OUTPUT ERROR MESSAGE 3789 FCC8 4C AA FB JMP STARTM 3790 FCCB 3791 FCCB ;COMPUTE FINAL OP CODE FOR DEFINED ADDRESING MODE 3792 FCCB BD E2 FA OPCOMP LDA TYPTR1,X ;MATCH TYPE MASK WITH VALID MODE 3793 FCCE F0 05 BEQ OPCMP1 ;PATTERNS & SKIP 1ST WORD TEST IF 3794 FCD0 2D 26 01 AND TMASK1 ;ALREADY ZERO 3795 FCD3 D0 08 BNE VALID 3796 FCD5 BD F1 FA OPCMP1 LDA TYPTR2,X ;TEST 2ND PART 3797 FCD8 2D 27 01 AND TMASK2 ;INST DOES NOT HAVE SPECIFIED MODE 3798 FCDB F0 E8 BEQ ERRORM 3799 FCDD 18 VALID CLC ;FORM FINAL OP CODE 3800 FCDE BD 00 FB LDA CORR,X 3801 FCE1 6D 34 A4 ADC OPCODE 3802 FCE4 8D 34 A4 STA OPCODE 3803 FCE7 3804 FCE7 ;PROCESS ADRESSES TO FINAL FORMAT 3805 FCE7 BD 0F FB LDA SIZEM,X ;OBTAIN ADDRESS FORMAT FROM TABLE 3806 FCEA C9 00 CMP #00 3807 FCEC F0 50 BEQ ONEBYT 3808 FCEE C9 0F CMP #$0F ;NEED BRANCH COMPUTATION? 3809 FCF0 F0 1D BEQ BRNCHC 3810 FCF2 8D 33 A4 STA TEMPA ;SAVE START POINT & CHAR COUNT 3811 FCF5 29 0F AND #$0F ;SEPARATE CHARACTER COUNT 3812 FCF7 A8 TAY ;LOAD ADDR BYTES INTO Y (0,1,OR 2) 3813 FCF8 8D 2F A4 STA BYTESM ;SAVE IN BYTES 3814 FCFB EE 2F A4 INC BYTESM ;TO INSTR LENGTH (1,2,OR 3 BYTES) 3815 FCFE AD 33 A4 LDA TEMPA ;SEPARATE STARTING POINT 3816 FD01 29 F0 AND #$F0 3817 FD03 4A LSR A 3818 FD04 4A LSR A 3819 FD05 4A LSR A 3820 FD06 4A LSR A 3821 FD07 AA TAX ;AND PUT IT IN X 3822 FD08 20 12 FD JSR CONVRT ;CONVERT ASCII ADDRESS TO HEX 3823 FD0B B0 B8 BCS ERRORM ;SKIP OUT IF ERROR IN INPUT 3824 FD0D 90 1D BCC STASH 3825 FD0F 4C 86 FD BRNCHC JMP BRCOMP 3826 FD12 3827 FD12 ;############ SUBROUTINE ############### 3828 FD12 ;CONVERT FORMATTED ADDRESS INTO PROPER HEX ADDRESS 3829 FD12 BD 33 01 CONVRT LDA ADFLD,X ;PICK UP 1ST ADDRES CHARACTER 3830 FD15 20 7D EA JSR HEX ;CONVERT TO MOST SIG HEX 3831 FD18 B0 11 BCS ERRFLG 3832 FD1A E8 INX ;GET NEXT ASCII CHARACTER 3833 FD1B BD 33 01 LDA ADFLD,X 3834 FD1E E8 INX ;POINT TO NEXT CHARACTER, IF ANY 3835 FD1F 20 84 EA JSR PACK 3836 FD22 B0 07 BCS ERRFLG 3837 FD24 99 34 A4 STA OPCODE,Y ;SAVE IN MOST SIG. BYTE LOCATION 3838 FD27 88 DEY ;SET UP FOR NEXT ADDR BYTE, IF ANY 3839 FD28 D0 E8 BNE CONVRT ;IF NECESSARY, FORM NEXT ADDR BYTE 3840 FD2A 18 CLC 3841 FD2B 60 ERRFLG RTS ;NON HEX CLEARED CARRY 3842 FD2C ;############# 3843 FD2C 3844 FD2C AC 2F A4 STASH LDY BYTESM ;SET UP TO STORE COMMAND 3845 FD2F 88 DEY 3846 FD30 B9 34 A4 STSHLP LDA OPCODE,Y 3847 FD33 20 78 EB JSR SADDR ;STORE ONE BYTE OF COMMAND 3848 FD36 C0 00 CPY #00 3849 FD38 F0 0B BEQ FORMDS 3850 FD3A 88 DEY 3851 FD3B B8 CLV 3852 FD3C 50 F2 BVC STSHLP ;REPEAT TILL THRU 3853 FD3E 3854 FD3E A9 01 ONEBYT LDA #01 ;SET BYTES = 1 3855 FD40 8D 2F A4 STA BYTESM 3856 FD43 D0 E7 BNE STASH 3857 FD45 3858 FD45 ;FORMAT FOR SYSTEM 65 DISPLAY (REFORMAT FOR AIM) 3859 FD45 20 44 EB FORMDS JSR CLR 3860 FD48 20 DD E5 JSR CGPC1 ;ADDR TO SAVPC FOR DISASSEMBLY 3861 FD4B 20 42 E8 JSR TTYTST ;IF TTY DO NOT GO TO DISASS 3862 FD4E D0 08 BNE FORMD1 3863 FD50 20 3B E8 JSR BLANK2 ;IT IS TTY 3864 FD53 20 3B E8 JSR BLANK2 3865 FD56 D0 11 BNE FORMD2 ;OUTPUT OPCODE 3866 FD58 20 6C F4 FORMD1 JSR DISASM 3867 FD5B 20 24 EA JSR CRCK ; IF PRI PTR DIFF FROM 0 3868 FD5E AD 37 A4 LDA CODFLG ;SEE IF HE WANTS CODE ALSO 3869 FD61 F0 1A BEQ FORM1 3870 FD63 20 3E E8 JSR BLANK 3871 FD66 20 3C F5 JSR PRPC ;PROG CNTR 3872 FD69 ;OUTPUT OPCODE 3873 FD69 AE 2F A4 FORMD2 LDX BYTESM 3874 FD6C A0 00 LDY #00 3875 FD6E A9 1C DISPLY LDA #ADDR ;DO LDA (ADDR),Y ,WHITOUT PAG 0 3876 FD70 20 58 EB JSR LDAY 3877 FD73 20 46 EA JSR NUMA 3878 FD76 20 3E E8 JSR BLANK 3879 FD79 C8 INY 3880 FD7A CA DEX 3881 FD7B D0 F1 BNE DISPLY 3882 FD7D 3883 FD7D ;POINT TO NEXT INSTRUCTION LOCATION 3884 FD7D AC 2F A4 FORM1 LDY BYTESM ;ADD BYTESM TO ADDR 3885 FD80 20 CD E2 JSR NXTADD 3886 FD83 4C 24 FF JMP PATC16 ;UPDATE PC 3887 FD86 3888 FD86 ;RELATIVE BRANCH ADDRESS COMPUTATION 3889 FD86 AD 31 A4 BRCOMP LDA TEMPX 3890 FD89 C9 02 CMP #02 ;IF REL BRANCH INPUT, USE IT 3891 FD8B D0 11 BNE COMPBR 3892 FD8D A2 00 LDX #00 3893 FD8F A0 01 LDY #01 3894 FD91 20 12 FD JSR CONVRT 3895 FD94 B0 40 BCS ERRJMP 3896 FD96 A9 02 LDA #02 3897 FD98 8D 2F A4 STA BYTESM ;SET PROPER BYTES 3898 FD9B 4C 2C FD JMP STASH 3899 FD9E A2 00 COMPBR LDX #00 3900 FDA0 A0 02 LDY #02 3901 FDA2 20 12 FD JSR CONVRT 3902 FDA5 B0 2F BCS ERRJMP 3903 FDA7 AD 1D A4 LDA ADDR+1 ;ADD BRANCH OFFSET 3904 FDAA 8D 27 01 STA MOVAD+1 3905 FDAD AD 1C A4 LDA ADDR 3906 FDB0 18 CLC 3907 FDB1 69 02 ADC #02 3908 FDB3 8D 26 01 STA MOVAD 3909 FDB6 90 03 BCC CMPBR1 3910 FDB8 EE 27 01 INC MOVAD+1 3911 FDBB 38 CMPBR1 SEC ;COMPUTE BRANCH RELATIVE ADDRESS 3912 FDBC AD 35 A4 LDA OPCODE+1 3913 FDBF ED 26 01 SBC MOVAD 3914 FDC2 8D 35 A4 STA OPCODE+1 3915 FDC5 AD 36 A4 LDA OPCODE+2 3916 FDC8 ED 27 01 SBC MOVAD+1 3917 FDCB 8D 36 A4 STA OPCODE+2 3918 FDCE C9 00 CMP #00 3919 FDD0 F0 0E BEQ FORWRD 3920 FDD2 C9 FF CMP #$FF 3921 FDD4 F0 03 BEQ BACKWD 3922 FDD6 4C C5 FC ERRJMP JMP ERRORM 3923 FDD9 AD 35 A4 BACKWD LDA OPCODE+1 ;CHECK IN RANGE 3924 FDDC 30 09 BMI OK 3925 FDDE 10 F6 BPL ERRJMP 3926 FDE0 AD 35 A4 FORWRD LDA OPCODE+1 3927 FDE3 10 02 BPL OK 3928 FDE5 30 EF BMI ERRJMP 3929 FDE7 A9 02 OK LDA #02 ;SET UP FOR STASH 3930 FDE9 8D 2F A4 STA BYTESM 3931 FDEC 4C 2C FD JMP STASH 3932 FDEF 3933 FDEF ;###### SUBROUTINE ######## 3934 FDEF ;SUBROUTINE FOR DETERMINING X OR Y OR NEITHER 3935 FDEF A2 04 XORY LDX #04 3936 FDF1 BD 33 01 XORYZ LDA ADFLD,X 3937 FDF4 C9 2C CMP #',' 3938 FDF6 D0 04 BNE XORY1 3939 FDF8 E8 INX 3940 FDF9 BD 33 01 LDA ADFLD,X 3941 FDFC C9 58 XORY1 CMP #'X' 3942 FDFE F0 03 BEQ ISX 3943 FE00 C9 59 CMP #'Y' 3944 FE02 GOBK E26D GOBK0 E278 GOBK1 E286 GETID E425 GID1 E427 GOERR E608 GCNT E785 GCN1 E78C GETTTY EBDB GET1 EBE2 GET3 EBED GETKD0 EC38 GETKEY EC40 GETKY EC43 GETK0 EC55 GETK00 EC67 GETK1 EC71 GETK1B EC80 GETK2 EC82 GETK3 EC8D GETK4 EC93 GETK5 ECA4 GETK6 ECB9 GETK7 ECBE GETK8 ECBF GETK11 ECC9 GETK12 ECD2 GETK13 ECE1 GETK14 ECEB GETK10 ECEC GETTAP EE29 GETA1 EE2B GETFMT F499 GOGO FA4A GOGO1 FA5B GOTIT FE5F HISTM A42E HISTP A414 HIST A42E HEX EA7D HATCJ FC3D HATCH FCB6 IRQV4 A400 IRQV2 A404 INFLG A412 IBUFM A460 IDIR A474 ICOL A475 IOFFST A476 IDOT A477 IOUTL A478 IOUTU A479 IBITL A47A IBITU A47B IMASK A47C IFR A80D IER A80E IRQV1 E078 IRQV3 E154 IRQ1 E163 IRQ2 E17F INCS2 E566 INTAB1 E743 INTAB2 E752 INTAB3 E756 INLOW E8F8 INALL E993 IPST F045 IPS0 F04A IPO0 F050 IPO2 F066 IPO3 F073 IPO4 F078 IPSU F0E3 IPS1 F0E8 IPS3 F105 IPS2 F10E INCP F121 IEVEN F486 IN F764 INL F76D IN02 F77A IN02A F785 IN03B F799 IN03 F7A8 IN03A F7B9 IN05 F7C5 INPU F7CB INPU1 F7D8 INDX FC81 IMMED1 FCC1 ISX FE03 INLUP FE35 JUMP A47D JMPR E1C1 JD1 E723 JD2 E72B JD3 E73C JD4 E742 JTBL FAB8 KEYF1 010C KEYF2 010F KEYF3 0112 KMASK A42A KDISA E70A KEP E7AF KEPR E970 KIFLG F8B6 KI2 F8B8 LENGTH 00EA LMNEM 0117 LDIY A42A LF 000A LOAD E2E6 LOAD1 E2E9 LOAD2 E306 LOAD4 E321 LOAD5 E323 LOADTA E32F LOAD1A E349 LOADT2 E364 LOADKI E3A4 LOADK1 E3A7 LOADK2 E3AA LOADK3 E3B7 LOADK5 E3D1 LOADK6 E3D3 LOADK7 E3E8 LL Ell always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) BACK 4118 FF3D 4119 FF3D 20 F8 FE PATC18 JSR PATC12 ;RESET PRIFLG 4120 FF40 48 PHA 4121 FF41 20 42 E8 JSR TTYTST ;IF TTY JUST RTN 4122 FF44 D0 02 BNE PAT18A 4123 FF46 68 PLA 4124 FF47 60 RTS 4125 FF48 20 FE E8 PAT18A JSR LL ;SET TO LOW SPEED 4126 FF4B 20 45 F0 JSR IPST ;PRINT WHAT IS IN BUFFER 4127 FF4E 20 44 EB JSR CLR ;CLR PRINTER BUFFER BY OUTPUTTING 4128 FF51 20 3E E8 JSR BLANK ;AN SPACE 4129 FF54 20 44 EB JSR CLR 4130 FF57 68 PLA ;RTN ACC 4131 FF58 60 RTS 4132 FF59 4133 FF59 D8 PAT19 CLD 4134 FF5A 20 24 EA JSR CRCK 4135 FF5D 4C 85 E1 JMP STA1 4136 FF60 4137 FF60 F0 0D PAT20 BEQ VECK4 ;END - B=-A Negation. Note that 0-A is subtraction, while -A is negation. ^ (F3 key) 130 PRINT X^3 Exponentiation (equal to X*X*X in in the sample statement) 0^0=1 0 to any other power = 0 A^B, with A negative and B not an integer gives an FC error. * 140 X=R*(B*D) Multiplication. / 150 PRINT X/1.3 Division. + 160 Z=R+T+Q Addition - 170 J=100-I Subtraction RULES FOR EVALUATING EXPRESSIONS: 1) Operations of higher precedence are performed before operations of lower precedence. This means the multiplication and divisions are performed before additions and subtractions. As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found in a formula, the left hand one is executed first: 6-3+5=8, not -2. 2) The order in which operations are performed can always be specified explicitly through the use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use (5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the highest precedence : NOTE Operators listed on the same line have the same precedence. 1) Expressions in parentheses are always evaluated first 2) ^ (F3 KEY) ExponentiatiOn 3) NEGATION -X where X may be a formula 4) * and / Multiplication and Division 5) + and - Addition and Subtraction 6) RELATIONAL OPERATORS: = Equal (equal precedence for all six) <> Not Equal < Less Than > Greater Than =< or <= Less Than or Equal => or >= Greater Than or Equal (These three below are Logical Operators) 7) NOT Logical and bitwise "NOT" like negation, not takes only the formula to its right as an argument 8) AND Logical and bitwise "AND" 9) OR Logical and bitwise "OR" A relational expression can be used as part of any expression. Relational Operator expressions will always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) - B=-A Negation. Note that 0-A is subtraction, while -A is negation. ^ (F3 key) 130 PRINT X^3 Exponentiation (equal to X*X*X in in the sample statement) 0^0=1 0 to any other power = 0 A^B, with A negative and B not an integer gives an FC error. * 140 X=R*(B*D) Multiplication. / 150 PRINT X/1.3 Division. + 160 Z=R+T+Q Addition - 170 J=100-I Subtraction RULES FOR EVALUATING EXPRESSIONS: 1) Operations of higher precedence are performed before operations of lower precedence. This means the multiplication and divisions are performed before additions and subtractions. As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found in a formula, the left hand one is executed first: 6-3+5=8, not -2. 2) The order in which operations are performed can always be specified explicitly through the use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use (5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the highest precedence : NOTE Operators listed on the same line have the same precedence. 1) Expressions in parentheses are always evaluated first 2) ^ (F3 KEY) ExponentiatiOn 3) NEGATION -X where X may be a formula 4) * and / Multiplication and Division 5) + and - Addition and Subtraction 6) RELATIONAL OPERATORS: = Equal (equal precedence for all six) <> Not Equal < Less Than > Greater Than =< or <= Less Than or Equal => or >= Greater Than or Equal (These three below are Logical Operators) 7) NOT Logical and bitwise "NOT" like negation, not takes only the formula to its right as an argument 8) AND Logical and bitwise "AND" 9) OR Logical and bitwise "OR" A relational expression can be used as part of any expression. Relational Operator expressions will always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) - B=-A Negation. Note that 0-A is subtraction, while -A is negation. ^ (F3 key) 130 PRINT X^3 Exponentiation (equal to X*X*X in in the sample statement) 0^0=1 0 to any other power = 0 A^B, with A negative and B not an integer gives an FC error. * 140 X=R*(B*D) Multiplication. / 150 PRINT X/1.3 Division. + 160 Z=R+T+Q Addition - 170 J=100-I Subtraction RULES FOR EVALUATING EXPRESSIONS: 1) Operations of higher precedence are performed before operations of lower precedence. This means the multiplication and divisions are performed before additions and subtractions. As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found in a formula, the left hand one is executed first: 6-3+5=8, not -2. 2) The order in which operations are performed can always be specified explicitly through the use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use (5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the highest precedence : NOTE Operators listed on the same line have the same precedence. 1) Expressions in parentheses are always evaluated first 2) ^ (F3 KEY) ExponentiatiOn 3) NEGATION -X where X may be a formula 4) * and / Multiplication and Division 5) + and - Addition and Subtraction 6) RELATIONAL OPERATORS: = Equal (equal precedence for all six) <> Not Equal < Less Than > Greater Than =< or <= Less Than or Equal => or >= Greater Than or Equal (These three below are Logical Operators) 7) NOT Logical and bitwise "NOT" like negation, not takes only the formula to its right as an argument 8) AND Logical and bitwise "AND" 9) OR Logical and bitwise "OR" A relational expression can be used as part of any expression. Relational Operator expressions will always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR EÜb@ÿØóA/§J6€2Hà¸>ùÁõÊPH%´expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) - B=-A Negation. Note that 0-A is subtraction, while -A is negation. ^ (F3 key) 130 PRINT X^3 Exponentiation (equal to X*X*X in in the sample statement) 0^0=1 0 to any other power = 0 A^B, with A negative and B not an integer gives an FC error. * 140 X=R*(B*D) Multiplication. / 150 PRINT X/1.3 Division. + 160 Z=R+T+Q Addition - 170 J=100-I Subtraction RULES FOR EVALUATING EXPRESSIONS: 1) Operations of higher precedence are performed before operations of lower precedence. This means the multiplication and divisions are performed before additions and subtractions. As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found in a formula, the left hand one is executed first: 6-3+5=8, not -2. 2) The order in which operations are performed can always be specified explicitly through the use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use (5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the highest precedence : NOTE Operators listed on the same line have the same precedence. 1) Expressions in parentheses are always evaluated first 2) ^ (F3 KEY) ExponentiatiOn 3) NEGATION -X where X may be a formula 4) * and / Multiplication and Division 5) + and - Addition and Subtraction 6) RELATIONAL OPERATORS: = Equal (equal precedence for all six) <> Not Equal < Less Than > Greater Than =< or <= Less Than or Equal => or >= Greater Than or Equal (These three below are Logical Operators) 7) NOT Logical and bitwise "NOT" like negation, not takes only the formula to its right as an argument 8) AND Logical and bitwise "AND" 9) OR Logical and bitwise "OR" A relational expression can be used as part of any expression. Relational Operator expressions will always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR EÜb@ÿØóA/§J6€2Hà¸>ùÁõÊPH%´expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) - B=-A Negation. Note that 0-A is subtraction, while -A is negation. ^ (F3 key) 130 PRINT X^3 Exponentiation (equal to X*X*X in in the sample statement) 0^0=1 0 to any other power = 0 A^B, with A negative and B not an integer gives an FC error. * 140 X=R*(B*D) Multiplication. / 150 PRINT X/1.3 Division. + 160 Z=R+T+Q Addition - 170 J=100-I Subtraction RULES FOR EVALUATING EXPRESSIONS: 1) Operations of higher precedence are performed before operations of lower precedence. This means the multiplication and divisions are performed before additions and subtractions. As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found in a formula, the left hand one is executed first: 6-3+5=8, not -2. 2) The order in which operations are performed can always be specified explicitly through the use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use (5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the highest precedence : NOTE Operators listed on the same line have the same precedence. 1) Expressions in parentheses are always evaluated first 2) ^ (F3 KEY) ExponentiatiOn 3) NEGATION -X where X may be a formula 4) * and / Multiplication and Division 5) + and - Addition and Subtraction 6) RELATIONAL OPERATORS: = Equal (equal precedence for all six) <> Not Equal < Less Than > Greater Than =< or <= Less Than or Equal => or >= Greater Than or Equal (These three below are Logical Operators) 7) NOT Logical and bitwise "NOT" like negation, not takes only the formula to its right as an argument 8) AND Logical and bitwise "AND" 9) OR Logical and bitwise "OR" A relational expression can be used as part of any expression. Relational Operator expressions will always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR EÜb@ÿØóA/§J6€2Hà¸>ùÁõÊPH%´expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) gn will be "+" for positive and "-" for negative. Two digits of the exponent are always printed; that is, zeroes are not suppressed in the exponent field. The value of any number expressed thus is the number so the left of the "E" times 10 raised to the power of the number to the right of the "E". Regardless of what format is used, a space is always printed following a number. BASIC checks to see if the entire number will fit on the current line. If it cannot, a carriage return/line feed is executed before printing the number. Following are examples of various numbers and the output format in which BASIC will output them: NUMBER OUTPUT FORMAT ------------- ------------- +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 .1 .01 .01 .000123 1.23 E-04 A number input from the keyboard or a numeric constant used in a BASIC program may have as many digits as desired, up to the maximum length of a line (72 characters) or maximum numeric value. However, only the first 10 digits are significant, and tenth digit is rounded up. PRINT 1.23456789876543210 1.2345679 206 VARIABLES ASSIGNING VARIABLES WITH AN INPUT STATEMENT Following is an example of a program that reads a value from the keyboard and uses that value to calculate and print a result: 10 INPUT R 20 PRINT 3.14159*R*R RUN ?10 314.159 Here's what's happening: When BASIC encounters the input statement, it outputs a question mark (?) on the display and then waits for you to type in a number. When you do (in the above example, 10 was typed), execution continues with the next statement in the program after the variable (R) has been set (in this case to 10). In the above example, line 20 would now be executed. When the formula after the PRINT statement is evaluated, the value 10 is substituted for the variable R each time R appears in the formula. Therefore, the formula becomes 3.14159*10*10, or 314.159. If we wanted so calculate the area of various circles, we could rerun the program for each successive circle. But, there's an easier way to do it simply by adding another line to the program, as follows: 30 GOTO 10 RUN ?10 314.159 ?3 28.27431 ?4.7 69.3977231 ? By putting a "GOTO" statement on the end of our program, we have caused it to go back to line 10 after it prints each answer for the successive circles. This could have gone on indefinitely, but we decided to stop after calculating the area for three circles. This was accomplished by typing a carriage return to the input statement (thus a blank line). VARIABLE NAMES The letter "R" in the program above is a "variable." A variable name can be any alphabetic character and may be followed by any alphanumeric character (letters A to Z, numbers 0 to 9). Any alphanumeric characters after the first two are ignored. Here are some examples of legal and illegal variable names: Legal Illegal A % (first character must be alphabetic) Z1 ZIABCD (variable name too long) TP TO (variable names cannot be reserved words) PSTG$ RGOTO (variable names cannot contain reserved words) COUNT ASSIGNING VARIABLES WITH A LET OR ASSIGNMENT STATEMENT Besides having values assigned to variables with an input statement, you can also set the value of a variable with a LET or assignment statement. Try the following examples: A=5 PRINT A, A*2 5 10 LET Z=7 PRINT Z, Z-A 7 2 As you will notice from the examples, the "LET" is optional in an assignment statement. BASIC "remembers" the values that have been assigned to variables using this type of statement. This "remembering" process uses space in the memory to store the data. The values of variables are discarded (and the space in memory used to store them is released) when one of four conditions occur: * A new line is typed into the program or an old line is deleted * A CLEAR command is typed in * A RUN command is typed in * NEW is typed in Another important fact is that if a variable is encountered in a formula before it is assigned a value, it is automatically assigned the value zero. Zero is then substituted as the value of the variable in the particular formula. Try the example below: PRINT Q;Q+2;Q*2 0 2 0 RESERVED WORDS The words used as BASIC statements are "reserved" for this specific purpose. You cannot use these words as variable names or inside of any variable name. For instance, "FEND" would be illegal because "END" is a reserved word. Table 206-1 is a list of the reserved words in BASIC. Table 206-1. AIM 65 BASIC Reserved Words ABS FN LIST PRINT SPC AND FOR LOAD POS SQR ASC FRE LOG READ STEP ATN GET MID$ REM STOP CHR$ GOSUB NEW RESTORE STR$ CLEAR GOTO NEXT RETURN TAB CONT IF NOT RIGHT$ TAN COS INPUT NULL RND THEN DATA INT ON RUN TO DEF LEFT$ OR SAVE USR DIM LEN PEEK SGN VAL END LET POKE SIN WAIT EXP REMARKS The REM (short for "remark") statement is used to insert comments or notes into a program. When BASIC encounters a REM statement, the rest of the line is ignored. This serves mainly as an aid for the programmer and serves no useful function as far as the operation of the program in solving a particular problem. 207 RELATIONAL TESTS Suppose we wanted to write a program to check whether a number is zero. With the statements we've gone over so far, this could not be done. What is needed is a statement which can be used to conditionally branch to another statement. The "IF-THEN" statement does just that. Type in the following program: (remember, type NEW first) 10 INPUT B 20 IF B=0 THEN 55 30 PRINT "NON-ZERO" 40 GOTO 10 50 PRINT "ZERO" 60 GOTO 10 When this program is typed and run, it will ask for a value for B. Type in any value you wish. The AIM 65 will then come to the "IF" statement. Between the "IF" and the "THEN" portion of the statement there are two expressions separated by a "relation." A relation is one of the following six symbols: RELATION MEANING -------- ------------------------ = EQUAL TO > GREATER THAN < LESS THAN <> NOT EQUAL TO <= or =< LESS THAN OR EQUAL TO => or >= GREATER THAN OR EQUAL TO The IF statement is either true or false, depending upon whether the two expressions satisfy the relation. For example, in the program we just did, if 0 was typed in for B the IF statement would be true because 0=0. In this case, since the number after the THEN is 50, execution of the program would continue at line 50. Therefore, "ZERO" would be printed and then the program would jump back to line 10 (because of the GOTO statement in line 60). Suppose a 1 was typed in for B. Since 1=0 is false, the IF statement would be false and the program would continue execution with the next line. Therefore, "NON-ZERO" would be printed and the GOTO in line 40 would send the program back to line 10. A PROGRAM USING RELATIONS Now try the following program for comparing two numbers: 10 INPUT A,B 20 IF A<=B THEN 50 30 PRINT "A IS BIGGER" 40 GOTO 10 50 IF A=1 THEN 20 Notice that we are now checking to see that I is greater than or equal to the final value. The reason is that we are now counting by a negative number. In the previous examples it was the opposite, so we were checking for a variable less than or equal to the final value. SOME OTHER LOOPING OPERATIONS The "STEP" statement previously shown can also be used with negative numbers to accomplish this same result. This can be done using the same format as in the other program: 10 FOR I=10 TO 1 STEP -1 20 PRINT I 30 NEXT I "FOR" loops can also be "nested." For example: 10 FOR I=1 TO 5 20 FOR J=1 TO 3 30 PRINT I,J 40 NEXT J 50 NEXT I Notice that "NEXT J" precedes "NEXT I." This is because the J-Ioop is inside the I-loop. The following program is incorrect; run it and see what happens: 10 FOR I=1 TO 5 20 FOR J=1 TO 3 30 PRINT I,J 40 NEXT I 50 NEXT J It does not work because when the "NEXT I" is encountered, all knowledge of the J-loop is lost. This happens because the J-loop is "inside" the I-loop. 209 MATRIX OPERATIONS It is often convenient to be able to select any element in a table of numbers. BASIC allows this to be done through the use of matrices. A matrix is a table of numbers. The name of this table (the matrix name) is any legal variable name, "A" for example. The matrix name "A" is distinct and separate from the simple variable "A," and you could use both in the same program. To select an element of the table, we subscript "A": that is, to select the I'th element, we enclose I in parentheses "(I)" and then follow "A" by this subscript. Therefore, "A(I)" is the I'th element in the matrix "A." "A(1)" is only one element of matrix A, and BASIC must be told how much space so allocate for the entire matrix. This is done with a "DIM" statement, using the format "DIM A(15)." In this case, we have reserved space for the matrix index "I" to go from 0 to 15. Matrix subscripts always start as 0; therefore, in the above example, we have allowed for 16 numbers in matrix A. If "A(1)" is used in a program before is has been dimensioned, BASIC reserves space for 11 elements (0 through 10). A SORT PROGRAM As an example of how matrices are used, try the following program so sort a list of 8 numbers, in which you pick the numbers to be sorted: 10 DIM A(8) 110 A(I)=A(I+1) 20 FOR I=1 TO 8 120 A(I+1)=T 30 INPUT A(I) 130 F=1 50 NEXT I 140 NEXT I 70 F=0 150 IF F=1 THEN 70 80 FOR I=1 TO 7 160 FOR I=1 TO 8 90 IF A(I)<=A(I+1) THEN 140 170 PRINT A(I) - B=-A Negation. Note that 0-A is subtraction, while -A is negation. ^ (F3 key) 130 PRINT X^3 Exponentiation (equal to X*X*X in in the sample statement) 0^0=1 0 to any other power = 0 A^B, with A negative and B not an integer gives an FC error. * 140 X=R*(B*D) Multiplication. / 150 PRINT X/1.3 Division. + 160 Z=R+T+Q Addition - 170 J=100-I Subtraction RULES FOR EVALUATING EXPRESSIONS: 1) Operations of higher precedence are performed before operations of lower precedence. This means the multiplication and divisions are performed before additions and subtractions. As an example, 2+10/5 equals 4, not 2.4. When operations of equal precedence are found in a formula, the left hand one is executed first: 6-3+5=8, not -2. 2) The order in which operations are performed can always be specified explicitly through the use of parentheses. For instance, to add 5 to 3 and then divided that by 4, we would use (5+3)/4, which equals 2. If instead we had used 5+3/4, we would get 5.75 as a result (5 plus 3/4). The precedence of operators used in evaluating expressions is as follows, in order beginning with the highest precedence : NOTE Operators listed on the same line have the same precedence. 1) Expressions in parentheses are always evaluated first 2) ^ (F3 KEY) ExponentiatiOn 3) NEGATION -X where X may be a formula 4) * and / Multiplication and Division 5) + and - Addition and Subtraction 6) RELATIONAL OPERATORS: = Equal (equal precedence for all six) <> Not Equal < Less Than > Greater Than =< or <= Less Than or Equal => or >= Greater Than or Equal (These three below are Logical Operators) 7) NOT Logical and bitwise "NOT" like negation, not takes only the formula to its right as an argument 8) AND Logical and bitwise "AND" 9) OR Logical and bitwise "OR" A relational expression can be used as part of any expression. Relational Operator expressions will always have a value of True (-1) or a value of False (0). Therefore, (5=4)=0, (5=5)=-1, (4>5)=0, (4<5)=-1, etc. The THEN clause of an IF statement is executed whenever the formula after the IF is not equal to 0. That is to say, IF X THEN ... is equivalent to IF X<>0 THEN .... SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- - 10 IF A=15 THEN 40 Expression Equals Expression <> 70 IF A<>0 THEN 5 Expression Does Not Equal Expression > 30 IF B>100 THEN 8 Expression Greater Than Expression < 160 IF B<2 THEN 10 Expression Less Than Expression <=,=< 180 IF 100<=B+C THEN 10 Expression Less Than or Equal To Expression >=,=> 190 IF Q=>R THEN 50 Expression Greater Than Or Equal To Expression AND 2 IF A<5 AND B<2 THEN 7 If expression 1 (A<5) AND expression 2 (B<2) are both true, then branch to line 7 OR IF A<1 OR B<2 THEN 2 If either expression 1 (A<1) OR EÜb@ÿØóA/§J6€2Hà¸>ùÁõÊPH%´expression 2 (B<2) is true, then branch to line 2 NOT IF NOT Q3 THEN 4 If expression "NOT Q3" is true (Because Q3 is false), then branch to line 4 Note: NOT -1=0 (NOT true=false) AND, OR, and NOT can be used for bit manipulation, and for performing boolean operations. These three operators convert their arguments to sixteen bit, signed two's-complement integers in the range -32768 to +32767. They then perform the specified logical operation on them and return a result within the same range. If the arguments are not in this range, an "FC" error results. The operations are performed in bitwise fashion, this means that each bit of the result is obtained by examining the bit in the same position for each argument. The following truth table shows the logical relationship between bits: OPERATOR ARGUMENT 1 ARGUMENT 2 RESULT -------- ---------- ---------- ------ AND 1 1 1 0 1 0 1 0 0 0 0 0 OR 1 1 1 1 0 1 0 1 1 0 0 0 NOT 1 - 0 0 - 1 EXAMPLES: (In all of the examples below, leading zeroes on binary numbers are not shown.) 63 AND 16=16 Since 63 equals binary 111111 and 16 equals binary 10000, the result of the AND is binary 10000 or 16. 15 AND 14=14 15 equals binary 1111 and 14 equals binary 1110, so 15 AND 14 equals binary 1110 or 14. -1 AND 8=8 -1 equals binary 1111111111111111 and 8 equals binary 1000, so the result is binary 1000 or 8 decimal. 4 AND 2=0 4 equals binary 100 and 2 equals binary 10, so the result is binary 0 because nons of the bits in either argument match to give a 1 bit in the result. 4 OR 2=6 Binary 100 OR'd with binary 10 equals binary 110, or 6 decimal. 10 OR 10=10 Binary 1010 OR'd with binary 1010 equals binary 1010, or 10 decimal. -1 OR -2=-1 Binary 1111111111111111 (-1) OR'd with binary 1111111111111110 (-2) equals binary 1111111111111111, or -1. NOT 0=-1 The bit complement of binary 0 to 16 places is sixteen ones (1111111111111111) or -1. Also NOT -1=0. NOT X NOT X is equal to -(X+1). This is because to form the sixteen bit two's complement of the number, you take the bit (one's) complement and add one. NOT 1=-2 The sixteen bit complement of 1 is 1111111111111110, which is equal to -(1+1) or -2. A typical use of the bitwise operators is to test bits set in the computer's locations which reflect the state of some external device. Bit position 7 is the most significant bit of a byte, while position 0 is the least significant. For instance, suppose bit 1 of location 40963 is 0 when the door to Room X is closed, and 1 if the door is open. The following program will print "Intruder Alert" if the door is opened: 10 IF NOT (PEEK(40963) AND 2) THEN 10 This line will execute over and over until bit 1 (masked or selected by the 2) appens. MID$ FUNCTION There is also a string function which allows us to take characters from the middle of a string. Try the following: FOR N=1 TO LEN(A$):PRINT MID$(A$,N):NEXT N ROCKWELL R6500 OCKWELL R6500 CKWELL R6500 KWELL R6500 WELL R6500 ELL R6500 LL R6500 L R6500 R6500 R6500 6500 500 00 0 "MID$" returns a string starting at the Nth position of A$ so the end (last character) of A$. The first position of the string is position 1 and the last possible position of a string is position 255. Very often it is desirable to extract only the Nth character from a string. This can be done by calling MID$ with three arguments. The third argument specifies the number of characters to return. For example: FOR N=1 TO LEN(A$):PRINT MID$(A$,N,1),MID$(A$,N,2):NEXT N R RO O OC C CK K KW W WE E EL L LL L L R R R6 6 65 5 50 0 00 0 0 CONCATENATION-JOINING STRINGS Strings may also be concatenated (put or joined together) through the use of the "+" operator. Try the following: B$="BASIC FOR"+" "+A$ PRINT B$ BASIC FOR ROCKWELL R6500 Concatenation is especially useful if you wish to take a string apart and then put it back together with slight modifications. For instance: C$=LEFT$(B$,9)+"-"+MID$(B$,11,8)+"-"+RIGHT$(B$,5) PRINT C$ BASIC FOR-ROCKWELL-R6500 VAL AND STRS FUNCTIONS Sometimes it is desirable to convert a number to its string representation, and vice-versa. "VAL" and "STR$" perform these functions. Try the following: STRING$="567.8" PRINT VAL(STRING$) 567.8 STRING$=STR$(3.1415) PRINT STRINGS$,LEFT$(STRING$,5) 3.1415 3.14 "STR$" can be used to perform formatted I/O on numbers. You can convert a number to a string and then use LEFT$, RIGHT$, MID$ and concatenation to reformat the number as desired. "STR$" can also be used to conveniently find out how many print columns a number will take. For example: PRINT LEN(STR$(3.157)) 6 If you have an application in which a user is typing in a question such as "WHAT IS THE VOLUME OF A CYLINDER OF RADIUS 5.36 FEET, OF HEIGHT 5.1 FEET?" you can use "VAL" to extract the numeric values 5.36 and 5.1 from the question. CHR$ FUNCTION CHR$ is a string function which returns a one character string which contains the alphanumeric equivalent of the argument, according so the conversion table in Appendix E. ASC takes the first character of a string and converts it to its ASCII decimal value. One of the most common uses of CHR$ is to send a special character to a terminal. 100 DIM A$(15) 110 FOR I=1 TO 15 120 READ A$(I) 130 NEXT I 120 F=0:I=1 130 IF A$(I)<=A$(I+1) THEN 180 140 T$=A$(I+1) 150 A$(I+1)=A$(I) 160 A$(I)=T$ 170 F=1 180 I=I+1 185 IF I<15 THEN 130 190 IF F THEN 120 200 FOR I=1 TO 15 202 PRINT A$(I) 204 NEXT I 220 DATA AIM 65,DOG 230 DATA CAT,R6500 240 DATA ROCKWELL,RANDOM 250 DATA SATURDAY,"***ANSWER***" 260 DATA MICRO,FOO 270 DATA COMPUTER,MED 280 DATA NEWPORT BE-ACH,DALLAS,ANAHEIM ADDITIONAL STRING CONSIDERATIONS 1. A string may contain from 0 to 255 characters. All string variable names end in a dollar sign ($); for example, A$, B9$, K$, HELLO$. 2. String matrices may be dimensioned exactly like numeric matrices. For instance, DIM A$(10,10) creates a string matrix of 121 elements, eleven rows by elevon columns (rows 0 to 10 and columns 0 to 10). Each string matrix element is a complete string, which can be up to 255 characters in length. NAME EXAMPLE PURPOSE/USE ---- ------- ----------- DIM 25 DIM A$(10,10) Allocates space for a pointer and length for each element of a string matrix. No string space is allocated. LET 27 LET A$="FOO"+V$ Assigns the value of a string expression to a string variable. LET is optional. = String comparison operators. Comparison > is made on the basis of ASCII codes, a < character at a time until a difference is <= or =< found. If during the comparison of two >= or => strings, the end of one is reached, the <> shorter string is considered smaller. Note that "A " is greater than "A" since trailing spaces are significant. + 30 LET Z$=R$+Q$ String concatenation. The resulting string must be less than 256 characters in length or an LS error will occur. INPUT 40 INPUT X$ Reads a string from the keyboard. String does not have to be quoted; but if not, leading blanks will be ignored and the string will be terminated on a "," or ":" character. READ 50 READ X$ Reads a string from DATA statements within the program. Strings do not have to be quoted; but if they are not, they are terminated on a "," or ":" character and leading spaces are ignored. See DATA for the format of string data. PRINT 60 PRINT X$ Prints the string expression on the 70 PRINT "FOO"+A$ display/printer. 300 STATEMENT DEFINITIONS 301 SPECIAL CHARACTERS CHARACTER USE --------- --- @ Erases current line being typed, and types a carriage return/line feed. DEL Erases last character typed. If no more characters are left on the line, types a carriage return/line feed. RETURN A RETURN must end every line typed in. Returns cursor to the first position (leftmost) on line, and prints the line if the printer is on. F1 Interrupts execution of a program or a list command. F1 has effect when a statement finishes execution, or in the case of interrupting a LIST command, when a complete line has finished printing. In both cases a return is made to BASIC's command level and OK is typed. Prints "BREAK IN LINE XXXX," where XXXX is the line number of the next statement to be executed. There is no F1 key on a TTY. However, when TTY is being used, the AIM 65's F1 key is operational and can be used. : (colon) A colon is used to separate statements on a line. Colons may be used in direct and indirect statements. The only limit on the number of statements per line is the line length. It is not possible to GOTO or GOSUB to the middle of a line. ? Question marks are equivalent to PRINT. For instance, ? 2+2 is equivalent to PRINT 2+2. Question marks can also be used in indirect statements. 10 ? X, when listed, will be typed as 10 PRINT X. $ A dollar sign ($) suffix on a variable name establishes the variable as a character string. % A percent sign (%) suffix on a variable name establishes the variable as an integer ! An exclamation sign (!) suffix on an INPUT, PRINT, or ? command causes the input or output to be printed even though the printer is turned off. ESC Returns control to the Monitor. CNTL PRINT Turns the AIM 65 printer on if it is off, and off if it is on. 302 OPERATORS SYMBOL SAMPLE STATEMENT PURPOSE/USE ------ ---------------- ----------- = A=100 Assigns a value to a variable LET Z=2.5 The LET is optional memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Edit becomes a 1. When that happens, we go to line 20. 20 PRINT "INTRUDER ALERT" Line 20 will output "INTRUDER ALERT." However, we can replace statement 10 with a "WAIT" statement, which has exactly the same effect. 10 WAIT 40963,2 This line delays the execution of the next statement in the program until bit 1 of location A003 becomes 1. The WAIT is much faster than the equivalent IF statement and also takes less bytes of program storage. The following is another useful way of using relational operators: 125 A=-(B>C)*B-(B<=C)*C This statement will set the variable A to MAX(B,C) = the larger of the two variables B and C. 303 COMMANDS A BASIC command may be entered when the cursor is displayed. This is called the "Command Level." Commands may be used as program statements. Certain commands, such as LIST, NEW, and LOAD will terminate program execution when they finish. Each command may require one or more arguments in addition to the command statement, as defined in the syntax/function description. An argument without parenthesis is required to be entered without parenthesis. Arguments contained within parenthesis are required to be entered with the shown parenthesis. Arguments within brackets are optional. Optional arguments, if included, must be entered with or without accompanying parenthesis, however shown. STATEMENT SYNTAX/FUNCTION EXAMPLE CLEAR CLEAR CLEAR Clears all program variables, resets "FOR" and "GOSUB" state, and restores data. STATEMENT SYNTAX/FUNCTION EXAMPLE CONT CONT CONT Continues program execution after the F1 key or a STOP or INPUT statement termi- nates execution. You cannot continue after any error, after modifying your program, or before your program has been run. One of the main purposes of CONT is debugging. Suppose at some point after running your program, nothing is printed. This may be because your program is performing some time consuming calculation, but it may be because you have fallen into an "infinite loop." An infinite loop is a series of BASIC statements from which there is no excape. BASIC will keep executing the series of statements over and over; until you inter- vene or until power to the AIM 65 is turned off. If you suspect your program is in an infinite loop, press F1 until the BREAK message is displayed. The line number of the statement BASIC was executing will be displayed. After BASIC has displayed the cursor, you can use PRINT to type out some of the values of your variables. After examining these values you may become satisfied that your program is functioning correctly. You should then type in CONT to Continue executing your program where it left off, or type a direct GOTO statement to resume execution of the program at a different line. You could also use assignment statements to set some of your variables to different values. Remember, if you interrupt a program with the F1 key and expect to continue it later, you must not get any errors or type in any new program lines. If you do, you won't be able to continue and will get a "CN" (continue not) error. It is impossible to continue a direct command. CONT always resumes execution at the next statement to be executed in your program when F1 was typed. STATEMENT SYNTAX/FUNCTION EXAMPLE FRE FRE (expression) 270 PRINT FRE(0) Gives the number of memory bytes currently unused by BASIC. A dummy operand--0 or 1--must be used. STATEMENT SYNTAX/FUNCTION EXAMPLE LIST LIST [[start line] [-[end line]]] Lists current program optionally starting at specified line. List can be interrupted with the F1 key. (BASIC will finish listing the current line.) Lists entire program LIST Lists just line 100. LIST 100 Lists lines 100 to 1000. LIST 100-1000 Lists from current line to line 1000. LIST -1000 Lists from line 100 to end of program. LIST 100- STATEMENT SYNTAX/FUNCTION EXAMPLE LOAD LOAD LOAD Loads a BASIC program from the cassette tape. When done, the LOAD will display the cursor. See Appendix G for more information. STATEMENT SYNTAX/FUNCTION EXAMPLE NEW NEW NEW Deletes current program and all variables. STATEMENT SYNTAX/FUNCTION EXAMPLE PEEK PEEK (address) 356 PRINT PEEK(I) The PEEK function returns the contents of memory address I in decimal. The value returned will be =>0 and <=255. If I is >65535 or <0, an FC error will occur. An attempt to read a non-existent memory address will return an unknown value. STATEMENT SYNTAX/FUNCTION EXAMPLE POKE POKE location, byte 357 POKE I,J The POKE statement stores the byte specified by its second argument (J) into the location given by its first argument (I). The byte to be stored must be =>0 and <=255, or an FC error will occur. The address (I) must be =>0 and <=65535, or an FC error result. Caution: Careless use of the POKE statement may cause your program, BASIC, or the Monitor functions to operate incorrectly, to hang up, and/or cause loss of your program. Note that Pages 0 and 1 in memory are reserved for use by BASIC and should not be used for user program variable storage. A POKE to a non-existent memory location is harmless. One of the main uses of POKE is to pass arguments to machine language subroutines. (See Appendix F.) You could also use PEEK and POKE to write a memory diagnostic or an assembler in BASIC. STATEMENT SYNTAX/FUNCTION EXAMPLE RUN RUN line number RUN 200 Starts execution of the program currently in memory at the specified line number. RUN deletes all variables [does a CLEAR) and restores DATA. If you have stopped your program and wish to continue execution at some point in the program, use a direct GOTO statement to start execution of your program at the desired line, or CONT to continue after a break. Start program execution at the lowest RUN numbered statement. STATEMENT SYNTAX/FUNCTION EXAMPLE SAVE SAVE SAVE Saves the current program in the AIM 65 memory on cassette tape. The program in memory is left unchanged. More than one program may be stored on cassette using this command. See Appendix G for more information. 304 PROGRAM STATEMENTS In the following description of statements, an argument of B, C, V or W denotes a numeric variable, X denotes a numeric expression, X$ denotes a string expression and an I or J denotes an expression that is truncated to an integer before the statement is executed. Truncation means that any fractional part of the number is lost, e.g., 3.9 becomes 3, 4.01 becomes 4. An expression is a series of variables, operators, function calls and constants which after the operations and function calls are performed using the precedence rules, evaluates to a numeric or string value. A constant is either a number (3.14) or a string literal ("FOO"). STATEMENT SYNTAX/FUNCTION EXAMPLE DEF DEF FNx [(argument list)] = expression 100 DEF FNA(V)=V/B+C The user can define functions like the built- in functions (SQR, SGN, ABS, etc.) through the use of the DEF statement. The name of the function is "FN" followed by any legal variable name, for example: FNX, FNJ7, FNKO, FNR2. User defined func- tions are restricted to one line. A function may be defined to be any expression, but may only have one argument. In the example, B and C are variables that are used in the program. Executing the DEF state- ment defines the function. User defined functions can be redefined by executing another DEF statement for the same function. "V" is called the dummy variable. Execution of this statement following the 100 Z=FNA(3) above would cause Z to be set to 3/B+C, but the value of V would be unchanged. STATEMENT SYNTAX/FUNCTION EXAMPLE DIM DIM variable (size 1, [size 2...]) 113 DIM A(3),B(10) Allocates space for matrices. All matrix elements are set to zero by the DIM statement. Matrices can have from one to 255 114 DIM R3(5,5), dimensions. D$(2,2,2) Matrices can be dimensioned dynamically 115 DIM Q1(N),Z(2*I) during program execution. If a matrix is not explicitly dimensioned with a DIM statement, it is assumed to be a single dimensioned matrix of whose single subscript may range 0 to 10 (eleven elements). If this statement was encountered before a 117 A(8)=4 DIM statement for A was found in the program, it would be as if a DIM A(10) had been executed previous to the execu- tion of line 117. All subscripts start at zero (0), which means that DIM X(100) really allocates 101 matrix elements. STATEMENT SYNTAX/FUNCTION EXAMPLE END END 999 END Terminates program execution without printing a BREAK message. (See STOP.) CONT after an END statement causes execution to resume at the statement after the END Statement. END can be used anywhere in the program, and is optional. STATEMENT SYNTAX/FUNCTION EXAMPLE FOR FOR variable = expression to expression 300 FOR V=1 TO 9.3 [STEP expression] (See NEXT statement) STEP .6 V is set equal to the value of the expression following the equal sign, in this case 1. This value is called the initial value. Then the statements between FOR and NEXT are executed. The final value is the value of the expression following the TO. The step is the value of the expression following STEP. When the NEXT statement is encountered, the step is added to the variable. If no STEP was specified, it is assumed to 310 FOR V=1 TO 9.3 be one. If the step is positive and the new value of the variable is <= the final value (9.3 in this example), or the step value is negative and the new value of the variable is => the final value, then the first state- ment following the FOR statement is executed. Otherwise, the statement following the NEXT statement is executed. All FOR loops execute the statements between the FOR and the NEXT at least once, even in cases like FOR V=1 TO 0. Note that expressions (formulas) may be 315 FOR V=10*N TO used for the initial, final and step values 3.4/Q STEP SQR(R) in a FOR loop. The values of the expres- sions are computed only once, before the body of the FOR...NEXT loop is executed. When the statement after the NEXT is 320 FOR V=9 TO 1 executed, the loop variable is never equal STEP -1 to the final value, but is equal to whatever value caused the FOR...NEXT loop to terminate. The statements between the FOR and its corresponding NEXT in both examples above (310 and 320) would be executed nine times. Error: do not use nested FOR...NEXT 330 FOR W=1 TO 10: loops with the same index variable. FOR W=1 TO 5:NEXT W:NEXT W FOR loop nesting is limited only by the available memory. (See Appendix C.) STATEMENT SYNTAX/FUNCTION EXAMPLE GOSUB GOSUB line number 10 GOSUB 910 Branches to the specified statement (910) until a RETURN is encountered; when a bra memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Edit memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Edit memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Edit memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Editpointer, and 2 are unused. Matrix variables require 7 bytes to hold the header, plus additional bytes to hold each matrix element. Each element that is an integer variable requires 2 bytes. Elements that are string variables or floating point variables require 3 bytes or 5 bytes, respectively. String variables also use one byte of string space for each character in the string. This is true whether the string variable is a simple string variable like A$, or an element of a string matrix such as Q1$(5,2). When a new function is defined by a DEF statement, 7 bytes are used to store the definition. Reserved words such as FOR, GOTO or NOT, and the names of the intrinsic functions such as COS, INT and STR$ take up only one byte of program storage. All other characters in programs use one byte of program storage each. When a program is being executed, memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Edit memory locations, beginning at decimal location 530 (hex location 212), unless limited by the user. You can limit BASIC's memory useage by answering the prompt MEMORY SIZE? (see Subject 100) with some number less than 4096, assuming a 4K system. This will leave sufficient space for the subroutine as the top of RAM. For example, if your response to MEMORY SIZE? is "2048", 1518 bytes at the top of RAM will be free for assembly language subroutines. Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format: ADDRESS CONTENT $A9 Exponent + $81 ($80 if mantissa = 00) $AA-$AD Mantissa, normalized so that Bit 7 of MSB is set. $AA is MSB, $AD is LSB. $AE Sign of mantissa A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007. A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register. Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command. Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05. Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does: * Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE. * Line 20 - Asks for a number "N". * Line 30 - Calls the subroutine, with N as the parameter. * Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program. * Line 50 - Loops back to get a new N ROCKWELL AIM 65 <5> MEMORY SIZE? 2048 WIDTH? 1518 BYTES FREE AIM 65 BASIC V1.1 OK 10 POKE 04,0: POKE 05 ,10 20 INPUT"NUMBER";N 30 X=USR(N) 40 PRINTX 50 GOTO 20 Figure F-1. BASIC Program That Calls Assembly Language Subroutine The assembly language subroutine (Figure F-2) performs these operations: * Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0), * Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.) * After conversion, the program again prints the floating point accumulator, * The program then swaps the bytes of the integer. * Finally, the program converts the result to floating point and returns to BASIC (JMP C0D3). Address $C0D3 was found in locations $B008, $B009. (Address $C0D3 may vary with different versions of BASIC. Be sure to check locations $B008 and $B009 for the correct address. <1> 0A26 *=A00 0A00 A0 LDY #00 0A02 A2 LDX #00 0A04 B5 LDA A9,X 0A06 20 JSR EA46 0A09 20 JSR E83E 0A0C E8 INX 0A0D E0 CPX #06 0A0F D0 BNE 0A04 0A11 20 JSR E9F0 0A14 C0 CPY #00 0A16 F0 BEQ 0A1F 0A13 A5 LDA AD 0A18 A4 LDY AC 0A1C 4C JMP C0D3 0A1F 20 JSR BF00 0A22 C8 INY 0A23 D0 BNE 0A02 0A25 00 BRK 0A26 Figure F-2 Assembly Language Subroutine Figure F-3 shows the print-out for various values of "N". <6> OK RUN NUMBER? 128 88 80 00 00 00 00 88 00 00 00 80 00 -32768 NUMBER? 1 81 80 00 00 00 00 81 00 00 00 01 00 256 NUMBER? 4097 8D 80 06 00 00 00 8D 00 00 10 01 00 272 NUMBER? 256 89 80 00 00 00 00 89 00 00 01 00 00 1 Figure F-3. Output for Example G STORING AIM 65 BASIC PROGRAMS ON CASSETTE AIM 65 BASIC Programs can be stored on cassette tape by using BASIC's SAVE and LOAD commands, or by using the AIM 65 Editor. Before employing either procedure be sure to care- fully observe the recorder installation and operation procedures given in Section 9 of the AIM 65 User's Guide. RECORDING ON CASSETTE USING THE BASIC SAVE COMMAND The procedure to store a BASIC program is: 1. Install a cassette in the recorder, and manually position the tape to the program record position. Be sure to initialise the counter at the start of the tape. Note: Since remote control must be used to retrieve a BASIC program, observe the tape gap CAUTION in Section 9.1.5 (Step 1) of the AIM 65 User's Guide. 2. While in BASIC, type in SAVE. BASIC will respond with: OUT= 3. Enter a T (for "Tape"). BASIC will display: OUT=T F= 4. Enter the file name (up to five characters). If the file name is FNAME, BASIC will display: OUT=T F=FNAME T= 5. Put the recorder into Record mode. 6. Enter the recorder number (1 or 2) and type RETURN. 7. If remote control is being used, observe the procedures outlined in Section 9.1.5 of the AIM 65 User's Guide. 8. When recording has been completed, BASIC will display the cursor. 9. Switch the recorder out of record mode. RETRIEVING A PROGRAM FROM CASSETTE USING THE BASIC LOAD COMMAND The procedure to retrieve a BASIC program is: 1. Install the cassette in the recorder., and manually position the tape to about five counts before the beginning of the desired file. Note: Remote control must be used when retrieving a file via BASIC. 2. While in BASIC, type in LOAD. BASIC will respond with: IN= 3. Enter a T (for "Tape"). BASIC will display: IN=T F= 4. Enter the file name. If the file name is FNAME, BASIC will display: IN=T F=FNAME T= 5. Enter the recorder number (1 or 2) and type RETURN. 6. Put the recorder into play mode. Be sure to observe the procedures outlined in Section 9.1.6 of the AIM 65 User's Guide. While the file is being read, each line will be displayed (and printed, if the printer is on). If the printer is on, the tape gap ($A409) will probably have to be increased. The file being loaded will not overlay any BASIC statements already entered unless the statement numbers are the same. 7. When loading has been completed. BASIC will display the cursor. 8. Switch the recorder out of play mode. CASSETTE OPERATIONS USING THE AIM 65 EDITOR AIM 65 BASIC programs can also be stored and retrieved from cassette using the AIM 65 Editor. However, if the program is to be retrieved by BASIC at some future time, one rule must be observed: When BASIC stores a program on cassette, it inserts a CTRL/Z after the last line. The AIM 65 Editor will strip off the CTRL/Z when it retrieves the program. Therefore, before storing a BASIC program from the Editor, the user must insert a CTRL/Z following the last line of the program. H ATN IMPLEMENTATION The ATN function (see Subject 307) can be programmed in RAM using the AIM 65 Mnemonic Entry (I) and Alter Memory Locations (/) commands, as shown below. The program is written for the AIM 65 with 4K bytes of RAM. The ATN function can be relocated elsewhere in memory by changing the starting addresses of the instructions and constants, the conditional branch addresses, the vector to the constants start address and the vector to the ATN function starT address. ATN FUNCTION CONSTANTS ENTERED BY ALTER MEMORY = 0F80 XX XX XX XX Constants Starting Address = 0F80 = 0F80 0B 76 83 83 8 0F84 BD D3 79 1E 0F88 F4 A6 F5 7B 0F8C 83 FC B0 10 0F90 7C 0C 1F 67 0F94 CA 7C DE 53 0F98 CB C1 7D 14 OF9C 64 70 4C 7D 0FA0 B7 EA 51. 7A 0FA4 7D 63 30 88 0FA8 7E 7E 92 44 0FAC 99 3A 7E 4C 0FR0 CC 91 C7 7F 0FB4 AA AA AA 13 0FR8 81 00 00 00 0FBC 00 ATN FUNCTION INSTRUCTIONS STORED BY MNEMONIC ENTRY (I) XXXX *=0FBD Instructions Starting Address = 0F8D 0FBD A5 LDA AE 0FBF 48 PHA 0FC0 10 BPL 0FC5 0FC2 20 JSR CCB8 0FC5 AS LDA A9 0FC7 48 PHA 0FC8 C9 CMP #81 0FCA 90 BCC 0FD3 0FCC A9 LDA #FB 0FCE A0 LDY #C6 0FD0 20 JSR C84E 0FD3 A9 LDA #80 \ Starting Address of Constants = 0F80 0FD5 A0 LDY #0F / 0FD7 20 JSR CD44 0FDA 68 PLA 0FDB C9 CMP #81 0FDD 90 BCC 0FE6 0FDF A9 LDA #4E 0FE1 A0 LDY #CE 0FE3 20 JSR C58F 0FE6 68 PLA 0FE7 10 BPL 0FEC 0FE9 4C JMP CCB8 0FEC 60 RTS 0FEC BASIC INITIALIZATION FOR ATN FUNCTION BASIC memory must be initialized below the memory allocated to the ATN function. The ATN vector in RAM must also be changed from the address of the FC error message to the starting address of the ATN function instructions. This can be done using BASIC initialization, as follows: <5> MEMORY SIZE? 3968 Limit BASIC to F80 WIDTH? 16 3438 BYTES FREE AIM 65 BASIC V1.1 POKE 188,189 Change ATN function vector low to $BD POKE 189,15 Change ATN function vector high to $0F ?ATN (TAN(.5)) Test case to verify proper ATN function program .5 Expected answer = .5 SAVING ATN OBJECT CODE ON CASSETTE The object code for the ATN function can be saved on cassette by dumping addresses $00BB through $00BD (Jump instruction to ATN) and $0F80 through $0FEC (constants and instructions) after the function is initially loaded and verified. The ATN function can then be loaded from cassette by executing the Monitor L command after BASIC has been initialized via the 5 command. After the ATN function has been loaded, reenter BASIC with the 6 command. ### • Apple II Computer Technical Information • Apple II Original ROM Information http://members.buckeye-express.com/marksm/6502/ -- 27 June 2004 -- 9 of 257