SFR:0000 ; +-------------------------------------------------------------------------+ SFR:0000 ; | AlphaSmart Pro v2.03 disassembly by ziggurat29 | SFR:0000 ; +-------------------------------------------------------------------------+ SFR:0000 SFR:0000 ; =========================================================================== SFR:0000 SFR:0000 ; Segment type: Pure data SFR:0000 ; segment SFR SFR:0000 ?? PORTA_0: rmb 1 ; ... SFR:0000 ; PortA various SFR:0000 ; b7: LCD EX SFR:0000 ; b5,3: XRAM page control SFR:0000 ; b2: kbdemu clock sense SFR:0000 ; b1: battery OK SFR:0000 ; b0: kbdemu data sense SFR:0001 ?? rmb 1 ; (reserved) SFR:0002 ?? PIOC_2: rmb 1 SFR:0003 ?? PORTC_3: rmb 1 ; (PortC is mux data/address bus) SFR:0004 ?? PORTB_4: rmb 1 ; (PortB is address bus) SFR:0005 ?? rmb 1 ; (reserved) SFR:0006 ?? DDRB_6: rmb 1 SFR:0007 ?? DDRC_7: rmb 1 SFR:0008 ?? PORTD_8: rmb 1 ; ... SFR:0008 ; PortD open drain (external pullups) SFR:0008 ; b5-2: LCD nybble (bidirectional) SFR:0008 ; b1: kbdemu data out (invertus; there's a discrete transistor) SFR:0008 ; b0: kdbemu clock out (rectus) SFR:0009 ?? DDRD_9: rmb 1 SFR:000A ?? rmb 1 ; (reserved) SFR:000B ?? CFORC_B: rmb 1 SFR:000C ?? OC1M_C: rmb 1 SFR:000D ?? OC1D_D: rmb 1 SFR:000E ?? ?? TCNT_E: rmb 2 ; ... SFR:000E ; TCNT runs at E clock; 2 MHz, 500 ns; 32.768 ms / period SFR:0010 ?? ?? TIC1_10: rmb 2 SFR:0012 ?? ?? TIC2_12: rmb 2 SFR:0014 ?? ?? TIC3_14: rmb 2 SFR:0016 ?? ?? TOC1_16: rmb 2 SFR:0018 ?? ?? TOC2_18: rmb 2 SFR:001A ?? ?? TOC3_1A: rmb 2 SFR:001C ?? ?? TOC4_1C: rmb 2 SFR:001E ?? ?? TI4O5_1E: rmb 2 SFR:0020 ?? TCTL1_20: rmb 1 SFR:0021 ?? TCTL2_21: rmb 1 SFR:0022 ?? TMSK1_22: rmb 1 SFR:0023 ?? TFLG1_23: rmb 1 SFR:0024 ?? TMSK2_24: rmb 1 SFR:0025 ?? TFLG2_25: rmb 1 SFR:0026 ?? PACTL_26: rmb 1 SFR:0027 ?? PACNT_27: rmb 1 SFR:0028 ?? SPCR_28: rmb 1 SFR:0029 ?? SPSR_29: rmb 1 SFR:002A ?? SPDR_2A: rmb 1 SFR:002B ?? BAUD_2B: rmb 1 SFR:002C ?? SCCR1_2C: rmb 1 SFR:002D ?? SCCR2_2D: rmb 1 SFR:002E ?? SCSR_2E: rmb 1 SFR:002F ?? SCDR_2F: rmb 1 SFR:0030 ?? ?? ?? ??+byte_30: rmb 9 ; (reserved) SFR:0039 ?? OPTION_39: rmb 1 SFR:003A ?? COPRST_3A: rmb 1 SFR:003B ?? PPROG_2B: rmb 1 SFR:003C ?? HPRIO_3C: rmb 1 SFR:003D ?? INIT_3D: rmb 1 SFR:003E ?? TEST_3E: rmb 1 SFR:003F ?? CONFIG_3F: rmb 1 SFR:003F ; end of 'SFR' SFR:003F IRAM:0040 ; =========================================================================== IRAM:0040 IRAM:0040 ; Segment type: Pure data IRAM:0040 ; segment IRAM IRAM:0040 org $40 IRAM:0040 ?? ?? word_40: rmb 2 ; ... IRAM:0042 ?? ?? scratchw_42: rmb 2 ; XXX scratch IRAM:0044 ?? ?? scratchw_44: rmb 2 ; XXX scratch IRAM:0046 ?? ?? scratchw_46: rmb 2 ; XXX scratch IRAM:0048 ?? scratchby_48: rmb 1 ; XXX column counter; 100/40 (40 for LCD) IRAM:0049 ?? byte_49: rmb 1 ; XXX field; possibly ADB related IRAM:004A ?? byte_4A: rmb 1 ; XXX flag? IRAM:004B ?? rmb 1 IRAM:004C ?? scratchby_4C: rmb 1 ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) IRAM:004D ?? scratchby_4D: rmb 1 ; ... IRAM:004D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) IRAM:004E ?? ?? scratchw_4E: rmb 2 ; scratch; /this/ keyboard scan column mask (rectus) IRAM:0050 ?? scratchby_50: rmb 1 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' IRAM:0051 ?? byte_51: rmb 1 IRAM:0052 ?? scratchbyw_52: rmb 1 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' IRAM:0053 ?? rmb 1 IRAM:0054 ?? flagby_54: rmb 1 ; b2 = 1 when sending shift; XXX FFFF when 'reset stuff' IRAM:0055 ?? rmb 1 IRAM:0056 ?? ?? word_56: rmb 2 ; XXX 675E when 'reset stuff' IRAM:0058 ?? byte_58: rmb 1 ; XXX flag? IRAM:0059 ?? byte_59: rmb 1 ; XXX flag? IRAM:005A ?? byte_5A: rmb 1 ; XXX flag? IRAM:005B ?? lcdCtlLineState_5B:rmb 1 ; LCD control lines state in b1 = IOC2, b0 = IOC1 IRAM:005B ; 00: command IRAM:005B ; 01: display address IRAM:005B ; 10: ram data IRAM:005B ; 11: cursor address IRAM:005C ?? rmb 1 IRAM:005D ?? byte_5D: rmb 1 IRAM:005E ?? ?? word_5E: rmb 2 ; /next/ keyboard scan column mask (invertus) IRAM:0060 ?? scratchby_60: rmb 1 ; scratch IRAM:0061 ?? bAltKeyDown_61: rmb 1 ; true if 'alt/option key down' IRAM:0062 ?? bCtrlKeyDown_62:rmb 1 ; true if 'ctrl key down' IRAM:0063 ?? bCloverKeyDown_63:rmb 1 ; true if 'clover key down' IRAM:0064 ?? bShiftKeyDown_64:rmb 1 ; true if 'shift key down' IRAM:0065 ?? byte_65: rmb 1 ; XXX keyboard related; values 6e, 12, 9, (dec) IRAM:0066 ?? byte_66: rmb 1 IRAM:0067 ?? ?? pNextCharToSend_67:rmb 2 ; file sending related? ptr to next char to send IRAM:0069 ?? rmb 1 IRAM:006A ?? rmb 1 IRAM:006B ?? lcdcpCol1_6B: rmb 1 ; 1-relative LCD cursor pos col IRAM:006C ?? lcdcpRow1_6C: rmb 1 ; 1-relative LCD cursor pos row IRAM:006D ?? byte_6D: rmb 1 ; XXX flag? is file sending??? IRAM:006E ?? rmb 1 IRAM:006F ?? byte_6F: rmb 1 ; XXX last scan code? IRAM:0070 ?? scratch_70: rmb 1 ; XXX scratch; scan code later used to convert to ascii IRAM:0071 ?? byte_71: rmb 1 ; scratch; prev row scan mask, this col; sometimes flag IRAM:0072 ?? byte_72: rmb 1 ; XXX PS/2 byte being received; shift register IRAM:0073 ?? ?? scratch_73: rmb 2 ; scratch; prev start of screen IRAM:0075 ?? byte_75: rmb 1 ; XXX flag? possibly ADB related IRAM:0076 ?? ?? ?? ??+byte_76: rmb $10 ; ... IRAM:0076 ?? ?? ?? ??+ ; XXX prev row scan mask for col IRAM:0086 ?? rmb 1 IRAM:0087 ?? rmb 1 IRAM:0088 ?? byte_88: rmb 1 ; XXX some sort of keyboard related flag IRAM:0089 ?? nLowBatCount_89:rmb 1 ; passes through 'low battery' logic; avoid showing the message and delay most of the time IRAM:008A ?? bKbdEmuMode_8A: rmb 1 ; flag; kbdemu b0 = 0 == mac, 1 == pc IRAM:008B ?? byte_8B: rmb 1 ; XXX flag? IRAM:008C ?? byte_8C: rmb 1 ; XXX flag? IRAM:008D ?? byte_8D: rmb 1 ; XXX flag? IRAM:008E ?? keybufPull_8E: rmb 1 ; keybuf pull index (where last pulled) IRAM:008F ?? keybufPush_8F: rmb 1 ; keybuf push index (where last pushed) IRAM:0090 ?? ?? ?? ??+keybufScanCode_90:rmb $10 ; ... IRAM:0090 ?? ?? ?? ??+ ; circular buffer of key scan codes indexed by push/pull at 8E,8F IRAM:00A0 ?? rmb 1 IRAM:00A1 ?? bCapsLock_A1: rmb 1 ; flag; CAPS lock in effect IRAM:00A2 ?? byte_A2: rmb 1 ; XXX flag? cleared in file sending??? IRAM:00A3 ?? byte_A3: rmb 1 IRAM:00A4 ?? ?? ?? ??+ rmb $1C ; (28 bytes unused space) IRAM:00C0 ?? ?? ?? ??+bos_C0: rmb $3F ; ... IRAM:00C0 ?? ?? ?? ??+ ; bottom of stack IRAM:00FF ?? tos_FF: rmb 1 ; ... IRAM:00FF ; end of 'IRAM' ; top-of-stack IRAM:00FF XRAM:0100 ; =========================================================================== XRAM:0100 XRAM:0100 ; Segment type: Pure data XRAM:0100 ; segment XRAM XRAM:0100 org $100 XRAM:0100 ?? ?? ?? ??+ramsiglocp0_100:rmb $20 ; ... XRAM:0100 ?? ?? ?? ??+ ; on page 0 only; RAM signature location XRAM:0120 ?? ?? curfileStartOfScreen_120:rmb 2 ; this file; current file screen start ptr .2 XRAM:0122 ?? ?? curfileCurPosPtr_122:rmb 2 ; this file; cursor position ptr .0 XRAM:0124 ?? ?? curfileEnd_124: rmb 2 ; this file; current file ptr end char (one past last) .4 XRAM:0126 ?? ?? curFileRgnLast_126:rmb 2 ; this file; file region end addr (inclusive) XRAM:0128 ?? ?? curFileRgnFirst_128:rmb 2 ; this file; file region start addr XRAM:012A ?? ?? ?? ??+aFileState_12A: rmb $30 ; ... XRAM:012A ?? ?? ?? ??+ ; File (0-7) state structures: XRAM:012A ?? ?? ?? ??+ ; + 0 = cursor pointer XRAM:012A ?? ?? ?? ??+ ; + 2 = screen start pointer XRAM:012A ?? ?? ?? ??+ ; + 4 = end pointer XRAM:015A ?? rmb 1 XRAM:015B ?? rmb 1 XRAM:015C ?? kbdemuSpeed_15C:rmb 1 ; keyboard transfer speed (0, 1, 2, c8???) XRAM:015D ?? curFileNo_15D: rmb 1 ; current file number (1-8) XRAM:015E ?? thisRAMpageNo_15E:rmb 1 ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XRAM:015F ?? rmb 1 XRAM:0160 ?? ?? ?? ??+userdatatstartp0_160:rmb $7E7F ; on p0 only, user (file) data starts here (other pages starts at 0x0100) XRAM:7FDF ?? ?? ?? ??+ramsiglocp3_7FDF:rmb $20 ; ... XRAM:7FDF ?? ?? ?? ??+ ; on page 3 only, RAM signature location XRAM:7FFF ?? endOfRAMpage_7FFF:rmb 1 ; ... XRAM:7FFF ; end of 'XRAM' XRAM:7FFF XROM:E000 ; =========================================================================== XROM:E000 XROM:E000 ; Segment type: Pure code XROM:E000 ; segment XROM XROM:E000 org $E000 XROM:E000 XROM:E000 ; =============== S U B R O U T I N E ======================================= XROM:E000 XROM:E000 XROM:E000 start_E000: ; ... XROM:E000 8E 00 FF lds #tos_FF ; stack pointer in internal RAM c0-ff XROM:E003 BD E4 1B jsr configurePeripherals_E41B ; configure hardware XROM:E006 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E009 BD EC 16 jsr lcdInit_EC16 ; setup LCD XROM:E00C BD F6 B3 jsr showFirmwareVersion_F6B3 ; show firmware version XROM:E00F BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E012 BD E4 59 jsr handlePowerOnSpecialKeys_E459 ; handle power up special keys XROM:E015 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E018 BD F6 C6 jsr testRAMsignature_F6C6 ; test RAM signature on p0,3. V clear on success. XROM:E01B 28 0E bvc contRAMok_E02B XROM:E01D BD EC 91 jsr testExtRAM_EC91 ; execute RAM test (with message) XROM:E020 BD EB 74 jsr initFileStructsOpenFile1_EB74 ; setup file structs and open file 1 XROM:E023 BD F7 23 jsr stampRAMsignature_F723 ; stamp 'ram valid signature' on RAM page 0 and 3 XROM:E026 86 02 ldaa #2 ; default speed is 2 = 'fast' XROM:E028 B7 01 5C staa kbdemuSpeed_15C ; keyboard transfer speed (0, 1, 2, c8???) XROM:E02B XROM:E02B contRAMok_E02B: ; ... XROM:E02B BD EB 48 jsr showOpeningFile_EB48 ; show what file we're opening XROM:E02E BD E5 03 jsr powerOnCheckBattery_E503 ; check low battery and show message if needed (done once during power on) XROM:E031 BD EE DA jsr updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:E031 ; End of function start_E000 XROM:E031 XROM:E034 XROM:E034 ; =============== S U B R O U T I N E ======================================= XROM:E034 XROM:E034 ; main(); cyclic executive w/sleep XROM:E034 XROM:E034 main_E034: ; ... XROM:E034 BD E4 E4 jsr checkBatteryLevel_E4E4 ; check battery level and show warning XROM:E037 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:E03A 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:E03D 13 00 04 15 brclr PORTA_0 4 standalone_E056 ; if PAb2 (ckin???) low, no kbd attached XROM:E041 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E044 BD E3 56 jsr waitFallingEdge3_E356 ; XXX wait for falling edge on IC3 (PAb0 datain?), use OC2 as timeout; V set timeout, V clear edge detected XROM:E047 28 08 bvc loc_E051 ; falling edge detected; kbd emu connected XROM:E049 BD E0 89 jsr sub_E089 ; XXX kbd emu = pc; could be PS/2 version of sub_E068 XROM:E04C XROM:E04C updateDisplayAndLoop_E04C: ; ... XROM:E04C BD EE DA jsr updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:E04F 20 E3 bra main_E034 ; main(); cyclic executive w/sleep XROM:E051 ; --------------------------------------------------------------------------- XROM:E051 XROM:E051 loc_E051: ; ... XROM:E051 BD E0 68 jsr sub_E068 ; XXX could be ADB version of sub_E089 XROM:E054 20 F6 bra updateDisplayAndLoop_E04C XROM:E056 ; --------------------------------------------------------------------------- XROM:E056 XROM:E056 standalone_E056: ; ... XROM:E056 BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:E059 XROM:E059 loopGetDispatchKey_E059: ; ... XROM:E059 BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:E05C 29 05 bvs contNoKey_E063 ; leave if no key found XROM:E05E BD EE 37 jsr handleKeyScanCode_EE37 ; dispatch key scan code in A XROM:E061 20 F6 bra loopGetDispatchKey_E059 XROM:E063 ; --------------------------------------------------------------------------- XROM:E063 XROM:E063 contNoKey_E063: ; ... XROM:E063 BD E4 06 jsr sleepForKbdEvent_E406 ; setup to sleep, waiting for any key press to wake XROM:E066 20 CC bra main_E034 ; main(); cyclic executive w/sleep XROM:E066 ; End of function main_E034 XROM:E066 XROM:E068 XROM:E068 ; =============== S U B R O U T I N E ======================================= XROM:E068 XROM:E068 ; XXX could be ADB version of sub_E089 XROM:E068 XROM:E068 sub_E068: ; ... XROM:E068 14 75 FF bset byte_75 $FF ; XXX flag? possibly ADB related XROM:E06B BD F5 ED jsr promptKbdEmuModeSend_F5ED ; show which keyboard emulation and prompt for send key XROM:E06E XROM:E06E loop_E06E: ; ... XROM:E06E 86 05 ldaa #5 XROM:E070 XROM:E070 loop_E070: ; ... XROM:E070 36 psha XROM:E071 BD E6 BD jsr sub_E6BD ; XXX ADB related? XROM:E074 32 pula XROM:E075 29 08 bvs loc_E07F XROM:E077 4A deca XROM:E078 26 F6 bne loop_E070 XROM:E07A BD E4 89 jsr sub_E489 XROM:E07D 20 EF bra loop_E06E XROM:E07F ; --------------------------------------------------------------------------- XROM:E07F XROM:E07F loc_E07F: ; ... XROM:E07F 7F 00 6D clr byte_6D ; XXX flag? is file sending??? XROM:E082 7F 00 8B clr byte_8B ; XXX flag? XROM:E085 7F 00 75 clr byte_75 ; XXX flag? possibly ADB related XROM:E088 39 rts XROM:E088 ; End of function sub_E068 XROM:E088 XROM:E089 XROM:E089 ; =============== S U B R O U T I N E ======================================= XROM:E089 XROM:E089 ; XXX kbd emu = pc; could be PS/2 version of sub_E068 XROM:E089 XROM:E089 sub_E089: ; ... XROM:E089 14 8A FF bset bKbdEmuMode_8A $FF ; flag; kbdemu b0 = 0 == mac, 1 == pc XROM:E08C BD F5 ED jsr promptKbdEmuModeSend_F5ED ; show which keyboard emulation and prompt for send key XROM:E08F XROM:E08F nokey_E08F: ; ... XROM:E08F 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:E092 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:E095 13 00 01 52 brclr PORTA_0 1 loc_E0EB ; PAb0 (datain?) low? XXX XROM:E099 13 00 04 5E brclr PORTA_0 4 loc_E0FB ; PAb2 (clkin?) low? XXX XROM:E09D BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:E0A0 XROM:E0A0 nextkey_E0A0: ; ... XROM:E0A0 BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:E0A3 29 EA bvs nokey_E08F XROM:E0A5 81 87 cmpa #$87 ; (scan code shift-Send) XROM:E0A7 27 F7 beq nextkey_E0A0 XROM:E0A9 81 07 cmpa #7 ; (scan code Send) XROM:E0AB 26 05 bne contNotSend_E0B2 XROM:E0AD BD E3 77 jsr sendFilePS2_E377 ; send the file in the PS/2 way XROM:E0B0 20 DD bra nokey_E08F XROM:E0B2 ; --------------------------------------------------------------------------- XROM:E0B2 XROM:E0B2 contNotSend_E0B2: ; ... XROM:E0B2 97 50 staa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E0B4 13 63 01 10 brclr bCloverKeyDown_63 1 contNotFkey_E0C8 ; true if 'clover key down' XROM:E0B8 BD EF 7D jsr scF18toNum_EF7D ; scan code F1-8 to number 1-8; C if not F1-8, clear if OK XROM:E0BB 25 0B bcs contNotFkey_E0C8 XROM:E0BD B7 01 5D staa curFileNo_15D ; current file number (1-8) XROM:E0C0 BD EA F9 jsr openFile_EAF9 ; open current file (specified at 15D) XROM:E0C3 BD F5 ED jsr promptKbdEmuModeSend_F5ED ; show which keyboard emulation and prompt for send key XROM:E0C6 20 C7 bra nokey_E08F XROM:E0C8 ; --------------------------------------------------------------------------- XROM:E0C8 XROM:E0C8 contNotFkey_E0C8: ; ... XROM:E0C8 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E0CA BD F4 DC jsr scanCodetoPS2_F4DC ; scan code to PS/2, no shift consideration XROM:E0CD 27 D1 beq nextkey_E0A0 XROM:E0CF 97 52 staa scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:E0D1 8D 67 bsr sub_E13A ; XXX handle freaky ps2 keys? XROM:E0D3 29 CB bvs nextkey_E0A0 XROM:E0D5 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E0D7 85 80 bita #$80 XROM:E0D9 27 07 beq notShifted_E0E2 XROM:E0DB 86 F0 ldaa #$F0 XROM:E0DD BD F7 A0 jsr ps2SendByte_F7A0 ; send keyup prefix XROM:E0E0 29 1F bvs ps2ErrorSending_E101 ; (horror; error sending) XROM:E0E2 XROM:E0E2 notShifted_E0E2: ; ... XROM:E0E2 96 52 ldaa scratchbyw_52 ; get stowed PS/2 scan code and send XROM:E0E4 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E0E7 29 18 bvs ps2ErrorSending_E101 ; (horror; error sending) XROM:E0E9 20 B5 bra nextkey_E0A0 XROM:E0EB ; --------------------------------------------------------------------------- XROM:E0EB XROM:E0EB loc_E0EB: ; ... XROM:E0EB 13 00 04 08 brclr PORTA_0 4 loc_E0F7 ; PAb2 (clkin) low?, XXX XROM:E0EF BD E2 65 jsr ps2HandleCommand_E265 ; handle PS/2 commands from host XROM:E0F2 29 03 bvs loc_E0F7 XROM:E0F4 XROM:E0F4 loc_E0F4: ; ... XROM:E0F4 7E E0 8F jmp nokey_E08F XROM:E0F7 ; --------------------------------------------------------------------------- XROM:E0F7 XROM:E0F7 loc_E0F7: ; ... XROM:E0F7 7F 00 8A clr bKbdEmuMode_8A ; flag; kbdemu b0 = 0 == mac, 1 == pc XROM:E0FA 39 rts XROM:E0FB ; --------------------------------------------------------------------------- XROM:E0FB XROM:E0FB loc_E0FB: ; ... XROM:E0FB 8D 11 bsr waitPS2clkHigh_E10E ; wait for PAb2 (PS/2 ck in?) high; V if went high, clear if timeout XROM:E0FD 28 F8 bvc loc_E0F7 XROM:E0FF 20 F3 bra loc_E0F4 XROM:E101 ; --------------------------------------------------------------------------- XROM:E101 XROM:E101 ps2ErrorSending_E101: ; ... XROM:E101 81 45 cmpa #$45 ; 'E' XROM:E103 27 E6 beq loc_E0EB XROM:E105 81 46 cmpa #$46 ; 'F' XROM:E107 27 F2 beq loc_E0FB XROM:E109 BD F5 C6 jsr showErr_F5C6 ; show 'Err: ' with hex code in A XROM:E10C XROM:E10C halt_E10C: ; ... XROM:E10C 20 FE bra halt_E10C ; infinite loop here; unexpected, should be "can't happen" XROM:E10C ; End of function sub_E089 XROM:E10C XROM:E10E XROM:E10E ; =============== S U B R O U T I N E ======================================= XROM:E10E XROM:E10E ; wait for PAb2 (PS/2 ck in?) high; V if went high, clear if timeout XROM:E10E XROM:E10E waitPS2clkHigh_E10E: ; ... XROM:E10E CE 46 50 ldx #18000 ; loop counter 18,000 XROM:E111 XROM:E111 loop_E111: ; ... XROM:E111 12 00 04 05 brset PORTA_0 4 leave_E11A ; PAb2 (clkin) high?, XXX XROM:E115 09 dex XROM:E116 26 F9 bne loop_E111 XROM:E118 0A clv XROM:E119 39 rts XROM:E11A ; --------------------------------------------------------------------------- XROM:E11A XROM:E11A leave_E11A: ; ... XROM:E11A 0B sev XROM:E11B 39 rts XROM:E11B ; End of function waitPS2clkHigh_E10E XROM:E11B XROM:E11C XROM:E11C ; =============== S U B R O U T I N E ======================================= XROM:E11C XROM:E11C ; wait for PAb2 (PS/2 ck in?) low; V if went low, clear if timeout XROM:E11C XROM:E11C waitPS2clkLow_E11C: XROM:E11C 86 28 ldaa #40 ; loop counter 50 XROM:E11E XROM:E11E loop_E11E: ; ... XROM:E11E 13 00 04 05 brclr PORTA_0 4 leave_E127 ; PAb2 (clkin) low?, XXX XROM:E122 4A deca XROM:E123 26 F9 bne loop_E11E XROM:E125 0A clv XROM:E126 39 rts XROM:E127 ; --------------------------------------------------------------------------- XROM:E127 XROM:E127 leave_E127: ; ... XROM:E127 0B sev XROM:E128 39 rts XROM:E128 ; End of function waitPS2clkLow_E11C XROM:E128 XROM:E129 ; --------------------------------------------------------------------------- XROM:E129 ; START OF FUNCTION CHUNK FOR sub_E13A XROM:E129 XROM:E129 xlatToF9_E129: ; ... XROM:E129 86 01 ldaa #1 ; ps/2 F9 XROM:E12B 20 0A bra loc_E137 XROM:E12D ; --------------------------------------------------------------------------- XROM:E12D XROM:E12D xlatToF10_E12D: ; ... XROM:E12D 86 09 ldaa #9 ; ps/2 F10 XROM:E12F 20 06 bra loc_E137 XROM:E131 ; --------------------------------------------------------------------------- XROM:E131 XROM:E131 xlatToF11_E131: ; ... XROM:E131 86 78 ldaa #$78 ; ps/2 F11 XROM:E133 20 02 bra loc_E137 XROM:E135 ; --------------------------------------------------------------------------- XROM:E135 XROM:E135 xlatToF12_E135: ; ... XROM:E135 86 07 ldaa #7 ; ps/2 F12 XROM:E137 XROM:E137 loc_E137: ; ... XROM:E137 7E E1 FE jmp stowAndLeave_E1FE XROM:E137 ; END OF FUNCTION CHUNK FOR sub_E13A XROM:E13A XROM:E13A ; =============== S U B R O U T I N E ======================================= XROM:E13A XROM:E13A ; XXX handle freaky ps2 keys? XROM:E13A XROM:E13A sub_E13A: ; ... XROM:E13A XROM:E13A ; FUNCTION CHUNK AT XROM:E129 SIZE 00000011 BYTES XROM:E13A XROM:E13A 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E13C 84 7F anda #$7F ; get rid of shift bit XROM:E13E 13 63 01 20 brclr bCloverKeyDown_63 1 noclover_E162 ; true if 'clover key down' XROM:E142 81 0B cmpa #$B ; XXX (clover) pause/prtscn XROM:E144 27 E3 beq xlatToF9_E129 ; make into F9 XROM:E146 81 5B cmpa #$5B ; XXX (clover) numlock XROM:E148 27 E3 beq xlatToF10_E12D ; make into F10 XROM:E14A 81 77 cmpa #$77 ; XXX (clover) ins/del XROM:E14C 27 E3 beq xlatToF11_E131 ; make into F11 XROM:E14E 81 56 cmpa #$56 ; XXX (clover) Clear File XROM:E150 27 E3 beq xlatToF12_E135 ; make into F12 XROM:E152 81 37 cmpa #$37 ; XXX (clover) arrow up XROM:E154 27 7E beq loc_E1D4 XROM:E156 81 15 cmpa #$15 ; XXX (clover) arrow down XROM:E158 27 7E beq loc_E1D8 XROM:E15A 81 35 cmpa #$35 ; XXX (clover) arrow left XROM:E15C 27 7E beq loc_E1DC XROM:E15E 81 34 cmpa #$34 ; XXX (clover) arrow right XROM:E160 27 7E beq loc_E1E0 XROM:E162 XROM:E162 noclover_E162: ; ... XROM:E162 81 0B cmpa #$B ; XXX pause/prtscn XROM:E164 27 2C beq loc_E192 XROM:E166 81 5B cmpa #$5B ; XXX numlock XROM:E168 27 2B beq loc_E195 XROM:E16A 81 77 cmpa #$77 ; XXX ins/del XROM:E16C 27 3D beq loc_E1AB XROM:E16E 81 37 cmpa #$37 ; XXX arrow up XROM:E170 27 5B beq ps2E0andLeave_E1CD XROM:E172 81 15 cmpa #$15 ; XXX arrow down XROM:E174 27 57 beq ps2E0andLeave_E1CD XROM:E176 81 35 cmpa #$35 ; XXX arrow left XROM:E178 27 53 beq ps2E0andLeave_E1CD XROM:E17A 81 34 cmpa #$34 ; XXX arrow right XROM:E17C 27 4F beq ps2E0andLeave_E1CD XROM:E17E 81 66 cmpa #$66 ; XXX home XROM:E180 27 4B beq ps2E0andLeave_E1CD XROM:E182 81 75 cmpa #$75 ; XXX end XROM:E184 27 47 beq ps2E0andLeave_E1CD XROM:E186 81 2B cmpa #$2B ; XXX backspace XROM:E188 27 5E beq loc_E1E8 XROM:E18A 81 03 cmpa #3 ; XXX '-' XROM:E18C 27 66 beq loc_E1F4 XROM:E18E XROM:E18E leave_E18E: ; ... XROM:E18E 0A clv XROM:E18F 39 rts XROM:E190 ; --------------------------------------------------------------------------- XROM:E190 XROM:E190 leave_E190: ; ... XROM:E190 0B sev XROM:E191 39 rts XROM:E192 ; --------------------------------------------------------------------------- XROM:E192 XROM:E192 loc_E192: ; ... XROM:E192 7E E2 02 jmp loc_E202 XROM:E195 ; --------------------------------------------------------------------------- XROM:E195 XROM:E195 loc_E195: ; ... XROM:E195 12 64 01 04 brset bShiftKeyDown_64 1 shifted_E19D ; true if 'shift key down' XROM:E199 86 7E ldaa #$7E ; scan code Scroll Lock XROM:E19B 20 61 bra stowAndLeave_E1FE XROM:E19D ; --------------------------------------------------------------------------- XROM:E19D XROM:E19D shifted_E19D: ; ... XROM:E19D 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E19F 85 80 bita #$80 ; '€' XROM:E1A1 26 EB bne leave_E18E XROM:E1A3 96 A3 ldaa byte_A3 XROM:E1A5 88 FF eora #$FF XROM:E1A7 97 A3 staa byte_A3 XROM:E1A9 20 E3 bra leave_E18E XROM:E1AB ; --------------------------------------------------------------------------- XROM:E1AB XROM:E1AB loc_E1AB: ; ... XROM:E1AB 13 64 01 1E brclr bShiftKeyDown_64 1 ps2E0andLeave_E1CD ; true if 'shift key down' XROM:E1AF 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E1B1 85 80 bita #$80 XROM:E1B3 26 14 bne loc_E1C9 XROM:E1B5 86 F0 ldaa #$F0 ; keyup XROM:E1B7 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E1BA 86 12 ldaa #$12 ; left shift XROM:E1BC BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E1BF 86 F0 ldaa #$F0 ; keyup XROM:E1C1 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E1C4 86 59 ldaa #$59 ; right shift XROM:E1C6 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E1C9 XROM:E1C9 loc_E1C9: ; ... XROM:E1C9 86 70 ldaa #$70 ; scan code Insert XROM:E1CB 20 17 bra stowAndE0andLeave_E1E4 XROM:E1CD ; --------------------------------------------------------------------------- XROM:E1CD XROM:E1CD ps2E0andLeave_E1CD: ; ... XROM:E1CD 86 E0 ldaa #$E0 ; prefix for extra special PS/2 keys XROM:E1CF BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E1D2 20 BA bra leave_E18E XROM:E1D4 ; --------------------------------------------------------------------------- XROM:E1D4 XROM:E1D4 loc_E1D4: ; ... XROM:E1D4 86 7D ldaa #$7D ; scan code Page Up XROM:E1D6 20 0C bra stowAndE0andLeave_E1E4 XROM:E1D8 ; --------------------------------------------------------------------------- XROM:E1D8 XROM:E1D8 loc_E1D8: ; ... XROM:E1D8 86 7A ldaa #$7A ; scan code Page Down XROM:E1DA 20 08 bra stowAndE0andLeave_E1E4 XROM:E1DC ; --------------------------------------------------------------------------- XROM:E1DC XROM:E1DC loc_E1DC: ; ... XROM:E1DC 86 6C ldaa #$6C ; scan code Home XROM:E1DE 20 04 bra stowAndE0andLeave_E1E4 XROM:E1E0 ; --------------------------------------------------------------------------- XROM:E1E0 XROM:E1E0 loc_E1E0: ; ... XROM:E1E0 86 69 ldaa #$69 ; scan code End XROM:E1E2 20 00 bra *+2 ; (knumbskull 'break' in 'switch' for last 'case') XROM:E1E4 ; --------------------------------------------------------------------------- XROM:E1E4 XROM:E1E4 stowAndE0andLeave_E1E4: ; ... XROM:E1E4 97 52 staa scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:E1E6 20 E5 bra ps2E0andLeave_E1CD XROM:E1E8 ; --------------------------------------------------------------------------- XROM:E1E8 XROM:E1E8 loc_E1E8: ; ... XROM:E1E8 13 61 01 A2 brclr bAltKeyDown_61 1 leave_E18E ; true if 'alt/option key down' XROM:E1EC 13 62 01 9E brclr bCtrlKeyDown_62 1 leave_E18E ; true if 'ctrl key down' XROM:E1F0 86 71 ldaa #$71 ; scan code Delete XROM:E1F2 20 F0 bra stowAndE0andLeave_E1E4 XROM:E1F4 ; --------------------------------------------------------------------------- XROM:E1F4 XROM:E1F4 loc_E1F4: ; ... XROM:E1F4 13 61 01 96 brclr bAltKeyDown_61 1 leave_E18E ; true if 'alt/option key down' XROM:E1F8 13 62 01 92 brclr bCtrlKeyDown_62 1 leave_E18E ; true if 'ctrl key down' XROM:E1FC 86 7B ldaa #$7B ; scan code keypad '-' XROM:E1FE XROM:E1FE stowAndLeave_E1FE: ; ... XROM:E1FE 97 52 staa scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:E200 20 8C bra leave_E18E XROM:E202 ; --------------------------------------------------------------------------- XROM:E202 XROM:E202 loc_E202: ; ... XROM:E202 12 64 01 23 brset bShiftKeyDown_64 1 loc_E229 ; true if 'shift key down' XROM:E206 13 61 01 3A brclr bAltKeyDown_61 1 loc_E244 ; true if 'alt/option key down' XROM:E20A 13 62 01 14 brclr bCtrlKeyDown_62 1 loc_E222 ; true if 'ctrl key down' XROM:E20E 13 64 01 10 brclr bShiftKeyDown_64 1 loc_E222 ; true if 'shift key down' XROM:E212 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E214 85 80 bita #$80 ; '€' XROM:E216 27 05 beq loc_E21D XROM:E218 CE E2 4E ldx #byte_E24E ; XXX freaky seq XROM:E21B 20 1C bra loc_E239 XROM:E21D ; --------------------------------------------------------------------------- XROM:E21D XROM:E21D loc_E21D: ; ... XROM:E21D CE E2 55 ldx #byte_E255 ; XXX freaky seq XROM:E220 20 17 bra loc_E239 XROM:E222 ; --------------------------------------------------------------------------- XROM:E222 XROM:E222 loc_E222: ; ... XROM:E222 86 7C ldaa #$7C ; scan code PrintScreen XROM:E224 97 52 staa scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:E226 7E E1 CD jmp ps2E0andLeave_E1CD XROM:E229 ; --------------------------------------------------------------------------- XROM:E229 XROM:E229 loc_E229: ; ... XROM:E229 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E22B 85 80 bita #$80 ; '€' XROM:E22D 27 03 beq loc_E232 XROM:E22F 7E E1 90 jmp leave_E190 XROM:E232 ; --------------------------------------------------------------------------- XROM:E232 XROM:E232 loc_E232: ; ... XROM:E232 12 62 01 09 brset bCtrlKeyDown_62 1 loc_E23F ; true if 'ctrl key down' XROM:E236 CE E2 47 ldx #byte_E247 ; XXX freaky seq XROM:E239 XROM:E239 loc_E239: ; ... XROM:E239 BD E2 5A jsr sendPS2bytes_E25A ; send nts sequence @X over PS/2 XROM:E23C 7E E1 90 jmp leave_E190 XROM:E23F ; --------------------------------------------------------------------------- XROM:E23F XROM:E23F loc_E23F: ; ... XROM:E23F CE E2 48 ldx #byte_E248 ; XXX freaky seq XROM:E242 20 F5 bra loc_E239 XROM:E244 ; --------------------------------------------------------------------------- XROM:E244 XROM:E244 loc_E244: ; ... XROM:E244 7E E1 8E jmp leave_E18E XROM:E244 ; End of function sub_E13A XROM:E244 XROM:E244 ; --------------------------------------------------------------------------- XROM:E247 F0 byte_E247: fcb $F0 ; ... XROM:E247 ; XXX freaky seq XROM:E248 E0 byte_E248: fcb $E0 ; ... XROM:E248 ; XXX freaky seq XROM:E249 7E fcb $7E XROM:E24A E0 fcb $E0 XROM:E24B F0 fcb $F0 XROM:E24C 7E fcb $7E XROM:E24D 00 fcb 0 XROM:E24E E0 byte_E24E: fcb $E0 ; ... XROM:E24E ; XXX freaky seq XROM:E24F F0 fcb $F0 XROM:E250 7C fcb $7C XROM:E251 E0 fcb $E0 XROM:E252 F0 fcb $F0 XROM:E253 12 fcb $12 XROM:E254 00 fcb 0 XROM:E255 E0 byte_E255: fcb $E0 ; ... XROM:E255 ; XXX freaky seq XROM:E256 12 fcb $12 XROM:E257 E0 fcb $E0 XROM:E258 7C fcb $7C XROM:E259 00 fcb 0 XROM:E25A XROM:E25A ; =============== S U B R O U T I N E ======================================= XROM:E25A XROM:E25A ; send nts sequence @X over PS/2 XROM:E25A XROM:E25A sendPS2bytes_E25A: ; ... XROM:E25A A6 00 ldaa 0,x XROM:E25C 27 06 beq leave_E264 XROM:E25E BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E261 08 inx XROM:E262 20 F6 bra sendPS2bytes_E25A ; send nts sequence @X over PS/2 XROM:E264 ; --------------------------------------------------------------------------- XROM:E264 XROM:E264 leave_E264: ; ... XROM:E264 39 rts XROM:E264 ; End of function sendPS2bytes_E25A XROM:E264 XROM:E265 XROM:E265 ; =============== S U B R O U T I N E ======================================= XROM:E265 XROM:E265 ; handle PS/2 commands from host XROM:E265 XROM:E265 ps2HandleCommand_E265: ; ... XROM:E265 XROM:E265 ; FUNCTION CHUNK AT XROM:E2C4 SIZE 0000003A BYTES XROM:E265 XROM:E265 BD E2 FE jsr ps2GetByte_E2FE ; PS/2 get byte in A (and byte_72); V set if err, clear if OK XROM:E268 29 49 bvs leave_E2B3 XROM:E26A 96 72 ldaa byte_72 ; XXX PS/2 byte being received; shift register XROM:E26C 81 FF cmpa #$FF ; 'reset and self-test' XROM:E26E 27 44 beq ps2ResetResponse_E2B4 XROM:E270 81 FE cmpa #$FE ; 'resend last byte' XROM:E272 27 49 beq leave_E2BD ; just ignore; no ACK needed XROM:E274 81 FD cmpa #$FD ; 'set specific key to make only' XROM:E276 27 60 beq ps2EatNack_E2D8 ; PS/2 eat-and-ack for ignored commands XROM:E278 81 FC cmpa #$FC ; 'set specific key to make/release' XROM:E27A 27 5C beq ps2EatNack_E2D8 ; PS/2 eat-and-ack for ignored commands XROM:E27C 81 FB cmpa #$FB ; 'set specific key to typematic/autorepeat only' XROM:E27E 27 58 beq ps2EatNack_E2D8 ; PS/2 eat-and-ack for ignored commands XROM:E280 81 FA cmpa #$FA ; 'set all keys to typematic/autorepeat/make/release' XROM:E282 27 2C beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E284 81 F9 cmpa #$F9 ; 'set all keys to make only' XROM:E286 27 28 beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E288 81 F8 cmpa #$F8 ; 'set all keys to make/release' XROM:E28A 27 24 beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E28C 81 F7 cmpa #$F7 ; 'set all keys to typematic/autorepeat only' XROM:E28E 27 20 beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E290 81 F6 cmpa #$F6 ; 'set default parameters' XROM:E292 27 1C beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E294 81 F5 cmpa #$F5 ; 'disable scanning' XROM:E296 27 18 beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E298 81 F4 cmpa #$F4 ; 'enable scanning' XROM:E29A 27 14 beq ps2AckIgnore_E2B0 ; PS/2 just ack for ignored commands XROM:E29C 81 F3 cmpa #$F3 ; 'set typematic rate and delay' XROM:E29E 27 38 beq ps2EatNack_E2D8 ; PS/2 eat-and-ack for ignored commands XROM:E2A0 81 F2 cmpa #$F2 ; 'identify keyboard' XROM:E2A2 27 26 beq ps2IdentifyKeyboard_E2CA XROM:E2A4 81 F0 cmpa #$F0 ; 'get/set current scan code set' XROM:E2A6 27 3A beq ps2scanCodeSet_E2E2 XROM:E2A8 81 EE cmpa #$EE ; 'echo'; used for liveness testing by controller XROM:E2AA 27 18 beq ps2sendEcho_E2C4 XROM:E2AC 81 ED cmpa #$ED ; 'set LEDs' XROM:E2AE 27 28 beq ps2EatNack_E2D8 ; PS/2 eat-and-ack for ignored commands XROM:E2B0 XROM:E2B0 ps2AckIgnore_E2B0: ; ... XROM:E2B0 BD E2 BE jsr ps2SendAck_E2BE ; PS/2 just ack for ignored commands XROM:E2B3 XROM:E2B3 leave_E2B3: ; ... XROM:E2B3 39 rts XROM:E2B4 ; --------------------------------------------------------------------------- XROM:E2B4 XROM:E2B4 ps2ResetResponse_E2B4: ; ... XROM:E2B4 BD E2 BE jsr ps2SendAck_E2BE ; PS/2 send ACK XROM:E2B7 86 AA ldaa #$AA ; PS/2 self-test OK XROM:E2B9 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E2BC 39 rts XROM:E2BD ; --------------------------------------------------------------------------- XROM:E2BD XROM:E2BD leave_E2BD: ; ... XROM:E2BD 39 rts XROM:E2BD ; End of function ps2HandleCommand_E265 XROM:E2BD XROM:E2BE XROM:E2BE ; =============== S U B R O U T I N E ======================================= XROM:E2BE XROM:E2BE ; PS/2 send ACK XROM:E2BE XROM:E2BE ps2SendAck_E2BE: ; ... XROM:E2BE 86 FA ldaa #$FA ; PS/2 ACK XROM:E2C0 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E2C3 39 rts XROM:E2C3 ; End of function ps2SendAck_E2BE XROM:E2C3 XROM:E2C4 ; --------------------------------------------------------------------------- XROM:E2C4 ; START OF FUNCTION CHUNK FOR ps2HandleCommand_E265 XROM:E2C4 XROM:E2C4 ps2sendEcho_E2C4: ; ... XROM:E2C4 86 EE ldaa #$EE ; PS/2 echo XROM:E2C6 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E2C9 39 rts XROM:E2CA ; --------------------------------------------------------------------------- XROM:E2CA XROM:E2CA ps2IdentifyKeyboard_E2CA: ; ... XROM:E2CA BD E2 BE jsr ps2SendAck_E2BE ; PS/2 send ACK XROM:E2CD 86 AB ldaa #$AB ; identify as 'MF2 keybaord' XROM:E2CF BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E2D2 86 83 ldaa #$83 XROM:E2D4 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E2D7 39 rts XROM:E2D8 ; --------------------------------------------------------------------------- XROM:E2D8 XROM:E2D8 ps2EatNack_E2D8: ; ... XROM:E2D8 BD E2 BE jsr ps2SendAck_E2BE ; PS/2 eat-and-ack for ignored commands XROM:E2DB BD E2 FE jsr ps2GetByte_E2FE ; PS/2 get byte in A (and byte_72); V set if err, clear if OK XROM:E2DE BD E2 BE jsr ps2SendAck_E2BE ; PS/2 send ACK XROM:E2E1 39 rts XROM:E2E2 ; --------------------------------------------------------------------------- XROM:E2E2 XROM:E2E2 ps2scanCodeSet_E2E2: ; ... XROM:E2E2 BD E2 BE jsr ps2SendAck_E2BE ; PS/2 send ACK XROM:E2E5 BD E2 FE jsr ps2GetByte_E2FE ; PS/2 get byte in A (and byte_72); V set if err, clear if OK XROM:E2E8 81 01 cmpa #1 ; 'set scan code set 1'? ignore XROM:E2EA 27 11 beq leave_E2FD XROM:E2EC 81 03 cmpa #3 ; 'set scan code set 3'? ignore XROM:E2EE 27 0D beq leave_E2FD XROM:E2F0 81 00 cmpa #0 ; 'get current scan code set'? XROM:E2F2 26 05 bne ackNgo_E2F9 ; (must have been 'set scan code set 2'; just ack and leave) XROM:E2F4 86 02 ldaa #2 ; indicate 'scan code set 2' XROM:E2F6 BD F7 A0 jsr ps2SendByte_F7A0 ; PS/2 send byte in A XROM:E2F9 XROM:E2F9 ackNgo_E2F9: ; ... XROM:E2F9 BD E2 BE jsr ps2SendAck_E2BE ; PS/2 send ACK XROM:E2FC 39 rts XROM:E2FD ; --------------------------------------------------------------------------- XROM:E2FD XROM:E2FD leave_E2FD: ; ... XROM:E2FD 39 rts XROM:E2FD ; END OF FUNCTION CHUNK FOR ps2HandleCommand_E265 XROM:E2FE XROM:E2FE ; =============== S U B R O U T I N E ======================================= XROM:E2FE XROM:E2FE ; PS/2 get byte in A (and byte_72); V set if err, clear if OK XROM:E2FE XROM:E2FE ps2GetByte_E2FE: ; ... XROM:E2FE 7F 00 72 clr byte_72 ; our received byte shift register XROM:E301 86 01 ldaa #1 XROM:E303 97 60 staa scratchby_60 ; we'll be using this for parity XROM:E305 18 CE 00 08 ldy #8 ; 8 bits XROM:E309 XROM:E309 loop_E309: ; ... XROM:E309 BD F8 47 jsr ps2GetBit_F847 ; flick PDb0 clock, sense PAb0, reflect in carry XROM:E30C 24 03 bcc cont_E311 XROM:E30E 7C 00 60 inc scratchby_60 ; increment parity counter for '1's XROM:E311 XROM:E311 cont_E311: ; ... XROM:E311 76 00 72 ror byte_72 ; shift in the bit (in C) XROM:E314 18 09 dey XROM:E316 26 F1 bne loop_E309 ; more bits please XROM:E318 BD F8 47 jsr ps2GetBit_F847 ; flick PDb0 clock, sense PAb0, reflect in carry XROM:E31B 86 00 ldaa #0 XROM:E31D 49 rola ; get the sent parity bit XROM:E31E 97 4C staa scratchby_4C ; remember the parity bit for later XROM:E320 C6 01 ldab #1 XROM:E322 BD F8 39 jsr delay_F839 ; delay 5 usec XROM:E325 15 08 01 bclr PORTD_8 1 ; PDb0 (ckout???) low XROM:E328 C6 0C ldab #$C XROM:E32A BD F8 39 jsr delay_F839 ; delay 32.5 usec XROM:E32D 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:E330 14 08 02 bset PORTD_8 2 ; PDb1 (/dataout???)high XROM:E333 C6 0B ldab #$B XROM:E335 BD F8 39 jsr delay_F839 ; delay 30 usec XROM:E338 15 08 01 bclr PORTD_8 1 ; PDb0 (ckout???) low XROM:E33B C6 0C ldab #$C XROM:E33D BD F8 39 jsr delay_F839 ; delay 32.5 usec XROM:E340 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:E343 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:E346 96 60 ldaa scratchby_60 ; get our computed parity XROM:E348 84 01 anda #1 XROM:E34A 98 4C eora scratchby_4C ; see if the parity computed matches that received XROM:E34C 26 04 bne leaveFail_E352 ; parity check failed! XROM:E34E 96 72 ldaa byte_72 ; get back our received value to return XROM:E350 0A clv XROM:E351 39 rts XROM:E352 ; --------------------------------------------------------------------------- XROM:E352 XROM:E352 leaveFail_E352: ; ... XROM:E352 86 60 ldaa #$60 ; '`' ; XXX error code? XROM:E354 0B sev XROM:E355 39 rts XROM:E355 ; End of function ps2GetByte_E2FE XROM:E355 XROM:E356 XROM:E356 ; =============== S U B R O U T I N E ======================================= XROM:E356 XROM:E356 ; XXX wait for falling edge on IC3 (PAb0 datain?), use OC2 as timeout; V set timeout, V clear edge detected XROM:E356 XROM:E356 waitFallingEdge3_E356: ; ... XROM:E356 86 02 ldaa #2 XROM:E358 97 21 staa TCTL2_21 ; TCTL2: EDG3 (PAb0 datain?) - capture falling edge XROM:E35A 86 01 ldaa #1 XROM:E35C 97 23 staa TFLG1_23 ; TFLG1: clear IC3F XROM:E35E DC 0E ldd TCNT_E ; TCNT runs at E clock; 2 MHz, 500 ns; 32.768 ms / period XROM:E360 C3 FF FF addd #$FFFF ; (curcnt-1; maximal delay of ~ 33 ms) XROM:E363 DD 18 std TOC2_18 ; TOC2: set OC2 to timeout one less than max count XROM:E365 86 40 ldaa #$40 XROM:E367 97 23 staa TFLG1_23 ; TFLG1: clear OC2F XROM:E369 XROM:E369 loop_E369: ; ... XROM:E369 13 23 01 02 brclr TFLG1_23 1 cont_E36F ; wait for falling EDG3 (PAb0 datain?) XROM:E36D 20 06 bra leaveDetected_E375 XROM:E36F ; --------------------------------------------------------------------------- XROM:E36F XROM:E36F cont_E36F: ; ... XROM:E36F 13 23 40 F6 brclr TFLG1_23 $40 loop_E369 ; until OC2 timeout XROM:E373 0B sev ; edge not detected XROM:E374 39 rts XROM:E375 ; --------------------------------------------------------------------------- XROM:E375 XROM:E375 leaveDetected_E375: ; ... XROM:E375 0A clv ; edge detected XROM:E376 39 rts XROM:E376 ; End of function waitFallingEdge3_E356 XROM:E376 XROM:E377 XROM:E377 ; =============== S U B R O U T I N E ======================================= XROM:E377 XROM:E377 ; send the file in the PS/2 way XROM:E377 XROM:E377 sendFilePS2_E377: ; ... XROM:E377 BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E37A BD F0 13 jsr prepareToSend_F013 ; prepare to send (setup flags and display prompt) XROM:E37D XROM:E37D loop_E37D: ; ... XROM:E37D BD F4 57 jsr getNextCharToSendXlatPS2_F457 ; get next char to send and translate (PS/2); V set if no char XROM:E380 29 4C bvs leaveDone_E3CE ; no char XROM:E382 97 50 staa scratchby_50 ; remember this keycode for later XROM:E384 85 80 bita #$80 ; shifted? XROM:E386 27 0C beq unshifted_E394 XROM:E388 14 54 04 bset flagby_54 4 ; remember we have sent the shift key down so we can send up later XROM:E38B 86 12 ldaa #$12 XROM:E38D BD F7 A0 jsr ps2SendByte_F7A0 ; send leftShift down XROM:E390 29 3C bvs leaveDone_E3CE ; (horror; leave) XROM:E392 20 03 bra loc_E397 XROM:E394 ; --------------------------------------------------------------------------- XROM:E394 XROM:E394 unshifted_E394: ; ... XROM:E394 15 54 04 bclr flagby_54 4 ; clear a flag so we don't send key up for shift after the character XROM:E397 XROM:E397 loc_E397: ; ... XROM:E397 96 50 ldaa scratchby_50 ; get back the original keycode XROM:E399 84 7F anda #$7F XROM:E39B BD F7 A0 jsr ps2SendByte_F7A0 ; send the keycode down XROM:E39E 29 2E bvs leaveDone_E3CE ; (horror; leave) XROM:E3A0 86 F0 ldaa #$F0 XROM:E3A2 BD F7 A0 jsr ps2SendByte_F7A0 ; send the keycode up XROM:E3A5 29 27 bvs leaveDone_E3CE ; (horror; leave) XROM:E3A7 96 50 ldaa scratchby_50 ; get back the original keycode XROM:E3A9 84 7F anda #$7F XROM:E3AB BD F7 A0 jsr ps2SendByte_F7A0 ; send the keycode up XROM:E3AE 29 1E bvs leaveDone_E3CE ; (horror; leave) XROM:E3B0 13 54 04 0E brclr flagby_54 4 checkForAbort_E3C2 ; if we don't need to send key up for shift, finish up loop XROM:E3B4 86 F0 ldaa #$F0 XROM:E3B6 BD F7 A0 jsr ps2SendByte_F7A0 ; send key up prefix XROM:E3B9 29 13 bvs leaveDone_E3CE ; (horror; leave) XROM:E3BB 86 12 ldaa #$12 XROM:E3BD BD F7 A0 jsr ps2SendByte_F7A0 ; send leftShift code XROM:E3C0 29 0C bvs leaveDone_E3CE ; (horror; leave) XROM:E3C2 XROM:E3C2 checkForAbort_E3C2: ; ... XROM:E3C2 BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:E3C5 BD EB EE jsr dequeueKbdScanCode_EBEE ; check for user key press to abort sending XROM:E3C8 29 B3 bvs loop_E37D ; no key press; continue XROM:E3CA 81 87 cmpa #$87 ; scan code for shift-Send XROM:E3CC 27 AF beq loop_E37D ; ignore shift-Send; but any other key halts sending XROM:E3CE XROM:E3CE leaveDone_E3CE: ; ... XROM:E3CE BD E8 42 jsr haltSending_E842 ; XXX halt sending XROM:E3D1 0A clv XROM:E3D2 39 rts XROM:E3D2 ; End of function sendFilePS2_E377 XROM:E3D2 XROM:E3D3 XROM:E3D3 ; =============== S U B R O U T I N E ======================================= XROM:E3D3 XROM:E3D3 XROM:E3D3 sub_E3D3: ; ... XROM:E3D3 1A 83 FF 81 cpd #$FF81 XROM:E3D7 26 08 bne cont_E3E1 XROM:E3D9 14 8B FF bset byte_8B $FF ; XXX flag? XROM:E3DC 14 8C FF bset byte_8C $FF ; XXX flag? XROM:E3DF 20 24 bra leave_E405 XROM:E3E1 ; --------------------------------------------------------------------------- XROM:E3E1 XROM:E3E1 cont_E3E1: ; ... XROM:E3E1 1A 83 FF 82 cpd #$FF82 XROM:E3E5 26 08 bne cont_E3EF XROM:E3E7 7F 00 8B clr byte_8B ; XXX flag? XROM:E3EA 7F 00 8C clr byte_8C ; XXX flag? XROM:E3ED 20 16 bra leave_E405 XROM:E3EF ; --------------------------------------------------------------------------- XROM:E3EF XROM:E3EF cont_E3EF: ; ... XROM:E3EF 1A 83 FF 83 cpd #$FF83 XROM:E3F3 26 05 bne cont_E3FA XROM:E3F5 BD EB 9B jsr deleteThisFile_EB9B ; delete file by resetting pointers (recoverable) XROM:E3F8 20 0B bra leave_E405 XROM:E3FA ; --------------------------------------------------------------------------- XROM:E3FA XROM:E3FA cont_E3FA: ; ... XROM:E3FA 1A 83 FF 84 cpd #$FF84 XROM:E3FE 26 EF bne cont_E3EF XROM:E400 BD F0 13 jsr prepareToSend_F013 ; prepare to send (setup flags and display prompt) XROM:E403 20 00 bra *+2 ; (knumbskull 'break' in 'switch' for last 'case') XROM:E405 ; --------------------------------------------------------------------------- XROM:E405 XROM:E405 leave_E405: ; ... XROM:E405 39 rts XROM:E405 ; End of function sub_E3D3 XROM:E405 XROM:E406 XROM:E406 ; =============== S U B R O U T I N E ======================================= XROM:E406 XROM:E406 ; setup to sleep, waiting for any key press to wake XROM:E406 XROM:E406 sleepForKbdEvent_E406: ; ... XROM:E406 14 21 02 bset TCTL2_21 2 ; TCL2; Edge3 falling edge XROM:E409 14 23 01 bset TFLG1_23 1 ; TFLG1; IC3 enable XROM:E40C 07 tpa XROM:E40D 84 7F anda #$7F ; clear the 'stop disable' flag XROM:E40F 06 tap XROM:E410 7F 80 00 clr $8000 ; set all key columns low; this will trigger interrupt XROM:E413 7F C0 00 clr $C000 ; on any key pressed (and so exiting STOP) XROM:E416 0E cli ; enable interrupts XROM:E417 CF stop ; place system in low-power mode; waiting for interrupt XROM:E418 ; --------------------------------------------------------------------------- XROM:E418 01 nop ; (can't fiddle with mask bit yet) XROM:E419 0F sei ; disable interrupts for processing XROM:E41A 39 rts ; get to it! XROM:E41A ; End of function sleepForKbdEvent_E406 XROM:E41A XROM:E41B XROM:E41B ; =============== S U B R O U T I N E ======================================= XROM:E41B XROM:E41B ; configure hardware XROM:E41B XROM:E41B configurePeripherals_E41B: ; ... XROM:E41B 86 00 ldaa #0 XROM:E41D 8A 04 oraa #4 ; disable COP, disable (non-existent) EPROM XROM:E41F 97 3F staa CONFIG_3F ; CONFIG XROM:E421 14 39 33 bset OPTION_39 $33 ; OPTION: /IRQ edge, STOP delay, COP div 64 XROM:E424 14 3C 20 bset HPRIO_3C $20 ; HIPRIO: multiplexed mode XROM:E427 14 28 20 bset SPCR_28 $20 ; SPCR; DWOM, port D open-drain XROM:E42A 14 09 FF bset DDRD_9 $FF ; DDRD; all port D output XROM:E42D 86 01 ldaa #1 XROM:E42F 97 08 staa PORTD_8 ; PDb0 (ckout???) high; all others low XROM:E431 14 26 80 bset PACTL_26 $80 ; PACTL; PAb7 output (lcdex) XROM:E434 14 26 08 bset PACTL_26 8 ; PACTL; PAb3 output (rampage0) XROM:E437 86 00 ldaa #0 XROM:E439 97 20 staa TCTL1_20 ; TCTL1; timer disconnected for output pins XROM:E43B 15 00 A8 bclr PORTA_0 $A8 ; PAb7 (lcdex), PAb5 (rampage1), PAb3 (rampage0) low XROM:E43E 7F 80 00 clr $8000 XROM:E441 CE 00 C0 ldx #bos_C0 ; clear from 40 to C0 (inclusive; C0 is stack, minor bug) XROM:E444 XROM:E444 loopClearIRAM_E444: ; ... XROM:E444 6F 00 clr 0,x XROM:E446 09 dex XROM:E447 8C 00 40 cpx #word_40 ; reached bottom of IRAM? XROM:E44A 24 F8 bcc loopClearIRAM_E444 XROM:E44C BD EA A7 jsr sub_EAA7 ; XXX reset stuff XROM:E44F BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E452 7F 00 75 clr byte_75 ; XXX flag? possibly ADB related XROM:E455 7F 00 8A clr bKbdEmuMode_8A ; flag; kbdemu b0 = 0 == mac, 1 == pc XROM:E458 39 rts XROM:E458 ; End of function configurePeripherals_E41B XROM:E458 XROM:E459 XROM:E459 ; =============== S U B R O U T I N E ======================================= XROM:E459 XROM:E459 ; handle power up special keys XROM:E459 XROM:E459 handlePowerOnSpecialKeys_E459: ; ... XROM:E459 BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:E45C XROM:E45C loop_E45C: ; ... XROM:E45C BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:E45F 29 27 bvs leave_E488 ; no key down on power up; leave XROM:E461 13 63 01 23 brclr bCloverKeyDown_63 1 leave_E488 ; true if 'clover key down' XROM:E465 13 61 01 1F brclr bAltKeyDown_61 1 leave_E488 ; true if 'alt/option key down' XROM:E469 81 61 cmpa #$61 ; secret key code ('R') to enter ram test; not in manual XROM:E46B 26 05 bne cont_E472 XROM:E46D BD EC 91 jsr testExtRAM_EC91 ; execute RAM test (with message) XROM:E470 20 16 bra leave_E488 XROM:E472 ; --------------------------------------------------------------------------- XROM:E472 XROM:E472 cont_E472: ; ... XROM:E472 81 56 cmpa #$56 ; secret key code ('Clear File') to re-intialize ram; not in manual XROM:E474 26 E6 bne loop_E45C XROM:E476 BD F7 54 jsr setcpLine2_F754 ; set cursor Line 2 XROM:E479 CE FC D6 ldx #aSignatureNotFo ; "(Signature not found. Initializing...)" XROM:E47C BD F6 69 jsr showText_F669 ; show nts text @ X XROM:E47F BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E482 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E485 BD EB 74 jsr initFileStructsOpenFile1_EB74 ; setup file structs and open file 1 XROM:E488 XROM:E488 leave_E488: ; ... XROM:E488 39 rts XROM:E488 ; End of function handlePowerOnSpecialKeys_E459 XROM:E488 XROM:E489 XROM:E489 ; =============== S U B R O U T I N E ======================================= XROM:E489 XROM:E489 XROM:E489 sub_E489: ; ... XROM:E489 BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:E48C BD EC 03 jsr peekKbdScanCode_EC03 ; get next key scan code from buffer, but don't dequeue; V set if none, clear if valid XROM:E48F 29 33 bvs leave_E4C4 ; leave if no next key XROM:E491 81 87 cmpa #$87 ; shifted 'Send' key? XROM:E493 27 37 beq leaveClearKbdBuff_E4CC XROM:E495 81 07 cmpa #7 ; 'Send' key scan code? XROM:E497 26 07 bne cont_E4A0 XROM:E499 BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E49C BD F0 13 jsr prepareToSend_F013 ; prepare to send (setup flags and display prompt) XROM:E49F 39 rts XROM:E4A0 ; --------------------------------------------------------------------------- XROM:E4A0 XROM:E4A0 cont_E4A0: ; ... XROM:E4A0 12 6D 01 21 brset byte_6D 1 loc_E4C5 ; XXX flag? is file sending??? XROM:E4A4 13 A1 01 0B brclr bCapsLock_A1 1 nocapslockYet_E4B3 ; flag; CAPS lock in effect XROM:E4A8 36 psha ; (remember peeked scan code) XROM:E4A9 84 7F anda #$7F XROM:E4AB 81 2D cmpa #$2D ; was it the capslock? XROM:E4AD 26 03 bne cont_E4B2 XROM:E4AF BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E4B2 XROM:E4B2 cont_E4B2: ; ... XROM:E4B2 32 pula ; (restore peeked scan code) XROM:E4B3 XROM:E4B3 nocapslockYet_E4B3: ; ... XROM:E4B3 81 2D cmpa #$2D ; now again, about that caps lock...? XROM:E4B5 26 06 bne notCapsLockImSerious_E4BD XROM:E4B7 96 A1 ldaa bCapsLock_A1 ; flag; CAPS lock in effect XROM:E4B9 88 01 eora #1 ; toggle caps lock flag XROM:E4BB 97 A1 staa bCapsLock_A1 ; flag; CAPS lock in effect XROM:E4BD XROM:E4BD notCapsLockImSerious_E4BD: ; ... XROM:E4BD 12 63 01 0F brset bCloverKeyDown_63 1 loc_E4D0 ; true if 'clover key down' XROM:E4C1 XROM:E4C1 leaveSetBy58_E4C1: ; ... XROM:E4C1 14 58 01 bset byte_58 1 ; XXX flag? XROM:E4C4 XROM:E4C4 leave_E4C4: ; ... XROM:E4C4 39 rts XROM:E4C5 ; --------------------------------------------------------------------------- XROM:E4C5 XROM:E4C5 loc_E4C5: ; ... XROM:E4C5 13 50 80 FB brclr scratchby_50 $80 leave_E4C4 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E4C9 BD E8 42 jsr haltSending_E842 ; XXX halt sending XROM:E4CC XROM:E4CC leaveClearKbdBuff_E4CC: ; ... XROM:E4CC BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E4CF 39 rts XROM:E4D0 ; --------------------------------------------------------------------------- XROM:E4D0 XROM:E4D0 loc_E4D0: ; ... XROM:E4D0 13 61 01 ED brclr bAltKeyDown_61 1 leaveSetBy58_E4C1 ; true if 'alt/option key down' XROM:E4D4 BD EF 7D jsr scF18toNum_EF7D ; scan code F1-8 to number 1-8; C if not F1-8, clear if OK XROM:E4D7 25 E8 bcs leaveSetBy58_E4C1 XROM:E4D9 B7 01 5D staa curFileNo_15D ; current file number (1-8) XROM:E4DC BD EA F9 jsr openFile_EAF9 ; open current file (specified at 15D) XROM:E4DF BD F5 ED jsr promptKbdEmuModeSend_F5ED ; show which keyboard emulation and prompt for send key XROM:E4E2 20 E8 bra leaveClearKbdBuff_E4CC XROM:E4E2 ; End of function sub_E489 XROM:E4E2 XROM:E4E4 XROM:E4E4 ; =============== S U B R O U T I N E ======================================= XROM:E4E4 XROM:E4E4 ; check battery level and show warning XROM:E4E4 XROM:E4E4 checkBatteryLevel_E4E4: ; ... XROM:E4E4 12 00 02 1A brset PORTA_0 2 leave_E502 ; if PAb1 (batok) is set it's fine XROM:E4E8 96 89 ldaa nLowBatCount_89 ; passes through 'low battery' logic; avoid showing the message and delay most of the time XROM:E4EA 26 10 bne cont_E4FC ; only do the warning (and delay) once in a while XROM:E4EC 86 0F ldaa #15 XROM:E4EE 97 89 staa nLowBatCount_89 ; passes through 'low battery' logic; avoid showing the message and delay most of the time XROM:E4F0 BD E5 14 jsr showLowBattery_E514 ; display low-battery message XROM:E4F3 CE 00 03 ldx #3 ; setup for delay of 1.77 sec XROM:E4F6 XROM:E4F6 delay_E4F6: ; ... XROM:E4F6 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E4F9 09 dex XROM:E4FA 26 FA bne delay_E4F6 XROM:E4FC XROM:E4FC cont_E4FC: ; ... XROM:E4FC 7A 00 89 dec nLowBatCount_89 ; this time, just show the file state; we'll be back later XROM:E4FF BD EE DA jsr updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:E502 XROM:E502 leave_E502: ; ... XROM:E502 39 rts XROM:E502 ; End of function checkBatteryLevel_E4E4 XROM:E502 XROM:E503 XROM:E503 ; =============== S U B R O U T I N E ======================================= XROM:E503 XROM:E503 ; check low battery and show message if needed (done once during power on) XROM:E503 XROM:E503 powerOnCheckBattery_E503: ; ... XROM:E503 12 00 02 0C brset PORTA_0 2 leave_E513 ; if PAb1 (batok) is set it's fine XROM:E507 BD E5 14 jsr showLowBattery_E514 ; display low-battery message XROM:E50A CE 00 04 ldx #4 ; about 1.96 sec XROM:E50D XROM:E50D loop_E50D: ; ... XROM:E50D BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E510 09 dex XROM:E511 26 FA bne loop_E50D XROM:E513 XROM:E513 leave_E513: ; ... XROM:E513 39 rts XROM:E513 ; End of function powerOnCheckBattery_E503 XROM:E513 XROM:E514 XROM:E514 ; =============== S U B R O U T I N E ======================================= XROM:E514 XROM:E514 ; display low-battery message XROM:E514 XROM:E514 showLowBattery_E514: ; ... XROM:E514 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:E517 BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:E51A CE FC BB ldx #aLowBattery ; " Low Battery!!" XROM:E51D BD F6 69 jsr showText_F669 ; show nts text @ X XROM:E520 39 rts XROM:E520 ; End of function showLowBattery_E514 XROM:E520 XROM:E521 XROM:E521 ; =============== S U B R O U T I N E ======================================= XROM:E521 XROM:E521 ; wake from sleep by keydown; setup to resume processing in main XROM:E521 XROM:E521 isrIRQ_E521: ; ... XROM:E521 86 FF ldaa #$FF XROM:E523 B7 80 00 staa $8000 ; set all kbd (high) cols high (inactive) XROM:E526 B7 C0 00 staa $C000 ; set all kbd (low) cols high (inactive) XROM:E529 3B rti XROM:E529 ; End of function isrIRQ_E521 XROM:E529 XROM:E52A XROM:E52A ; =============== S U B R O U T I N E ======================================= XROM:E52A XROM:E52A ; (not supposed to happen) XROM:E52A XROM:E52A isrNMI_E52A: ; ... XROM:E52A BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:E52D CE FC 4B ldx #aNmi ; "NMI" XROM:E530 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:E533 3B rti XROM:E533 ; End of function isrNMI_E52A XROM:E533 XROM:E534 XROM:E534 ; =============== S U B R O U T I N E ======================================= XROM:E534 XROM:E534 ; (not supposed to happen) XROM:E534 XROM:E534 isrSpuriousInt_E534: ; ... XROM:E534 BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:E537 CE FC 20 ldx #aSpurint ; "SpurInt!" XROM:E53A BD F6 69 jsr showText_F669 ; show nts text @ X XROM:E53D 3B rti XROM:E53D ; End of function isrSpuriousInt_E534 XROM:E53D XROM:E53E XROM:E53E ; =============== S U B R O U T I N E ======================================= XROM:E53E XROM:E53E ; horror; emit message, delay, and set to restart XROM:E53E XROM:E53E isrIllegalOpcode_E53E: ; ... XROM:E53E BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:E541 CE FC 29 ldx #aStackUnbalance ; "(Stack unbalance)ilOpCode @ addr:" XROM:E544 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:E547 38 pulx ; get faulting address in AB XROM:E548 8F xgdx XROM:E549 BD F5 B0 jsr showHexAB_F5B0 ; send AB as four-digit hex to display XROM:E54C BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E54F BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E552 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E555 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E558 CE E0 00 ldx #start_E000 ; set to re-init system upon return from interrupt XROM:E55B 3C pshx XROM:E55C 3B rti XROM:E55C ; End of function isrIllegalOpcode_E53E XROM:E55C XROM:E55D XROM:E55D ; =============== S U B R O U T I N E ======================================= XROM:E55D XROM:E55D XROM:E55D sub_E55D: ; ... XROM:E55D 5F clrb XROM:E55E CE 00 00 ldx #0 XROM:E561 XROM:E561 loc_E561: ; ... XROM:E561 A6 76 ldaa byte_76,x ; XXX prev row scan mask for col XROM:E563 26 07 bne loc_E56C XROM:E565 XROM:E565 loc_E565: ; ... XROM:E565 08 inx XROM:E566 8C 00 10 cpx #$10 XROM:E569 25 F6 bcs loc_E561 XROM:E56B 39 rts XROM:E56C ; --------------------------------------------------------------------------- XROM:E56C XROM:E56C loc_E56C: ; ... XROM:E56C 8C 00 0F cpx #$F XROM:E56F 27 F4 beq loc_E565 XROM:E571 8C 00 08 cpx #8 XROM:E574 27 EF beq loc_E565 XROM:E576 8C 00 09 cpx #9 XROM:E579 27 EA beq loc_E565 XROM:E57B 8C 00 06 cpx #6 XROM:E57E 26 02 bne loc_E582 XROM:E580 84 F5 anda #$F5 ; 'õ' XROM:E582 XROM:E582 loc_E582: ; ... XROM:E582 18 CE 00 09 ldy #9 XROM:E586 XROM:E586 loc_E586: ; ... XROM:E586 44 lsra XROM:E587 24 01 bcc loc_E58A XROM:E589 5C incb XROM:E58A XROM:E58A loc_E58A: ; ... XROM:E58A 18 09 dey XROM:E58C 26 F8 bne loc_E586 XROM:E58E 20 D5 bra loc_E565 XROM:E58E ; End of function sub_E55D XROM:E58E XROM:E590 XROM:E590 ; =============== S U B R O U T I N E ======================================= XROM:E590 XROM:E590 XROM:E590 sub_E590: ; ... XROM:E590 BD E5 5D jsr sub_E55D XROM:E593 C1 02 cmpb #2 XROM:E595 25 05 bcs leave_E59C XROM:E597 14 88 FF bset byte_88 $FF ; XXX some sort of keyboard related flag XROM:E59A 20 03 bra leave_E59F XROM:E59C ; --------------------------------------------------------------------------- XROM:E59C XROM:E59C leave_E59C: ; ... XROM:E59C 7F 00 88 clr byte_88 ; XXX some sort of keyboard related flag XROM:E59F XROM:E59F leave_E59F: ; ... XROM:E59F 39 rts XROM:E59F ; End of function sub_E590 XROM:E59F XROM:E5A0 XROM:E5A0 ; =============== S U B R O U T I N E ======================================= XROM:E5A0 XROM:E5A0 ; do key scan and enqueue XROM:E5A0 XROM:E5A0 scanKbd_E5A0: ; ... XROM:E5A0 BD E5 90 jsr sub_E590 XROM:E5A3 CC FF FE ldd #$FFFE ; 16-bits, bit 0 low XROM:E5A6 DD 5E std word_5E ; store as (initial) /next/ scan column XROM:E5A8 XROM:E5A8 loopNextKbdCol_E5A8: ; ... XROM:E5A8 DC 5E ldd word_5E ; get next scan column XROM:E5AA 1A 83 FF FF cpd #$FFFF XROM:E5AE 27 74 beq finishedScan_E624 ; finished! XROM:E5B0 B7 80 00 staa $8000 ; keyboard column latch high XROM:E5B3 F7 C0 00 stab $C000 ; keyboard column latch low XROM:E5B6 DD 4E std scratchw_4E ; (save for now) XROM:E5B8 05 lsld ; shift up for next scan column XROM:E5B9 CA 01 orab #1 ; (set the low bit; can only have a single 0) XROM:E5BB DD 5E std word_5E ; save /next/ scan column XROM:E5BD DC 4E ldd scratchw_4E ; (restore /this/ scan column) XROM:E5BF 88 FF eora #$FF ; (invert bits to have 1 in current column) XROM:E5C1 C8 FF eorb #$FF XROM:E5C3 DD 4E std scratchw_4E ; remember /this/ scan column; 'rectus' XROM:E5C5 8F xgdx ; get 'rectus' scan column in X XROM:E5C6 F6 80 00 ldab $8000 ; read keyboard row latch into B XROM:E5C9 C8 FF eorb #$FF ; complement to rectus row scan mask (1 in row keydown position) XROM:E5CB 8C 80 00 cpx #$8000 XROM:E5CE 27 5C beq handleCol15_E62C ; col 15 only has the two Shift keys XROM:E5D0 8C 02 00 cpx #$200 XROM:E5D3 27 71 beq handleCol9_E646 ; col 9 only has two Alt keys XROM:E5D5 8C 01 00 cpx #$100 XROM:E5D8 27 5F beq handleCol8_E639 ; col 8 only has Ctrl key XROM:E5DA 8C 00 40 cpx #$40 XROM:E5DD 27 76 beq handleCol6_E655 ; col 6 has two cloverleaf keys (and some others) XROM:E5DF XROM:E5DF processKbdBits_E5DF: ; ... XROM:E5DF 37 pshb ; (save row scan mask) XROM:E5E0 BD F5 7B jsr colMaskToColNo_F57B ; XXX col mask to col no; X is col mask; ret A = col no; V set if no col (done scanning) XROM:E5E3 29 7A bvs bug_E65F ; XXX cannot convert col mask to col no; bug? XROM:E5E5 16 tab XROM:E5E6 4F clra XROM:E5E7 8F xgdx ; X now contains column number XROM:E5E8 33 pulb ; (restore row scan mask) XROM:E5E9 E1 76 cmpb byte_76,x ; is this row scan mask different than the one before for this column? XROM:E5EB 27 BB beq loopNextKbdCol_E5A8 ; same as before; carry on XROM:E5ED A6 76 ldaa byte_76,x ; get prev row scan mask XROM:E5EF E7 76 stab byte_76,x ; save this row scan mask XROM:E5F1 97 71 staa byte_71 ; save prev row scan mask for this col XROM:E5F3 A4 76 anda byte_76,x ; mask off stuff from before that is now up XROM:E5F5 13 88 01 02 brclr byte_88 1 cont_E5FB ; XXX some sort of keyboard related flag XROM:E5F9 A7 76 staa byte_76,x ; save back just the stuff that is down now, that was down before XROM:E5FB XROM:E5FB cont_E5FB: ; ... XROM:E5FB A8 76 eora byte_76,x ; XXX prev row scan mask for col XROM:E5FD 27 0C beq cont_E60B ; XXX this row mask is the same as last time; repeat key processing? XROM:E5FF 16 tab XROM:E600 DE 4E ldx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:E602 BD F4 F6 jsr processKbdRowBits_F4F6 ; XXX process bits in row scan mask and enqueue scan codes XROM:E602 ; X is column scan mask, B is row scan mask XROM:E605 86 6E ldaa #$6E ; 'n' XROM:E607 97 65 staa byte_65 ; XXX keyboard related; values 6e, 12, 9, (dec) XROM:E609 20 9D bra loopNextKbdCol_E5A8 XROM:E60B ; --------------------------------------------------------------------------- XROM:E60B XROM:E60B cont_E60B: ; ... XROM:E60B 12 8A 01 04 brset bKbdEmuMode_8A 1 cont_E613 ; flag; kbdemu b0 = 0 == mac, 1 == pc XROM:E60F 13 75 01 95 brclr byte_75 1 loopNextKbdCol_E5A8 ; XXX flag? possibly ADB related XROM:E613 XROM:E613 cont_E613: ; ... XROM:E613 96 71 ldaa byte_71 ; scratch; prev row scan mask, this col; sometimes flag XROM:E615 A4 76 anda byte_76,x ; XXX prev row scan mask for col XROM:E617 98 71 eora byte_71 ; scratch; prev row scan mask, this col; sometimes flag XROM:E619 27 8D beq loopNextKbdCol_E5A8 XROM:E61B 16 tab XROM:E61C DE 4E ldx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:E61E BD F5 2A jsr SPECIALprocessKbdRowBits_F52A ; XXX SPECIAL process bits in row scan mask and enqueue scan codes; sets high bit and does not store in byte_6F XROM:E621 7E E5 A8 jmp loopNextKbdCol_E5A8 XROM:E624 ; --------------------------------------------------------------------------- XROM:E624 XROM:E624 finishedScan_E624: ; ... XROM:E624 12 75 01 03 brset byte_75 1 leave_E62B ; XXX flag? possibly ADB related XROM:E628 BD E6 6B jsr sub_E66B XROM:E62B XROM:E62B leave_E62B: ; ... XROM:E62B 39 rts XROM:E62C ; --------------------------------------------------------------------------- XROM:E62C XROM:E62C handleCol15_E62C: ; ... XROM:E62C 5D tstb ; any col 15? (only shift keys here) XROM:E62D 26 05 bne col15down_E634 XROM:E62F 7F 00 64 clr bShiftKeyDown_64 ; true if 'shift key down' XROM:E632 20 AB bra processKbdBits_E5DF XROM:E634 ; --------------------------------------------------------------------------- XROM:E634 XROM:E634 col15down_E634: ; ... XROM:E634 14 64 FF bset bShiftKeyDown_64 $FF ; true if 'shift key down' XROM:E637 20 A6 bra processKbdBits_E5DF XROM:E639 ; --------------------------------------------------------------------------- XROM:E639 XROM:E639 handleCol8_E639: ; ... XROM:E639 5D tstb ; any col 8? XROM:E63A 26 05 bne col8down_E641 XROM:E63C 7F 00 62 clr bCtrlKeyDown_62 ; true if 'ctrl key down' XROM:E63F 20 9E bra processKbdBits_E5DF XROM:E641 ; --------------------------------------------------------------------------- XROM:E641 XROM:E641 col8down_E641: ; ... XROM:E641 14 62 FF bset bCtrlKeyDown_62 $FF ; true if 'ctrl key down' XROM:E644 20 99 bra processKbdBits_E5DF XROM:E646 ; --------------------------------------------------------------------------- XROM:E646 XROM:E646 handleCol9_E646: ; ... XROM:E646 5D tstb ; any col 9? XROM:E647 26 06 bne col9down_E64F XROM:E649 7F 00 61 clr bAltKeyDown_61 ; true if 'alt/option key down' XROM:E64C 7E E5 DF jmp processKbdBits_E5DF XROM:E64F ; --------------------------------------------------------------------------- XROM:E64F XROM:E64F col9down_E64F: ; ... XROM:E64F 14 61 FF bset bAltKeyDown_61 $FF ; true if 'alt/option key down' XROM:E652 7E E5 DF jmp processKbdBits_E5DF XROM:E655 ; --------------------------------------------------------------------------- XROM:E655 XROM:E655 handleCol6_E655: ; ... XROM:E655 C5 0A bitb #$A ; test only the cloverleaf keys; there are others on this col XROM:E657 26 0C bne cont_E665 XROM:E659 7F 00 63 clr bCloverKeyDown_63 ; true if 'clover key down' XROM:E65C 7E E5 DF jmp processKbdBits_E5DF XROM:E65F ; --------------------------------------------------------------------------- XROM:E65F XROM:E65F bug_E65F: ; ... XROM:E65F BD F5 DD jsr debugHere2_F5DD ; Here2 related; a bug found XROM:E662 7E E5 A8 jmp loopNextKbdCol_E5A8 XROM:E665 ; --------------------------------------------------------------------------- XROM:E665 XROM:E665 cont_E665: ; ... XROM:E665 14 63 FF bset bCloverKeyDown_63 $FF ; true if 'clover key down' XROM:E668 7E E5 DF jmp processKbdBits_E5DF XROM:E668 ; End of function scanKbd_E5A0 XROM:E668 XROM:E66B XROM:E66B ; =============== S U B R O U T I N E ======================================= XROM:E66B XROM:E66B XROM:E66B sub_E66B: ; ... XROM:E66B BD E5 5D jsr sub_E55D XROM:E66E C1 03 cmpb #3 XROM:E670 25 03 bcs loc_E675 XROM:E672 BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E675 XROM:E675 loc_E675: ; ... XROM:E675 13 6F FF 38 brclr byte_6F $FF locret_E6B1 ; XXX last scan code? XROM:E679 BD E5 5D jsr sub_E55D XROM:E67C C1 00 cmpb #0 XROM:E67E 26 04 bne loc_E684 XROM:E680 XROM:E680 loc_E680: ; ... XROM:E680 7F 00 6F clr byte_6F ; XXX last scan code? XROM:E683 39 rts XROM:E684 ; --------------------------------------------------------------------------- XROM:E684 XROM:E684 loc_E684: ; ... XROM:E684 D6 6F ldab byte_6F ; XXX last scan code? XROM:E686 C4 0F andb #$F ; B is col no XROM:E688 CE 00 00 ldx #0 XROM:E68B 3A abx ; X is index by col no XROM:E68C D6 6F ldab byte_6F ; XXX last scan code? XROM:E68E 54 lsrb XROM:E68F 54 lsrb XROM:E690 54 lsrb XROM:E691 54 lsrb ; B is row no XROM:E692 86 01 ldaa #1 ; setup to convert row number to row mask (rectus) XROM:E694 XROM:E694 loop_E694: ; ... XROM:E694 5A decb XROM:E695 2B 03 bmi cont_E69A XROM:E697 48 asla XROM:E698 20 FA bra loop_E694 XROM:E69A ; --------------------------------------------------------------------------- XROM:E69A XROM:E69A cont_E69A: ; ... XROM:E69A A4 76 anda byte_76,x ; XXX prev row scan mask for col XROM:E69C 27 E2 beq loc_E680 XROM:E69E 96 65 ldaa byte_65 ; XXX keyboard related; values 6e, 12, 9, (dec) XROM:E6A0 26 10 bne loc_E6B2 XROM:E6A2 96 6F ldaa byte_6F ; XXX last scan code? XROM:E6A4 BD EB D7 jsr enqueueKbdScanCode_EBD7 ; push scan code A (rowno|colno) into keyboard buffer XROM:E6A7 96 6F ldaa byte_6F ; XXX last scan code? XROM:E6A9 81 2B cmpa #$2B ; '+' XROM:E6AB 27 09 beq loc_E6B6 XROM:E6AD 86 12 ldaa #$12 XROM:E6AF XROM:E6AF loc_E6AF: ; ... XROM:E6AF 97 65 staa byte_65 ; XXX keyboard related; values 6e, 12, 9, (dec) XROM:E6B1 XROM:E6B1 locret_E6B1: ; ... XROM:E6B1 39 rts XROM:E6B2 ; --------------------------------------------------------------------------- XROM:E6B2 XROM:E6B2 loc_E6B2: ; ... XROM:E6B2 7A 00 65 dec byte_65 ; XXX keyboard related; values 6e, 12, 9, (dec) XROM:E6B5 39 rts XROM:E6B6 ; --------------------------------------------------------------------------- XROM:E6B6 XROM:E6B6 loc_E6B6: ; ... XROM:E6B6 86 09 ldaa #9 XROM:E6B8 20 F5 bra loc_E6AF XROM:E6B8 ; End of function sub_E66B XROM:E6B8 XROM:E6BA ; --------------------------------------------------------------------------- XROM:E6BA ; START OF FUNCTION CHUNK FOR sub_E6BD XROM:E6BA XROM:E6BA loc_E6BA: ; ... XROM:E6BA 7E E7 82 jmp loc_E782 XROM:E6BA ; END OF FUNCTION CHUNK FOR sub_E6BD XROM:E6BD XROM:E6BD ; =============== S U B R O U T I N E ======================================= XROM:E6BD XROM:E6BD ; XXX ADB related? XROM:E6BD XROM:E6BD sub_E6BD: ; ... XROM:E6BD XROM:E6BD ; FUNCTION CHUNK AT XROM:E6BA SIZE 00000003 BYTES XROM:E6BD XROM:E6BD BD E8 4F jsr sub_E84F ; XXX ADB related? XROM:E6C0 29 2D bvs loc_E6EF XROM:E6C2 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E6C4 84 F0 anda #$F0 ; 'ð' XROM:E6C6 91 5D cmpa byte_5D XROM:E6C8 27 09 beq loc_E6D3 XROM:E6CA 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E6CC 81 2C cmpa #$2C ; ',' XROM:E6CE 26 1D bne loc_E6ED XROM:E6D0 7E E7 17 jmp loc_E717 XROM:E6D3 ; --------------------------------------------------------------------------- XROM:E6D3 XROM:E6D3 loc_E6D3: ; ... XROM:E6D3 12 49 0F E3 brset byte_49 $F loc_E6BA ; XXX field; possibly ADB related XROM:E6D7 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E6D9 84 0C anda #$C XROM:E6DB 81 08 cmpa #8 XROM:E6DD 27 27 beq loc_E706 XROM:E6DF 81 0C cmpa #$C XROM:E6E1 27 29 beq loc_E70C XROM:E6E3 81 00 cmpa #0 XROM:E6E5 26 06 bne loc_E6ED XROM:E6E7 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E6E9 84 F0 anda #$F0 ; 'ð' XROM:E6EB 27 1C beq loc_E709 XROM:E6ED XROM:E6ED loc_E6ED: ; ... XROM:E6ED 0A clv XROM:E6EE 39 rts XROM:E6EF ; --------------------------------------------------------------------------- XROM:E6EF XROM:E6EF loc_E6EF: ; ... XROM:E6EF 81 22 cmpa #$22 ; '"' ; ???error code we will handle? XROM:E6F1 26 08 bne loc_E6FB XROM:E6F3 7F 00 75 clr byte_75 ; XXX flag? possibly ADB related XROM:E6F6 BD EE DA jsr updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:E6F9 0B sev XROM:E6FA 39 rts XROM:E6FB ; --------------------------------------------------------------------------- XROM:E6FB XROM:E6FB loc_E6FB: ; ... XROM:E6FB BD F5 C6 jsr showErr_F5C6 ; show 'Err: ' with hex code in A XROM:E6FE BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E701 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:E704 20 E7 bra loc_E6ED XROM:E706 ; --------------------------------------------------------------------------- XROM:E706 XROM:E706 loc_E706: ; ... XROM:E706 7E E7 C2 jmp loc_E7C2 XROM:E709 ; --------------------------------------------------------------------------- XROM:E709 XROM:E709 loc_E709: ; ... XROM:E709 7E E8 3C jmp loc_E83C XROM:E70C ; --------------------------------------------------------------------------- XROM:E70C XROM:E70C loc_E70C: ; ... XROM:E70C 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E70E 84 03 anda #3 XROM:E710 81 00 cmpa #0 XROM:E712 26 5B bne loc_E76F XROM:E714 7E E6 ED jmp loc_E6ED XROM:E717 ; --------------------------------------------------------------------------- XROM:E717 XROM:E717 loc_E717: ; ... XROM:E717 13 58 01 D2 brclr byte_58 1 loc_E6ED ; XXX flag? XROM:E71B 13 6D 01 2D brclr byte_6D 1 loc_E74C ; XXX flag? is file sending??? XROM:E71F B6 01 5C ldaa kbdemuSpeed_15C ; keyboard transfer speed (0, 1, 2, c8???) XROM:E722 81 00 cmpa #0 XROM:E724 26 04 bne cont_E72A XROM:E726 86 0A ldaa #$A XROM:E728 20 06 bra loc_E730 XROM:E72A ; --------------------------------------------------------------------------- XROM:E72A XROM:E72A cont_E72A: ; ... XROM:E72A 81 01 cmpa #1 XROM:E72C 26 0F bne loc_E73D XROM:E72E 86 02 ldaa #2 XROM:E730 XROM:E730 loc_E730: ; ... XROM:E730 D6 66 ldab byte_66 XROM:E732 27 05 beq loc_E739 XROM:E734 7A 00 66 dec byte_66 XROM:E737 20 B4 bra loc_E6ED XROM:E739 ; --------------------------------------------------------------------------- XROM:E739 XROM:E739 loc_E739: ; ... XROM:E739 97 66 staa byte_66 XROM:E73B 20 0F bra loc_E74C XROM:E73D ; --------------------------------------------------------------------------- XROM:E73D XROM:E73D loc_E73D: ; ... XROM:E73D 96 66 ldaa byte_66 XROM:E73F 26 08 bne loc_E749 XROM:E741 B6 01 5C ldaa kbdemuSpeed_15C ; keyboard transfer speed (0, 1, 2, c8???) XROM:E744 97 66 staa byte_66 XROM:E746 7E E6 ED jmp loc_E6ED XROM:E749 ; --------------------------------------------------------------------------- XROM:E749 XROM:E749 loc_E749: ; ... XROM:E749 7A 00 66 dec byte_66 XROM:E74C XROM:E74C loc_E74C: ; ... XROM:E74C BD F2 6C jsr sub_F26C ; XXX send file ADB? XROM:E74F 29 04 bvs loc_E755 XROM:E751 DC 50 ldd scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E753 20 44 bra loc_E799 XROM:E755 ; --------------------------------------------------------------------------- XROM:E755 XROM:E755 loc_E755: ; ... XROM:E755 12 8C 01 0A brset byte_8C 1 loc_E763 ; XXX flag? XROM:E759 12 6D 01 03 brset byte_6D 1 loc_E760 ; XXX flag? is file sending??? XROM:E75D 7E E6 ED jmp loc_E6ED XROM:E760 ; --------------------------------------------------------------------------- XROM:E760 XROM:E760 loc_E760: ; ... XROM:E760 BD E8 42 jsr haltSending_E842 ; XXX halt sending XROM:E763 XROM:E763 loc_E763: ; ... XROM:E763 7E E6 ED jmp loc_E6ED XROM:E766 ; --------------------------------------------------------------------------- XROM:E766 XROM:E766 loc_E766: ; ... XROM:E766 BD F2 D6 jsr sub_F2D6 XROM:E769 29 F5 bvs loc_E760 XROM:E76B DC 50 ldd scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:E76D 20 2A bra loc_E799 XROM:E76F ; --------------------------------------------------------------------------- XROM:E76F XROM:E76F loc_E76F: ; ... XROM:E76F 81 01 cmpa #1 XROM:E771 26 04 bne loc_E777 XROM:E773 DC 52 ldd scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:E775 20 22 bra loc_E799 XROM:E777 ; --------------------------------------------------------------------------- XROM:E777 XROM:E777 loc_E777: ; ... XROM:E777 81 02 cmpa #2 XROM:E779 26 07 bne loc_E782 XROM:E77B 12 8C 01 E7 brset byte_8C 1 loc_E766 ; XXX flag? XROM:E77F 7E E6 ED jmp loc_E6ED XROM:E782 ; --------------------------------------------------------------------------- XROM:E782 XROM:E782 loc_E782: ; ... XROM:E782 13 5A 01 08 brclr byte_5A 1 loc_E78E ; XXX flag? XROM:E786 7F 00 5A clr byte_5A ; XXX flag? XROM:E789 DC 56 ldd word_56 ; XXX 675E when 'reset stuff' XROM:E78B 5F clrb XROM:E78C 20 0B bra loc_E799 XROM:E78E ; --------------------------------------------------------------------------- XROM:E78E XROM:E78E loc_E78E: ; ... XROM:E78E D6 0E ldab TCNT_E ; TCNT runs at E clock; 2 MHz, 500 ns; 32.768 ms / period XROM:E790 C4 0F andb #$F XROM:E792 96 56 ldaa word_56 ; XXX 675E when 'reset stuff' XROM:E794 84 F0 anda #$F0 ; 'ð' XROM:E796 1B aba XROM:E797 D6 57 ldab word_56+1 ; XXX 675E when 'reset stuff' XROM:E799 XROM:E799 loc_E799: ; ... XROM:E799 DD 4C std scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:E79B XROM:E79B loc_E79B: ; ... XROM:E79B 13 23 01 02 brclr TFLG1_23 1 loc_E7A1 ; IC3 XROM:E79F 20 1B bra loc_E7BC XROM:E7A1 ; --------------------------------------------------------------------------- XROM:E7A1 XROM:E7A1 loc_E7A1: ; ... XROM:E7A1 13 23 20 F6 brclr TFLG1_23 $20 loc_E79B ; ' ' ; OC3 XROM:E7A5 DC 4C ldd scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:E7A7 BD E9 B3 jsr xxxADBsendWord_E9B3 ; XXX ADB send word D (A then B), msb first XROM:E7AA 29 09 bvs loc_E7B5 XROM:E7AC 7F 00 59 clr byte_59 ; XXX flag? XROM:E7AF 14 4A 01 bset byte_4A 1 ; XXX flag? XROM:E7B2 7E E6 ED jmp loc_E6ED XROM:E7B5 ; --------------------------------------------------------------------------- XROM:E7B5 XROM:E7B5 loc_E7B5: ; ... XROM:E7B5 81 34 cmpa #$34 ; '4' XROM:E7B7 27 03 beq loc_E7BC XROM:E7B9 7E E6 ED jmp loc_E6ED XROM:E7BC ; --------------------------------------------------------------------------- XROM:E7BC XROM:E7BC loc_E7BC: ; ... XROM:E7BC 14 59 01 bset byte_59 1 ; XXX flag? XROM:E7BF XROM:E7BF loc_E7BF: ; ... XROM:E7BF 7E E6 ED jmp loc_E6ED XROM:E7C2 ; --------------------------------------------------------------------------- XROM:E7C2 XROM:E7C2 loc_E7C2: ; ... XROM:E7C2 BD EA 29 jsr sub_EA29 XROM:E7C5 28 03 bvc loc_E7CA XROM:E7C7 7E E6 EF jmp loc_E6EF XROM:E7CA ; --------------------------------------------------------------------------- XROM:E7CA XROM:E7CA loc_E7CA: ; ... XROM:E7CA 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E7CC 84 03 anda #3 XROM:E7CE 81 00 cmpa #0 XROM:E7D0 26 03 bne loc_E7D5 XROM:E7D2 7E E6 ED jmp loc_E6ED XROM:E7D5 ; --------------------------------------------------------------------------- XROM:E7D5 XROM:E7D5 loc_E7D5: ; ... XROM:E7D5 81 01 cmpa #1 XROM:E7D7 26 08 bne loc_E7E1 XROM:E7D9 DC 5E ldd word_5E ; /next/ keyboard scan column mask (invertus) XROM:E7DB BD E3 D3 jsr sub_E3D3 XROM:E7DE 7E E6 ED jmp loc_E6ED XROM:E7E1 ; --------------------------------------------------------------------------- XROM:E7E1 XROM:E7E1 loc_E7E1: ; ... XROM:E7E1 81 02 cmpa #2 XROM:E7E3 26 11 bne loc_E7F6 XROM:E7E5 96 5E ldaa word_5E ; /next/ keyboard scan column mask (invertus) XROM:E7E7 27 D6 beq loc_E7BF XROM:E7E9 BD F3 07 jsr insertCharToFile_F307 ; insert char A onto current file; V set if fail, clear on success XROM:E7EC 96 5F ldaa word_5E+1 ; /next/ keyboard scan column mask (invertus) XROM:E7EE 27 CF beq loc_E7BF XROM:E7F0 BD F3 07 jsr insertCharToFile_F307 ; insert char A onto current file; V set if fail, clear on success XROM:E7F3 7E E6 ED jmp loc_E6ED XROM:E7F6 ; --------------------------------------------------------------------------- XROM:E7F6 XROM:E7F6 loc_E7F6: ; ... XROM:E7F6 81 03 cmpa #3 XROM:E7F8 26 25 bne loc_E81F XROM:E7FA 96 5F ldaa word_5E+1 ; /next/ keyboard scan column mask (invertus) XROM:E7FC 81 FF cmpa #$FF XROM:E7FE 26 06 bne loc_E806 XROM:E800 BD EB AE jsr sub_EBAE XROM:E803 7E E6 ED jmp loc_E6ED XROM:E806 ; --------------------------------------------------------------------------- XROM:E806 XROM:E806 loc_E806: ; ... XROM:E806 81 FE cmpa #$FE ; 'þ' XROM:E808 26 18 bne loc_E822 XROM:E80A 12 59 01 11 brset byte_59 1 loc_E81F ; XXX flag? XROM:E80E 96 5E ldaa word_5E ; /next/ keyboard scan column mask (invertus) XROM:E810 84 0F anda #$F XROM:E812 D6 56 ldab word_56 ; XXX 675E when 'reset stuff' XROM:E814 C4 F0 andb #$F0 ; 'ð' XROM:E816 1B aba XROM:E817 97 56 staa word_56 ; XXX 675E when 'reset stuff' XROM:E819 48 asla XROM:E81A 48 asla XROM:E81B 48 asla XROM:E81C 48 asla XROM:E81D 97 5D staa byte_5D XROM:E81F XROM:E81F loc_E81F: ; ... XROM:E81F 7E E6 ED jmp loc_E6ED XROM:E822 ; --------------------------------------------------------------------------- XROM:E822 XROM:E822 loc_E822: ; ... XROM:E822 81 FD cmpa #$FD ; 'ý' XROM:E824 26 02 bne loc_E828 XROM:E826 20 F7 bra loc_E81F XROM:E828 ; --------------------------------------------------------------------------- XROM:E828 XROM:E828 loc_E828: ; ... XROM:E828 81 00 cmpa #0 XROM:E82A 26 0D bne loc_E839 XROM:E82C 96 5E ldaa word_5E ; /next/ keyboard scan column mask (invertus) XROM:E82E 97 56 staa word_56 ; XXX 675E when 'reset stuff' XROM:E830 48 asla XROM:E831 48 asla XROM:E832 48 asla XROM:E833 48 asla XROM:E834 97 5D staa byte_5D XROM:E836 7E E6 ED jmp loc_E6ED XROM:E839 ; --------------------------------------------------------------------------- XROM:E839 XROM:E839 loc_E839: ; ... XROM:E839 7E E6 ED jmp loc_E6ED XROM:E83C ; --------------------------------------------------------------------------- XROM:E83C XROM:E83C loc_E83C: ; ... XROM:E83C BD EA 9D jsr sub_EA9D XROM:E83F 7E E6 ED jmp loc_E6ED XROM:E83F ; End of function sub_E6BD XROM:E83F XROM:E842 XROM:E842 ; =============== S U B R O U T I N E ======================================= XROM:E842 XROM:E842 ; XXX halt sending XROM:E842 XROM:E842 haltSending_E842: ; ... XROM:E842 7F 00 6D clr byte_6D ; XXX flag? is file sending??? XROM:E845 7F 00 8B clr byte_8B ; XXX flag? XROM:E848 BD F5 ED jsr promptKbdEmuModeSend_F5ED ; show which keyboard emulation and prompt for send key XROM:E84B BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:E84E 39 rts XROM:E84E ; End of function haltSending_E842 XROM:E84E XROM:E84F XROM:E84F ; =============== S U B R O U T I N E ======================================= XROM:E84F XROM:E84F ; XXX ADB related? XROM:E84F XROM:E84F sub_E84F: ; ... XROM:E84F 7F 00 49 clr byte_49 ; XXX field; possibly ADB related XROM:E852 7F 00 5E clr word_5E ; /next/ keyboard scan column mask (invertus) XROM:E855 7F 00 5F clr word_5E+1 ; /next/ keyboard scan column mask (invertus) XROM:E858 86 64 ldaa #100 XROM:E85A 97 48 staa scratchby_48 ; XXX column counter; 100/40 (40 for LCD) XROM:E85C XROM:E85C loc_E85C: ; ... XROM:E85C 86 02 ldaa #2 XROM:E85E 97 21 staa TCTL2_21 ; TCTL2: EDG3 (PAb0 datain?) - capture falling edge XROM:E860 86 01 ldaa #1 XROM:E862 97 23 staa TFLG1_23 XROM:E864 DC 0E ldd TCNT_E ; TCNT runs at E clock; 2 MHz, 500 ns; 32.768 ms / period XROM:E866 C3 FF FF addd #$FFFF ; (curcnt-1; maximal delay of ~ 33 ms) XROM:E869 DD 18 std TOC2_18 ; TOC2: set OC2 to timeout one less than max count XROM:E86B 86 40 ldaa #$40 XROM:E86D 97 23 staa TFLG1_23 ; clear OC2 XROM:E86F XROM:E86F loc_E86F: ; ... XROM:E86F 13 23 01 02 brclr TFLG1_23 1 loc_E875 ; wait for falling EDG3 (PAb0 datain?) XROM:E873 20 09 bra loc_E87E XROM:E875 ; --------------------------------------------------------------------------- XROM:E875 XROM:E875 loc_E875: ; ... XROM:E875 13 23 40 F6 brclr TFLG1_23 $40 loc_E86F ; until OC2 timeout XROM:E879 86 22 ldaa #$22 ; '"' ; XXX error code? XROM:E87B 7E E8 F0 jmp loc_E8F0 ; edge not detected XROM:E87E ; --------------------------------------------------------------------------- XROM:E87E XROM:E87E loc_E87E: ; ... XROM:E87E DC 14 ldd TIC3_14 XROM:E880 DD 40 std word_40 XROM:E882 XROM:E882 loc_E882: ; ... XROM:E882 7A 00 48 dec scratchby_48 ; XXX column counter; 100/40 (40 for LCD) XROM:E885 27 67 beq loc_E8EE XROM:E887 BD E8 F2 jsr sub_E8F2 ; XXX ADB related? XROM:E88A 28 F6 bvc loc_E882 XROM:E88C 81 13 cmpa #$13 XROM:E88E 27 0E beq loc_E89E XROM:E890 81 12 cmpa #$12 XROM:E892 26 02 bne loc_E896 XROM:E894 20 C6 bra loc_E85C XROM:E896 ; --------------------------------------------------------------------------- XROM:E896 XROM:E896 loc_E896: ; ... XROM:E896 81 10 cmpa #$10 XROM:E898 26 02 bne loc_E89C XROM:E89A 20 C0 bra loc_E85C XROM:E89C ; --------------------------------------------------------------------------- XROM:E89C XROM:E89C loc_E89C: ; ... XROM:E89C 20 BE bra loc_E85C XROM:E89E ; --------------------------------------------------------------------------- XROM:E89E XROM:E89E loc_E89E: ; ... XROM:E89E 18 CE 00 08 ldy #8 XROM:E8A2 XROM:E8A2 loc_E8A2: ; ... XROM:E8A2 BD E8 F2 jsr sub_E8F2 ; XXX ADB related? XROM:E8A5 29 49 bvs loc_E8F0 XROM:E8A7 79 00 49 rol byte_49 ; XXX field; possibly ADB related XROM:E8AA 18 09 dey XROM:E8AC 26 F4 bne loc_E8A2 XROM:E8AE 13 58 01 10 brclr byte_58 1 loc_E8C2 ; XXX flag? XROM:E8B2 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E8B4 84 0F anda #$F XROM:E8B6 81 0C cmpa #$C XROM:E8B8 26 08 bne loc_E8C2 XROM:E8BA 96 49 ldaa byte_49 ; XXX field; possibly ADB related XROM:E8BC 84 F0 anda #$F0 ; 'ð' XROM:E8BE 81 20 cmpa #$20 ; ' ' XROM:E8C0 26 0A bne loc_E8CC XROM:E8C2 XROM:E8C2 loc_E8C2: ; ... XROM:E8C2 13 23 01 FC brclr TFLG1_23 1 loc_E8C2 XROM:E8C6 DC 14 ldd TIC3_14 ; TIC3 XROM:E8C8 DD 42 std scratchw_42 ; XXX scratch XROM:E8CA 20 0F bra loc_E8DB XROM:E8CC ; --------------------------------------------------------------------------- XROM:E8CC XROM:E8CC loc_E8CC: ; ... XROM:E8CC 14 08 02 bset PORTD_8 2 ; PDb1 (/dataout???) high XROM:E8CF C6 76 ldab #$76 XROM:E8D1 BD F8 39 jsr delay_F839 ; delay 297.5 usec XROM:E8D4 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:E8D7 DC 0E ldd TCNT_E ; TCNT XROM:E8D9 DD 42 std scratchw_42 ; XXX scratch XROM:E8DB XROM:E8DB loc_E8DB: ; ... XROM:E8DB C3 01 C2 addd #$1C2 ; XXX ticks to timeout XROM:E8DE DD 1A std TOC3_1A ; TOC3 XROM:E8E0 86 20 ldaa #$20 XROM:E8E2 97 23 staa TFLG1_23 ; TFLG1: clear OC3 XROM:E8E4 86 02 ldaa #2 XROM:E8E6 97 21 staa TCTL2_21 ; TCTL2: EDG3 falling XROM:E8E8 86 01 ldaa #1 XROM:E8EA 97 23 staa TFLG1_23 ; TFLG1: clear IC3 XROM:E8EC 0A clv XROM:E8ED 39 rts XROM:E8EE ; --------------------------------------------------------------------------- XROM:E8EE XROM:E8EE loc_E8EE: ; ... XROM:E8EE 86 21 ldaa #$21 ; '!' ; XXX error code? XROM:E8F0 XROM:E8F0 loc_E8F0: ; ... XROM:E8F0 0B sev XROM:E8F1 39 rts XROM:E8F1 ; End of function sub_E84F XROM:E8F1 XROM:E8F2 XROM:E8F2 ; =============== S U B R O U T I N E ======================================= XROM:E8F2 XROM:E8F2 ; XXX ADB related? XROM:E8F2 XROM:E8F2 sub_E8F2: ; ... XROM:E8F2 13 00 01 09 brclr PORTA_0 1 loc_E8FF ; PAb0 (datain) low? XXX XROM:E8F6 12 23 01 22 brset TFLG1_23 1 loc_E91C ; TFLG1: IC3 set? XROM:E8FA 86 15 ldaa #$15 XROM:E8FC 7E E9 B1 jmp loc_E9B1 XROM:E8FF ; --------------------------------------------------------------------------- XROM:E8FF XROM:E8FF loc_E8FF: ; ... XROM:E8FF 86 01 ldaa #1 XROM:E901 97 21 staa TCTL2_21 ; TCTL2: EDG3 rising XROM:E903 86 01 ldaa #1 XROM:E905 97 23 staa TFLG1_23 ; TFLG1: clear IC3 XROM:E907 DC 0E ldd TCNT_E ; TCNT XROM:E909 DD 1A std TOC3_1A ; TOC3 XROM:E90B 86 20 ldaa #$20 ; ' ' XROM:E90D 97 23 staa TFLG1_23 ; TFLG1: clear OC3 XROM:E90F XROM:E90F loc_E90F: ; ... XROM:E90F 13 23 01 02 brclr TFLG1_23 1 loc_E915 ; TFLG1: IC3 clear? XROM:E913 20 07 bra loc_E91C XROM:E915 ; --------------------------------------------------------------------------- XROM:E915 XROM:E915 loc_E915: ; ... XROM:E915 13 23 20 F6 brclr TFLG1_23 $20 loc_E90F ; ' ' ; TFLG1: OC3 clear? XROM:E919 7E E9 AB jmp loc_E9AB XROM:E91C ; --------------------------------------------------------------------------- XROM:E91C XROM:E91C loc_E91C: ; ... XROM:E91C DC 14 ldd TIC3_14 ; TIC3: XROM:E91E DD 42 std scratchw_42 ; XXX scratch XROM:E920 86 02 ldaa #2 XROM:E922 97 21 staa TCTL2_21 ; TCTL2: EDG3 falling XROM:E924 86 01 ldaa #1 XROM:E926 97 23 staa TFLG1_23 ; TFLG1: clear IC3 XROM:E928 DC 42 ldd scratchw_42 ; XXX scratch XROM:E92A 93 40 subd word_40 XROM:E92C DD 44 std scratchw_44 ; XXX scratch XROM:E92E 12 00 01 04 brset PORTA_0 1 loc_E936 ; PAb0 (datain) high? XXX XROM:E932 DC 0E ldd TCNT_E ; TCNT: XROM:E934 20 46 bra loc_E97C XROM:E936 ; --------------------------------------------------------------------------- XROM:E936 XROM:E936 loc_E936: ; ... XROM:E936 DC 42 ldd scratchw_42 ; XXX scratch XROM:E938 C3 00 A0 addd #$A0 ; ' ' XROM:E93B DD 1A std TOC3_1A ; TOC3: XROM:E93D 86 20 ldaa #$20 ; ' ' XROM:E93F 97 23 staa TFLG1_23 ; TFLG1: clear OC3 XROM:E941 XROM:E941 loc_E941: ; ... XROM:E941 13 23 01 02 brclr TFLG1_23 1 loc_E947 ; TGLG1: if IC3 clear XROM:E945 20 33 bra loc_E97A XROM:E947 ; --------------------------------------------------------------------------- XROM:E947 XROM:E947 loc_E947: ; ... XROM:E947 13 23 20 F6 brclr TFLG1_23 $20 loc_E941 ; ' ' ; TFLG1: if OC3 clear XROM:E94B DC 44 ldd scratchw_44 ; XXX scratch XROM:E94D 1A 83 00 82 cpd #$82 ; '‚' XROM:E951 25 0A bcs loc_E95D XROM:E953 1A 83 00 96 cpd #$96 ; '–' XROM:E957 22 04 bhi loc_E95D XROM:E959 86 10 ldaa #$10 XROM:E95B 20 54 bra loc_E9B1 XROM:E95D ; --------------------------------------------------------------------------- XROM:E95D XROM:E95D loc_E95D: ; ... XROM:E95D 1A 83 01 18 cpd #$118 XROM:E961 25 4C bcs loc_E9AF XROM:E963 1A 83 02 58 cpd #$258 XROM:E967 22 04 bhi loc_E96D XROM:E969 86 11 ldaa #$11 XROM:E96B 20 44 bra loc_E9B1 XROM:E96D ; --------------------------------------------------------------------------- XROM:E96D XROM:E96D loc_E96D: ; ... XROM:E96D 1A 83 17 70 cpd #$1770 XROM:E971 25 3C bcs loc_E9AF XROM:E973 BD EA 9D jsr sub_EA9D XROM:E976 86 12 ldaa #$12 XROM:E978 20 37 bra loc_E9B1 XROM:E97A ; --------------------------------------------------------------------------- XROM:E97A XROM:E97A loc_E97A: ; ... XROM:E97A DC 14 ldd TIC3_14 ; TIC3: XROM:E97C XROM:E97C loc_E97C: ; ... XROM:E97C DD 40 std word_40 XROM:E97E 93 42 subd scratchw_42 ; XXX scratch XROM:E980 DD 46 std scratchw_46 ; XXX scratch XROM:E982 86 01 ldaa #1 XROM:E984 97 21 staa TCTL2_21 ; TCTL2: EDG3 rising XROM:E986 86 01 ldaa #1 XROM:E988 97 23 staa TFLG1_23 ; TFLG1: clear IC3 XROM:E98A DC 44 ldd scratchw_44 ; XXX scratch XROM:E98C 1A 83 05 DC cpd #$5DC XROM:E990 25 14 bcs loc_E9A6 XROM:E992 1A 83 06 A4 cpd #$6A4 XROM:E996 22 0C bhi loc_E9A4 XROM:E998 DC 46 ldd scratchw_46 ; XXX scratch XROM:E99A 1A 83 00 7C cpd #$7C ; '|' XROM:E99E 25 0F bcs loc_E9AF XROM:E9A0 86 13 ldaa #$13 XROM:E9A2 0B sev XROM:E9A3 39 rts XROM:E9A4 ; --------------------------------------------------------------------------- XROM:E9A4 XROM:E9A4 loc_E9A4: ; ... XROM:E9A4 20 09 bra loc_E9AF XROM:E9A6 ; --------------------------------------------------------------------------- XROM:E9A6 XROM:E9A6 loc_E9A6: ; ... XROM:E9A6 1A 93 46 cpd scratchw_46 ; XXX scratch XROM:E9A9 0A clv XROM:E9AA 39 rts XROM:E9AB ; --------------------------------------------------------------------------- XROM:E9AB XROM:E9AB loc_E9AB: ; ... XROM:E9AB 86 22 ldaa #$22 ; '"' XROM:E9AD 20 02 bra loc_E9B1 XROM:E9AF ; --------------------------------------------------------------------------- XROM:E9AF XROM:E9AF loc_E9AF: ; ... XROM:E9AF 86 14 ldaa #$14 XROM:E9B1 XROM:E9B1 loc_E9B1: ; ... XROM:E9B1 0B sev XROM:E9B2 39 rts XROM:E9B2 ; End of function sub_E8F2 XROM:E9B2 XROM:E9B3 XROM:E9B3 ; =============== S U B R O U T I N E ======================================= XROM:E9B3 XROM:E9B3 ; XXX ADB send word D (A then B), msb first XROM:E9B3 XROM:E9B3 xxxADBsendWord_E9B3: ; ... XROM:E9B3 DD 4C std scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:E9B5 0D sec XROM:E9B6 BD E9 ED jsr xxxADBsendBit_E9ED ; XXX seems 'ADB send bit' with phase timing; C is bit to send XROM:E9B9 29 30 bvs leaveErr_E9EB XROM:E9BB 18 CE 00 08 ldy #8 ; 8 bits in a byte XROM:E9BF XROM:E9BF loopFirstByte_E9BF: ; ... XROM:E9BF 78 00 4C asl scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:E9C2 BD E9 ED jsr xxxADBsendBit_E9ED ; XXX seems 'ADB send bit' with phase timing; C is bit to send XROM:E9C5 29 24 bvs leaveErr_E9EB XROM:E9C7 18 09 dey XROM:E9C9 26 F4 bne loopFirstByte_E9BF XROM:E9CB 18 CE 00 08 ldy #8 ; 9 bits in a byte XROM:E9CF XROM:E9CF loopSecondByte_E9CF: ; ... XROM:E9CF 78 00 4D asl scratchby_4D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) XROM:E9D2 BD E9 ED jsr xxxADBsendBit_E9ED ; XXX seems 'ADB send bit' with phase timing; C is bit to send XROM:E9D5 18 09 dey XROM:E9D7 26 F6 bne loopSecondByte_E9CF XROM:E9D9 C6 01 ldab #1 XROM:E9DB BD F8 39 jsr delay_F839 ; delay 5 usec XROM:E9DE 14 08 02 bset PORTD_8 2 ; PDb1 (/dataout???) high XROM:E9E1 C6 19 ldab #$19 XROM:E9E3 BD F8 39 jsr delay_F839 ; delay 65 usec XROM:E9E6 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:E9E9 0A clv XROM:E9EA 39 rts XROM:E9EB ; --------------------------------------------------------------------------- XROM:E9EB XROM:E9EB leaveErr_E9EB: ; ... XROM:E9EB 0B sev XROM:E9EC 39 rts XROM:E9EC ; End of function xxxADBsendWord_E9B3 XROM:E9EC XROM:E9ED XROM:E9ED ; =============== S U B R O U T I N E ======================================= XROM:E9ED XROM:E9ED ; XXX seems 'ADB send bit' with phase timing; C is bit to send XROM:E9ED XROM:E9ED xxxADBsendBit_E9ED: ; ... XROM:E9ED 24 16 bcc zeroBit_EA05 XROM:E9EF 14 08 02 bset PORTD_8 2 ; PDb1 (/dataout???) high XROM:E9F2 C6 0A ldab #$A XROM:E9F4 BD F8 39 jsr delay_F839 ; delay 27.5 usec XROM:E9F7 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:E9FA C6 0F ldab #$F XROM:E9FC BD F8 39 jsr delay_F839 ; delay 40 usec XROM:E9FF 13 00 01 18 brclr PORTA_0 1 leaveErr34_EA1B ; PAb0 (datain) low? XXX XROM:EA03 20 14 bra leaveOK_EA19 XROM:EA05 ; --------------------------------------------------------------------------- XROM:EA05 XROM:EA05 zeroBit_EA05: ; ... XROM:EA05 14 08 02 bset PORTD_8 2 ; PDb1 (/dataout???) high XROM:EA08 C6 16 ldab #$16 XROM:EA0A BD F8 39 jsr delay_F839 ; delay 57.5 usec XROM:EA0D 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:EA10 C6 03 ldab #3 XROM:EA12 BD F8 39 jsr delay_F839 ; delay 10 usec XROM:EA15 13 00 01 02 brclr PORTA_0 1 leaveErr34_EA1B ; PAb0 (datain) low: XXX XROM:EA19 XROM:EA19 leaveOK_EA19: ; ... XROM:EA19 0A clv XROM:EA1A 39 rts XROM:EA1B ; --------------------------------------------------------------------------- XROM:EA1B XROM:EA1B leaveErr34_EA1B: ; ... XROM:EA1B 86 34 ldaa #$34 ; '4' XROM:EA1D 20 02 bra leaveShowErr_EA21 XROM:EA1F ; --------------------------------------------------------------------------- XROM:EA1F 86 15 ldaa #$15 ; XXX DEAD CODE? XROM:EA21 XROM:EA21 leaveShowErr_EA21: ; ... XROM:EA21 BD F5 C6 jsr showErr_F5C6 ; show 'Err: ' with hex code in A XROM:EA24 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EA27 0B sev XROM:EA28 39 rts XROM:EA28 ; End of function xxxADBsendBit_E9ED XROM:EA28 XROM:EA29 XROM:EA29 ; =============== S U B R O U T I N E ======================================= XROM:EA29 XROM:EA29 XROM:EA29 sub_EA29: ; ... XROM:EA29 12 00 01 04 brset PORTA_0 1 loc_EA31 ; PAb0 (datain) low? XXX XROM:EA2D 86 31 ldaa #$31 ; '1' XROM:EA2F 20 6A bra leave_EA9B XROM:EA31 ; --------------------------------------------------------------------------- XROM:EA31 XROM:EA31 loc_EA31: ; ... XROM:EA31 86 02 ldaa #2 XROM:EA33 97 21 staa TCTL2_21 ; TCTL2: EDG3 falling XROM:EA35 86 01 ldaa #1 XROM:EA37 97 23 staa TFLG1_23 ; TFLG1: IC3 clear XROM:EA39 86 00 ldaa #0 XROM:EA3B 97 20 staa TCTL1_20 ; TCTL1: disconnect all OC from pins XROM:EA3D DC 0E ldd TCNT_E ; TCNT: XROM:EA3F C3 02 08 addd #$208 XROM:EA42 DD 1C std TOC4_1C ; TOC4: XROM:EA44 86 10 ldaa #$10 XROM:EA46 97 23 staa TFLG1_23 ; TFLG1: OC4 clear XROM:EA48 XROM:EA48 loop_EA48: ; ... XROM:EA48 13 23 01 02 brclr TFLG1_23 1 cont_EA4E ; IC3 clear? XROM:EA4C 20 08 bra loc_EA56 ; XXX file full related XROM:EA4E ; --------------------------------------------------------------------------- XROM:EA4E XROM:EA4E cont_EA4E: ; ... XROM:EA4E 13 23 10 F6 brclr TFLG1_23 $10 loop_EA48 ; OC4 clear? XROM:EA52 86 33 ldaa #$33 ; '3' XROM:EA54 20 45 bra leave_EA9B XROM:EA56 ; --------------------------------------------------------------------------- XROM:EA56 XROM:EA56 loc_EA56: ; ... XROM:EA56 DC 14 ldd TIC3_14 ; TIC3: XROM:EA58 DD 40 std word_40 XROM:EA5A 86 01 ldaa #1 XROM:EA5C 97 23 staa TFLG1_23 ; TFLG1: IC3 clear XROM:EA5E BD E8 F2 jsr sub_E8F2 ; XXX ADB related? XROM:EA61 29 38 bvs leave_EA9B XROM:EA63 25 04 bcs loc_EA69 XROM:EA65 86 32 ldaa #$32 ; '2' XROM:EA67 20 32 bra leave_EA9B XROM:EA69 ; --------------------------------------------------------------------------- XROM:EA69 XROM:EA69 loc_EA69: ; ... XROM:EA69 18 CE 00 08 ldy #8 XROM:EA6D XROM:EA6D loop_EA6D: ; ... XROM:EA6D BD E8 F2 jsr sub_E8F2 ; XXX ADB related? XROM:EA70 29 29 bvs leave_EA9B XROM:EA72 79 00 5E rol word_5E ; /next/ keyboard scan column mask (invertus) XROM:EA75 18 09 dey XROM:EA77 26 F4 bne loop_EA6D XROM:EA79 18 CE 00 08 ldy #8 XROM:EA7D XROM:EA7D loop_EA7D: ; ... XROM:EA7D BD E8 F2 jsr sub_E8F2 ; XXX ADB related? XROM:EA80 29 19 bvs leave_EA9B XROM:EA82 79 00 5F rol word_5E+1 ; /next/ keyboard scan column mask (invertus) XROM:EA85 18 09 dey XROM:EA87 26 F4 bne loop_EA7D XROM:EA89 BD E8 F2 jsr sub_E8F2 ; XXX ADB related? XROM:EA8C 28 08 bvc loc_EA96 XROM:EA8E 81 10 cmpa #$10 XROM:EA90 26 09 bne leave_EA9B XROM:EA92 86 02 ldaa #2 XROM:EA94 0A clv XROM:EA95 39 rts XROM:EA96 ; --------------------------------------------------------------------------- XROM:EA96 XROM:EA96 loc_EA96: ; ... XROM:EA96 BD F5 DD jsr debugHere2_F5DD ; Here2 related; a bug found XROM:EA99 86 35 ldaa #$35 ; '5' XROM:EA9B XROM:EA9B leave_EA9B: ; ... XROM:EA9B 0B sev XROM:EA9C 39 rts XROM:EA9C ; End of function sub_EA29 XROM:EA9C XROM:EA9D XROM:EA9D ; =============== S U B R O U T I N E ======================================= XROM:EA9D XROM:EA9D XROM:EA9D sub_EA9D: ; ... XROM:EA9D BD EA A7 jsr sub_EAA7 ; XXX reset stuff XROM:EAA0 14 75 FF bset byte_75 $FF ; XXX flag? possibly ADB related XROM:EAA3 BD EB D0 jsr clearKbdBuf_EBD0 ; clear keyboard buffer (just by resetting indices) XROM:EAA6 39 rts XROM:EAA6 ; End of function sub_EA9D XROM:EAA6 XROM:EAA7 XROM:EAA7 ; =============== S U B R O U T I N E ======================================= XROM:EAA7 XROM:EAA7 ; XXX reset stuff XROM:EAA7 XROM:EAA7 sub_EAA7: ; ... XROM:EAA7 CC FF FF ldd #$FFFF XROM:EAAA DD 54 std flagby_54 ; b2 = 1 when sending shift; XXX FFFF when 'reset stuff' XROM:EAAC 97 4A staa byte_4A ; XXX flag? XROM:EAAE CC DB 01 ldd #$DB01 XROM:EAB1 DD 52 std scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:EAB3 CC 80 FF ldd #$80FF XROM:EAB6 DD 50 std scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:EAB8 CC 67 5E ldd #$675E XROM:EABB DD 56 std word_56 ; XXX 675E when 'reset stuff' XROM:EABD 96 56 ldaa word_56 ; XXX 675E when 'reset stuff' XROM:EABF 48 asla XROM:EAC0 48 asla XROM:EAC1 48 asla XROM:EAC2 48 asla XROM:EAC3 97 5D staa byte_5D XROM:EAC5 7F 00 22 clr TMSK1_22 ; TMSK1: all OC, IC interrupts disabled XROM:EAC8 7F 00 24 clr TMSK2_24 ; TMSK2: all timer/pulse accumulator interrupts disabled; timer prescaler div 1 XROM:EACB 7F 00 25 clr TFLG2_25 ; TFLG2: clear timer interrupt flags XROM:EACE 7F 00 20 clr TCTL1_20 ; TCTL1: all output compare 2-5 disconnected XROM:EAD1 39 rts XROM:EAD1 ; End of function sub_EAA7 XROM:EAD1 XROM:EAD2 XROM:EAD2 ; =============== S U B R O U T I N E ======================================= XROM:EAD2 XROM:EAD2 ; XXX update file table entry; (122,120,124)=>entry XROM:EAD2 XROM:EAD2 updateFileState_EAD2: ; ... XROM:EAD2 F6 01 5D ldab curFileNo_15D ; current file number (1-8) XROM:EAD5 27 5B beq leaveBadFileNo_EB32 XROM:EAD7 C1 08 cmpb #8 XROM:EAD9 22 57 bhi leaveBadFileNo_EB32 XROM:EADB 5A decb ; normalize file no to 0-7, then multiply by 6 to get entry offset XROM:EADC 58 aslb XROM:EADD CE 01 2A ldx #aFileState_12A ; File (0-7) state structures: XROM:EADD ; + 0 = cursor pointer XROM:EADD ; + 2 = screen start pointer XROM:EADD ; + 4 = end pointer XROM:EAE0 3A abx XROM:EAE1 3A abx XROM:EAE2 3A abx XROM:EAE3 18 FE 01 22 ldy curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:EAE7 1A EF 00 sty 0,x XROM:EAEA 18 FE 01 20 ldy curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:EAEE 1A EF 02 sty 2,x XROM:EAF1 18 FE 01 24 ldy curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:EAF5 1A EF 04 sty 4,x XROM:EAF8 39 rts XROM:EAF8 ; End of function updateFileState_EAD2 XROM:EAF8 XROM:EAF9 XROM:EAF9 ; =============== S U B R O U T I N E ======================================= XROM:EAF9 XROM:EAF9 ; open current file (specified at 15D) XROM:EAF9 XROM:EAF9 openFile_EAF9: ; ... XROM:EAF9 F6 01 5D ldab curFileNo_15D ; current file number (1-8) XROM:EAFC 27 34 beq leaveBadFileNo_EB32 ; gotta be 1-8 (human friendly) XROM:EAFE C1 08 cmpb #8 XROM:EB00 22 30 bhi leaveBadFileNo_EB32 XROM:EB02 5A decb ; make file no 0-7 (computer friendly) XROM:EB03 58 aslb ; (fileno *= 2) XROM:EB04 CE 01 2A ldx #aFileState_12A ; File (0-7) state structures: XROM:EB04 ; + 0 = cursor pointer XROM:EB04 ; + 2 = screen start pointer XROM:EB04 ; + 4 = end pointer XROM:EB07 3A abx ; (+ 2) XROM:EB08 3A abx ; (now + 4) XROM:EB09 3A abx ; (now + 6) XROM:EB0A 1A EE 00 ldy 0,x ; get first element (file region start) XROM:EB0D 18 FF 01 22 sty curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:EB11 1A EE 02 ldy 2,x XROM:EB14 18 FF 01 20 sty curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:EB18 1A EE 04 ldy 4,x XROM:EB1B 18 FF 01 24 sty curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:EB1F CE FB 24 ldx #aFilePartitions_FB24 ; 8 4-byte structures; [start,end] file partitions XROM:EB22 3A abx XROM:EB23 3A abx ; effectively X += (fileno*4) XROM:EB24 EC 00 ldd 0,x XROM:EB26 FD 01 28 std curFileRgnFirst_128 ; this file; file region start addr XROM:EB29 EC 02 ldd 2,x XROM:EB2B FD 01 26 std curFileRgnLast_126 ; this file; file region end addr (inclusive) XROM:EB2E BD EB 48 jsr showOpeningFile_EB48 ; show what file we're opening XROM:EB31 39 rts XROM:EB32 ; --------------------------------------------------------------------------- XROM:EB32 XROM:EB32 leaveBadFileNo_EB32: ; ... XROM:EB32 8D 02 bsr showBadFileNo_EB36 ; show that we specified a bad file number, then force it to 1 XROM:EB34 20 C3 bra openFile_EAF9 ; open current file (specified at 15D) XROM:EB34 ; End of function openFile_EAF9 XROM:EB34 XROM:EB36 XROM:EB36 ; =============== S U B R O U T I N E ======================================= XROM:EB36 XROM:EB36 ; show that we specified a bad file number, then force it to 1 XROM:EB36 XROM:EB36 showBadFileNo_EB36: ; ... XROM:EB36 BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:EB39 CE FC 60 ldx #aBadFile ; "Bad File#" XROM:EB3C BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EB3F BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EB42 C6 01 ldab #1 ; force the file number to 1 XROM:EB44 F7 01 5D stab curFileNo_15D ; current file number (1-8) XROM:EB47 39 rts XROM:EB47 ; End of function showBadFileNo_EB36 XROM:EB47 XROM:EB48 XROM:EB48 ; =============== S U B R O U T I N E ======================================= XROM:EB48 XROM:EB48 ; show what file we're opening XROM:EB48 XROM:EB48 showOpeningFile_EB48: ; ... XROM:EB48 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:EB4B CE FE 81 ldx #aOpeningFile ; "Opening File " XROM:EB4E BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EB51 B6 01 5D ldaa curFileNo_15D ; current file number (1-8) XROM:EB54 27 1A beq badFileNo_EB70 ; (can't be 0) XROM:EB56 81 08 cmpa #8 XROM:EB58 22 16 bhi badFileNo_EB70 ; (can't be more than 8) XROM:EB5A BD EB B2 jsr bin2hexA_EBB2 ; (hex is fine because it's just 1-8) XROM:EB5D BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EB60 CE FD 24 ldx #a____ ; "...." XROM:EB63 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EB66 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EB69 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EB6C BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EB6F 39 rts XROM:EB70 ; --------------------------------------------------------------------------- XROM:EB70 XROM:EB70 badFileNo_EB70: ; ... XROM:EB70 8D C4 bsr showBadFileNo_EB36 ; show that we specified a bad file number, then force it to 1 XROM:EB72 20 D4 bra showOpeningFile_EB48 ; since we forced it to 1, we can loop around and try again XROM:EB72 ; End of function showOpeningFile_EB48 XROM:EB72 XROM:EB74 XROM:EB74 ; =============== S U B R O U T I N E ======================================= XROM:EB74 XROM:EB74 ; setup file structs and open file 1 XROM:EB74 XROM:EB74 initFileStructsOpenFile1_EB74: ; ... XROM:EB74 CE 01 2A ldx #aFileState_12A ; File (0-7) state structures: XROM:EB74 ; + 0 = cursor pointer XROM:EB74 ; + 2 = screen start pointer XROM:EB74 ; + 4 = end pointer XROM:EB77 18 CE FB 24 ldy #aFilePartitions_FB24 ; 8 4-byte structures; [start,end] file partitions XROM:EB7B XROM:EB7B loop_EB7B: ; ... XROM:EB7B 18 EC 00 ldd 0,y ; get start address for file XROM:EB7E ED 00 std 0,x ; init file as empty; start=end=current XROM:EB80 ED 02 std 2,x XROM:EB82 ED 04 std 4,x XROM:EB84 C6 06 ldab #6 XROM:EB86 3A abx ; XXX next 6 byte structure at X XROM:EB87 C6 04 ldab #4 XROM:EB89 18 3A aby ; XXX next 4 byte structure at Y XROM:EB8B 8C 01 58 cpx #$158 ; finished? (this will happen at struct index 8, beyond the end) XROM:EB8E 25 EB bcs loop_EB7B XROM:EB90 86 01 ldaa #1 ; force file no selection to 1, then open it XROM:EB92 B7 01 5D staa curFileNo_15D ; current file number (1-8) XROM:EB95 BD EA F9 jsr openFile_EAF9 ; open current file (specified at 15D) XROM:EB98 8D 01 bsr deleteThisFile_EB9B ; delete file by resetting pointers (recoverable) XROM:EB9A 39 rts XROM:EB9A ; End of function initFileStructsOpenFile1_EB74 XROM:EB9A XROM:EB9B XROM:EB9B ; =============== S U B R O U T I N E ======================================= XROM:EB9B XROM:EB9B ; delete file by resetting pointers (recoverable) XROM:EB9B XROM:EB9B deleteThisFile_EB9B: ; ... XROM:EB9B FC 01 28 ldd curFileRgnFirst_128 ; this file; file region start addr XROM:EB9E FD 01 20 std curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:EBA1 FD 01 22 std curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:EBA4 FD 01 24 std curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:EBA7 86 01 ldaa #1 XROM:EBA9 97 6B staa lcdcpCol1_6B ; 1-relative LCD cursor pos col XROM:EBAB 97 6C staa lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:EBAD 39 rts XROM:EBAD ; End of function deleteThisFile_EB9B XROM:EBAD XROM:EBAE XROM:EBAE ; =============== S U B R O U T I N E ======================================= XROM:EBAE XROM:EBAE XROM:EBAE sub_EBAE: ; ... XROM:EBAE 7F 00 5A clr byte_5A ; XXX flag? XROM:EBB1 39 rts XROM:EBB1 ; End of function sub_EBAE XROM:EBB1 XROM:EBB2 XROM:EBB2 ; =============== S U B R O U T I N E ======================================= XROM:EBB2 XROM:EBB2 ; A to ascii hex (A, B) XROM:EBB2 XROM:EBB2 bin2hexA_EBB2: ; ... XROM:EBB2 5F clrb XROM:EBB3 04 lsrd ; nybble down XROM:EBB4 04 lsrd XROM:EBB5 04 lsrd XROM:EBB6 04 lsrd XROM:EBB7 54 lsrb ; low nybble down in B XROM:EBB8 54 lsrb XROM:EBB9 54 lsrb XROM:EBBA 54 lsrb XROM:EBBB 81 0A cmpa #$A XROM:EBBD 25 04 bcs cont_EBC3 XROM:EBBF 8B 37 adda #$37 ; '7' ; alpha XROM:EBC1 20 02 bra cont_EBC5 XROM:EBC3 ; --------------------------------------------------------------------------- XROM:EBC3 XROM:EBC3 cont_EBC3: ; ... XROM:EBC3 8B 30 adda #$30 ; '0' ; numeric XROM:EBC5 XROM:EBC5 cont_EBC5: ; ... XROM:EBC5 C1 0A cmpb #$A XROM:EBC7 25 04 bcs cont_EBCD XROM:EBC9 CB 37 addb #$37 ; '7' ; alpha XROM:EBCB 20 02 bra leave_EBCF XROM:EBCD ; --------------------------------------------------------------------------- XROM:EBCD XROM:EBCD cont_EBCD: ; ... XROM:EBCD CB 30 addb #$30 ; '0' ; numeric XROM:EBCF XROM:EBCF leave_EBCF: ; ... XROM:EBCF 39 rts XROM:EBCF ; End of function bin2hexA_EBB2 XROM:EBCF XROM:EBD0 XROM:EBD0 ; =============== S U B R O U T I N E ======================================= XROM:EBD0 XROM:EBD0 ; clear keyboard buffer (just by resetting indices) XROM:EBD0 XROM:EBD0 clearKbdBuf_EBD0: ; ... XROM:EBD0 7F 00 8F clr keybufPush_8F ; keybuf push index (where last pushed) XROM:EBD3 7F 00 8E clr keybufPull_8E ; keybuf pull index (where last pulled) XROM:EBD6 39 rts XROM:EBD6 ; End of function clearKbdBuf_EBD0 XROM:EBD6 XROM:EBD7 XROM:EBD7 ; =============== S U B R O U T I N E ======================================= XROM:EBD7 XROM:EBD7 ; push scan code A (rowno|colno) into keyboard buffer XROM:EBD7 XROM:EBD7 enqueueKbdScanCode_EBD7: ; ... XROM:EBD7 D6 8F ldab keybufPush_8F ; keybuf push index (where last pushed) XROM:EBD9 5C incb ; next index... XROM:EBDA C4 0F andb #$F ; (16-byte buffer; wrap around) XROM:EBDC D1 8E cmpb keybufPull_8E ; keybuf pull index (where last pulled) XROM:EBDE 27 0A beq leaveFull_EBEA XROM:EBE0 D7 8F stab keybufPush_8F ; keybuf push index (where last pushed) XROM:EBE2 CE 00 00 ldx #0 XROM:EBE5 3A abx XROM:EBE6 A7 90 staa keybufScanCode_90,x ; circular buffer of key scan codes indexed by push/pull at 8E,8F XROM:EBE8 0A clv XROM:EBE9 39 rts XROM:EBEA ; --------------------------------------------------------------------------- XROM:EBEA XROM:EBEA leaveFull_EBEA: ; ... XROM:EBEA 8D E4 bsr clearKbdBuf_EBD0 ; dump everything on overflow! XROM:EBEC 0B sev XROM:EBED 39 rts XROM:EBED ; End of function enqueueKbdScanCode_EBD7 XROM:EBED XROM:EBEE XROM:EBEE ; =============== S U B R O U T I N E ======================================= XROM:EBEE XROM:EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:EBEE XROM:EBEE dequeueKbdScanCode_EBEE: ; ... XROM:EBEE D6 8E ldab keybufPull_8E ; keybuf pull index (where last pulled) XROM:EBF0 D1 8F cmpb keybufPush_8F ; keybuf push index (where last pushed) XROM:EBF2 27 0D beq leaveEmpty_EC01 XROM:EBF4 5C incb XROM:EBF5 C4 0F andb #$F ; (16-byte buffer; wrap around) XROM:EBF7 D7 8E stab keybufPull_8E ; keybuf pull index (where last pulled) XROM:EBF9 CE 00 00 ldx #0 XROM:EBFC 3A abx XROM:EBFD A6 90 ldaa keybufScanCode_90,x ; circular buffer of key scan codes indexed by push/pull at 8E,8F XROM:EBFF 0A clv XROM:EC00 39 rts XROM:EC01 ; --------------------------------------------------------------------------- XROM:EC01 XROM:EC01 leaveEmpty_EC01: ; ... XROM:EC01 0B sev XROM:EC02 39 rts XROM:EC02 ; End of function dequeueKbdScanCode_EBEE XROM:EC02 XROM:EC03 XROM:EC03 ; =============== S U B R O U T I N E ======================================= XROM:EC03 XROM:EC03 ; get next key scan code from buffer, but don't dequeue; V set if none, clear if valid XROM:EC03 XROM:EC03 peekKbdScanCode_EC03: ; ... XROM:EC03 D6 8E ldab keybufPull_8E ; keybuf pull index (where last pulled) XROM:EC05 D1 8F cmpb keybufPush_8F ; keybuf push index (where last pushed) XROM:EC07 27 0B beq leaveEmpty_EC14 XROM:EC09 5C incb ; bump to next key in buffer XROM:EC0A C4 0F andb #$F ; (16-byte buffer; wrap around) XROM:EC0C CE 00 00 ldx #0 XROM:EC0F 3A abx XROM:EC10 A6 90 ldaa keybufScanCode_90,x ; circular buffer of key scan codes indexed by push/pull at 8E,8F XROM:EC12 0A clv XROM:EC13 39 rts XROM:EC14 ; --------------------------------------------------------------------------- XROM:EC14 XROM:EC14 leaveEmpty_EC14: ; ... XROM:EC14 0B sev XROM:EC15 39 rts XROM:EC15 ; End of function peekKbdScanCode_EC03 XROM:EC15 XROM:EC16 XROM:EC16 ; =============== S U B R O U T I N E ======================================= XROM:EC16 XROM:EC16 ; setup LCD XROM:EC16 XROM:EC16 lcdInit_EC16: ; ... XROM:EC16 15 5B 01 bclr lcdCtlLineState_5B 1 ; clear LCD OC2 and OC1 for 'command' XROM:EC19 15 5B 02 bclr lcdCtlLineState_5B 2 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:EC1C XROM:EC1C loop_EC1C: ; ... XROM:EC1C BD EC 45 jsr readLCDnybble_EC45 ; LCD read (status) nybble; return PD in A (shifted LCD data into b5-3) XROM:EC1F 84 20 anda #$20 ; wait for LCD 'ready' XROM:EC21 26 F9 bne loop_EC1C XROM:EC23 C6 DB ldab #$DB ; LCD SF: nybble mode, 5x8 font, 4x40 XROM:EC25 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EC28 C6 50 ldab #$50 ; LCD SE: cursor increments after write, no change in display address start address XROM:EC2A BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EC2D C6 3B ldab #$3B ; LCD SD: Display On, Cursor On, Underline Off, Cursor Blink, Character Blink XROM:EC2F BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EC32 C6 0D ldab #$D ; LCD SU: set/reset mode cancelled XROM:EC34 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EC37 C6 05 ldab #5 ; LCD SB: set blink frequency XROM:EC39 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EC3C C6 01 ldab #1 ; LCD CH: clear display and home XROM:EC3E BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EC41 14 5B 02 bset lcdCtlLineState_5B 2 ; leave with LCD OC2 set for the typical case of 'data' XROM:EC44 39 rts XROM:EC44 ; End of function lcdInit_EC16 XROM:EC44 XROM:EC45 XROM:EC45 ; =============== S U B R O U T I N E ======================================= XROM:EC45 XROM:EC45 ; LCD read (status) nybble; return PD in A (shifted LCD data into b5-3) XROM:EC45 XROM:EC45 readLCDnybble_EC45: ; ... XROM:EC45 86 03 ldaa #3 XROM:EC47 97 09 staa DDRD_9 ; DDRD: b1, b0 output; others input XROM:EC49 86 04 ldaa #4 XROM:EC4B B7 80 00 staa $8000 ; b2 R/~W, b1 OC2, b0 OC1 XROM:EC4E 14 00 80 bset PORTA_0 $80 ; PAb7 (lcdex) high XROM:EC51 96 08 ldaa PORTD_8 ; PORTD: all data bits XROM:EC53 15 00 80 bclr PORTA_0 $80 ; PAb7 (lcdex) low XROM:EC56 14 09 FF bset DDRD_9 $FF ; DDRD: all pins output XROM:EC59 7F 80 00 clr $8000 ; b2 R/~W, b1 OC2, b0 OC1 XROM:EC5C 15 08 3C bclr PORTD_8 $3C ; PORTD: b5,4,3,2 low XROM:EC5F 39 rts XROM:EC5F ; End of function readLCDnybble_EC45 XROM:EC5F XROM:EC60 XROM:EC60 ; =============== S U B R O U T I N E ======================================= XROM:EC60 XROM:EC60 ; select 32 KiB RAM page as per A (0-3) XROM:EC60 XROM:EC60 selectRAMPageA_EC60: ; ... XROM:EC60 85 01 bita #1 ; translate Ab1,0 into PAb5,3 XROM:EC62 26 05 bne flick3high_EC69 XROM:EC64 15 00 08 bclr PORTA_0 8 ; PAb3 (rampage0) low XROM:EC67 20 03 bra cont_EC6C XROM:EC69 ; --------------------------------------------------------------------------- XROM:EC69 XROM:EC69 flick3high_EC69: ; ... XROM:EC69 14 00 08 bset PORTA_0 8 ; PAb3 (rampage0) high XROM:EC6C XROM:EC6C cont_EC6C: ; ... XROM:EC6C 85 02 bita #2 XROM:EC6E 26 05 bne flick5high_EC75 XROM:EC70 15 00 20 bclr PORTA_0 $20 ; PAb5 (rampage1) low XROM:EC73 20 03 bra leave_EC78 XROM:EC75 ; --------------------------------------------------------------------------- XROM:EC75 XROM:EC75 flick5high_EC75: ; ... XROM:EC75 14 00 20 bset PORTA_0 $20 ; PAb5 (rampage1) high XROM:EC78 XROM:EC78 leave_EC78: ; ... XROM:EC78 39 rts XROM:EC78 ; End of function selectRAMPageA_EC60 XROM:EC78 XROM:EC79 XROM:EC79 ; =============== S U B R O U T I N E ======================================= XROM:EC79 XROM:EC79 ; select 32 KiB RAM page 0 XROM:EC79 XROM:EC79 selectRAMPage0_EC79: ; ... XROM:EC79 15 00 08 bclr PORTA_0 8 ; PAb3 (rampage0) low XROM:EC7C 15 00 20 bclr PORTA_0 $20 ; PAb5 (rampage1) low XROM:EC7F 39 rts XROM:EC7F ; End of function selectRAMPage0_EC79 XROM:EC7F XROM:EC80 XROM:EC80 ; =============== S U B R O U T I N E ======================================= XROM:EC80 XROM:EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:EC80 XROM:EC80 selectRAMpageForFile_EC80: ; ... XROM:EC80 8D F7 bsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:EC82 B6 01 5D ldaa curFileNo_15D ; current file number (1-8) XROM:EC85 81 08 cmpa #8 XROM:EC87 24 04 bcc oobFileNo_EC8D ; (file no is bonkers) XROM:EC89 44 lsra ; (translate 1-8, to 0-3 with nifty math) XROM:EC8A XROM:EC8A loc_EC8A: ; ... XROM:EC8A 8D D4 bsr selectRAMPageA_EC60 ; select 32 KiB RAM page as per A (0-3) XROM:EC8C 39 rts XROM:EC8D ; --------------------------------------------------------------------------- XROM:EC8D XROM:EC8D oobFileNo_EC8D: ; ... XROM:EC8D 86 03 ldaa #3 ; (saturate to page 3) XROM:EC8F 20 F9 bra loc_EC8A XROM:EC8F ; End of function selectRAMpageForFile_EC80 XROM:EC8F XROM:EC91 XROM:EC91 ; =============== S U B R O U T I N E ======================================= XROM:EC91 XROM:EC91 ; execute RAM test (with message) XROM:EC91 XROM:EC91 testExtRAM_EC91: ; ... XROM:EC91 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:EC94 BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:EC97 CE FC 6A ldx #aTestingRam___ ; "Testing RAM..." XROM:EC9A BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EC9D XROM:EC9D loop_EC9D: ; ... XROM:EC9D BD EC A3 jsr testExtRAMcore_ECA3 ; core test ram routine; V set if fail, clear if success XROM:ECA0 29 FB bvs loop_EC9D ; repeat test on fail XROM:ECA2 39 rts XROM:ECA2 ; End of function testExtRAM_EC91 XROM:ECA2 XROM:ECA3 XROM:ECA3 ; =============== S U B R O U T I N E ======================================= XROM:ECA3 XROM:ECA3 ; core test ram routine; V set if fail, clear if success XROM:ECA3 XROM:ECA3 testExtRAMcore_ECA3: ; ... XROM:ECA3 86 01 ldaa #1 ; rotating bit; start with 1, will shift up XROM:ECA5 XROM:ECA5 loop_ECA5: ; ... XROM:ECA5 B7 01 5E staa thisRAMpageNo_15E ; stick it here for test and read back to validate XROM:ECA8 B1 01 5E cmpa thisRAMpageNo_15E ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XROM:ECAB 26 4D bne leavefailData_ECFA ; fail; show data bus error and exit XROM:ECAD 48 asla ; move bit up for next iteration XROM:ECAE 26 F5 bne loop_ECA5 ; keep going until all bits gone XROM:ECB0 CE 01 01 ldx #(ramsiglocp0_100+1) ; on page 0 only; RAM signature location XROM:ECB3 XROM:ECB3 loop_ECB3: ; ... XROM:ECB3 A6 00 ldaa 0,x XROM:ECB5 36 psha XROM:ECB6 8F xgdx XROM:ECB7 05 lsld XROM:ECB8 8F xgdx XROM:ECB9 8C 80 80 cpx #$8080 XROM:ECBC 26 F5 bne loop_ECB3 XROM:ECBE CE 01 01 ldx #(ramsiglocp0_100+1) ; on page 0 only; RAM signature location XROM:ECC1 7F 00 60 clr scratchby_60 ; scratch XROM:ECC4 XROM:ECC4 loop_ECC4: ; ... XROM:ECC4 7C 00 60 inc scratchby_60 ; scratch XROM:ECC7 96 60 ldaa scratchby_60 ; scratch XROM:ECC9 A7 00 staa 0,x XROM:ECCB 8F xgdx XROM:ECCC 05 lsld XROM:ECCD 8F xgdx XROM:ECCE 8C 80 80 cpx #$8080 XROM:ECD1 26 F1 bne loop_ECC4 XROM:ECD3 CE 01 01 ldx #(ramsiglocp0_100+1) ; on page 0 only; RAM signature location XROM:ECD6 7F 00 60 clr scratchby_60 ; scratch XROM:ECD9 XROM:ECD9 loop_ECD9: ; ... XROM:ECD9 7C 00 60 inc scratchby_60 ; scratch XROM:ECDC 96 60 ldaa scratchby_60 ; scratch XROM:ECDE A1 00 cmpa 0,x XROM:ECE0 26 1B bne leavefailAddr_ECFD ; fail; show address bus error and exit XROM:ECE2 8F xgdx XROM:ECE3 05 lsld XROM:ECE4 8F xgdx XROM:ECE5 8C 80 80 cpx #$8080 XROM:ECE8 26 EF bne loop_ECD9 XROM:ECEA CE 40 40 ldx #$4040 XROM:ECED XROM:ECED loop_ECED: ; ... XROM:ECED 32 pula XROM:ECEE A7 00 staa 0,x XROM:ECF0 8F xgdx XROM:ECF1 04 lsrd XROM:ECF2 8F xgdx XROM:ECF3 8C 00 80 cpx #$80 ; '€' XROM:ECF6 26 F5 bne loop_ECED XROM:ECF8 20 06 bra cont_ED00 XROM:ECFA ; --------------------------------------------------------------------------- XROM:ECFA XROM:ECFA leavefailData_ECFA: ; ... XROM:ECFA 7E ED CF jmp showfail_EDCF ; XXX data bus ram error message XROM:ECFD ; --------------------------------------------------------------------------- XROM:ECFD XROM:ECFD leavefailAddr_ECFD: ; ... XROM:ECFD 7E ED DF jmp showfail_EDDF ; XXX address bus ram error message XROM:ED00 ; --------------------------------------------------------------------------- XROM:ED00 XROM:ED00 cont_ED00: ; ... XROM:ED00 BD EC 79 jsr selectRAMPage0_EC79 ; stamp RAM page numbers; select page 0 XROM:ED03 4F clra XROM:ED04 B7 01 5E staa thisRAMpageNo_15E ; stamp page no 0 XROM:ED07 86 01 ldaa #1 XROM:ED09 BD EC 60 jsr selectRAMPageA_EC60 ; select page 1 XROM:ED0C 86 01 ldaa #1 XROM:ED0E B7 01 5E staa thisRAMpageNo_15E ; stamp page no 1 XROM:ED11 86 02 ldaa #2 XROM:ED13 BD EC 60 jsr selectRAMPageA_EC60 ; select page 2 XROM:ED16 86 02 ldaa #2 XROM:ED18 B7 01 5E staa thisRAMpageNo_15E ; stamp page no 2 XROM:ED1B 86 03 ldaa #3 XROM:ED1D BD EC 60 jsr selectRAMPageA_EC60 ; select page 3 XROM:ED20 86 03 ldaa #3 XROM:ED22 B7 01 5E staa thisRAMpageNo_15E ; stamp page no 3 XROM:ED25 BD EC 79 jsr selectRAMPage0_EC79 ; validate RAM page numbers; select page 0 XROM:ED28 B6 01 5E ldaa thisRAMpageNo_15E ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XROM:ED2B 81 00 cmpa #0 ; validate page no 0 XROM:ED2D 26 CE bne leavefailAddr_ECFD ; fail; show address bus error and exit XROM:ED2F 86 01 ldaa #1 XROM:ED31 BD EC 60 jsr selectRAMPageA_EC60 ; select page 1 XROM:ED34 B6 01 5E ldaa thisRAMpageNo_15E ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XROM:ED37 81 01 cmpa #1 ; validate page no 1 XROM:ED39 26 C2 bne leavefailAddr_ECFD ; fail; show address bus error and exit XROM:ED3B 86 02 ldaa #2 XROM:ED3D BD EC 60 jsr selectRAMPageA_EC60 ; select page 2 XROM:ED40 B6 01 5E ldaa thisRAMpageNo_15E ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XROM:ED43 81 02 cmpa #2 ; validate page no 2 XROM:ED45 26 B6 bne leavefailAddr_ECFD ; fail; show address bus error and exit XROM:ED47 86 03 ldaa #3 XROM:ED49 BD EC 60 jsr selectRAMPageA_EC60 ; select page 3 XROM:ED4C B6 01 5E ldaa thisRAMpageNo_15E ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XROM:ED4F 81 03 cmpa #3 ; validate page no 3 XROM:ED51 26 AA bne leavefailAddr_ECFD ; fail; show address bus error and exit XROM:ED53 BD EC 79 jsr selectRAMPage0_EC79 ; select page 0 XROM:ED56 86 A5 ldaa #$A5 XROM:ED58 BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED5B 29 48 bvs ramerrReadWrite_EDA5 XROM:ED5D 86 5A ldaa #$5A XROM:ED5F BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED62 29 41 bvs ramerrReadWrite_EDA5 XROM:ED64 86 01 ldaa #1 XROM:ED66 BD EC 60 jsr selectRAMPageA_EC60 ; select page 1 XROM:ED69 86 A5 ldaa #$A5 XROM:ED6B BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED6E 29 35 bvs ramerrReadWrite_EDA5 XROM:ED70 86 5A ldaa #$5A XROM:ED72 BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED75 29 2E bvs ramerrReadWrite_EDA5 XROM:ED77 86 02 ldaa #2 XROM:ED79 BD EC 60 jsr selectRAMPageA_EC60 ; select page 2 XROM:ED7C 86 A5 ldaa #$A5 XROM:ED7E BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED81 29 22 bvs ramerrReadWrite_EDA5 XROM:ED83 86 5A ldaa #$5A XROM:ED85 BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED88 29 1B bvs ramerrReadWrite_EDA5 XROM:ED8A BD EC 79 jsr selectRAMPage0_EC79 ; select page 0 (XXX why? just going to change it again) XROM:ED8D 86 03 ldaa #3 XROM:ED8F BD EC 60 jsr selectRAMPageA_EC60 ; select page 3 XROM:ED92 86 A5 ldaa #$A5 XROM:ED94 BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED97 29 0C bvs ramerrReadWrite_EDA5 XROM:ED99 86 5A ldaa #$5A XROM:ED9B BD ED EF jsr testExtRAM_EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:ED9E 29 05 bvs ramerrReadWrite_EDA5 XROM:EDA0 BD EC 79 jsr selectRAMPage0_EC79 ; select page 0 XROM:EDA3 0A clv XROM:EDA4 39 rts XROM:EDA5 ; --------------------------------------------------------------------------- XROM:EDA5 XROM:EDA5 ramerrReadWrite_EDA5: ; ... XROM:EDA5 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:EDA8 37 pshb ; push value read XROM:EDA9 36 psha ; push value written XROM:EDAA 3C pshx ; push address of fault XROM:EDAB BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:EDAE CE FC 86 ldx #aRWRamErr ; "R/W RAM err:" XROM:EDB1 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EDB4 XROM:EDB4 showAddExpRd_EDB4: ; ... XROM:EDB4 38 pulx ; get fault address in D XROM:EDB5 8F xgdx XROM:EDB6 BD F5 B0 jsr showHexAB_F5B0 ; send AB as four-digit hex to display XROM:EDB9 XROM:EDB9 showExpRd_EDB9: ; ... XROM:EDB9 CE FC B6 ldx #aExp ; "Exp:" XROM:EDBC BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EDBF 32 pula ; pop value written XROM:EDC0 BD F5 B9 jsr showHexA_F5B9 ; send A as two-digit hex to display XROM:EDC3 CE FC B2 ldx #aRd ; "Rd:" XROM:EDC6 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EDC9 32 pula ; pop value read XROM:EDCA BD F5 B9 jsr showHexA_F5B9 ; send A as two-digit hex to display XROM:EDCD 0B sev ; fail :( XROM:EDCE 39 rts XROM:EDCF ; --------------------------------------------------------------------------- XROM:EDCF XROM:EDCF showfail_EDCF: ; ... XROM:EDCF F6 01 5E ldab thisRAMpageNo_15E ; this RAM page no (only used during test, as it's in the middle of file areas on xram pages 1-3) XROM:EDD2 37 pshb ; push value read XROM:EDD3 36 psha ; push value written XROM:EDD4 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:EDD7 CE FC 93 ldx #aDatabusramErr ; "DataBusRAM err:" XROM:EDDA BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EDDD 20 DA bra showExpRd_EDB9 XROM:EDDF ; --------------------------------------------------------------------------- XROM:EDDF XROM:EDDF showfail_EDDF: ; ... XROM:EDDF E6 00 ldab 0,x XROM:EDE1 37 pshb ; push value read XROM:EDE2 36 psha ; push value written XROM:EDE3 3C pshx XROM:EDE4 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:EDE7 CE FC A3 ldx #aAdrbusramErr ; "AdrBusRAM err:" XROM:EDEA BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EDED 20 C5 bra showAddExpRd_EDB4 XROM:EDED ; End of function testExtRAMcore_ECA3 XROM:EDED XROM:EDEF XROM:EDEF ; =============== S U B R O U T I N E ======================================= XROM:EDEF XROM:EDEF ; non-destructive test fill RAM pattern in A, V set on fail, clear on success XROM:EDEF XROM:EDEF testExtRAM_EDEF: ; ... XROM:EDEF CE 7F FF ldx #endOfRAMpage_7FFF ; start from top of external RAM XROM:EDF2 XROM:EDF2 loop_EDF2: ; ... XROM:EDF2 E6 00 ldab 0,x ; save what's currently there XROM:EDF4 A7 00 staa 0,x ; stick in our pattern XROM:EDF6 A1 00 cmpa 0,x ; read back to test XROM:EDF8 26 0A bne leaveFail_EE04 ; oh no... XROM:EDFA E7 00 stab 0,x ; restore what was there before XROM:EDFC 09 dex ; next! XROM:EDFD 8C 01 00 cpx #ramsiglocp0_100 ; go to bottom of external RAM XROM:EE00 24 F0 bcc loop_EDF2 XROM:EE02 0A clv ; clear V; success! XROM:EE03 39 rts XROM:EE04 ; --------------------------------------------------------------------------- XROM:EE04 XROM:EE04 leaveFail_EE04: ; ... XROM:EE04 E6 00 ldab 0,x ; fail; save fail address in D for later display XROM:EE06 0B sev ; set V; fail :( XROM:EE07 39 rts XROM:EE07 ; End of function testExtRAM_EDEF XROM:EE07 XROM:EE08 ; --------------------------------------------------------------------------- XROM:EE08 ; START OF FUNCTION CHUNK FOR handleKeyScanCode_EE37 XROM:EE08 XROM:EE08 optionclover_EE08: ; ... XROM:EE08 81 56 cmpa #$56 ; 'Clear File' scan code XROM:EE0A 27 25 beq eraseFile_EE31 ; erase file if option,clover,'File Clear' pressed XROM:EE0C 81 21 cmpa #$21 ; 'T' scan code XROM:EE0E 27 0E beq fillTestFile_EE1E ; emit test file if option,clover,T is pressed XROM:EE10 81 61 cmpa #$61 ; 'R' scan code XROM:EE12 27 17 beq recoverFile_EE2B ; recover file if option,clover,R is pressed XROM:EE14 81 4D cmpa #$4D ; 'S' scan code XROM:EE16 26 27 bne noclover_EE3F ; (end of option-clover items; others treated normally) XROM:EE18 BD F0 34 jsr changeSendSpeed_F034 ; change send speed if option,clover,S is pressed XROM:EE1B 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE1E ; --------------------------------------------------------------------------- XROM:EE1E XROM:EE1E fillTestFile_EE1E: ; ... XROM:EE1E 13 62 01 1D brclr bCtrlKeyDown_62 1 noclover_EE3F ; (also require Ctrl key) XROM:EE22 BD F7 6D jsr spewROMtestFile_F76D ; load the ROM test file into the current file XROM:EE25 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE28 ; --------------------------------------------------------------------------- XROM:EE28 XROM:EE28 doDeleteFile_EE28: ; ... XROM:EE28 7E EE E1 jmp promptAndDeleteFile_EEE1 ; prompt confirmation and clear current file XROM:EE2B ; --------------------------------------------------------------------------- XROM:EE2B XROM:EE2B recoverFile_EE2B: ; ... XROM:EE2B BD EF CA jsr recoverFile_EFCA ; XXX attempt to recover file; looks like it just sets the end pointer to the end of partition and user has to delete junk XROM:EE2E 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE31 ; --------------------------------------------------------------------------- XROM:EE31 XROM:EE31 eraseFile_EE31: ; ... XROM:EE31 BD EF 06 jsr promptAndEraseFile_EF06 ; prompt to erase file and then erase it if 'y' XROM:EE34 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE34 ; END OF FUNCTION CHUNK FOR handleKeyScanCode_EE37 XROM:EE37 XROM:EE37 ; =============== S U B R O U T I N E ======================================= XROM:EE37 XROM:EE37 ; dispatch key scan code in A XROM:EE37 XROM:EE37 handleKeyScanCode_EE37: ; ... XROM:EE37 XROM:EE37 ; FUNCTION CHUNK AT XROM:EE08 SIZE 0000002F BYTES XROM:EE37 ; FUNCTION CHUNK AT XROM:EF67 SIZE 00000016 BYTES XROM:EE37 XROM:EE37 13 63 01 04 brclr bCloverKeyDown_63 1 noclover_EE3F ; true if 'clover key down' XROM:EE3B 12 61 01 C9 brset bAltKeyDown_61 1 optionclover_EE08 ; true if 'alt/option key down' XROM:EE3F XROM:EE3F noclover_EE3F: ; ... XROM:EE3F 13 64 01 02 brclr bShiftKeyDown_64 1 cont_EE45 ; true if 'shift key down' XROM:EE43 8A 80 oraa #$80 ; set high bit in base scan code to mark as shifted XROM:EE45 XROM:EE45 cont_EE45: ; ... XROM:EE45 97 70 staa scratch_70 ; save the scan code for later XROM:EE47 81 56 cmpa #$56 ; 'Clear File' scan code XROM:EE49 27 DD beq doDeleteFile_EE28 XROM:EE4B 81 2B cmpa #$2B ; 'Delete' scan code XROM:EE4D 27 28 beq doDeleteChar_EE77 ; delete a char in file? XROM:EE4F 81 35 cmpa #$35 ; 'arrow Left' scan code XROM:EE51 27 2A beq doLeft_EE7D XROM:EE53 81 34 cmpa #$34 ; 'arrow Right' scan code XROM:EE55 27 36 beq doRight_EE8D XROM:EE57 81 37 cmpa #$37 ; 'arrow Up' scan code XROM:EE59 27 40 beq doUp_EE9B XROM:EE5B 81 15 cmpa #$15 ; 'arrow Down' scan code XROM:EE5D 27 4A beq doDown_EEA9 XROM:EE5F 81 66 cmpa #$66 ; 'Home' scan code XROM:EE61 27 54 beq doHome_EEB7 XROM:EE63 81 75 cmpa #$75 ; 'End' scan code XROM:EE65 27 55 beq doEnd_EEBC XROM:EE67 81 2D cmpa #$2D ; 'Caps lock' scan code XROM:EE69 27 56 beq toggleCapLock_EEC1 XROM:EE6B 7E EF 67 jmp tryFkeys_EF67 XROM:EE6E ; --------------------------------------------------------------------------- XROM:EE6E XROM:EE6E lastDitchTryNorm_EE6E: ; ... XROM:EE6E 7E EE C9 jmp normalChar_EEC9 XROM:EE71 ; --------------------------------------------------------------------------- XROM:EE71 BD F0 13 jsr prepareToSend_F013 ; XXX IS THIS DEAD CODE??? XROM:EE74 7E EE E0 jmp leave_EEE0 XROM:EE77 ; --------------------------------------------------------------------------- XROM:EE77 XROM:EE77 doDeleteChar_EE77: ; ... XROM:EE77 BD F1 BA jsr handleDeleteChar_F1BA ; delete a byte in the file at the current position XROM:EE7A 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE7D ; --------------------------------------------------------------------------- XROM:EE7D XROM:EE7D doLeft_EE7D: ; ... XROM:EE7D 12 63 01 06 brset bCloverKeyDown_63 1 doCloverLeft_EE87 ; true if 'clover key down' XROM:EE81 BD F1 EE jsr handleCurPosM1_F1EE ; cur file cursor pos ptr -= 1 XROM:EE84 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE87 ; --------------------------------------------------------------------------- XROM:EE87 XROM:EE87 doCloverLeft_EE87: ; ... XROM:EE87 BD EF 57 jsr handleCurPosSOL_EF57 ; set cursor position to start-of-line XROM:EE8A 7E EE DA jmp updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE8D ; --------------------------------------------------------------------------- XROM:EE8D XROM:EE8D doRight_EE8D: ; ... XROM:EE8D 12 63 01 05 brset bCloverKeyDown_63 1 doCloverRight_EE96 ; true if 'clover key down' XROM:EE91 BD F2 06 jsr handleCurPosP1_F206 ; cur file cursor pos ptr += 1 XROM:EE94 20 44 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE96 ; --------------------------------------------------------------------------- XROM:EE96 XROM:EE96 doCloverRight_EE96: ; ... XROM:EE96 BD EF 5F jsr handleCurPosEOL_EF5F ; set cursor pos to end-of-line XROM:EE99 20 3F bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EE9B ; --------------------------------------------------------------------------- XROM:EE9B XROM:EE9B doUp_EE9B: ; ... XROM:EE9B 13 63 01 05 brclr bCloverKeyDown_63 1 doUpOnce_EEA4 ; true if 'clover key down' XROM:EE9F BD EF 4A jsr handlePageUp_EF4A ; page up screen XROM:EEA2 20 36 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEA4 ; --------------------------------------------------------------------------- XROM:EEA4 XROM:EEA4 doUpOnce_EEA4: ; ... XROM:EEA4 BD F1 15 jsr handleLineUp_F115 ; up arrow handler XROM:EEA7 20 31 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEA9 ; --------------------------------------------------------------------------- XROM:EEA9 XROM:EEA9 doDown_EEA9: ; ... XROM:EEA9 13 63 01 05 brclr bCloverKeyDown_63 1 doDownOnce_EEB2 ; true if 'clover key down' XROM:EEAD BD EF 3D jsr handlePageDown_EF3D ; page down screen XROM:EEB0 20 28 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEB2 ; --------------------------------------------------------------------------- XROM:EEB2 XROM:EEB2 doDownOnce_EEB2: ; ... XROM:EEB2 BD F0 DF jsr handleLineDown_F0DF ; down arrow handler XROM:EEB5 20 23 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEB7 ; --------------------------------------------------------------------------- XROM:EEB7 XROM:EEB7 doHome_EEB7: ; ... XROM:EEB7 BD F1 6B jsr handleHome_F16B ; set cursor to start-of-file XROM:EEBA 20 1E bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEBC ; --------------------------------------------------------------------------- XROM:EEBC XROM:EEBC doEnd_EEBC: ; ... XROM:EEBC BD F1 75 jsr handleEnd_F175 ; End key handler XROM:EEBF 20 19 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEC1 ; --------------------------------------------------------------------------- XROM:EEC1 XROM:EEC1 toggleCapLock_EEC1: ; ... XROM:EEC1 96 A1 ldaa bCapsLock_A1 ; flag; CAPS lock in effect XROM:EEC3 88 01 eora #1 XROM:EEC5 97 A1 staa bCapsLock_A1 ; flag; CAPS lock in effect XROM:EEC7 20 11 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EEC9 ; --------------------------------------------------------------------------- XROM:EEC9 XROM:EEC9 normalChar_EEC9: ; ... XROM:EEC9 96 70 ldaa scratch_70 ; XXX scratch; scan code later used to convert to ascii XROM:EECB BD F5 92 jsr xlatScanToAscii_F592 ; XXX convert kbd scan code to ASCII (consider shift but not caps lock) XROM:EECE 29 10 bvs leave_EEE0 ; bogus chars need not be inserted XROM:EED0 13 A1 01 03 brclr bCapsLock_A1 1 cont_EED7 ; we manually shift things when caps lock is in effect XROM:EED4 BD EF BF jsr makeUPPERcase_EFBF ; make UPPER case only [a-z] (caps lock helper) XROM:EED7 XROM:EED7 cont_EED7: ; ... XROM:EED7 BD F3 07 jsr insertCharToFile_F307 ; insert char A onto current file; V set if fail, clear on success XROM:EED7 ; End of function handleKeyScanCode_EE37 XROM:EED7 XROM:EEDA XROM:EEDA ; =============== S U B R O U T I N E ======================================= XROM:EEDA XROM:EEDA ; update LCD to show current file state XROM:EEDA XROM:EEDA updateCurFileDisplay_EEDA: ; ... XROM:EEDA BD F3 74 jsr displayCurFile_F374 ; re-paint LCD for current file state XROM:EEDD BD F2 56 jsr setLCDcp_F256 ; set LCD cursor position from the (row,col) @ (6c,6b) XROM:EEE0 XROM:EEE0 leave_EEE0: ; ... XROM:EEE0 39 rts XROM:EEE0 ; End of function updateCurFileDisplay_EEDA XROM:EEE0 XROM:EEE1 XROM:EEE1 ; =============== S U B R O U T I N E ======================================= XROM:EEE1 XROM:EEE1 ; prompt confirmation and clear current file XROM:EEE1 XROM:EEE1 promptAndDeleteFile_EEE1: ; ... XROM:EEE1 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:EEE4 CE FD F6 ldx #aAreYouSureYo_0 ; "Are you sure you want to delete" XROM:EEE7 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EEEA BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:EEED CE FE 16 ldx #aAllTheDataInThisFile?YN ; "all the data in this file?(y/n)" XROM:EEF0 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EEF3 XROM:EEF3 waitKey_EEF3: ; ... XROM:EEF3 BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:EEF6 BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:EEF9 29 F8 bvs waitKey_EEF3 XROM:EEFB 81 22 cmpa #$22 ; scan code for 'y' XROM:EEFD 27 02 beq delete_EF01 ; empty it if 'y' pressed XROM:EEFF 20 03 bra leave_EF04 ; skip if anything else XROM:EF01 ; --------------------------------------------------------------------------- XROM:EF01 XROM:EF01 delete_EF01: ; ... XROM:EF01 BD EB 9B jsr deleteThisFile_EB9B ; delete file by resetting pointers (recoverable) XROM:EF04 XROM:EF04 leave_EF04: ; ... XROM:EF04 20 D4 bra updateCurFileDisplay_EEDA ; update LCD to show current file state XROM:EF04 ; End of function promptAndDeleteFile_EEE1 XROM:EF04 XROM:EF06 XROM:EF06 ; =============== S U B R O U T I N E ======================================= XROM:EF06 XROM:EF06 ; prompt to erase file and then erase it if 'y' XROM:EF06 XROM:EF06 promptAndEraseFile_EF06: ; ... XROM:EF06 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:EF09 CE FE 36 ldx #aAreYouSureYouWantToPermanently ; "Are you sure you want to PERMANENTLY" XROM:EF0C BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EF0F BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:EF12 CE FE 5B ldx #aEraseAllTheDataInThisFile?YN ; "erase all the data in this file?(y/n)" XROM:EF15 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EF18 XROM:EF18 waitKey_EF18: ; ... XROM:EF18 BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:EF1B BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:EF1E 29 F8 bvs waitKey_EF18 XROM:EF20 81 22 cmpa #$22 ; scan code for 'y' key XROM:EF22 26 18 bne leave_EF3C ; leave if any key other than 'y' XROM:EF24 FE 01 26 ldx curFileRgnLast_126 ; this file; file region end addr (inclusive) XROM:EF27 DF 4C stx scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:EF29 FE 01 28 ldx curFileRgnFirst_128 ; this file; file region start addr XROM:EF2C BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:EF2F XROM:EF2F loopEraseFile_EF2F: ; ... XROM:EF2F 6F 00 clr 0,x XROM:EF31 08 inx XROM:EF32 9C 4C cpx scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:EF34 26 F9 bne loopEraseFile_EF2F XROM:EF36 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:EF39 BD EB 9B jsr deleteThisFile_EB9B ; set pointers to empty file XROM:EF3C XROM:EF3C leave_EF3C: ; ... XROM:EF3C 39 rts XROM:EF3C ; End of function promptAndEraseFile_EF06 XROM:EF3C XROM:EF3D XROM:EF3D ; =============== S U B R O U T I N E ======================================= XROM:EF3D XROM:EF3D ; page down screen XROM:EF3D XROM:EF3D handlePageDown_EF3D: ; ... XROM:EF3D BD F0 DF jsr handleLineDown_F0DF ; down arrow handler XROM:EF40 BD F0 DF jsr handleLineDown_F0DF ; down arrow handler XROM:EF43 BD F0 DF jsr handleLineDown_F0DF ; down arrow handler XROM:EF46 BD F0 DF jsr handleLineDown_F0DF ; down arrow handler XROM:EF49 39 rts XROM:EF49 ; End of function handlePageDown_EF3D XROM:EF49 XROM:EF4A XROM:EF4A ; =============== S U B R O U T I N E ======================================= XROM:EF4A XROM:EF4A ; page up screen XROM:EF4A XROM:EF4A handlePageUp_EF4A: ; ... XROM:EF4A BD F1 15 jsr handleLineUp_F115 ; up arrow handler XROM:EF4D BD F1 15 jsr handleLineUp_F115 ; up arrow handler XROM:EF50 BD F1 15 jsr handleLineUp_F115 ; up arrow handler XROM:EF53 BD F1 15 jsr handleLineUp_F115 ; up arrow handler XROM:EF56 39 rts XROM:EF56 ; End of function handlePageUp_EF4A XROM:EF56 XROM:EF57 XROM:EF57 ; =============== S U B R O U T I N E ======================================= XROM:EF57 XROM:EF57 ; set cursor position to start-of-line XROM:EF57 XROM:EF57 handleCurPosSOL_EF57: ; ... XROM:EF57 86 01 ldaa #1 XROM:EF59 97 6B staa lcdcpCol1_6B ; 1-relative LCD cursor pos col XROM:EF5B BD F1 27 jsr fixupCurFileCPasPerRowCol_F127 ; XXX sync file cp ptr with row,col cp XROM:EF5E 39 rts XROM:EF5E ; End of function handleCurPosSOL_EF57 XROM:EF5E XROM:EF5F XROM:EF5F ; =============== S U B R O U T I N E ======================================= XROM:EF5F XROM:EF5F ; set cursor pos to end-of-line XROM:EF5F XROM:EF5F handleCurPosEOL_EF5F: ; ... XROM:EF5F 86 28 ldaa #40 XROM:EF61 97 6B staa lcdcpCol1_6B ; 1-relative LCD cursor pos col XROM:EF63 BD F1 27 jsr fixupCurFileCPasPerRowCol_F127 ; XXX sync file cp ptr with row,col cp XROM:EF66 39 rts XROM:EF66 ; End of function handleCurPosEOL_EF5F XROM:EF66 XROM:EF67 ; --------------------------------------------------------------------------- XROM:EF67 ; START OF FUNCTION CHUNK FOR handleKeyScanCode_EE37 XROM:EF67 XROM:EF67 tryFkeys_EF67: ; ... XROM:EF67 BD EF 7D jsr scF18toNum_EF7D ; try to interpret the scan code as F-key 1-8 for opening file XROM:EF6A 25 0E bcs lastDitchTryNorm_EF7A ; not an F-key; try as a normal key XROM:EF6C 36 psha XROM:EF6D BD EA D2 jsr updateFileState_EAD2 ; save our current file working state into state array entry XROM:EF70 32 pula XROM:EF71 B7 01 5D staa curFileNo_15D ; save translated F-key as current file number XROM:EF74 BD EA F9 jsr openFile_EAF9 ; open it up! XROM:EF77 7E EE DA jmp updateCurFileDisplay_EEDA ; paint the screen and be done XROM:EF7A ; --------------------------------------------------------------------------- XROM:EF7A XROM:EF7A lastDitchTryNorm_EF7A: ; ... XROM:EF7A 7E EE 6E jmp lastDitchTryNorm_EE6E ; boing! XROM:EF7A ; END OF FUNCTION CHUNK FOR handleKeyScanCode_EE37 XROM:EF7D XROM:EF7D ; =============== S U B R O U T I N E ======================================= XROM:EF7D XROM:EF7D ; scan code F1-8 to number 1-8; C if not F1-8, clear if OK XROM:EF7D XROM:EF7D scF18toNum_EF7D: ; ... XROM:EF7D 81 0D cmpa #$D ; scan code for F1 XROM:EF7F 26 04 bne cont_EF85 XROM:EF81 86 01 ldaa #1 XROM:EF83 20 36 bra leaveok_EFBB XROM:EF85 ; --------------------------------------------------------------------------- XROM:EF85 XROM:EF85 cont_EF85: ; ... XROM:EF85 81 0C cmpa #$C ; scan code for F2 XROM:EF87 26 04 bne cont_EF8D XROM:EF89 86 02 ldaa #2 XROM:EF8B 20 2E bra leaveok_EFBB XROM:EF8D ; --------------------------------------------------------------------------- XROM:EF8D XROM:EF8D cont_EF8D: ; ... XROM:EF8D 81 2C cmpa #$2C ; scan code for F3 XROM:EF8F 26 04 bne cont_EF95 XROM:EF91 86 03 ldaa #3 XROM:EF93 20 26 bra leaveok_EFBB XROM:EF95 ; --------------------------------------------------------------------------- XROM:EF95 XROM:EF95 cont_EF95: ; ... XROM:EF95 81 1C cmpa #$1C ; scan code for F4 XROM:EF97 26 04 bne cont_EF9D XROM:EF99 86 04 ldaa #4 XROM:EF9B 20 1E bra leaveok_EFBB XROM:EF9D ; --------------------------------------------------------------------------- XROM:EF9D XROM:EF9D cont_EF9D: ; ... XROM:EF9D 81 1B cmpa #$1B ; scan code for F5 XROM:EF9F 26 04 bne cont_EFA5 XROM:EFA1 86 05 ldaa #5 XROM:EFA3 20 16 bra leaveok_EFBB XROM:EFA5 ; --------------------------------------------------------------------------- XROM:EFA5 XROM:EFA5 cont_EFA5: ; ... XROM:EFA5 81 1A cmpa #$1A ; scan code for F6 XROM:EFA7 26 04 bne cont_EFAD XROM:EFA9 86 06 ldaa #6 XROM:EFAB 20 0E bra leaveok_EFBB XROM:EFAD ; --------------------------------------------------------------------------- XROM:EFAD XROM:EFAD cont_EFAD: ; ... XROM:EFAD 81 20 cmpa #$20 ; scan code for F7 XROM:EFAF 26 04 bne cont_EFB5 XROM:EFB1 86 07 ldaa #7 XROM:EFB3 20 06 bra leaveok_EFBB XROM:EFB5 ; --------------------------------------------------------------------------- XROM:EFB5 XROM:EFB5 cont_EFB5: ; ... XROM:EFB5 81 00 cmpa #0 ; scan code for F8 XROM:EFB7 26 04 bne leavefail_EFBD XROM:EFB9 86 08 ldaa #8 XROM:EFBB XROM:EFBB leaveok_EFBB: ; ... XROM:EFBB 0C clc XROM:EFBC 39 rts XROM:EFBD ; --------------------------------------------------------------------------- XROM:EFBD XROM:EFBD leavefail_EFBD: ; ... XROM:EFBD 0D sec XROM:EFBE 39 rts XROM:EFBE ; End of function scF18toNum_EF7D XROM:EFBE XROM:EFBF XROM:EFBF ; =============== S U B R O U T I N E ======================================= XROM:EFBF XROM:EFBF ; make UPPER case only [a-z] (caps lock helper) XROM:EFBF XROM:EFBF makeUPPERcase_EFBF: ; ... XROM:EFBF 81 61 cmpa #'a' XROM:EFC1 25 06 bcs leave_EFC9 ; less than 'a' XROM:EFC3 81 7A cmpa #'z' XROM:EFC5 22 02 bhi leave_EFC9 ; more than 'z' XROM:EFC7 84 DF anda #$DF ; goodbye, bit 5 XROM:EFC9 XROM:EFC9 leave_EFC9: ; ... XROM:EFC9 39 rts XROM:EFC9 ; End of function makeUPPERcase_EFBF XROM:EFC9 XROM:EFCA XROM:EFCA ; =============== S U B R O U T I N E ======================================= XROM:EFCA XROM:EFCA ; XXX attempt to recover file; looks like it just sets the end pointer to the end of partition and user has to delete junk XROM:EFCA XROM:EFCA recoverFile_EFCA: ; ... XROM:EFCA BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:EFCD BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:EFD0 CE FC FD ldx #aPerformingEmer ; "Performing emergency recovery of" XROM:EFD3 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EFD6 BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:EFD9 CE FD 1E ldx #aFile ; "file " XROM:EFDC BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EFDF B6 01 5D ldaa curFileNo_15D ; current file number (1-8) XROM:EFE2 BD EB B2 jsr bin2hexA_EBB2 ; A to ascii hex (A, B) XROM:EFE5 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:EFE8 CE FD 24 ldx #a____ ; "...." XROM:EFEB BD F6 69 jsr showText_F669 ; show nts text @ X XROM:EFEE BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EFF1 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EFF4 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:EFF7 F6 01 5D ldab curFileNo_15D ; current file number (1-8) XROM:EFFA 5A decb XROM:EFFB 58 aslb XROM:EFFC CE 01 2A ldx #aFileState_12A ; File (0-7) state structures: XROM:EFFC ; + 0 = cursor pointer XROM:EFFC ; + 2 = screen start pointer XROM:EFFC ; + 4 = end pointer XROM:EFFF 18 CE FB 24 ldy #aFilePartitions_FB24 ; 8 4-byte structures; [start,end] file partitions XROM:F003 3A abx XROM:F004 3A abx XROM:F005 3A abx XROM:F006 18 3A aby XROM:F008 18 3A aby ; get X and Y pointing to the relevant entries for the file XROM:F00A 18 EC 02 ldd 2,y ; XXX get file partition end and put it into X+4 XROM:F00D ED 04 std 4,x XROM:F00F BD EA F9 jsr openFile_EAF9 ; open current file (specified at 15D) XROM:F012 39 rts XROM:F012 ; End of function recoverFile_EFCA XROM:F012 XROM:F013 XROM:F013 ; =============== S U B R O U T I N E ======================================= XROM:F013 XROM:F013 ; prepare to send (setup flags and display prompt) XROM:F013 XROM:F013 prepareToSend_F013: ; ... XROM:F013 FE 01 28 ldx curFileRgnFirst_128 ; this file; file region start addr XROM:F016 DF 67 stx pNextCharToSend_67 ; file sending related? ptr to next char to send XROM:F018 14 6D FF bset byte_6D $FF ; XXX flag? is file sending??? XROM:F01B 13 8B 01 05 brclr byte_8B 1 loc_F024 ; XXX flag? XROM:F01F 14 8C FF bset byte_8C $FF ; XXX flag? XROM:F022 20 03 bra loc_F027 XROM:F024 ; --------------------------------------------------------------------------- XROM:F024 XROM:F024 loc_F024: ; ... XROM:F024 14 58 FF bset byte_58 $FF ; XXX flag? XROM:F027 XROM:F027 loc_F027: ; ... XROM:F027 7F 00 A2 clr byte_A2 ; XXX flag? cleared in file sending??? XROM:F02A BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:F02D CE FE F9 ldx #aSending____pressAnyKeyToStop_ ; "Sending....Press any key to stop. " XROM:F030 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F033 39 rts XROM:F033 ; End of function prepareToSend_F013 XROM:F033 XROM:F034 XROM:F034 ; =============== S U B R O U T I N E ======================================= XROM:F034 XROM:F034 ; prompt and change send speed XROM:F034 XROM:F034 changeSendSpeed_F034: ; ... XROM:F034 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:F037 CE FD 76 ldx #aToChangeSendSp ; "To change Send speed, type 1, 2, 3 or 4"... XROM:F03A BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F03D BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:F040 CE FD 9F ldx #a1VerySlow2Slow ; " 1: VERY Slow 2: Slow" XROM:F043 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F046 BD F7 54 jsr setcpLine2_F754 ; set cursor Line 2 XROM:F049 CE FD BF ldx #a3FastDefault4F ; " 3: Fast(default) 4: Fastest" XROM:F04C BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F04F BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:F052 CE FD E2 ldx #aCurrentSetting ; "Current setting is " XROM:F055 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F058 B6 01 5C ldaa kbdemuSpeed_15C ; keyboard transfer speed (0, 1, 2, c8???) XROM:F05B 81 00 cmpa #0 ; 0 is very slow XROM:F05D 26 04 bne cont_F063 XROM:F05F C6 31 ldab #'1' XROM:F061 20 16 bra showcurspeed_F079 XROM:F063 ; --------------------------------------------------------------------------- XROM:F063 XROM:F063 cont_F063: ; ... XROM:F063 81 01 cmpa #1 ; 1 is slow XROM:F065 26 04 bne cont_F06B XROM:F067 C6 32 ldab #'2' XROM:F069 20 0E bra showcurspeed_F079 XROM:F06B ; --------------------------------------------------------------------------- XROM:F06B XROM:F06B cont_F06B: ; ... XROM:F06B 81 02 cmpa #2 ; 2 is fast XROM:F06D 26 04 bne cont_F073 XROM:F06F C6 33 ldab #'3' XROM:F071 20 06 bra showcurspeed_F079 XROM:F073 ; --------------------------------------------------------------------------- XROM:F073 XROM:F073 cont_F073: ; ... XROM:F073 81 C8 cmpa #$C8 ; 'È' ; c8 is fastest XROM:F075 26 19 bne loc_F090 ; unknown setting, force to 1, slow XROM:F077 C6 34 ldab #'4' XROM:F079 XROM:F079 showcurspeed_F079: ; ... XROM:F079 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F07C XROM:F07C waitKey_F07C: ; ... XROM:F07C BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:F07F BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:F082 29 F8 bvs waitKey_F07C XROM:F084 81 5E cmpa #$5E ; scan code for '1' XROM:F086 26 04 bne cont_F08C XROM:F088 86 00 ldaa #0 XROM:F08A 20 18 bra storeSpeed_F0A4 XROM:F08C ; --------------------------------------------------------------------------- XROM:F08C XROM:F08C cont_F08C: ; ... XROM:F08C 81 5D cmpa #$5D ; scan code for '2' XROM:F08E 26 04 bne cont_F094 XROM:F090 XROM:F090 loc_F090: ; ... XROM:F090 86 01 ldaa #1 XROM:F092 20 10 bra storeSpeed_F0A4 XROM:F094 ; --------------------------------------------------------------------------- XROM:F094 XROM:F094 cont_F094: ; ... XROM:F094 81 5C cmpa #$5C ; scan code for '3' XROM:F096 26 04 bne cont_F09C XROM:F098 86 02 ldaa #2 XROM:F09A 20 08 bra storeSpeed_F0A4 XROM:F09C ; --------------------------------------------------------------------------- XROM:F09C XROM:F09C cont_F09C: ; ... XROM:F09C 81 51 cmpa #$51 ; scan code for '4' XROM:F09E 26 07 bne leave_F0A7 XROM:F0A0 86 C8 ldaa #$C8 XROM:F0A2 20 00 bra *+2 ; (knumbskull 'break' in 'switch' for last 'case') XROM:F0A4 ; --------------------------------------------------------------------------- XROM:F0A4 XROM:F0A4 storeSpeed_F0A4: ; ... XROM:F0A4 B7 01 5C staa kbdemuSpeed_15C ; keyboard transfer speed (0, 1, 2, c8???) XROM:F0A7 XROM:F0A7 leave_F0A7: ; ... XROM:F0A7 39 rts XROM:F0A7 ; End of function changeSendSpeed_F034 XROM:F0A7 XROM:F0A8 XROM:F0A8 ; =============== S U B R O U T I N E ======================================= XROM:F0A8 XROM:F0A8 ; update start of screen to subsequent line; V if no more, clear if success XROM:F0A8 XROM:F0A8 updateStartNextLine_F0A8: ; ... XROM:F0A8 FE 01 20 ldx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F0AB BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F0AE 29 04 bvs leave_F0B4 XROM:F0B0 FF 01 20 stx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F0B3 0A clv XROM:F0B4 XROM:F0B4 leave_F0B4: ; ... XROM:F0B4 39 rts XROM:F0B4 ; End of function updateStartNextLine_F0A8 XROM:F0B4 XROM:F0B5 XROM:F0B5 ; =============== S U B R O U T I N E ======================================= XROM:F0B5 XROM:F0B5 ; update start of screen to previous line XROM:F0B5 XROM:F0B5 updateStartPrevLine_F0B5: ; ... XROM:F0B5 FC 01 20 ldd curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F0B8 1A B3 01 28 cpd curFileRgnFirst_128 ; this file; file region start addr XROM:F0BC 27 20 beq leave_F0DE ; leave if start of screen is start of file XROM:F0BE DD 4C std scratchby_4C ; save original start-of-screen XROM:F0C0 FC 01 28 ldd curFileRgnFirst_128 ; start looking for the prior line start by searching forward XROM:F0C3 FD 01 20 std curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F0C6 DD 73 std scratch_73 ; scratch; prev start of screen XROM:F0C8 XROM:F0C8 nextLine_F0C8: ; ... XROM:F0C8 BD F0 A8 jsr updateStartNextLine_F0A8 ; update start of screen to subsequent line; V if no more, clear if success XROM:F0CB 29 0C bvs finish_F0D9 XROM:F0CD FC 01 20 ldd curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F0D0 1A 93 4C cpd scratchby_4C ; check against original start of screen XROM:F0D3 24 04 bcc finish_F0D9 ; if this line start is >= the original, then we keep the last one we found XROM:F0D5 DD 73 std scratch_73 ; otherwise we save this as the last one for the next iteration XROM:F0D7 20 EF bra nextLine_F0C8 XROM:F0D9 ; --------------------------------------------------------------------------- XROM:F0D9 XROM:F0D9 finish_F0D9: ; ... XROM:F0D9 DC 73 ldd scratch_73 ; get the last start of line we found and update start of screen XROM:F0DB FD 01 20 std curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F0DE XROM:F0DE leave_F0DE: ; ... XROM:F0DE 39 rts XROM:F0DE ; End of function updateStartPrevLine_F0B5 XROM:F0DE XROM:F0DF XROM:F0DF ; =============== S U B R O U T I N E ======================================= XROM:F0DF XROM:F0DF ; down arrow handler XROM:F0DF XROM:F0DF handleLineDown_F0DF: ; ... XROM:F0DF 96 6C ldaa lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F0E1 81 04 cmpa #4 ; is the cursor on the last line? will need to scroll up XROM:F0E3 26 0A bne easyNoScroll_F0EF XROM:F0E5 BD F0 FF jsr findDispNewLastLine_F0FF ; find start of fifth line (which will be new fourth line) XROM:F0E8 29 0D bvs satcpeof_F0F7 ; no more lines; saturate cursor to end-of-file XROM:F0EA BD F0 A8 jsr updateStartNextLine_F0A8 ; effectively, scroll up one line XROM:F0ED 20 03 bra leavok_F0F2 XROM:F0EF ; --------------------------------------------------------------------------- XROM:F0EF XROM:F0EF easyNoScroll_F0EF: ; ... XROM:F0EF 7C 00 6C inc lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F0F2 XROM:F0F2 leavok_F0F2: ; ... XROM:F0F2 BD F1 27 jsr fixupCurFileCPasPerRowCol_F127 ; XXX sync file cp ptr with row,col cp XROM:F0F5 0A clv XROM:F0F6 39 rts XROM:F0F7 ; --------------------------------------------------------------------------- XROM:F0F7 XROM:F0F7 satcpeof_F0F7: ; ... XROM:F0F7 FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F0FA FF 01 22 stx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F0FD 0B sev XROM:F0FE 39 rts XROM:F0FE ; End of function handleLineDown_F0DF XROM:F0FE XROM:F0FF XROM:F0FF ; =============== S U B R O U T I N E ======================================= XROM:F0FF XROM:F0FF ; find start of fifth line (which will be new fourth line) XROM:F0FF XROM:F0FF findDispNewLastLine_F0FF: ; ... XROM:F0FF FE 01 20 ldx curfileStartOfScreen_120 ; start at line 0 XROM:F102 BD F3 D5 jsr findNextLineStart_F3D5 ; find line 1 XROM:F105 29 0D bvs leave_F114 XROM:F107 BD F3 D5 jsr findNextLineStart_F3D5 ; find line 2 XROM:F10A 29 08 bvs leave_F114 XROM:F10C BD F3 D5 jsr findNextLineStart_F3D5 ; find line 3 XROM:F10F 29 03 bvs leave_F114 XROM:F111 BD F3 D5 jsr findNextLineStart_F3D5 ; find line 4 (currently offscreen) which will be new last line XROM:F114 XROM:F114 leave_F114: ; ... XROM:F114 39 rts ; (V will be set appropriately) XROM:F114 ; End of function findDispNewLastLine_F0FF XROM:F114 XROM:F115 XROM:F115 ; =============== S U B R O U T I N E ======================================= XROM:F115 XROM:F115 ; up arrow handler XROM:F115 XROM:F115 handleLineUp_F115: ; ... XROM:F115 96 6C ldaa lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F117 81 01 cmpa #1 XROM:F119 26 05 bne loc_F120 XROM:F11B BD F0 B5 jsr updateStartPrevLine_F0B5 ; update start of screen to previous line XROM:F11E 20 03 bra loc_F123 XROM:F120 ; --------------------------------------------------------------------------- XROM:F120 XROM:F120 loc_F120: ; ... XROM:F120 7A 00 6C dec lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F123 XROM:F123 loc_F123: ; ... XROM:F123 BD F1 27 jsr fixupCurFileCPasPerRowCol_F127 ; XXX sync file cp ptr with row,col cp XROM:F126 39 rts XROM:F126 ; End of function handleLineUp_F115 XROM:F126 XROM:F127 XROM:F127 ; =============== S U B R O U T I N E ======================================= XROM:F127 XROM:F127 ; XXX sync file cp ptr with row,col cp XROM:F127 XROM:F127 fixupCurFileCPasPerRowCol_F127: ; ... XROM:F127 FE 01 20 ldx curfileStartOfScreen_120 ; start X at start of screen XROM:F12A C6 01 ldab #1 ; start on line (row) 1 XROM:F12C XROM:F12C loop_F12C: ; ... XROM:F12C D1 6C cmpb lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F12E 27 0E beq cont_F13E ; this is us; carry on with fixing up column XROM:F130 5C incb ; next line XROM:F131 C1 05 cmpb #5 ; reached end? XROM:F133 27 35 beq leave_F16A XROM:F135 37 pshb XROM:F136 BD F3 D5 jsr findNextLineStart_F3D5 ; advance X to start of next line for next iteration XROM:F139 33 pulb XROM:F13A 29 02 bvs cont_F13E ; no more lines! XROM:F13C 20 EE bra loop_F12C XROM:F13E ; --------------------------------------------------------------------------- XROM:F13E XROM:F13E cont_F13E: ; ... XROM:F13E 3C pshx ; X is at start of line for row XROM:F13F 18 38 puly XROM:F141 D6 6B ldab lcdcpCol1_6B ; 1-relative LCD cursor pos col XROM:F143 5A decb ; make 0-relative XROM:F144 3A abx ; X now is at row,col XROM:F145 DF 4E stx scratchw_4E ; remember X at row,col XROM:F147 18 3C pshy XROM:F149 38 pulx XROM:F14A BD F3 D5 jsr findNextLineStart_F3D5 ; get start of line for subsequent row XROM:F14D 29 0B bvs fixupToEndOfFileMaybe_F15A ; no next line XROM:F14F 9C 4E cpx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:F151 23 04 bls fixupToStartOfNextLine_F157 ; start of next line less than computed as per row,col XROM:F153 DE 4E ldx scratchw_4E ; computed X at row,col is fine XROM:F155 20 0F bra leaveSave_F166 XROM:F157 ; --------------------------------------------------------------------------- XROM:F157 XROM:F157 fixupToStartOfNextLine_F157: ; ... XROM:F157 09 dex ; go one back to end of current line XROM:F158 20 0C bra leaveSave_F166 XROM:F15A ; --------------------------------------------------------------------------- XROM:F15A XROM:F15A fixupToEndOfFileMaybe_F15A: ; ... XROM:F15A DE 4E ldx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:F15C BC 01 24 cpx curfileEnd_124 ; see how computed location is relative to end of file XROM:F15F 25 05 bcs leaveSave_F166 ; less than end of file; OK as is XROM:F161 FE 01 24 ldx curfileEnd_124 ; saturate to end-of-file XROM:F164 20 00 bra *+2 ; (knumbskull 'break' in 'switch' for last 'case') XROM:F166 ; --------------------------------------------------------------------------- XROM:F166 XROM:F166 leaveSave_F166: ; ... XROM:F166 FF 01 22 stx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F169 39 rts XROM:F16A ; --------------------------------------------------------------------------- XROM:F16A XROM:F16A leave_F16A: ; ... XROM:F16A 39 rts XROM:F16A ; End of function fixupCurFileCPasPerRowCol_F127 XROM:F16A XROM:F16B XROM:F16B ; =============== S U B R O U T I N E ======================================= XROM:F16B XROM:F16B ; set cursor to start-of-file XROM:F16B XROM:F16B handleHome_F16B: ; ... XROM:F16B FC 01 28 ldd curFileRgnFirst_128 ; this file; file region start addr XROM:F16E FD 01 22 std curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F171 FD 01 20 std curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F174 39 rts XROM:F174 ; End of function handleHome_F16B XROM:F174 XROM:F175 XROM:F175 ; =============== S U B R O U T I N E ======================================= XROM:F175 XROM:F175 ; End key handler XROM:F175 XROM:F175 handleEnd_F175: ; ... XROM:F175 FE 01 20 ldx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F178 DF 4C stx scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F17A DF 4E stx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:F17C DF 50 stx scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F17E DF 52 stx scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:F180 FE 01 20 ldx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F183 XROM:F183 loc_F183: ; ... XROM:F183 BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F186 29 19 bvs loc_F1A1 XROM:F188 DF 4C stx scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F18A BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F18D 29 16 bvs loc_F1A5 XROM:F18F DF 4E stx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:F191 BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F194 29 13 bvs loc_F1A9 XROM:F196 DF 50 stx scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F198 BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F19B 29 10 bvs loc_F1AD XROM:F19D DF 52 stx scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:F19F 20 E2 bra loc_F183 XROM:F1A1 ; --------------------------------------------------------------------------- XROM:F1A1 XROM:F1A1 loc_F1A1: ; ... XROM:F1A1 DE 4C ldx scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F1A3 20 0A bra loc_F1AF XROM:F1A5 ; --------------------------------------------------------------------------- XROM:F1A5 XROM:F1A5 loc_F1A5: ; ... XROM:F1A5 DE 4E ldx scratchw_4E ; scratch; /this/ keyboard scan column mask (rectus) XROM:F1A7 20 06 bra loc_F1AF XROM:F1A9 ; --------------------------------------------------------------------------- XROM:F1A9 XROM:F1A9 loc_F1A9: ; ... XROM:F1A9 DE 50 ldx scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F1AB 20 02 bra loc_F1AF XROM:F1AD ; --------------------------------------------------------------------------- XROM:F1AD XROM:F1AD loc_F1AD: ; ... XROM:F1AD DE 52 ldx scratchbyw_52 ; scratch XXX stow ps2 codes; DB01 when 'reset stuff' XROM:F1AF XROM:F1AF loc_F1AF: ; ... XROM:F1AF FF 01 20 stx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F1B2 FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F1B5 FF 01 22 stx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F1B8 0B sev XROM:F1B9 39 rts XROM:F1B9 ; End of function handleEnd_F175 XROM:F1B9 XROM:F1BA XROM:F1BA ; =============== S U B R O U T I N E ======================================= XROM:F1BA XROM:F1BA ; delete a byte in the file at the current position XROM:F1BA XROM:F1BA handleDeleteChar_F1BA: ; ... XROM:F1BA FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F1BD BC 01 28 cpx curFileRgnFirst_128 ; this file; file region start addr XROM:F1C0 27 2B beq leave_F1ED ; if the file is empty, leave XROM:F1C2 FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F1C5 BC 01 28 cpx curFileRgnFirst_128 ; this file; file region start addr XROM:F1C8 27 23 beq leave_F1ED ; if the cursor position is at the start, leave XROM:F1CA BD F1 EE jsr handleCurPosM1_F1EE ; cur file cursor pos ptr -= 1 XROM:F1CD FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F1D0 DF 4C stx scratchby_4C ; remember cur file end ptr XROM:F1D2 FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F1D5 BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:F1D8 XROM:F1D8 loop_F1D8: ; ... XROM:F1D8 9C 4C cpx scratchby_4C ; is it the original current file end pointer? XROM:F1DA 2A 07 bpl shortenFileBy1Char_F1E3 ; leave if we got there XROM:F1DC E6 01 ldab 1,x XROM:F1DE E7 00 stab 0,x ; move char down XROM:F1E0 08 inx XROM:F1E1 20 F5 bra loop_F1D8 ; keep going until done XROM:F1E3 ; --------------------------------------------------------------------------- XROM:F1E3 XROM:F1E3 shortenFileBy1Char_F1E3: ; ... XROM:F1E3 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F1E6 FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F1E9 09 dex XROM:F1EA FF 01 24 stx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F1ED XROM:F1ED leave_F1ED: ; ... XROM:F1ED 39 rts XROM:F1ED ; End of function handleDeleteChar_F1BA XROM:F1ED XROM:F1EE XROM:F1EE ; =============== S U B R O U T I N E ======================================= XROM:F1EE XROM:F1EE ; cur file cursor pos ptr -= 1 XROM:F1EE XROM:F1EE handleCurPosM1_F1EE: ; ... XROM:F1EE FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F1F1 BC 01 28 cpx curFileRgnFirst_128 ; this file; file region start addr XROM:F1F4 27 0F beq leave_F205 ; if cursor pointer at start of file; leave XROM:F1F6 BC 01 20 cpx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F1F9 22 03 bhi cont_F1FE ; if its on the screen somewhere other than the first char; simply decrement XROM:F1FB BD F0 B5 jsr updateStartPrevLine_F0B5 ; otherwise, set start of screen to previous line, then decrement XROM:F1FE XROM:F1FE cont_F1FE: ; ... XROM:F1FE FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F201 09 dex XROM:F202 FF 01 22 stx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F205 XROM:F205 leave_F205: ; ... XROM:F205 39 rts XROM:F205 ; End of function handleCurPosM1_F1EE XROM:F205 XROM:F206 XROM:F206 ; =============== S U B R O U T I N E ======================================= XROM:F206 XROM:F206 ; cur file cursor pos ptr += 1 XROM:F206 XROM:F206 handleCurPosP1_F206: ; ... XROM:F206 FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F209 BC 01 24 cpx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F20C 27 0F beq leave_F21D ; if the insertion point is at the end, there's nothing to do XROM:F20E BD F2 1E jsr checkNeedScrollDown_F21E ; see if we need to scroll screen for increment cursor pos. V set if we do; clear otherwise. XROM:F211 28 03 bvc cont_F216 ; skip the scroll XROM:F213 BD F0 A8 jsr updateStartNextLine_F0A8 ; need to scroll window up a line XROM:F216 XROM:F216 cont_F216: ; ... XROM:F216 FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F219 08 inx XROM:F21A FF 01 22 stx curfileCurPosPtr_122 ; bump the insertion point XROM:F21D XROM:F21D leave_F21D: ; ... XROM:F21D 39 rts XROM:F21D ; End of function handleCurPosP1_F206 XROM:F21D XROM:F21E XROM:F21E ; =============== S U B R O U T I N E ======================================= XROM:F21E XROM:F21E ; see if we need to scroll screen for increment cursor pos. V set if we do; clear otherwise. XROM:F21E XROM:F21E checkNeedScrollDown_F21E: ; ... XROM:F21E FE 01 20 ldx curfileStartOfScreen_120 ; start at start-of-screen XROM:F221 BD F3 D5 jsr findNextLineStart_F3D5 ; find second line XROM:F224 29 2E bvs leaveNoScroll_F254 ; (no second display line) XROM:F226 BC 01 22 cpx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F229 22 29 bhi leaveNoScroll_F254 ; (second line is after cursor pos) XROM:F22B BD F3 D5 jsr findNextLineStart_F3D5 ; find third line XROM:F22E 29 24 bvs leaveNoScroll_F254 ; (no third line) XROM:F230 BC 01 22 cpx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F233 22 1F bhi leaveNoScroll_F254 ; (third line is after cursor pos) XROM:F235 BD F3 D5 jsr findNextLineStart_F3D5 ; find fourth line XROM:F238 29 1A bvs leaveNoScroll_F254 ; (no fourth line) XROM:F23A BC 01 22 cpx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F23D 22 15 bhi leaveNoScroll_F254 ; (fourth line is after cursor pos) XROM:F23F BD F3 D5 jsr findNextLineStart_F3D5 ; find fifth line XROM:F242 29 08 bvs maybe_F24C ; (no fifth line) XROM:F244 09 dex ; back one up to end of fourth line XROM:F245 BC 01 22 cpx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F248 22 0A bhi leaveNoScroll_F254 ; (cusor pos is before end of fourth line) XROM:F24A XROM:F24A leaveYesScroll_F24A: ; ... XROM:F24A 0B sev XROM:F24B 39 rts XROM:F24C ; --------------------------------------------------------------------------- XROM:F24C XROM:F24C maybe_F24C: ; ... XROM:F24C FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F24F BC 01 24 cpx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F252 27 F6 beq leaveYesScroll_F24A XROM:F254 XROM:F254 leaveNoScroll_F254: ; ... XROM:F254 0A clv XROM:F255 39 rts XROM:F255 ; End of function checkNeedScrollDown_F21E XROM:F255 XROM:F256 XROM:F256 ; =============== S U B R O U T I N E ======================================= XROM:F256 XROM:F256 ; set LCD cursor position from the (row,col) @ (6c,6b) XROM:F256 XROM:F256 setLCDcp_F256: ; ... XROM:F256 86 28 ldaa #40 ; (char per line) XROM:F258 D6 6C ldab lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F25A 5A decb ; (0-relative) XROM:F25B 3D mul XROM:F25C DB 6B addb lcdcpCol1_6B ; 1-relative LCD cursor pos col XROM:F25E 5A decb ; (0-relative); row*40+col XROM:F25F 14 5B 01 bset lcdCtlLineState_5B 1 ; set OC2,OC1 to 11; 'set cursor address' XROM:F262 14 5B 02 bset lcdCtlLineState_5B 2 ; (could have set them both at once, but hey) XROM:F265 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F268 15 5B 01 bclr lcdCtlLineState_5B 1 ; return OC2,1 to 10; 'data' XROM:F26B 39 rts XROM:F26B ; End of function setLCDcp_F256 XROM:F26B XROM:F26C XROM:F26C ; =============== S U B R O U T I N E ======================================= XROM:F26C XROM:F26C ; XXX send file ADB? XROM:F26C XROM:F26C sub_F26C: ; ... XROM:F26C 13 4A 01 4E brclr byte_4A 1 loc_F2BE ; XXX flag? XROM:F270 12 6D 01 12 brset byte_6D 1 loc_F286 ; XXX flag? is file sending??? XROM:F274 XROM:F274 loc_F274: ; ... XROM:F274 BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:F277 29 58 bvs loc_F2D1 XROM:F279 BD F4 82 jsr scanCodeToADB_F482 ; translate scan code to ADB code, preserving high bit XROM:F27C 29 F6 bvs loc_F274 XROM:F27E 97 50 staa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F280 86 FF ldaa #$FF XROM:F282 97 51 staa byte_51 XROM:F284 20 35 bra loc_F2BB XROM:F286 ; --------------------------------------------------------------------------- XROM:F286 XROM:F286 loc_F286: ; ... XROM:F286 12 A2 01 08 brset byte_A2 1 loc_F292 ; XXX flag? cleared in file sending??? XROM:F28A CC B8 B9 ldd #$B8B9 XROM:F28D 14 A2 FF bset byte_A2 $FF ; XXX flag? cleared in file sending??? XROM:F290 20 27 bra loc_F2B9 XROM:F292 ; --------------------------------------------------------------------------- XROM:F292 XROM:F292 loc_F292: ; ... XROM:F292 96 50 ldaa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F294 85 80 bita #$80 ; '€' XROM:F296 27 2B beq loc_F2C3 XROM:F298 12 8C 01 35 brset byte_8C 1 loc_F2D1 ; XXX flag? XROM:F29C BD F4 3E jsr getNextCharToSendXlatADB_F43E ; get next char to send and translate (ADB); V set if no char XROM:F29F 29 30 bvs loc_F2D1 XROM:F2A1 14 54 04 bset flagby_54 4 ; b2 = 1 when sending shift; XXX FFFF when 'reset stuff' XROM:F2A4 85 80 bita #$80 ; '€' XROM:F2A6 27 0A beq loc_F2B2 XROM:F2A8 84 7F anda #$7F ; '' XROM:F2AA 97 51 staa byte_51 XROM:F2AC C6 38 ldab #$38 ; '8' XROM:F2AE D7 50 stab scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F2B0 20 09 bra loc_F2BB XROM:F2B2 ; --------------------------------------------------------------------------- XROM:F2B2 XROM:F2B2 loc_F2B2: ; ... XROM:F2B2 15 54 04 bclr flagby_54 4 ; b2 = 1 when sending shift; XXX FFFF when 'reset stuff' XROM:F2B5 84 7F anda #$7F ; '' XROM:F2B7 C6 FF ldab #$FF XROM:F2B9 XROM:F2B9 loc_F2B9: ; ... XROM:F2B9 DD 50 std scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F2BB XROM:F2BB loc_F2BB: ; ... XROM:F2BB 7F 00 4A clr byte_4A ; XXX flag? XROM:F2BE XROM:F2BE loc_F2BE: ; ... XROM:F2BE 14 58 FF bset byte_58 $FF ; XXX flag? XROM:F2C1 0A clv XROM:F2C2 39 rts XROM:F2C3 ; --------------------------------------------------------------------------- XROM:F2C3 XROM:F2C3 loc_F2C3: ; ... XROM:F2C3 14 50 80 bset scratchby_50 $80 ; '€' ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F2C6 14 51 80 bset byte_51 $80 ; '€' XROM:F2C9 7F 00 4A clr byte_4A ; XXX flag? XROM:F2CC 14 58 FF bset byte_58 $FF ; XXX flag? XROM:F2CF 0A clv XROM:F2D0 39 rts XROM:F2D1 ; --------------------------------------------------------------------------- XROM:F2D1 XROM:F2D1 loc_F2D1: ; ... XROM:F2D1 7F 00 58 clr byte_58 ; XXX flag? XROM:F2D4 0B sev XROM:F2D5 39 rts XROM:F2D5 ; End of function sub_F26C XROM:F2D5 XROM:F2D6 XROM:F2D6 ; =============== S U B R O U T I N E ======================================= XROM:F2D6 XROM:F2D6 ; XXX ADB related? XROM:F2D6 XROM:F2D6 sub_F2D6: ; ... XROM:F2D6 13 4A 01 14 brclr byte_4A 1 loc_F2EE ; XXX flag? XROM:F2DA BD F4 60 jsr getNextCharToSend_F460 ; get next char to send in A; V set if no more chars to send, clear if valid XROM:F2DD 29 14 bvs loc_F2F3 XROM:F2DF 7F 00 8D clr byte_8D ; XXX flag? XROM:F2E2 97 50 staa scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F2E4 BD F4 60 jsr getNextCharToSend_F460 ; get next char to send in A; V set if no more chars to send, clear if valid XROM:F2E7 29 11 bvs loc_F2FA XROM:F2E9 97 51 staa byte_51 XROM:F2EB XROM:F2EB loc_F2EB: ; ... XROM:F2EB 7F 00 4A clr byte_4A ; XXX flag? XROM:F2EE XROM:F2EE loc_F2EE: ; ... XROM:F2EE 14 8C FF bset byte_8C $FF ; XXX flag? XROM:F2F1 0A clv XROM:F2F2 39 rts XROM:F2F3 ; --------------------------------------------------------------------------- XROM:F2F3 XROM:F2F3 loc_F2F3: ; ... XROM:F2F3 12 8D 01 0B brset byte_8D 1 loc_F302 ; XXX flag? XROM:F2F7 7F 00 50 clr scratchby_50 ; scratch, keycode code when sending file XXX 8F02 when 'reset stuff' XROM:F2FA XROM:F2FA loc_F2FA: ; ... XROM:F2FA 7F 00 51 clr byte_51 XROM:F2FD 14 8D FF bset byte_8D $FF ; XXX flag? XROM:F300 20 E9 bra loc_F2EB XROM:F302 ; --------------------------------------------------------------------------- XROM:F302 XROM:F302 loc_F302: ; ... XROM:F302 7F 00 8C clr byte_8C ; XXX flag? XROM:F305 0B sev XROM:F306 39 rts XROM:F306 ; End of function sub_F2D6 XROM:F306 XROM:F307 XROM:F307 ; =============== S U B R O U T I N E ======================================= XROM:F307 XROM:F307 ; insert char A onto current file; V set if fail, clear on success XROM:F307 XROM:F307 insertCharToFile_F307: ; ... XROM:F307 FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F30A BC 01 26 cpx curFileRgnLast_126 ; this file; file region end addr (inclusive) XROM:F30D 27 42 beq leaveFileFull_F351 XROM:F30F FE 01 22 ldx curfileCurPosPtr_122 ; this file; cursor position ptr .0 XROM:F312 BC 01 24 cpx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F315 26 0C bne scootchFileUp_F323 ; if inserting into the middle, we have to scootch things up XROM:F317 FE 01 22 ldx curfileCurPosPtr_122 ; (did we really need to load it again?) XROM:F31A 36 psha XROM:F31B BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:F31E 32 pula XROM:F31F A7 00 staa 0,x XROM:F321 20 1F bra finishUp_F342 XROM:F323 ; --------------------------------------------------------------------------- XROM:F323 XROM:F323 scootchFileUp_F323: ; ... XROM:F323 36 psha ; save char to insert for later XROM:F324 FE 01 22 ldx curfileCurPosPtr_122 ; (did we really need to load it again?) XROM:F327 DF 46 stx scratchw_46 ; save insert point in scratch var XROM:F329 FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F32C BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:F32F XROM:F32F loop_F32F: ; ... XROM:F32F EC 00 ldd 0,x ; get two chars XROM:F331 ED 01 std 1,x ; store back up one byte XROM:F333 09 dex XROM:F334 09 dex ; bump down twice since we're doing two chars at a time XROM:F335 9C 46 cpx scratchw_46 ; are we at the insertion point? XROM:F337 2A F6 bpl loop_F32F ; keep going if not XROM:F339 DE 46 ldx scratchw_46 ; get back the insertion point XROM:F33B A6 00 ldaa 0,x XROM:F33D A7 01 staa 1,x ; do the last odd char XROM:F33F 32 pula ; get back char to insert XROM:F340 A7 00 staa 0,x ; /now/ stick the char in XROM:F342 XROM:F342 finishUp_F342: ; ... XROM:F342 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F345 FE 01 24 ldx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F348 08 inx XROM:F349 FF 01 24 stx curfileEnd_124 ; increment cur file end pointer XROM:F34C BD F2 06 jsr handleCurPosP1_F206 ; cur file cursor pos ptr += 1 XROM:F34F 0A clv ; clear V for success XROM:F350 39 rts XROM:F351 ; --------------------------------------------------------------------------- XROM:F351 XROM:F351 leaveFileFull_F351: ; ... XROM:F351 BD F3 56 jsr showFileFull_F356 ; show File Full message XROM:F354 0B sev ; set V for fail XROM:F355 39 rts XROM:F355 ; End of function insertCharToFile_F307 XROM:F355 XROM:F356 XROM:F356 ; =============== S U B R O U T I N E ======================================= XROM:F356 XROM:F356 ; show File Full message XROM:F356 XROM:F356 showFileFull_F356: ; ... XROM:F356 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:F359 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:F35C CE FD 29 ldx #aFileIsFull_Use ; "File is full. Use another file or" XROM:F35F BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F362 BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:F365 CE FD 4C ldx #aSendDataToYour ; "send data to your computer." XROM:F368 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F36B 86 05 ldaa #5 ; delay ~ 3 sec XROM:F36D XROM:F36D delay_F36D: ; ... XROM:F36D BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:F370 4A deca XROM:F371 26 FA bne delay_F36D XROM:F373 39 rts XROM:F373 ; End of function showFileFull_F356 XROM:F373 XROM:F374 XROM:F374 ; =============== S U B R O U T I N E ======================================= XROM:F374 XROM:F374 ; re-paint LCD for current file state XROM:F374 XROM:F374 displayCurFile_F374: ; ... XROM:F374 BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:F377 FE 01 20 ldx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F37A BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F37D DF 4E stx scratchw_4E ; save start of /next/ line XROM:F37F FE 01 20 ldx curfileStartOfScreen_120 ; this file; current file screen start ptr .2 XROM:F382 86 01 ldaa #1 XROM:F384 97 4C staa scratchby_4C ; (used for tracking row) XROM:F386 XROM:F386 loopLine_F386: ; ... XROM:F386 86 01 ldaa #1 XROM:F388 97 60 staa scratchby_60 ; (used for tracking col) XROM:F38A XROM:F38A loopChar_F38A: ; ... XROM:F38A BC 01 22 cpx curfileCurPosPtr_122 ; is this char at the insertion point? remember (row,col) for it XROM:F38D 26 08 bne cont_F397 ; nope; keep spewing chars XROM:F38F 96 4C ldaa scratchby_4C ; row XROM:F391 97 6C staa lcdcpRow1_6C ; 1-relative LCD cursor pos row XROM:F393 96 60 ldaa scratchby_60 ; col XROM:F395 97 6B staa lcdcpCol1_6B ; 1-relative LCD cursor pos col XROM:F397 XROM:F397 cont_F397: ; ... XROM:F397 BC 01 24 cpx curfileEnd_124 ; finished entire file? leave XROM:F39A 27 2A beq showCapLockLeave_F3C6 XROM:F39C BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:F39F A6 00 ldaa 0,x ; get char in file XROM:F3A1 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F3A4 BD F6 2D jsr xlatShowChar_F62D ; put it on the LCD (cp will advance automatically) XROM:F3A7 08 inx ; next char XROM:F3A8 7C 00 60 inc scratchby_60 ; next col XROM:F3AB 9C 4E cpx scratchw_4E ; is it now at the start of the next display line? XROM:F3AD 26 DB bne loopChar_F38A ; nope; keep spewing chars XROM:F3AF 96 4C ldaa scratchby_4C ; row XROM:F3B1 81 04 cmpa #4 ; was this the 4th (last) line? leave if so XROM:F3B3 27 11 beq showCapLockLeave_F3C6 XROM:F3B5 7C 00 4C inc scratchby_4C ; next row XROM:F3B8 3C pshx ; save file ptr while we fiddle with things XROM:F3B9 BD F4 2E jsr lcdSetCPatLineA ; set LCD cursor position at start of line A XROM:F3BC DE 4E ldx scratchw_4E ; get the last end-of-line and hunt for next end-of-line XROM:F3BE BD F3 D5 jsr findNextLineStart_F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F3C1 DF 4E stx scratchw_4E ; save the next end-of-line XROM:F3C3 38 pulx ; restore file ptr while we continue on the next line XROM:F3C4 20 C0 bra loopLine_F386 XROM:F3C6 ; --------------------------------------------------------------------------- XROM:F3C6 XROM:F3C6 showCapLockLeave_F3C6: ; ... XROM:F3C6 13 A1 01 0A brclr bCapsLock_A1 1 leave_F3D4 ; flag; CAPS lock in effect XROM:F3CA C6 9F ldab #159 ; cursor at end of screen XROM:F3CC BD F7 60 jsr commonSetCursorPosB_F760 ; common set cursor position (abs pos in B) XROM:F3CF C6 0F ldab #$F ; solid block char XROM:F3D1 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F3D4 XROM:F3D4 leave_F3D4: ; ... XROM:F3D4 39 rts XROM:F3D4 ; End of function displayCurFile_F374 XROM:F3D4 XROM:F3D5 XROM:F3D5 ; =============== S U B R O U T I N E ======================================= XROM:F3D5 XROM:F3D5 ; find start of next display line considering breaking chars; X = cur file.2; V if no more lines; clear if next line start valid XROM:F3D5 XROM:F3D5 findNextLineStart_F3D5: ; ... XROM:F3D5 DF 44 stx scratchw_44 ; save original ptr for later XROM:F3D7 86 28 ldaa #40 ; have to break at 40 char; end of LCD line XROM:F3D9 97 48 staa scratchby_48 ; XXX column counter; 100/40 (40 for LCD) XROM:F3DB 18 FE 01 24 ldy curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F3DF 18 DF 42 sty scratchw_42 ; XXX scratch XROM:F3E2 BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:F3E5 XROM:F3E5 loop_F3E5: ; ... XROM:F3E5 9C 42 cpx scratchw_42 ; EOF? XROM:F3E7 27 2A beq leaveEOF_F413 XROM:F3E9 A6 00 ldaa 0,x XROM:F3EB 81 0D cmpa #$D ; CR? XROM:F3ED 27 1E beq breakLocDetermined_F40D XROM:F3EF 7A 00 48 dec scratchby_48 ; XXX column counter; 100/40 (40 for LCD) XROM:F3F2 27 03 beq eolOnBreakingChar_F3F7 ; didn't find CR before the 40th column XROM:F3F4 08 inx ; next XROM:F3F5 20 EE bra loop_F3E5 XROM:F3F7 ; --------------------------------------------------------------------------- XROM:F3F7 XROM:F3F7 eolOnBreakingChar_F3F7: ; ... XROM:F3F7 BD F4 1A jsr isLineBreakChar_F41A ; if the last char is the line break char, we'll consider it done XROM:F3FA 29 11 bvs breakLocDetermined_F40D XROM:F3FC XROM:F3FC loop_F3FC: ; ... XROM:F3FC 09 dex ; whizz backwards to try to find the last breaking char XROM:F3FD A6 00 ldaa 0,x XROM:F3FF BD F4 1A jsr isLineBreakChar_F41A ; test if break chars (cr, tab, space, hyphen); V set = yes, clear no XROM:F402 29 09 bvs breakLocDetermined_F40D XROM:F404 9C 44 cpx scratchw_44 ; ...up to the original start-of-line XROM:F406 26 F4 bne loop_F3FC XROM:F408 DE 44 ldx scratchw_44 ; couldn't find one, so just force break at 40th col XROM:F40A C6 27 ldab #39 XROM:F40C 3A abx XROM:F40D XROM:F40D breakLocDetermined_F40D: ; ... XROM:F40D BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F410 08 inx ; next char is start of next display line XROM:F411 0A clv ; start of next display line computed XROM:F412 39 rts XROM:F413 ; --------------------------------------------------------------------------- XROM:F413 XROM:F413 leaveEOF_F413: ; ... XROM:F413 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F416 DE 44 ldx scratchw_44 ; restore original ptr XROM:F418 0B sev ; no more lines XROM:F419 39 rts XROM:F419 ; End of function findNextLineStart_F3D5 XROM:F419 XROM:F41A XROM:F41A ; =============== S U B R O U T I N E ======================================= XROM:F41A XROM:F41A ; test if break chars (cr, tab, space, hyphen); V set = yes, clear no XROM:F41A XROM:F41A isLineBreakChar_F41A: ; ... XROM:F41A 81 0D cmpa #$D XROM:F41C 27 0E beq leaveyes_F42C XROM:F41E 81 09 cmpa #9 XROM:F420 27 0A beq leaveyes_F42C XROM:F422 81 20 cmpa #' ' XROM:F424 27 06 beq leaveyes_F42C XROM:F426 81 2D cmpa #'-' XROM:F428 27 02 beq leaveyes_F42C XROM:F42A 0A clv XROM:F42B 39 rts XROM:F42C ; --------------------------------------------------------------------------- XROM:F42C XROM:F42C leaveyes_F42C: ; ... XROM:F42C 0B sev XROM:F42D 39 rts XROM:F42D ; End of function isLineBreakChar_F41A XROM:F42D XROM:F42E XROM:F42E ; =============== S U B R O U T I N E ======================================= XROM:F42E XROM:F42E ; set LCD cursor position at start of line A XROM:F42E XROM:F42E lcdSetCPatLineA: ; ... XROM:F42E C6 28 ldab #40 XROM:F430 3D mul XROM:F431 14 5B 01 bset lcdCtlLineState_5B 1 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F434 14 5B 02 bset lcdCtlLineState_5B 2 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F437 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F43A 15 5B 01 bclr lcdCtlLineState_5B 1 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F43D 39 rts XROM:F43D ; End of function lcdSetCPatLineA XROM:F43D XROM:F43E XROM:F43E ; =============== S U B R O U T I N E ======================================= XROM:F43E XROM:F43E ; get next char to send and translate (ADB); V set if no char XROM:F43E XROM:F43E getNextCharToSendXlatADB_F43E: ; ... XROM:F43E 8D 20 bsr getNextCharToSend_F460 ; get next char to send in A; V set if no more chars to send, clear if valid XROM:F440 29 0C bvs leave_F44E XROM:F442 81 09 cmpa #9 ; TAB? XROM:F444 27 09 beq tab_F44F XROM:F446 81 0D cmpa #$D ; Return? XROM:F448 27 09 beq return_F453 XROM:F44A BD F4 AA jsr xlatASCIItoADB_F4AA ; translate printable ASCII 20-7f to Apple ADB key code XROM:F44D XROM:F44D leaveSuccess_F44D: ; ... XROM:F44D 0A clv XROM:F44E XROM:F44E leave_F44E: ; ... XROM:F44E 39 rts XROM:F44F ; --------------------------------------------------------------------------- XROM:F44F XROM:F44F tab_F44F: ; ... XROM:F44F 86 30 ldaa #$30 ; manually translate tab to 0x30 XROM:F451 20 FA bra leaveSuccess_F44D XROM:F453 ; --------------------------------------------------------------------------- XROM:F453 XROM:F453 return_F453: ; ... XROM:F453 86 24 ldaa #$24 ; manually translate return to 0x24 XROM:F455 20 F6 bra leaveSuccess_F44D XROM:F455 ; End of function getNextCharToSendXlatADB_F43E XROM:F455 XROM:F457 XROM:F457 ; =============== S U B R O U T I N E ======================================= XROM:F457 XROM:F457 ; get next char to send and translate (PS/2); V set if no char XROM:F457 XROM:F457 getNextCharToSendXlatPS2_F457: ; ... XROM:F457 8D 07 bsr getNextCharToSend_F460 ; get next char to send in A; V set if no more chars to send, clear if valid XROM:F459 29 04 bvs leave_F45F XROM:F45B BD F4 B6 jsr xlatASCIItoPS2_F4B6 ; ASCII to PS/2 code. high bit set if shifted. XROM:F45E 0A clv XROM:F45F XROM:F45F leave_F45F: ; ... XROM:F45F 39 rts XROM:F45F ; End of function getNextCharToSendXlatPS2_F457 XROM:F45F XROM:F460 XROM:F460 ; =============== S U B R O U T I N E ======================================= XROM:F460 XROM:F460 ; get next char to send in A; V set if no more chars to send, clear if valid XROM:F460 XROM:F460 getNextCharToSend_F460: ; ... XROM:F460 DE 67 ldx pNextCharToSend_67 ; file sending related? ptr to next char to send XROM:F462 BC 01 24 cpx curfileEnd_124 ; this file; current file ptr end char (one past last) .4 XROM:F465 27 15 beq leaveDone_F47C ; finished XROM:F467 BD EC 80 jsr selectRAMpageForFile_EC80 ; select in the relevant RAM page based on file number (byte_15D) XROM:F46A A6 00 ldaa 0,x ; get char for file XROM:F46C BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F46F 08 inx XROM:F470 DF 67 stx pNextCharToSend_67 ; update send pointer XROM:F472 81 09 cmpa #9 ; ascii < 9 translates to '?' XROM:F474 2D 08 blt translateUnusual_F47E XROM:F476 85 80 bita #$80 ; high ascii translates to '?' XROM:F478 26 04 bne translateUnusual_F47E XROM:F47A XROM:F47A leaveValid_F47A: ; ... XROM:F47A 0A clv XROM:F47B 39 rts XROM:F47C ; --------------------------------------------------------------------------- XROM:F47C XROM:F47C leaveDone_F47C: ; ... XROM:F47C 0B sev XROM:F47D 39 rts XROM:F47E ; --------------------------------------------------------------------------- XROM:F47E XROM:F47E translateUnusual_F47E: ; ... XROM:F47E 86 3F ldaa #'?' XROM:F480 20 F8 bra leaveValid_F47A XROM:F480 ; End of function getNextCharToSend_F460 XROM:F480 XROM:F482 XROM:F482 ; =============== S U B R O U T I N E ======================================= XROM:F482 XROM:F482 ; translate scan code to ADB code, preserving high bit XROM:F482 XROM:F482 scanCodeToADB_F482: ; ... XROM:F482 85 80 bita #$80 ; remember high bit status (using byte_71 scratch var) for later XROM:F484 27 05 beq cont_F48B XROM:F486 14 71 FF bset byte_71 $FF ; scratch; prev row scan mask, this col; sometimes flag XROM:F489 20 03 bra cont_F48E XROM:F48B ; --------------------------------------------------------------------------- XROM:F48B XROM:F48B cont_F48B: ; ... XROM:F48B 7F 00 71 clr byte_71 ; scratch; prev row scan mask, this col; sometimes flag XROM:F48E XROM:F48E cont_F48E: ; ... XROM:F48E 84 7F anda #$7F ; mask off high bit in key scan code XROM:F490 16 tab XROM:F491 4F clra XROM:F492 05 lsld XROM:F493 05 lsld ; effectively scan code *= 4 XROM:F494 C3 F8 C5 addd #scanCodeStructs_F8C5 ; 128 4-byte structures per scan code (0xFF in +0 means invalid) XROM:F497 8F xgdx ; X is now scan code structure pointer XROM:F498 A6 00 ldaa 0,x ; F8C5[].0 XROM:F49A 81 FF cmpa #$FF XROM:F49C 27 08 beq invalidKey_F4A6 XROM:F49E 13 71 01 02 brclr byte_71 1 loc_F4A4 ; restore high bit state XROM:F4A2 8A 80 oraa #$80 XROM:F4A4 XROM:F4A4 loc_F4A4: ; ... XROM:F4A4 0A clv XROM:F4A5 39 rts XROM:F4A6 ; --------------------------------------------------------------------------- XROM:F4A6 XROM:F4A6 invalidKey_F4A6: ; ... XROM:F4A6 86 2A ldaa #$2A ; '*' XROM:F4A8 0B sev XROM:F4A9 39 rts XROM:F4A9 ; End of function scanCodeToADB_F482 XROM:F4A9 XROM:F4AA XROM:F4AA ; =============== S U B R O U T I N E ======================================= XROM:F4AA XROM:F4AA ; translate printable ASCII 20-7f to Apple ADB key code XROM:F4AA XROM:F4AA xlatASCIItoADB_F4AA: ; ... XROM:F4AA 84 7F anda #$7F ; reset high bit XROM:F4AC 80 20 suba #' ' ; offset to space = 0 XROM:F4AE CE FA C5 ldx #byte_FAC5 ; index into here XROM:F4B1 16 tab XROM:F4B2 3A abx XROM:F4B3 A6 00 ldaa 0,x XROM:F4B5 39 rts XROM:F4B5 ; End of function xlatASCIItoADB_F4AA XROM:F4B5 XROM:F4B6 XROM:F4B6 ; =============== S U B R O U T I N E ======================================= XROM:F4B6 XROM:F4B6 ; ASCII to PS/2 code. high bit set if shifted. XROM:F4B6 XROM:F4B6 xlatASCIItoPS2_F4B6: ; ... XROM:F4B6 84 7F anda #$7F ; reset high bit XROM:F4B8 CE F8 C5 ldx #scanCodeStructs_F8C5 ; 128 4-byte structures per scan code (0xFF in +0 means invalid) XROM:F4BB XROM:F4BB loop_F4BB: ; ... XROM:F4BB 8C FA C5 cpx #byte_FAC5 ; (end of array) XROM:F4BE 27 18 beq notfound_F4D8 XROM:F4C0 A1 02 cmpa 2,x ; match either lower case XROM:F4C2 27 0A beq matchLower_F4CE XROM:F4C4 A1 03 cmpa 3,x ; or upper case XROM:F4C6 27 0A beq matchUpper_F4D2 XROM:F4C8 08 inx XROM:F4C9 08 inx XROM:F4CA 08 inx XROM:F4CB 08 inx ; next struct... XROM:F4CC 20 ED bra loop_F4BB XROM:F4CE ; --------------------------------------------------------------------------- XROM:F4CE XROM:F4CE matchLower_F4CE: ; ... XROM:F4CE A6 01 ldaa 1,x ; +1 is PS/2 base scan code XROM:F4D0 20 04 bra cont_F4D6 XROM:F4D2 ; --------------------------------------------------------------------------- XROM:F4D2 XROM:F4D2 matchUpper_F4D2: ; ... XROM:F4D2 A6 01 ldaa 1,x ; +1 is PS/2 base scan code XROM:F4D4 8A 80 oraa #$80 XROM:F4D6 XROM:F4D6 cont_F4D6: ; ... XROM:F4D6 0A clv XROM:F4D7 39 rts XROM:F4D8 ; --------------------------------------------------------------------------- XROM:F4D8 XROM:F4D8 notfound_F4D8: ; ... XROM:F4D8 86 4A ldaa #$4A ; (PS/2 code for '/?') XROM:F4DA 0B sev XROM:F4DB 39 rts XROM:F4DB ; End of function xlatASCIItoPS2_F4B6 XROM:F4DB XROM:F4DC XROM:F4DC ; =============== S U B R O U T I N E ======================================= XROM:F4DC XROM:F4DC ; scan code to PS/2, no shift consideration XROM:F4DC XROM:F4DC scanCodetoPS2_F4DC: ; ... XROM:F4DC 84 7F anda #$7F ; reset high bit XROM:F4DE 16 tab XROM:F4DF 4F clra XROM:F4E0 05 lsld XROM:F4E1 05 lsld XROM:F4E2 C3 F8 C5 addd #scanCodeStructs_F8C5 ; 128 4-byte structures per scan code (0xFF in +0 means invalid) XROM:F4E5 8F xgdx ; X is scan code struct for scan code originally in A XROM:F4E6 A6 01 ldaa 1,x ; +1 is PS/2 base scan code XROM:F4E8 39 rts XROM:F4E8 ; End of function scanCodetoPS2_F4DC XROM:F4E8 XROM:F4E9 XROM:F4E9 ; =============== S U B R O U T I N E ======================================= XROM:F4E9 XROM:F4E9 ; PS/2 kbd send delay function; X * 1.004 msec + 2.5 usec + 3 usec XROM:F4E9 XROM:F4E9 ps2SendDelay_F4E9: ; ... XROM:F4E9 18 CE 00 DE ldy #$DE ; 4 cy XROM:F4ED XROM:F4ED loop_F4ED: ; ... XROM:F4ED 18 09 dey ; 4 cy XROM:F4EF 01 nop ; 2 cy XROM:F4F0 26 FB bne loop_F4ED ; 3 cy XROM:F4F2 09 dex ; 3 cy XROM:F4F3 26 F4 bne ps2SendDelay_F4E9 ; 3 cy XROM:F4F5 39 rts ; 5 cy XROM:F4F5 ; End of function ps2SendDelay_F4E9 XROM:F4F5 XROM:F4F6 XROM:F4F6 ; =============== S U B R O U T I N E ======================================= XROM:F4F6 XROM:F4F6 ; XXX process bits in row scan mask and enqueue scan codes XROM:F4F6 ; X is column scan mask, B is row scan mask XROM:F4F6 XROM:F4F6 processKbdRowBits_F4F6: ; ... XROM:F4F6 D7 4D stab scratchby_4D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) XROM:F4F8 BD F5 7B jsr colMaskToColNo_F57B ; XXX col mask to col no; X is col mask; ret A = col no; V set if no col (done scanning) XROM:F4FB 29 20 bvs leaveBadScanCode_F51D ; error converting to col no; bug? XROM:F4FD 97 4C staa scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F4FF XROM:F4FF loop_F4FF: ; ... XROM:F4FF 96 4D ldaa scratchby_4D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) XROM:F501 BD F5 5E jsr rowMaskToRowNo_F55E ; row scan mask to row scan no; A = scan no, B = 'normalized' scan mask (only 1 bit set). V set on none, V clear on success XROM:F504 29 12 bvs leave_F518 ; no more bits to process; done XROM:F506 37 pshb ; (save 'normalized' row scan mask) XROM:F507 48 asla ; get scan row no in hi nybble XROM:F508 48 asla XROM:F509 48 asla XROM:F50A 48 asla XROM:F50B D6 4C ldab scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F50D 1B aba ; get scan col no in low nybble XROM:F50E BD EB D7 jsr enqueueKbdScanCode_EBD7 ; push scan code A (rowno|colno) into keyboard buffer XROM:F511 97 6F staa byte_6F ; XXX last scan code? XROM:F513 32 pula ; get 'normalized' row scan mask in A XROM:F514 98 4D eora scratchby_4D ; remove this bit from the current row scan mask XROM:F516 26 01 bne cont_F519 ; if there are more bits to process, keep going XROM:F518 XROM:F518 leave_F518: ; ... XROM:F518 39 rts XROM:F519 ; --------------------------------------------------------------------------- XROM:F519 XROM:F519 cont_F519: ; ... XROM:F519 97 4D staa scratchby_4D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) XROM:F51B 20 E2 bra loop_F4FF XROM:F51D ; --------------------------------------------------------------------------- XROM:F51D XROM:F51D leaveBadScanCode_F51D: ; ... XROM:F51D BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:F520 CE FD 68 ldx #aBadScanCode ; "Bad Scan Code" XROM:F523 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F526 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:F529 39 rts XROM:F529 ; End of function processKbdRowBits_F4F6 XROM:F529 XROM:F52A XROM:F52A ; =============== S U B R O U T I N E ======================================= XROM:F52A XROM:F52A ; XXX SPECIAL process bits in row scan mask and enqueue scan codes; sets high bit and does not store in byte_6F XROM:F52A XROM:F52A SPECIALprocessKbdRowBits_F52A: ; ... XROM:F52A D7 4D stab scratchby_4D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) XROM:F52C BD F5 7B jsr colMaskToColNo_F57B ; XXX col mask to col no; X is col mask; ret A = col no; V set if no col (done scanning) XROM:F52F 29 20 bvs leaveBadScanCode_F551 XROM:F531 97 4C staa scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F533 XROM:F533 loopRowBits_F533: ; ... XROM:F533 96 4D ldaa scratchby_4D ; scratch; ADB second byte XXX /this/ keyboard scan row mask (rectus) XROM:F535 BD F5 5E jsr rowMaskToRowNo_F55E ; row scan mask to row scan no; A = scan no, B = 'normalized' scan mask (only 1 bit set). V set on none, V clear on success XROM:F538 29 12 bvs leave_F54C ; no more bits in row mask XROM:F53A 37 pshb ; save the 'normalized' bit (just the bit we're working on) XROM:F53B 48 asla ; scootch row into high nybble XROM:F53C 48 asla XROM:F53D 48 asla XROM:F53E 48 asla XROM:F53F D6 4C ldab scratchby_4C ; scratch; ADB first byte XXX /this/ keyboard scan column no (also scratch when erasing file) XROM:F541 1B aba ; stick on col no in lo nybble XROM:F542 8A 80 oraa #$80 ; '€' ; XXX set high bit of scan code? XROM:F544 BD EB D7 jsr enqueueKbdScanCode_EBD7 ; push scan code A (rowno|colno) into keyboard buffer XROM:F547 32 pula ; restore the 'normalized' bit (just the bit we're working on) XROM:F548 98 4D eora scratchby_4D ; effectively remove this bit we worked on a see what's left XROM:F54A 26 01 bne cont_F54D ; more to do... XROM:F54C XROM:F54C leave_F54C: ; ... XROM:F54C 39 rts ; finished! XROM:F54D ; --------------------------------------------------------------------------- XROM:F54D XROM:F54D cont_F54D: ; ... XROM:F54D 97 4D staa scratchby_4D ; save back the remaining bits to work on and loop XROM:F54F 20 E2 bra loopRowBits_F533 XROM:F551 ; --------------------------------------------------------------------------- XROM:F551 XROM:F551 leaveBadScanCode_F551: ; ... XROM:F551 BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:F554 CE FD 68 ldx #aBadScanCode ; "Bad Scan Code" XROM:F557 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F55A BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:F55D 39 rts XROM:F55D ; End of function SPECIALprocessKbdRowBits_F52A XROM:F55D XROM:F55E XROM:F55E ; =============== S U B R O U T I N E ======================================= XROM:F55E XROM:F55E ; row scan mask to row scan no; A = scan no, B = 'normalized' scan mask (only 1 bit set). V set on none, V clear on success XROM:F55E XROM:F55E rowMaskToRowNo_F55E: ; ... XROM:F55E 81 00 cmpa #0 ; (we will come in with nothing when finished processing bits) XROM:F560 27 17 beq leaveNone_F579 XROM:F562 C6 01 ldab #1 XROM:F564 D7 60 stab scratchby_60 ; we're going to use this for the 'normalized' row scan mask (only 1 bit set) XROM:F566 5F clrb ; this will be our row scan no XROM:F567 XROM:F567 loop_F567: ; ... XROM:F567 44 lsra ; get LSB into carry for inspection XROM:F568 25 0A bcs leaveSuccess_F574 XROM:F56A 78 00 60 asl scratchby_60 ; move the 1 up XROM:F56D 5C incb ; increment bit number for next test XROM:F56E C1 08 cmpb #8 ; 8 bits in a byte; bit no can only be 0-7 XROM:F570 27 07 beq leaveNone_F579 XROM:F572 20 F3 bra loop_F567 XROM:F574 ; --------------------------------------------------------------------------- XROM:F574 XROM:F574 leaveSuccess_F574: ; ... XROM:F574 17 tba ; A will have the row scan no XROM:F575 D6 60 ldab scratchby_60 ; B will have the 'normalized' row scan mask (only 1 bit set) XROM:F577 0A clv ; success XROM:F578 39 rts XROM:F579 ; --------------------------------------------------------------------------- XROM:F579 XROM:F579 leaveNone_F579: ; ... XROM:F579 0B sev ; not an error so much as no more to do XROM:F57A 39 rts XROM:F57A ; End of function rowMaskToRowNo_F55E XROM:F57A XROM:F57B XROM:F57B ; =============== S U B R O U T I N E ======================================= XROM:F57B XROM:F57B ; XXX col mask to col no; X is col mask; ret A = col no; V set if no col (done scanning) XROM:F57B XROM:F57B colMaskToColNo_F57B: ; ... XROM:F57B 8C 00 00 cpx #0 ; is the column mask '0'? done; finished scanning XROM:F57E 27 10 beq leaveNoCol_F590 ; (this is a bug if you get here) XROM:F580 8F xgdx XROM:F581 7F 00 60 clr scratchby_60 ; scratch XROM:F584 XROM:F584 loop_F584: ; ... XROM:F584 04 lsrd ; shift down into carry so we can tell when to stop counting XROM:F585 25 05 bcs leaveDone_F58C XROM:F587 7C 00 60 inc scratchby_60 ; scratch XROM:F58A 20 F8 bra loop_F584 XROM:F58C ; --------------------------------------------------------------------------- XROM:F58C XROM:F58C leaveDone_F58C: ; ... XROM:F58C 96 60 ldaa scratchby_60 ; scratch XROM:F58E 0A clv ; clear V; valid data XROM:F58F 39 rts XROM:F590 ; --------------------------------------------------------------------------- XROM:F590 XROM:F590 leaveNoCol_F590: ; ... XROM:F590 0B sev ; set V; finished scanning (no col) XROM:F591 39 rts XROM:F591 ; End of function colMaskToColNo_F57B XROM:F591 XROM:F592 XROM:F592 ; =============== S U B R O U T I N E ======================================= XROM:F592 XROM:F592 ; XXX convert kbd scan code to ASCII (consider shift but not caps lock) XROM:F592 XROM:F592 xlatScanToAscii_F592: ; ... XROM:F592 84 7F anda #$7F ; remove high bit, if present XROM:F594 16 tab XROM:F595 4F clra XROM:F596 05 lsld XROM:F597 05 lsld ; effectively multiply by 4 (4 byte entries) XROM:F598 C3 F8 C5 addd #scanCodeStructs_F8C5 ; 128 4-byte structures per scan code (0xFF in +0 means invalid) XROM:F59B 8F xgdx ; X is now struct address for this scan code XROM:F59C 13 64 01 04 brclr bShiftKeyDown_64 1 loc_F5A4 ; true if 'shift key down' XROM:F5A0 A6 03 ldaa 3,x ; upper case character XROM:F5A2 20 02 bra cont_F5A6 XROM:F5A4 ; --------------------------------------------------------------------------- XROM:F5A4 XROM:F5A4 loc_F5A4: ; ... XROM:F5A4 A6 02 ldaa 2,x ; lower case character XROM:F5A6 XROM:F5A6 cont_F5A6: ; ... XROM:F5A6 81 00 cmpa #0 XROM:F5A8 27 02 beq nochar_F5AC XROM:F5AA 0A clv XROM:F5AB 39 rts XROM:F5AC ; --------------------------------------------------------------------------- XROM:F5AC XROM:F5AC nochar_F5AC: ; ... XROM:F5AC 86 2A ldaa #$2A ; '*' XROM:F5AE 0B sev XROM:F5AF 39 rts XROM:F5AF ; End of function xlatScanToAscii_F592 XROM:F5AF XROM:F5B0 XROM:F5B0 ; =============== S U B R O U T I N E ======================================= XROM:F5B0 XROM:F5B0 ; send AB as four-digit hex to display XROM:F5B0 XROM:F5B0 showHexAB_F5B0: ; ... XROM:F5B0 37 pshb XROM:F5B1 BD F5 B9 jsr showHexA_F5B9 ; send A as two-digit hex to display XROM:F5B4 32 pula XROM:F5B5 BD F5 B9 jsr showHexA_F5B9 ; send A as two-digit hex to display XROM:F5B8 39 rts XROM:F5B8 ; End of function showHexAB_F5B0 XROM:F5B8 XROM:F5B9 XROM:F5B9 ; =============== S U B R O U T I N E ======================================= XROM:F5B9 XROM:F5B9 ; send A as two-digit hex to display XROM:F5B9 XROM:F5B9 showHexA_F5B9: ; ... XROM:F5B9 BD EB B2 jsr bin2hexA_EBB2 ; A to ascii hex (A, B) XROM:F5BC 37 pshb XROM:F5BD 16 tab XROM:F5BE BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F5C1 33 pulb XROM:F5C2 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F5C5 39 rts XROM:F5C5 ; End of function showHexA_F5B9 XROM:F5C5 XROM:F5C6 XROM:F5C6 ; =============== S U B R O U T I N E ======================================= XROM:F5C6 XROM:F5C6 ; show 'Err: ' with hex code in A XROM:F5C6 XROM:F5C6 showErr_F5C6: ; ... XROM:F5C6 36 psha XROM:F5C7 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:F5CA CE FC 4F ldx #aErr ; "Err:" XROM:F5CD BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F5D0 32 pula XROM:F5D1 BD F5 B9 jsr showHexA_F5B9 ; send A as two-digit hex to display XROM:F5D4 39 rts XROM:F5D4 ; End of function showErr_F5C6 XROM:F5D4 XROM:F5D5 XROM:F5D5 ; =============== S U B R O U T I N E ======================================= XROM:F5D5 XROM:F5D5 ; Here1 related; no references, dead debugging code XROM:F5D5 XROM:F5D5 debugHere1_F5D5: XROM:F5D5 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:F5D8 CE FC 54 ldx #aHere1 ; "Here1" XROM:F5DB 20 06 bra loc_F5E3 XROM:F5DB ; End of function debugHere1_F5D5 XROM:F5DB XROM:F5DD XROM:F5DD ; =============== S U B R O U T I N E ======================================= XROM:F5DD XROM:F5DD ; Here2 related; a bug found XROM:F5DD XROM:F5DD debugHere2_F5DD: ; ... XROM:F5DD BD F7 54 jsr setcpLine2_F754 ; set cursor Line 2 XROM:F5E0 CE FC 5A ldx #aHere2 ; "Here2" XROM:F5E3 XROM:F5E3 loc_F5E3: ; ... XROM:F5E3 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F5E6 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:F5E9 BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:F5EC 39 rts XROM:F5EC ; End of function debugHere2_F5DD XROM:F5EC XROM:F5ED XROM:F5ED ; =============== S U B R O U T I N E ======================================= XROM:F5ED XROM:F5ED ; show which keyboard emulation and prompt for send key XROM:F5ED XROM:F5ED promptKbdEmuModeSend_F5ED: ; ... XROM:F5ED BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:F5F0 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:F5F3 CE FE 8F ldx #aAttachedToMacE ; "Attached to Mac, emulating keyboard." XROM:F5F6 13 8A 01 03 brclr bKbdEmuMode_8A 1 show_F5FD ; flag; kbdemu b0 = 0 == mac, 1 == pc XROM:F5FA CE FE B4 ldx #aAttachedToPcEm ; "Attached to PC, emulating keyboard." XROM:F5FD XROM:F5FD show_F5FD: ; ... XROM:F5FD BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F600 BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:F603 CE FE D8 ldx #aPressSendKeyTo ; "Press Send key to transfer file " XROM:F606 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F609 B6 01 5D ldaa curFileNo_15D ; current file number (1-8) XROM:F60C BD EB B2 jsr bin2hexA_EBB2 ; A to ascii hex (A, B) XROM:F60F BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F612 C6 2E ldab #'.' XROM:F614 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F617 39 rts XROM:F617 ; End of function promptKbdEmuModeSend_F5ED XROM:F617 XROM:F618 XROM:F618 ; =============== S U B R O U T I N E ======================================= XROM:F618 XROM:F618 ; Clear LCD set cursor pos 0 XROM:F618 XROM:F618 clearHomeLCD_F618: ; ... XROM:F618 86 01 ldaa #1 ; LCD CH: Clear and Home XROM:F61A BD F6 5E jsr lcdSendCommandA_F65E ; send LCD command in A XROM:F61D 39 rts XROM:F61D ; End of function clearHomeLCD_F618 XROM:F61D XROM:F61E XROM:F61E ; =============== S U B R O U T I N E ======================================= XROM:F61E XROM:F61E ; delay ~ 590 ms; 1,179,687 cy XROM:F61E XROM:F61E delay590ms_F61E: ; ... XROM:F61E 8D 03 bsr delay295ms_F623 ; delay ~ 295 ms XROM:F620 8D 01 bsr delay295ms_F623 ; delay ~ 295 ms XROM:F622 39 rts XROM:F622 ; End of function delay590ms_F61E XROM:F622 XROM:F623 XROM:F623 ; =============== S U B R O U T I N E ======================================= XROM:F623 XROM:F623 ; delay ~ 295 ms; 589,835 cy XROM:F623 XROM:F623 delay295ms_F623: ; ... XROM:F623 18 CE FF FF ldy #$FFFF XROM:F627 XROM:F627 loop_F627: ; ... XROM:F627 18 09 dey XROM:F629 01 nop XROM:F62A 26 FB bne loop_F627 XROM:F62C 39 rts XROM:F62C ; End of function delay295ms_F623 XROM:F62C XROM:F62D XROM:F62D ; =============== S U B R O U T I N E ======================================= XROM:F62D XROM:F62D ; show char with translate for LCD XROM:F62D XROM:F62D xlatShowChar_F62D: ; ... XROM:F62D 81 09 cmpa #9 ; less than TAB? XROM:F62F 2D 19 blt bogoChar_F64A XROM:F631 85 80 bita #$80 ; high ASCII? XROM:F633 26 15 bne bogoChar_F64A XROM:F635 81 5C cmpa #'\' ; ascii backslash looks like Yen on LCD, so translate XROM:F637 27 15 beq xlatbackslash_F64E XROM:F639 81 7E cmpa #'~' ; ascii tilde looks like right arrow on LCD, so translate XROM:F63B 27 15 beq xlattildeswinton_F652 XROM:F63D 81 0D cmpa #$D XROM:F63F 27 15 beq xlatcr_F656 XROM:F641 81 09 cmpa #9 XROM:F643 27 15 beq xlattab_F65A XROM:F645 16 tab XROM:F646 XROM:F646 loc_F646: ; ... XROM:F646 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F649 39 rts XROM:F64A ; --------------------------------------------------------------------------- XROM:F64A XROM:F64A bogoChar_F64A: ; ... XROM:F64A C6 3F ldab #'?' ; junk character maps to '?' XROM:F64C 20 F8 bra loc_F646 XROM:F64E ; --------------------------------------------------------------------------- XROM:F64E XROM:F64E xlatbackslash_F64E: ; ... XROM:F64E C6 8F ldab #$8F ; LCD backslash char XROM:F650 20 F4 bra loc_F646 XROM:F652 ; --------------------------------------------------------------------------- XROM:F652 XROM:F652 xlattildeswinton_F652: ; ... XROM:F652 C6 F3 ldab #$F3 ; LCD infinity is an approximation of tilde XROM:F654 20 F0 bra loc_F646 XROM:F656 ; --------------------------------------------------------------------------- XROM:F656 XROM:F656 xlatcr_F656: ; ... XROM:F656 C6 7F ldab #$7F ; LCD left arrow indicates hard CR XROM:F658 20 EC bra loc_F646 XROM:F65A ; --------------------------------------------------------------------------- XROM:F65A XROM:F65A xlattab_F65A: ; ... XROM:F65A C6 7E ldab #$7E ; LCD right arrow indicates TAB XROM:F65C 20 E8 bra loc_F646 XROM:F65C ; End of function xlatShowChar_F62D XROM:F65C XROM:F65E XROM:F65E ; =============== S U B R O U T I N E ======================================= XROM:F65E XROM:F65E ; send LCD command in A XROM:F65E XROM:F65E lcdSendCommandA_F65E: ; ... XROM:F65E 15 5B 02 bclr lcdCtlLineState_5B 2 ; drop IOC2 for command (IOC1 is presumably low) XROM:F661 16 tab XROM:F662 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F665 14 5B 02 bset lcdCtlLineState_5B 2 ; raise IOC2 for data (IOC1 is presumably low) XROM:F668 39 rts XROM:F668 ; End of function lcdSendCommandA_F65E XROM:F668 XROM:F669 XROM:F669 ; =============== S U B R O U T I N E ======================================= XROM:F669 XROM:F669 ; show nts text @ X XROM:F669 XROM:F669 showText_F669: ; ... XROM:F669 E6 00 ldab 0,x XROM:F66B 27 06 beq leave_F673 XROM:F66D BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F670 08 inx XROM:F671 20 F6 bra showText_F669 ; show nts text @ X XROM:F673 ; --------------------------------------------------------------------------- XROM:F673 XROM:F673 leave_F673: ; ... XROM:F673 39 rts XROM:F673 ; End of function showText_F669 XROM:F673 XROM:F674 XROM:F674 ; =============== S U B R O U T I N E ======================================= XROM:F674 XROM:F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F674 XROM:F674 sendLCDbyteB_F674: ; ... XROM:F674 37 pshb ; save this for doing second nybble XROM:F675 37 pshb ; save these prior to flicking gpios XROM:F676 36 psha XROM:F677 XROM:F677 loop_F677: ; ... XROM:F677 BD EC 45 jsr readLCDnybble_EC45 ; first (high) nybble (in Ab5-2) XROM:F67A BD EC 45 jsr readLCDnybble_EC45 ; second (low) nybble (in Ab5-2) XROM:F67D 84 20 anda #$20 ; PDb6 set? wait for 'ready' XROM:F67F 26 F6 bne loop_F677 XROM:F681 32 pula ; restore these XROM:F682 33 pulb XROM:F683 54 lsrb ; get high nybble into low XROM:F684 54 lsrb XROM:F685 54 lsrb XROM:F686 54 lsrb XROM:F687 8D 06 bsr sendLCDnybble_F68F ; send LCD nybble (w/ctrl as per 0x5b) XROM:F689 33 pulb ; restore byte to send and mask lower nybble XROM:F68A C4 0F andb #$F XROM:F68C 8D 01 bsr sendLCDnybble_F68F ; send LCD nybble (w/ctrl as per 0x5b) XROM:F68E 39 rts XROM:F68E ; End of function sendLCDbyteB_F674 XROM:F68E XROM:F68F XROM:F68F ; =============== S U B R O U T I N E ======================================= XROM:F68F XROM:F68F ; send LCD nybble (w/ctrl as per 0x5b) XROM:F68F XROM:F68F sendLCDnybble_F68F: ; ... XROM:F68F 4F clra ; (an elaborate way of A = (0x5b) & 3. Why? unknown.) XROM:F690 13 5B 02 04 brclr lcdCtlLineState_5B 2 cont_F698 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F694 8A 02 oraa #2 ; set OC2 high because it's high in byte_5B XROM:F696 20 00 bra *+2 ; delay 3 cy; 1.5 usec XROM:F698 ; --------------------------------------------------------------------------- XROM:F698 XROM:F698 cont_F698: ; ... XROM:F698 13 5B 01 04 brclr lcdCtlLineState_5B 1 cont_F6A0 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F69C 8A 01 oraa #1 ; set OC1 high because it's high in byte_5B XROM:F69E 20 00 bra *+2 ; delay 3 cy; 1.5 usec XROM:F6A0 ; --------------------------------------------------------------------------- XROM:F6A0 XROM:F6A0 cont_F6A0: ; ... XROM:F6A0 58 aslb ; move up two bits to align lower nybble with PDb5-4 XROM:F6A1 58 aslb XROM:F6A2 B7 80 00 staa $8000 ; get R/~W (b2), OC2 (b1), and OC1 (b0) set in $8000 XROM:F6A5 96 08 ldaa PORTD_8 ; PORTD: XROM:F6A7 84 03 anda #3 ; preserve lower two bits used for other stuff XROM:F6A9 1B aba ; merge on shifted B into nybble position (port D7,6 are not bonded, so who cares about those) XROM:F6AA 97 08 staa PORTD_8 ; write nybble out XROM:F6AC 14 00 80 bset PORTA_0 $80 ; flick PAb7 (lcdex) high, low XROM:F6AF 15 00 80 bclr PORTA_0 $80 XROM:F6B2 39 rts XROM:F6B2 ; End of function sendLCDnybble_F68F XROM:F6B2 XROM:F6B3 XROM:F6B3 ; =============== S U B R O U T I N E ======================================= XROM:F6B3 XROM:F6B3 ; show firmware version XROM:F6B3 XROM:F6B3 showFirmwareVersion_F6B3: ; ... XROM:F6B3 BD F7 48 jsr setcpLine0_F748 ; set cursor Line 0 XROM:F6B6 CE FF 1C ldx #aAlphasmartV2_0 ; "AlphaSmart v2.03" XROM:F6B9 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F6BC 39 rts XROM:F6BC ; End of function showFirmwareVersion_F6B3 XROM:F6BC XROM:F6BC ; --------------------------------------------------------------------------- XROM:F6BD A4 fcb $A4 ; ¤ XROM:F6BE F6 fcb $F6 ; ö XROM:F6BF 56 fcb $56 ; V XROM:F6C0 24 fcb $24 ; $ XROM:F6C1 16 fcb $16 XROM:F6C2 27 fcb $27 ; ' XROM:F6C3 27 fcb $27 ; ' XROM:F6C4 57 fcb $57 ; W XROM:F6C5 37 fcb $37 ; 7 XROM:F6C6 XROM:F6C6 ; =============== S U B R O U T I N E ======================================= XROM:F6C6 XROM:F6C6 ; test RAM signature on p0,3. V clear on success. XROM:F6C6 XROM:F6C6 testRAMsignature_F6C6: ; ... XROM:F6C6 86 03 ldaa #3 XROM:F6C8 BD EC 60 jsr selectRAMPageA_EC60 ; select 32 KiB RAM page as per A (0-3) XROM:F6CB CE F8 A5 ldx #aThisIsTheRamVa ; "This is the RAM valid signatur2" XROM:F6CE 18 CE 7F DF ldy #ramsiglocp3_7FDF ; on page 3 only, RAM signature location XROM:F6D2 XROM:F6D2 loc_F6D2: ; ... XROM:F6D2 E6 00 ldab 0,x XROM:F6D4 27 0A beq loc_F6E0 XROM:F6D6 XROM:F6D6 loc_F6D6: XROM:F6D6 18 E1 00 cmpb 0,y XROM:F6D9 26 1F bne loc_F6FA XROM:F6DB 18 08 iny XROM:F6DD 08 inx XROM:F6DE 20 F2 bra loc_F6D2 XROM:F6E0 ; --------------------------------------------------------------------------- XROM:F6E0 XROM:F6E0 loc_F6E0: ; ... XROM:F6E0 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F6E3 CE F8 A5 ldx #aThisIsTheRamVa ; "This is the RAM valid signatur2" XROM:F6E6 18 CE 01 00 ldy #ramsiglocp0_100 ; on page 0 only; RAM signature location XROM:F6EA XROM:F6EA loop_F6EA: ; ... XROM:F6EA E6 00 ldab 0,x XROM:F6EC 27 0A beq loc_F6F8 XROM:F6EE 18 E1 00 cmpb 0,y XROM:F6F1 26 07 bne loc_F6FA XROM:F6F3 18 08 iny XROM:F6F5 08 inx XROM:F6F6 20 F2 bra loop_F6EA XROM:F6F8 ; --------------------------------------------------------------------------- XROM:F6F8 XROM:F6F8 loc_F6F8: ; ... XROM:F6F8 0A clv XROM:F6F9 39 rts XROM:F6FA ; --------------------------------------------------------------------------- XROM:F6FA XROM:F6FA loc_F6FA: ; ... XROM:F6FA BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F6FD BD F7 54 jsr setcpLine2_F754 ; set cursor Line 2 XROM:F700 CE FC D6 ldx #aSignatureNotFo ; "(Signature not found. Initializing...)" XROM:F703 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F706 BD F7 5A jsr setcpLine3_F75A ; set cursor Line 3 XROM:F709 86 20 ldaa #$20 XROM:F70B CE 7F DF ldx #ramsiglocp3_7FDF ; on page 3 only, RAM signature location XROM:F70E XROM:F70E loc_F70E: ; ... XROM:F70E E6 00 ldab 0,x XROM:F710 08 inx XROM:F711 36 psha XROM:F712 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F715 32 pula XROM:F716 4A deca XROM:F717 26 F5 bne loc_F70E XROM:F719 86 02 ldaa #2 ; (could have just called it twice, like everywhere else) XROM:F71B XROM:F71B loc_F71B: ; ... XROM:F71B BD F6 1E jsr delay590ms_F61E ; delay ~ 590 ms XROM:F71E 4A deca XROM:F71F 26 FA bne loc_F71B XROM:F721 0B sev XROM:F722 39 rts XROM:F722 ; End of function testRAMsignature_F6C6 XROM:F722 XROM:F723 XROM:F723 ; =============== S U B R O U T I N E ======================================= XROM:F723 XROM:F723 ; stamp 'ram valid signature' on RAM page 0 and 3 XROM:F723 XROM:F723 stampRAMsignature_F723: ; ... XROM:F723 18 CE 01 00 ldy #ramsiglocp0_100 ; on page 0 only; RAM signature location XROM:F727 8D 0F bsr stampRAMsignatureAtY_F738 ; store ram valid sig @ Y (without nul!) XROM:F729 86 03 ldaa #3 XROM:F72B BD EC 60 jsr selectRAMPageA_EC60 ; select 32 KiB RAM page as per A (0-3) XROM:F72E 18 CE 7F DF ldy #ramsiglocp3_7FDF ; on page 3 only, RAM signature location XROM:F732 8D 04 bsr stampRAMsignatureAtY_F738 ; store ram valid sig @ Y (without nul!) XROM:F734 BD EC 79 jsr selectRAMPage0_EC79 ; select 32 KiB RAM page 0 XROM:F737 39 rts XROM:F737 ; End of function stampRAMsignature_F723 XROM:F737 XROM:F738 XROM:F738 ; =============== S U B R O U T I N E ======================================= XROM:F738 XROM:F738 ; store ram valid sig @ Y (without nul!) XROM:F738 XROM:F738 stampRAMsignatureAtY_F738: ; ... XROM:F738 CE F8 A5 ldx #aThisIsTheRamVa ; "This is the RAM valid signatur2" XROM:F73B XROM:F73B loop_F73B: ; ... XROM:F73B E6 00 ldab 0,x XROM:F73D 27 08 beq leave_F747 XROM:F73F 18 E7 00 stab 0,y XROM:F742 08 inx XROM:F743 18 08 iny XROM:F745 20 F4 bra loop_F73B XROM:F747 ; --------------------------------------------------------------------------- XROM:F747 XROM:F747 leave_F747: ; ... XROM:F747 39 rts XROM:F747 ; End of function stampRAMsignatureAtY_F738 XROM:F747 XROM:F748 XROM:F748 ; =============== S U B R O U T I N E ======================================= XROM:F748 XROM:F748 ; set cursor Line 0 XROM:F748 XROM:F748 setcpLine0_F748: ; ... XROM:F748 C6 00 ldab #0 XROM:F74A BD F7 60 jsr commonSetCursorPosB_F760 ; LCD 'set cursor position to 0 (line 0) XROM:F74D 39 rts XROM:F74D ; End of function setcpLine0_F748 XROM:F74D XROM:F74E XROM:F74E ; =============== S U B R O U T I N E ======================================= XROM:F74E XROM:F74E ; set cursor Line 1 XROM:F74E XROM:F74E setcpLine1_F74E: ; ... XROM:F74E C6 28 ldab #40 XROM:F750 BD F7 60 jsr commonSetCursorPosB_F760 ; LCD 'set cursor position to 40 (line 1) XROM:F753 39 rts XROM:F753 ; End of function setcpLine1_F74E XROM:F753 XROM:F754 XROM:F754 ; =============== S U B R O U T I N E ======================================= XROM:F754 XROM:F754 ; set cursor Line 2 XROM:F754 XROM:F754 setcpLine2_F754: ; ... XROM:F754 C6 50 ldab #80 XROM:F756 BD F7 60 jsr commonSetCursorPosB_F760 ; LCD 'set cursor position to 80 (line 2) XROM:F759 39 rts XROM:F759 ; End of function setcpLine2_F754 XROM:F759 XROM:F75A XROM:F75A ; =============== S U B R O U T I N E ======================================= XROM:F75A XROM:F75A ; set cursor Line 3 XROM:F75A XROM:F75A setcpLine3_F75A: ; ... XROM:F75A C6 78 ldab #120 XROM:F75C BD F7 60 jsr commonSetCursorPosB_F760 ; LCD 'set cursor position to 120 (line 3) XROM:F75F 39 rts XROM:F75F ; End of function setcpLine3_F75A XROM:F75F XROM:F760 XROM:F760 ; =============== S U B R O U T I N E ======================================= XROM:F760 XROM:F760 ; common set cursor position (abs pos in B) XROM:F760 XROM:F760 commonSetCursorPosB_F760: ; ... XROM:F760 14 5B 01 bset lcdCtlLineState_5B 1 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F763 14 5B 02 bset lcdCtlLineState_5B 2 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F766 BD F6 74 jsr sendLCDbyteB_F674 ; send byte in B to LCD (w/ctrl as per 0x5b) XROM:F769 15 5B 01 bclr lcdCtlLineState_5B 1 ; LCD control lines state in b1 = IOC2, b0 = IOC1 XROM:F76C 39 rts XROM:F76C ; End of function commonSetCursorPosB_F760 XROM:F76C XROM:F76D XROM:F76D ; =============== S U B R O U T I N E ======================================= XROM:F76D XROM:F76D ; load the ROM test file into the current file XROM:F76D XROM:F76D spewROMtestFile_F76D: ; ... XROM:F76D BD F6 18 jsr clearHomeLCD_F618 ; Clear LCD set cursor pos 0 XROM:F770 CE FB D5 ldx #aAreYouSureYouWantToOverwrite ; "Are you sure you want to overwrite" XROM:F773 BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F776 BD F7 4E jsr setcpLine1_F74E ; set cursor Line 1 XROM:F779 CE FB F8 ldx #aThisFileWithTheRomTestFile?YN ; "this file with the ROM test file? (y/n)" XROM:F77C BD F6 69 jsr showText_F669 ; show nts text @ X XROM:F77F XROM:F77F waitKey_F77F: ; ... XROM:F77F BD E5 A0 jsr scanKbd_E5A0 ; do key scan and enqueue XROM:F782 BD EB EE jsr dequeueKbdScanCode_EBEE ; pull scan code A (rowno|colno) from keyboard buffer; V set if empty, clear if valid XROM:F785 29 F8 bvs waitKey_F77F XROM:F787 81 22 cmpa #$22 ; 'y' scan code XROM:F789 26 14 bne leave_F79F XROM:F78B BD EB 9B jsr deleteThisFile_EB9B ; delete file by resetting pointers (recoverable) XROM:F78E CE FB 44 ldx #testFile_FB44 ; "1 AlphaSmart is easy to use and rugged."... XROM:F791 XROM:F791 loop_F791: ; ... XROM:F791 A6 00 ldaa 0,x XROM:F793 27 0A beq leave_F79F XROM:F795 08 inx XROM:F796 3C pshx XROM:F797 BD F3 07 jsr insertCharToFile_F307 ; insert char A onto current file; V set if fail, clear on success XROM:F79A 38 pulx XROM:F79B 29 02 bvs leave_F79F XROM:F79D 20 F2 bra loop_F791 XROM:F79F ; --------------------------------------------------------------------------- XROM:F79F XROM:F79F leave_F79F: ; ... XROM:F79F 39 rts XROM:F79F ; End of function spewROMtestFile_F76D XROM:F79F XROM:F7A0 XROM:F7A0 ; =============== S U B R O U T I N E ======================================= XROM:F7A0 XROM:F7A0 ; PS/2 send byte in A XROM:F7A0 XROM:F7A0 ps2SendByte_F7A0: ; ... XROM:F7A0 C6 01 ldab #1 XROM:F7A2 D7 60 stab scratchby_60 ; using this for parity XROM:F7A4 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:F7A7 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:F7AA XROM:F7AA wait_F7AA: ; ... XROM:F7AA 13 00 01 4D brclr PORTA_0 1 leaveErr_F7FB ; PAb0 (datain) low? err XROM:F7AE 13 00 04 F8 brclr PORTA_0 4 wait_F7AA ; PAb2 (clkin) low? keep checking XROM:F7B2 0C clc XROM:F7B3 8D 4C bsr ps2SendBit_F801 ; send PS/2 bit (from C) XROM:F7B5 29 48 bvs leaveErr_F7FF XROM:F7B7 18 CE 00 08 ldy #8 ; 8 bits? XROM:F7BB XROM:F7BB loop_F7BB: ; ... XROM:F7BB 44 lsra XROM:F7BC 24 03 bcc cont_F7C1 XROM:F7BE 7C 00 60 inc scratchby_60 ; count 1's bits for parity XROM:F7C1 XROM:F7C1 cont_F7C1: ; ... XROM:F7C1 8D 3E bsr ps2SendBit_F801 ; send PS/2 bit (from C) XROM:F7C3 29 3A bvs leaveErr_F7FF XROM:F7C5 18 09 dey XROM:F7C7 26 F2 bne loop_F7BB ; more bits! XROM:F7C9 74 00 60 lsr scratchby_60 ; get parity in C XROM:F7CC BD F8 01 jsr ps2SendBit_F801 ; send PS/2 bit (from C) XROM:F7CF 29 2E bvs leaveErr_F7FF XROM:F7D1 0D sec XROM:F7D2 BD F8 01 jsr ps2SendBit_F801 ; send PS/2 bit (from C) XROM:F7D5 B6 01 5C ldaa kbdemuSpeed_15C ; keyboard transfer speed (0, 1, 2, c8???) XROM:F7D8 81 00 cmpa #0 XROM:F7DA 27 0D beq slowest_F7E9 XROM:F7DC 81 01 cmpa #1 XROM:F7DE 27 0E beq slow_F7EE XROM:F7E0 81 02 cmpa #2 XROM:F7E2 27 0F beq fast_F7F3 XROM:F7E4 CE 00 01 ldx #1 ; 1 msec XROM:F7E7 20 0D bra kbdDelay_F7F6 XROM:F7E9 ; --------------------------------------------------------------------------- XROM:F7E9 XROM:F7E9 slowest_F7E9: ; ... XROM:F7E9 CE 00 1E ldx #30 ; 30 msec XROM:F7EC 20 08 bra kbdDelay_F7F6 XROM:F7EE ; --------------------------------------------------------------------------- XROM:F7EE XROM:F7EE slow_F7EE: ; ... XROM:F7EE CE 00 07 ldx #7 ; 7 msec XROM:F7F1 20 03 bra kbdDelay_F7F6 XROM:F7F3 ; --------------------------------------------------------------------------- XROM:F7F3 XROM:F7F3 fast_F7F3: ; ... XROM:F7F3 CE 00 04 ldx #4 ; 4 msec XROM:F7F6 XROM:F7F6 kbdDelay_F7F6: ; ... XROM:F7F6 BD F4 E9 jsr ps2SendDelay_F4E9 ; PS/2 kbd send delay function; X * 1.004 msec + 2.5 usec + 3 usec XROM:F7F9 0A clv XROM:F7FA 39 rts XROM:F7FB ; --------------------------------------------------------------------------- XROM:F7FB XROM:F7FB leaveErr_F7FB: ; ... XROM:F7FB 86 45 ldaa #$45 ; 'E' XROM:F7FD 20 00 bra *+2 ; (knumbskull 'break' in 'switch' for last 'case') XROM:F7FF ; --------------------------------------------------------------------------- XROM:F7FF XROM:F7FF leaveErr_F7FF: ; ... XROM:F7FF 0B sev XROM:F800 39 rts XROM:F800 ; End of function ps2SendByte_F7A0 XROM:F800 XROM:F801 XROM:F801 ; =============== S U B R O U T I N E ======================================= XROM:F801 XROM:F801 ; send PS/2 bit (from C) XROM:F801 XROM:F801 ps2SendBit_F801: ; ... XROM:F801 24 0D bcc zero_F810 XROM:F803 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:F806 C6 03 ldab #3 XROM:F808 8D 2F bsr delay_F839 ; delay 10 usec XROM:F80A 13 00 01 1D brclr PORTA_0 1 leaveErr45_F82B ; PAb0 (datain) low? err XROM:F80E 20 07 bra cont_F817 XROM:F810 ; --------------------------------------------------------------------------- XROM:F810 XROM:F810 zero_F810: ; ... XROM:F810 14 08 02 bset PORTD_8 2 ; PDb1 (/dataout???) high XROM:F813 C6 03 ldab #3 XROM:F815 8D 22 bsr delay_F839 ; delay 10 usec XROM:F817 XROM:F817 cont_F817: ; ... XROM:F817 15 08 01 bclr PORTD_8 1 ; PDb0 (ckout???) low XROM:F81A C6 0D ldab #$D XROM:F81C 8D 1B bsr delay_F839 ; delay 35 usec XROM:F81E 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:F821 C6 01 ldab #1 XROM:F823 8D 14 bsr delay_F839 ; delay 5 usec XROM:F825 0A clv XROM:F826 13 00 04 05 brclr PORTA_0 4 leaveErr46_F82F ; PAb2 (clkin) low? Err XROM:F82A 39 rts XROM:F82B ; --------------------------------------------------------------------------- XROM:F82B XROM:F82B leaveErr45_F82B: ; ... XROM:F82B 86 45 ldaa #$45 ; 'E' XROM:F82D 20 02 bra leaveErr_F831 XROM:F82F ; --------------------------------------------------------------------------- XROM:F82F XROM:F82F leaveErr46_F82F: ; ... XROM:F82F 86 46 ldaa #$46 ; 'F' XROM:F831 XROM:F831 leaveErr_F831: ; ... XROM:F831 15 08 02 bclr PORTD_8 2 ; PDb1 (/dataout???) low XROM:F834 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:F837 0B sev XROM:F838 39 rts XROM:F838 ; End of function ps2SendBit_F801 XROM:F838 XROM:F839 XROM:F839 ; =============== S U B R O U T I N E ======================================= XROM:F839 XROM:F839 ; delay B*5+5 cy; (B+1)*2.5us (max delay @ 0=256) XROM:F839 XROM:F839 delay_F839: ; ... XROM:F839 5A decb XROM:F83A 26 FD bne delay_F839 ; delay B*5+5 cy; (B+1)*2.5us (max delay @ 0=256) XROM:F83C 39 rts XROM:F83C ; End of function delay_F839 XROM:F83C XROM:F83D XROM:F83D ; =============== S U B R O U T I N E ======================================= XROM:F83D XROM:F83D ; XXX DEAD CODE? a delay based on free running timer count XROM:F83D XROM:F83D XXXdeadCode_F83D: XROM:F83D 58 aslb XROM:F83E 4F clra XROM:F83F D3 0E addd TCNT_E ; TCNT runs at E clock; 2 MHz, 500 ns; 32.768 ms / period XROM:F841 XROM:F841 loop_F841: ; ... XROM:F841 1A 93 0E cpd TCNT_E ; TCNT runs at E clock; 2 MHz, 500 ns; 32.768 ms / period XROM:F844 22 FB bhi loop_F841 XROM:F846 39 rts XROM:F846 ; End of function XXXdeadCode_F83D XROM:F846 XROM:F847 XROM:F847 ; =============== S U B R O U T I N E ======================================= XROM:F847 XROM:F847 ; flick PDb0 clock, sense PAb0, reflect in carry XROM:F847 XROM:F847 ps2GetBit_F847: ; ... XROM:F847 15 08 01 bclr PORTD_8 1 ; PDb0 (ckout???) clock low XROM:F84A C6 0C ldab #$C XROM:F84C 8D EB bsr delay_F839 ; delay 32.5 usec XROM:F84E 14 08 01 bset PORTD_8 1 ; PDb0 (ckout???) high XROM:F851 13 00 01 06 brclr PORTA_0 1 cont_F85B ; PAb0 (datain) low? read as '0' XROM:F855 C6 04 ldab #4 XROM:F857 8D E0 bsr delay_F839 ; delay 12.5 usec XROM:F859 0D sec ; PAb0 high, reflect by setting carry XROM:F85A 39 rts XROM:F85B ; --------------------------------------------------------------------------- XROM:F85B XROM:F85B cont_F85B: ; ... XROM:F85B C6 04 ldab #4 XROM:F85D 8D DA bsr delay_F839 ; delay 12.5 usec XROM:F85F 0C clc ; PAb0 low, reflect by clearing carry XROM:F860 39 rts XROM:F860 ; End of function ps2GetBit_F847 XROM:F860 XROM:F860 ; --------------------------------------------------------------------------- XROM:F861 43 6F 70 79+aCopyrightIntel:fcc "Copyright Intelligent Peripheral Devices ¨ 1995 All rights rese" XROM:F861 72 69 67 68+ fcc "rved" XROM:F8A5 54 68 69 73+aThisIsTheRamVa:fcc "This is the RAM valid signatur2" ; ... XROM:F8A5 20 69 73 20+ fcb 0 XROM:F8C5 64 scanCodeStructs_F8C5:fcb $64 ; ... XROM:F8C5 ; scan code 00 - 'F8' XROM:F8C5 ; +0 is XXX ??? XROM:F8C6 0A fcb $A ; +1 is the PS/2 base scan code (i.e. without prefixes) XROM:F8C7 00 fcb 0 ; +2 unshifted ASCII (bShiftKeyDown_64 clear); 0 if not valid ascii XROM:F8C8 00 fcb 0 ; +3 shifted ASCII (bShiftKeyDown_64 set); 0 if not valid ascii XROM:F8C9 17 fcb $17 ; scan code 01 - '5' XROM:F8CA 2E fcb $2E XROM:F8CB 35 fcb '5' XROM:F8CC 25 fcb '%' XROM:F8CD 16 fcb $16 ; scan code 02 - '6' XROM:F8CE 36 fcb $36 XROM:F8CF 36 fcb '6' XROM:F8D0 5E fcb '^' XROM:F8D1 1B fcb $1B ; scan code 03 - '-' XROM:F8D2 4E fcb $4E XROM:F8D3 2D fcb '-' XROM:F8D4 5F fcb '_' XROM:F8D5 4C fcb $4C ; scan code 04 - Enter XROM:F8D6 5A fcb $5A XROM:F8D7 00 fcb 0 XROM:F8D8 00 fcb 0 XROM:F8D9 FF fcb $FF ; scan code 05 - (INVALID) XROM:F8DA 00 fcb 0 XROM:F8DB 00 fcb 0 XROM:F8DC 00 fcb 0 XROM:F8DD FF fcb $FF ; scan code 06 - (INVALID) XROM:F8DE 00 fcb 0 XROM:F8DF 00 fcb 0 XROM:F8E0 00 fcb 0 XROM:F8E1 FF fcb $FF ; scan code 07 - (INVALID) XROM:F8E2 00 fcb 0 XROM:F8E3 00 fcb 0 XROM:F8E4 00 fcb 0 XROM:F8E5 FF fcb $FF ; scan code 08 - (INVALID) XROM:F8E6 00 fcb 0 XROM:F8E7 00 fcb 0 XROM:F8E8 00 fcb 0 XROM:F8E9 3A fcb $3A ; scan code 09 - left??? Alt XROM:F8EA 11 fcb $11 XROM:F8EB 00 fcb 0 XROM:F8EC 00 fcb 0 XROM:F8ED 18 fcb $18 ; scan code 0a - '=' XROM:F8EE 55 fcb $55 XROM:F8EF 3D fcb '=' XROM:F8F0 2B fcb '+' XROM:F8F1 65 fcb $65 ; scan code 0b - XXX F9? pauseprtscrn? 84 in ps2 is ??? XROM:F8F2 84 fcb $84 XROM:F8F3 00 fcb 0 XROM:F8F4 00 fcb 0 XROM:F8F5 78 fcb $78 ; scan code 0c - F2 XROM:F8F6 06 fcb 6 XROM:F8F7 00 fcb 0 XROM:F8F8 00 fcb 0 XROM:F8F9 7A fcb $7A ; scan code 0d - F1 XROM:F8FA 05 fcb 5 XROM:F8FB 00 fcb 0 XROM:F8FC 00 fcb 0 XROM:F8FD 32 fcb $32 ; scan code 0e - '`' XROM:F8FE 0E fcb $E XROM:F8FF 60 fcb '`' XROM:F900 7E fcb '~' XROM:F901 FF fcb $FF ; scan code 0f - (INVALID) XROM:F902 00 fcb 0 XROM:F903 00 fcb 0 XROM:F904 00 fcb 0 XROM:F905 FF fcb $FF ; scan code 10 - (INVALID) XROM:F906 00 fcb 0 XROM:F907 00 fcb 0 XROM:F908 00 fcb 0 XROM:F909 05 fcb 5 ; scan code 11 - 'G' XROM:F90A 34 fcb $34 XROM:F90B 67 fcb 'g' XROM:F90C 47 fcb 'G' XROM:F90D 04 fcb 4 ; scan code 12 - 'H' XROM:F90E 33 fcb $33 XROM:F90F 68 fcb 'h' XROM:F910 48 fcb 'H' XROM:F911 27 fcb $27 ; scan code 13 - ''' XROM:F912 52 fcb $52 XROM:F913 27 fcb $27 ; (apostrophe) XROM:F914 22 fcb $22 ; (double quote) XROM:F915 FF fcb $FF ; scan code 14 - (INVALID) XROM:F916 00 fcb 0 XROM:F917 00 fcb 0 XROM:F918 00 fcb 0 XROM:F919 3D fcb $3D ; scan code 15 - arrow Down XROM:F91A 72 fcb $72 XROM:F91B 00 fcb 0 XROM:F91C 00 fcb 0 XROM:F91D 37 fcb $37 ; scan code 16 - left??? cloverleaf XROM:F91E 00 fcb 0 XROM:F91F 00 fcb 0 XROM:F920 00 fcb 0 XROM:F921 FF fcb $FF ; scan code 17 - (INVALID) XROM:F922 00 fcb 0 XROM:F923 00 fcb 0 XROM:F924 00 fcb 0 XROM:F925 FF fcb $FF ; scan code 18 - (INVALID) XROM:F926 00 fcb 0 XROM:F927 00 fcb 0 XROM:F928 00 fcb 0 XROM:F929 FF fcb $FF ; scan code 19 - (INVALID) XROM:F92A 00 fcb 0 XROM:F92B 00 fcb 0 XROM:F92C 00 fcb 0 XROM:F92D 61 fcb $61 ; scan code 1a - F6 XROM:F92E 0B fcb $B XROM:F92F 00 fcb 0 XROM:F930 00 fcb 0 XROM:F931 60 fcb $60 ; scan code 1b - F5 XROM:F932 03 fcb 3 XROM:F933 00 fcb 0 XROM:F934 00 fcb 0 XROM:F935 76 fcb $76 ; scan code 1c - F4 XROM:F936 0C fcb $C XROM:F937 00 fcb 0 XROM:F938 00 fcb 0 XROM:F939 FF fcb $FF ; scan code 1d - (INVALID) XROM:F93A 00 fcb 0 XROM:F93B 00 fcb 0 XROM:F93C 00 fcb 0 XROM:F93D 35 fcb $35 ; scan code 1e - ESC XROM:F93E 76 fcb $76 XROM:F93F 00 fcb 0 XROM:F940 00 fcb 0 XROM:F941 FF fcb $FF ; scan code 1f - (INVALID) XROM:F942 00 fcb 0 XROM:F943 00 fcb 0 XROM:F944 00 fcb 0 XROM:F945 62 fcb $62 ; scan code 20 - F7 XROM:F946 83 fcb $83 XROM:F947 00 fcb 0 XROM:F948 00 fcb 0 XROM:F949 11 fcb $11 ; scan code 21 - 'T' XROM:F94A 2C fcb $2C XROM:F94B 74 fcb 't' XROM:F94C 54 fcb 'T' XROM:F94D 10 fcb $10 ; scan code 22 - 'Y' XROM:F94E 35 fcb $35 XROM:F94F 79 fcb 'y' XROM:F950 59 fcb 'Y' XROM:F951 21 fcb $21 ; scan code 23 - '[' XROM:F952 54 fcb $54 XROM:F953 5B fcb '[' XROM:F954 7B fcb '{' XROM:F955 FF fcb $FF ; scan code 24 - (INVALID) XROM:F956 00 fcb 0 XROM:F957 00 fcb 0 XROM:F958 00 fcb 0 XROM:F959 FF fcb $FF ; scan code 25 - (INVALID) XROM:F95A 00 fcb 0 XROM:F95B 00 fcb 0 XROM:F95C 00 fcb 0 XROM:F95D FF fcb $FF ; scan code 26 - (INVALID) XROM:F95E 00 fcb 0 XROM:F95F 00 fcb 0 XROM:F960 00 fcb 0 XROM:F961 FF fcb $FF ; scan code 27 - (INVALID) XROM:F962 00 fcb 0 XROM:F963 00 fcb 0 XROM:F964 00 fcb 0 XROM:F965 FF fcb $FF ; scan code 28 - (INVALID) XROM:F966 00 fcb 0 XROM:F967 00 fcb 0 XROM:F968 00 fcb 0 XROM:F969 FF fcb $FF ; scan code 29 - (INVALID) XROM:F96A 00 fcb 0 XROM:F96B 00 fcb 0 XROM:F96C 00 fcb 0 XROM:F96D 1E fcb $1E ; scan code 2a - ']' XROM:F96E 5B fcb $5B XROM:F96F 5D fcb ']' XROM:F970 7D fcb '}' XROM:F971 33 fcb $33 ; scan code 2b - Backspace XROM:F972 66 fcb $66 XROM:F973 00 fcb 0 XROM:F974 00 fcb 0 XROM:F975 63 fcb $63 ; scan code 2c - F4 XROM:F976 04 fcb 4 XROM:F977 00 fcb 0 XROM:F978 00 fcb 0 XROM:F979 39 fcb $39 ; scan code 2d - Caps Lock XROM:F97A 58 fcb $58 XROM:F97B 00 fcb 0 XROM:F97C 00 fcb 0 XROM:F97D 30 fcb $30 ; scan code 2e - TAB XROM:F97E 0D fcb $D XROM:F97F 09 fcb 9 ; TAB XROM:F980 09 fcb 9 ; TAB XROM:F981 38 fcb $38 ; scan code 2f - left Shift XROM:F982 12 fcb $12 XROM:F983 00 fcb 0 XROM:F984 00 fcb 0 XROM:F985 FF fcb $FF ; scan code 30 - (INVALID) XROM:F986 00 fcb 0 XROM:F987 00 fcb 0 XROM:F988 00 fcb 0 XROM:F989 0B fcb $B ; scan code 31 - 'B' XROM:F98A 32 fcb $32 XROM:F98B 62 fcb 'b' XROM:F98C 42 fcb 'B' XROM:F98D 2D fcb $2D ; scan code 32 - 'N' XROM:F98E 31 fcb $31 XROM:F98F 6E fcb 'n' XROM:F990 4E fcb 'N' XROM:F991 2C fcb $2C ; scan code 33 - '/' XROM:F992 4A fcb $4A XROM:F993 2F fcb '/' XROM:F994 3F fcb '?' XROM:F995 3C fcb $3C ; scan code 34 - arrow Right XROM:F996 74 fcb $74 XROM:F997 00 fcb 0 XROM:F998 00 fcb 0 XROM:F999 3B fcb $3B ; scan code 35 - arrow Left XROM:F99A 6B fcb $6B XROM:F99B 00 fcb 0 XROM:F99C 00 fcb 0 XROM:F99D 37 fcb $37 ; scan code 36 - left??? cloverleaf XROM:F99E 00 fcb 0 XROM:F99F 00 fcb 0 XROM:F9A0 00 fcb 0 XROM:F9A1 3E fcb $3E ; scan code 37 - arrow Up XROM:F9A2 75 fcb $75 XROM:F9A3 00 fcb 0 XROM:F9A4 00 fcb 0 XROM:F9A5 FF fcb $FF ; scan code 38 - (INVALID) XROM:F9A6 00 fcb 0 XROM:F9A7 00 fcb 0 XROM:F9A8 00 fcb 0 XROM:F9A9 FF fcb $FF ; scan code 39 - (INVALID) XROM:F9AA 00 fcb 0 XROM:F9AB 00 fcb 0 XROM:F9AC 00 fcb 0 XROM:F9AD FF fcb $FF ; scan code 3a - (INVALID) XROM:F9AE 00 fcb 0 XROM:F9AF 00 fcb 0 XROM:F9B0 00 fcb 0 XROM:F9B1 31 fcb $31 ; scan code 3b - Space XROM:F9B2 29 fcb $29 XROM:F9B3 20 fcb $20 ; Space XROM:F9B4 20 fcb $20 ; Space XROM:F9B5 FF fcb $FF ; scan code 3c - (INVALID) XROM:F9B6 00 fcb 0 XROM:F9B7 00 fcb 0 XROM:F9B8 00 fcb 0 XROM:F9B9 FF fcb $FF ; scan code 3d - (INVALID) XROM:F9BA 00 fcb 0 XROM:F9BB 00 fcb 0 XROM:F9BC 00 fcb 0 XROM:F9BD FF fcb $FF ; scan code 3e - (INVALID) XROM:F9BE 00 fcb 0 XROM:F9BF 00 fcb 0 XROM:F9C0 00 fcb 0 XROM:F9C1 FF fcb $FF ; scan code 3f - (INVALID) XROM:F9C2 00 fcb 0 XROM:F9C3 00 fcb 0 XROM:F9C4 00 fcb 0 XROM:F9C5 25 fcb $25 ; scan code 40 - 'L' XROM:F9C6 4B fcb $4B XROM:F9C7 6C fcb 'l' XROM:F9C8 4C fcb 'L' XROM:F9C9 03 fcb 3 ; scan code 41 - 'F' XROM:F9CA 2B fcb $2B XROM:F9CB 66 fcb 'f' XROM:F9CC 46 fcb 'F' XROM:F9CD 26 fcb $26 ; scan code 42 - 'J' XROM:F9CE 3B fcb $3B XROM:F9CF 6A fcb 'j' XROM:F9D0 4A fcb 'J' XROM:F9D1 29 fcb $29 ; scan code 43 - ';' XROM:F9D2 4C fcb $4C XROM:F9D3 3B fcb ';' XROM:F9D4 3A fcb ':' XROM:F9D5 FF fcb $FF ; scan code 44 - (INVALID) XROM:F9D6 00 fcb 0 XROM:F9D7 00 fcb 0 XROM:F9D8 00 fcb 0 XROM:F9D9 FF fcb $FF ; scan code 45 - (INVALID) XROM:F9DA 00 fcb 0 XROM:F9DB 00 fcb 0 XROM:F9DC 00 fcb 0 XROM:F9DD FF fcb $FF ; scan code 46 - (INVALID) XROM:F9DE 00 fcb 0 XROM:F9DF 00 fcb 0 XROM:F9E0 00 fcb 0 XROM:F9E1 FF fcb $FF ; scan code 47 - (INVALID) XROM:F9E2 00 fcb 0 XROM:F9E3 00 fcb 0 XROM:F9E4 00 fcb 0 XROM:F9E5 36 fcb $36 ; scan code 48 - left Ctrl XROM:F9E6 14 fcb $14 XROM:F9E7 00 fcb 0 XROM:F9E8 00 fcb 0 XROM:F9E9 FF fcb $FF ; scan code 49 - (INVALID) XROM:F9EA 00 fcb 0 XROM:F9EB 00 fcb 0 XROM:F9EC 00 fcb 0 XROM:F9ED 28 fcb $28 ; scan code 4a - 'K' XROM:F9EE 42 fcb $42 XROM:F9EF 6B fcb 'k' XROM:F9F0 4B fcb 'K' XROM:F9F1 2A fcb $2A ; scan code 4b - '\' XROM:F9F2 5D fcb $5D XROM:F9F3 5C fcb '\' XROM:F9F4 7C fcb '|' XROM:F9F5 02 fcb 2 ; scan code 4c - 'D' XROM:F9F6 23 fcb $23 XROM:F9F7 64 fcb 'd' XROM:F9F8 44 fcb 'D' XROM:F9F9 01 fcb 1 ; scan code 4d - 'S' XROM:F9FA 1B fcb $1B XROM:F9FB 73 fcb 's' XROM:F9FC 53 fcb 'S' XROM:F9FD 00 fcb 0 ; scan code 4e - 'A' XROM:F9FE 1C fcb $1C XROM:F9FF 61 fcb 'a' XROM:FA00 41 fcb 'A' XROM:FA01 FF fcb $FF ; scan code 4f - (INVALID) XROM:FA02 00 fcb 0 XROM:FA03 00 fcb 0 XROM:FA04 00 fcb 0 XROM:FA05 19 fcb $19 ; scan code 50 - '9' XROM:FA06 46 fcb $46 XROM:FA07 39 fcb '9' XROM:FA08 28 fcb '(' XROM:FA09 15 fcb $15 ; scan code 51 - '4' XROM:FA0A 25 fcb $25 XROM:FA0B 34 fcb '4' XROM:FA0C 24 fcb '$' XROM:FA0D 1A fcb $1A ; scan code 52 - '7' XROM:FA0E 3D fcb $3D XROM:FA0F 37 fcb '7' XROM:FA10 26 fcb '&' XROM:FA11 1D fcb $1D ; scan code 53 - '0' XROM:FA12 45 fcb $45 XROM:FA13 30 fcb '0' XROM:FA14 29 fcb ')' XROM:FA15 FF fcb $FF ; scan code 54 - (INVALID) XROM:FA16 00 fcb 0 XROM:FA17 00 fcb 0 XROM:FA18 00 fcb 0 XROM:FA19 FF fcb $FF ; scan code 55 - (INVALID) XROM:FA1A 00 fcb 0 XROM:FA1B 00 fcb 0 XROM:FA1C 00 fcb 0 XROM:FA1D 47 fcb $47 ; scan code 56 - Clear File XROM:FA1E 00 fcb 0 XROM:FA1F 00 fcb 0 XROM:FA20 00 fcb 0 XROM:FA21 FF fcb $FF ; scan code 57 - (INVALID) XROM:FA22 00 fcb 0 XROM:FA23 00 fcb 0 XROM:FA24 00 fcb 0 XROM:FA25 FF fcb $FF ; scan code 58 - (INVALID) XROM:FA26 00 fcb 0 XROM:FA27 00 fcb 0 XROM:FA28 00 fcb 0 XROM:FA29 FF fcb $FF ; scan code 59 - (INVALID) XROM:FA2A 00 fcb 0 XROM:FA2B 00 fcb 0 XROM:FA2C 00 fcb 0 XROM:FA2D 1C fcb $1C ; scan code 5a - '8' XROM:FA2E 3E fcb $3E XROM:FA2F 38 fcb '8' XROM:FA30 2A fcb '*' XROM:FA31 6D fcb $6D ; scan code 5b - Num Lock XROM:FA32 77 fcb $77 XROM:FA33 00 fcb 0 XROM:FA34 00 fcb 0 XROM:FA35 14 fcb $14 ; scan code 5c - '3' XROM:FA36 26 fcb $26 XROM:FA37 33 fcb '3' XROM:FA38 23 fcb '#' XROM:FA39 13 fcb $13 ; scan code 5d - '2' XROM:FA3A 1E fcb $1E XROM:FA3B 32 fcb '2' XROM:FA3C 40 fcb $40 XROM:FA3D 12 fcb $12 ; scan code 5e - '1' XROM:FA3E 16 fcb $16 XROM:FA3F 31 fcb '1' XROM:FA40 21 fcb '!' XROM:FA41 FF fcb $FF ; scan code 5f - (INVALID) XROM:FA42 00 fcb 0 XROM:FA43 00 fcb 0 XROM:FA44 00 fcb 0 XROM:FA45 1F fcb $1F ; scan code 60 - 'O' XROM:FA46 44 fcb $44 XROM:FA47 6F fcb 'o' XROM:FA48 4F fcb 'O' XROM:FA49 0F fcb $F ; scan code 61 - 'R' XROM:FA4A 2D fcb $2D XROM:FA4B 72 fcb 'r' XROM:FA4C 52 fcb 'R' XROM:FA4D 20 fcb $20 ; scan code 62 - 'U' XROM:FA4E 3C fcb $3C XROM:FA4F 75 fcb 'u' XROM:FA50 55 fcb 'U' XROM:FA51 23 fcb $23 ; scan code 63 - 'P' XROM:FA52 4D fcb $4D XROM:FA53 70 fcb 'p' XROM:FA54 50 fcb 'P' XROM:FA55 FF fcb $FF ; scan code 64 - (INVALID) XROM:FA56 00 fcb 0 XROM:FA57 00 fcb 0 XROM:FA58 00 fcb 0 XROM:FA59 FF fcb $FF ; scan code 65 - (INVALID) XROM:FA5A 00 fcb 0 XROM:FA5B 00 fcb 0 XROM:FA5C 00 fcb 0 XROM:FA5D 73 fcb $73 ; scan code 66 - Home XROM:FA5E 6C fcb $6C XROM:FA5F 00 fcb 0 XROM:FA60 00 fcb 0 XROM:FA61 FF fcb $FF ; scan code 67 - (INVALID) XROM:FA62 00 fcb 0 XROM:FA63 00 fcb 0 XROM:FA64 00 fcb 0 XROM:FA65 FF fcb $FF ; scan code 68 - (INVALID) XROM:FA66 00 fcb 0 XROM:FA67 00 fcb 0 XROM:FA68 00 fcb 0 XROM:FA69 FF fcb $FF ; scan code 69 - (INVALID) XROM:FA6A 00 fcb 0 XROM:FA6B 00 fcb 0 XROM:FA6C 00 fcb 0 XROM:FA6D 22 fcb $22 ; scan code 6a - 'I' XROM:FA6E 43 fcb $43 XROM:FA6F 69 fcb 'i' XROM:FA70 49 fcb 'I' XROM:FA71 FF fcb $FF ; scan code 6b - (INVALID) XROM:FA72 00 fcb 0 XROM:FA73 00 fcb 0 XROM:FA74 00 fcb 0 XROM:FA75 0E fcb $E ; scan code 6c - 'E' XROM:FA76 24 fcb $24 XROM:FA77 65 fcb 'e' XROM:FA78 45 fcb 'E' XROM:FA79 0D fcb $D ; scan code 6d - 'W' XROM:FA7A 1D fcb $1D XROM:FA7B 77 fcb 'w' XROM:FA7C 57 fcb 'W' XROM:FA7D 0C fcb $C ; scan code 6e - 'Q' XROM:FA7E 15 fcb $15 XROM:FA7F 71 fcb 'q' XROM:FA80 51 fcb 'Q' XROM:FA81 FF fcb $FF ; scan code 6f - (INVALID) XROM:FA82 00 fcb 0 XROM:FA83 00 fcb 0 XROM:FA84 00 fcb 0 XROM:FA85 2F fcb $2F ; scan code 70 - '.' XROM:FA86 49 fcb $49 XROM:FA87 2E fcb '.' XROM:FA88 3E fcb '>' XROM:FA89 09 fcb 9 ; scan code 71 - 'V' XROM:FA8A 2A fcb $2A XROM:FA8B 76 fcb 'v' XROM:FA8C 56 fcb 'V' XROM:FA8D 2E fcb $2E ; scan code 72 - 'M' XROM:FA8E 3A fcb $3A XROM:FA8F 6D fcb 'm' XROM:FA90 4D fcb 'M' XROM:FA91 FF fcb $FF ; scan code 73 - (INVALID) XROM:FA92 00 fcb 0 XROM:FA93 00 fcb 0 XROM:FA94 00 fcb 0 XROM:FA95 FF fcb $FF ; scan code 74 - (INVALID) XROM:FA96 00 fcb 0 XROM:FA97 00 fcb 0 XROM:FA98 00 fcb 0 XROM:FA99 77 fcb $77 ; scan code 75 - End XROM:FA9A 69 fcb $69 XROM:FA9B 00 fcb 0 XROM:FA9C 00 fcb 0 XROM:FA9D FF fcb $FF ; scan code 76 - (INVALID) XROM:FA9E 00 fcb 0 XROM:FA9F 00 fcb 0 XROM:FAA0 00 fcb 0 XROM:FAA1 67 fcb $67 ; scan code 77 - ins/del XROM:FAA2 71 fcb $71 XROM:FAA3 00 fcb 0 XROM:FAA4 00 fcb 0 XROM:FAA5 FF fcb $FF ; scan code 78 - (INVALID) XROM:FAA6 00 fcb 0 XROM:FAA7 00 fcb 0 XROM:FAA8 00 fcb 0 XROM:FAA9 3A fcb $3A ; scan code 79 - left??? Alt XROM:FAAA 11 fcb $11 XROM:FAAB 00 fcb 0 XROM:FAAC 00 fcb 0 XROM:FAAD 2B fcb $2B ; scan code 7a - ',' XROM:FAAE 41 fcb $41 XROM:FAAF 2C fcb ',' XROM:FAB0 3C fcb '<' XROM:FAB1 24 fcb $24 ; scan code 7b - Return XROM:FAB2 5A fcb $5A XROM:FAB3 0D fcb $D ; Return XROM:FAB4 0D fcb $D ; Return XROM:FAB5 08 fcb 8 ; scan code 7c - 'C' XROM:FAB6 21 fcb $21 XROM:FAB7 63 fcb 'c' XROM:FAB8 43 fcb 'C' XROM:FAB9 07 fcb 7 ; scan code 7d - 'X' XROM:FABA 22 fcb $22 XROM:FABB 78 fcb 'x' XROM:FABC 58 fcb 'X' XROM:FABD 06 fcb 6 ; scan code 7e - 'Z' XROM:FABE 1A fcb $1A XROM:FABF 7A fcb 'z' XROM:FAC0 5A fcb 'Z' XROM:FAC1 38 fcb $38 ; scan code 7f - right Shift XROM:FAC2 59 fcb $59 XROM:FAC3 00 fcb 0 XROM:FAC4 00 fcb 0 XROM:FAC5 31 byte_FAC5: fcb $31 ; ... XROM:FAC5 ; 20h - space XROM:FAC6 92 fcb $92 XROM:FAC7 A7 fcb $A7 XROM:FAC8 94 fcb $94 XROM:FAC9 95 fcb $95 XROM:FACA 97 fcb $97 XROM:FACB 9A fcb $9A XROM:FACC 27 fcb $27 XROM:FACD 99 fcb $99 XROM:FACE 9D fcb $9D XROM:FACF 9C fcb $9C XROM:FAD0 98 fcb $98 XROM:FAD1 2B fcb $2B XROM:FAD2 1B fcb $1B XROM:FAD3 2F fcb $2F XROM:FAD4 2C fcb $2C XROM:FAD5 1D fcb $1D ; 30h - '0' XROM:FAD6 12 fcb $12 XROM:FAD7 13 fcb $13 XROM:FAD8 14 fcb $14 XROM:FAD9 15 fcb $15 XROM:FADA 17 fcb $17 XROM:FADB 16 fcb $16 XROM:FADC 1A fcb $1A XROM:FADD 1C fcb $1C XROM:FADE 19 fcb $19 XROM:FADF A9 fcb $A9 XROM:FAE0 29 fcb $29 XROM:FAE1 AB fcb $AB XROM:FAE2 18 fcb $18 XROM:FAE3 AF fcb $AF XROM:FAE4 AC fcb $AC XROM:FAE5 93 fcb $93 XROM:FAE6 80 fcb $80 ; 41h - 'A' XROM:FAE7 8B fcb $8B XROM:FAE8 88 fcb $88 XROM:FAE9 82 fcb $82 XROM:FAEA 8E fcb $8E XROM:FAEB 83 fcb $83 XROM:FAEC 85 fcb $85 XROM:FAED 84 fcb $84 XROM:FAEE A2 fcb $A2 XROM:FAEF A6 fcb $A6 XROM:FAF0 A8 fcb $A8 XROM:FAF1 A5 fcb $A5 XROM:FAF2 AE fcb $AE XROM:FAF3 AD fcb $AD XROM:FAF4 9F fcb $9F XROM:FAF5 A3 fcb $A3 XROM:FAF6 8C fcb $8C XROM:FAF7 8F fcb $8F XROM:FAF8 81 fcb $81 XROM:FAF9 91 fcb $91 XROM:FAFA A0 fcb $A0 XROM:FAFB 89 fcb $89 XROM:FAFC 8D fcb $8D XROM:FAFD 87 fcb $87 XROM:FAFE 90 fcb $90 XROM:FAFF 86 fcb $86 ; 5ah - 'Z' XROM:FB00 21 fcb $21 XROM:FB01 2A fcb $2A XROM:FB02 1E fcb $1E XROM:FB03 96 fcb $96 XROM:FB04 9B fcb $9B XROM:FB05 27 fcb $27 XROM:FB06 00 fcb 0 ; 61h - 'a' XROM:FB07 0B fcb $B XROM:FB08 08 fcb 8 XROM:FB09 02 fcb 2 XROM:FB0A 0E fcb $E XROM:FB0B 03 fcb 3 XROM:FB0C 05 fcb 5 XROM:FB0D 04 fcb 4 XROM:FB0E 22 fcb $22 XROM:FB0F 26 fcb $26 XROM:FB10 28 fcb $28 XROM:FB11 25 fcb $25 XROM:FB12 2E fcb $2E XROM:FB13 2D fcb $2D XROM:FB14 1F fcb $1F XROM:FB15 23 fcb $23 XROM:FB16 0C fcb $C XROM:FB17 0F fcb $F XROM:FB18 01 fcb 1 XROM:FB19 11 fcb $11 XROM:FB1A 20 fcb $20 XROM:FB1B 09 fcb 9 XROM:FB1C 0D fcb $D XROM:FB1D 07 fcb 7 XROM:FB1E 10 fcb $10 XROM:FB1F 06 fcb 6 ; 7ah - 'z' XROM:FB20 A1 fcb $A1 XROM:FB21 AA fcb $AA XROM:FB22 9E fcb $9E XROM:FB23 B2 fcb $B2 XROM:FB24 01 60 aFilePartitions_FB24:fdb $160 ; ... XROM:FB24 ; 8 4-byte structures; [start,end] file partitions XROM:FB26 7F FF fdb $7FFF XROM:FB28 01 00 fdb $100 XROM:FB2A 3F FF fdb $3FFF XROM:FB2C 40 00 fdb $4000 XROM:FB2E 7F FF fdb $7FFF XROM:FB30 01 00 fdb $100 XROM:FB32 3F FF fdb $3FFF XROM:FB34 40 00 fdb $4000 XROM:FB36 7F FF fdb $7FFF XROM:FB38 01 00 fdb $100 XROM:FB3A 2F FF fdb $2FFF XROM:FB3C 30 00 fdb $3000 XROM:FB3E 5F FF fdb $5FFF XROM:FB40 60 00 fdb $6000 XROM:FB42 7F DE fdb $7FDE XROM:FB44 31 20 41 6C+testFile_FB44: fcc "1 AlphaSmart is easy to use and rugged." ; ... XROM:FB44 70 68 61 53+ fcb $D ; (next line) XROM:FB6C 32 20 61 62+ fcc "2 abcdefghijklmnopqrstuvwxyz" XROM:FB88 09 fcb 9 ; (greek gamma? TAB?) XROM:FB89 31 32 33 34+ fcc "1234567890" XROM:FB93 0D fcb $D ; (next line) XROM:FB94 33 20 60 2D+ fcc "3 `-=[]\" XROM:FB9C 27 fcb $27 ; (apostrophe) XROM:FB9D 2C 2E 2F 7E+ fcc ",./~!@#$%^&*()_+{}|:<>?;" XROM:FBB5 22 fcb $22 ; (double quote) XROM:FBB6 0D fcb $D ; (next line) XROM:FBB7 34 20 41 42+ fcc "4 ABCDEFGHIJKLMNOPQRSTUVWXYZ" XROM:FBD3 0D fcb $D ; (next line) XROM:FBD4 00 fcb 0 ; (and done) XROM:FBD5 41 72 65 20+aAreYouSureYouWantToOverwrite:fcc "Are you sure you want to overwrite" ; ... XROM:FBD5 79 6F 75 20+ fcb 0 XROM:FBF8 74 68 69 73+aThisFileWithTheRomTestFile?YN:fcc "this file with the ROM test file? (y/n)" ; ... XROM:FBF8 20 66 69 6C+ fcb 0 XROM:FC20 53 70 75 72+aSpurint: fcc "SpurInt!" ; ... XROM:FC20 49 6E 74 21+ fcb 0 XROM:FC29 28 53 74 61+aStackUnbalance:fcc "(Stack unbalance)ilOpCode @ addr:" ; ... XROM:FC29 63 6B 20 75+ fcb 0 XROM:FC4B 4E 4D 49 00 aNmi: fcc "NMI" ; ... XROM:FC4B fcb 0 XROM:FC4F 45 72 72 3A+aErr: fcc "Err:" ; ... XROM:FC4F 00 fcb 0 XROM:FC54 48 65 72 65+aHere1: fcc "Here1" ; ... XROM:FC54 31 00 fcb 0 XROM:FC5A 48 65 72 65+aHere2: fcc "Here2" ; ... XROM:FC5A 32 00 fcb 0 XROM:FC60 42 61 64 20+aBadFile: fcc "Bad File#" ; ... XROM:FC60 46 69 6C 65+ fcb 0 XROM:FC6A 54 65 73 74+aTestingRam___: fcc "Testing RAM..." ; ... XROM:FC6A 69 6E 67 20+ fcb 0 XROM:FC79 41 64 64 72+aAddrramErr: fcc "AddrRAM err:" XROM:FC79 52 41 4D 20+ fcb 0 XROM:FC86 52 2F 57 20+aRWRamErr: fcc "R/W RAM err:" ; ... XROM:FC86 52 41 4D 20+ fcb 0 XROM:FC93 44 61 74 61+aDatabusramErr: fcc "DataBusRAM err:" ; ... XROM:FC93 42 75 73 52+ fcb 0 XROM:FCA3 41 64 72 42+aAdrbusramErr: fcc "AdrBusRAM err:" ; ... XROM:FCA3 75 73 52 41+ fcb 0 XROM:FCB2 52 64 3A 00 aRd: fcc "Rd:" ; ... XROM:FCB2 fcb 0 XROM:FCB6 45 78 70 3A+aExp: fcc "Exp:" ; ... XROM:FCB6 00 fcb 0 XROM:FCBB 20 20 20 20+aLowBattery: fcc " Low Battery!!" ; ... XROM:FCBB 20 20 20 20+ fcb 0 XROM:FCD6 28 53 69 67+aSignatureNotFo:fcc "(Signature not found. Initializing...)" ; ... XROM:FCD6 6E 61 74 75+ fcb 0 XROM:FCFD 50 65 72 66+aPerformingEmer:fcc "Performing emergency recovery of" ; ... XROM:FCFD 6F 72 6D 69+ fcb 0 XROM:FD1E 66 69 6C 65+aFile: fcc "file " ; ... XROM:FD1E 20 00 fcb 0 XROM:FD24 2E 2E 2E 2E+a____: fcc "...." ; ... XROM:FD24 00 fcb 0 XROM:FD29 46 69 6C 65+aFileIsFull_Use:fcc "File is full. Use another file or" ; ... XROM:FD29 20 69 73 20+ fcb 0 XROM:FD4C 73 65 6E 64+aSendDataToYour:fcc "send data to your computer." ; ... XROM:FD4C 20 64 61 74+ fcb 0 XROM:FD68 42 61 64 20+aBadScanCode: fcc "Bad Scan Code" ; ... XROM:FD68 53 63 61 6E+ fcb 0 XROM:FD76 54 6F 20 63+aToChangeSendSp:fcc "To change Send speed, type 1, 2, 3 or 4." ; ... XROM:FD76 68 61 6E 67+ fcb 0 XROM:FD9F 20 20 20 20+a1VerySlow2Slow:fcc " 1: VERY Slow 2: Slow" ; ... XROM:FD9F 31 3A 20 56+ fcb 0 XROM:FDBF 20 20 20 20+a3FastDefault4F:fcc " 3: Fast(default) 4: Fastest" ; ... XROM:FDBF 33 3A 20 46+ fcb 0 XROM:FDE2 43 75 72 72+aCurrentSetting:fcc "Current setting is " ; ... XROM:FDE2 65 6E 74 20+ fcb 0 XROM:FDF6 41 72 65 20+aAreYouSureYo_0:fcc "Are you sure you want to delete" ; ... XROM:FDF6 79 6F 75 20+ fcb 0 XROM:FE16 61 6C 6C 20+aAllTheDataInThisFile?YN:fcc "all the data in this file?(y/n)" ; ... XROM:FE16 74 68 65 20+ fcb 0 XROM:FE36 41 72 65 20+aAreYouSureYouWantToPermanently:fcc "Are you sure you want to PERMANENTLY" ; ... XROM:FE36 79 6F 75 20+ fcb 0 XROM:FE5B 65 72 61 73+aEraseAllTheDataInThisFile?YN:fcc "erase all the data in this file?(y/n)" ; ... XROM:FE5B 65 20 61 6C+ fcb 0 XROM:FE81 4F 70 65 6E+aOpeningFile: fcc "Opening File " ; ... XROM:FE81 69 6E 67 20+ fcb 0 XROM:FE8F 41 74 74 61+aAttachedToMacE:fcc "Attached to Mac, emulating keyboard." ; ... XROM:FE8F 63 68 65 64+ fcb 0 XROM:FEB4 41 74 74 61+aAttachedToPcEm:fcc "Attached to PC, emulating keyboard." ; ... XROM:FEB4 63 68 65 64+ fcb 0 XROM:FED8 50 72 65 73+aPressSendKeyTo:fcc "Press Send key to transfer file " ; ... XROM:FED8 73 20 53 65+ fcb 0 XROM:FEF9 53 65 6E 64+aSending____pressAnyKeyToStop_:fcc "Sending....Press any key to stop. " ; ... XROM:FEF9 69 6E 67 2E+ fcb 0 XROM:FF1C 41 6C 70 68+aAlphasmartV2_0:fcc "AlphaSmart v2.03" ; ... XROM:FF1C 61 53 6D 61+ fcb 0 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ; NOP padding XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FF2D 01 01 01 01+ fcb 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 XROM:FFD3 7E fcb $7E ; ~ XROM:FFD4 E0 00 fdb start_E000 XROM:FFD6 E5 34 vecSCIserial: fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFD8 E5 34 vecSPIserialTransferComplete:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFDA E5 34 vecPulseAccumulatorInputEdge:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFDC E5 34 vecPulseAccumulatorOverflow:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFDE E5 34 vecTimerOverflow:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFE0 E5 34 vecTIC4OC5: fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFE2 E5 34 vecTimerOutputCompare4:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFE4 E5 34 vecTimerOutputCompare3:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFE6 E5 34 vecTimerOutputCompare2:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFE8 E5 34 vecTimerOutputCompare1:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFEA E5 34 vecTimerInputCapture3:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFEC E5 34 vecTimerInputCapture2:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFEE E5 34 vecTimerInputCapture1:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFF0 E5 34 vecRealTime: fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFF2 E5 21 vecIRQ: fdb isrIRQ_E521 ; wake from sleep by keydown; setup to resume processing in main XROM:FFF4 E5 2A vecXIRQ: fdb isrNMI_E52A ; (not supposed to happen) XROM:FFF6 E5 34 vecSWI: fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFF8 E5 3E vecIllegalOpcode:fdb isrIllegalOpcode_E53E ; horror; emit message, delay, and set to restart XROM:FFFA E5 34 vecCOPwatchdog: fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFFC E5 34 vecClockMonitor:fdb isrSpuriousInt_E534 ; (not supposed to happen) XROM:FFFE E0 00 vecPowerOnReset:fdb start_E000 XROM:FFFE ; end of 'XROM' XROM:FFFE XROM:FFFE XROM:FFFE end