 .OPT NO LIST›;  SAVE #D1:KEYBDIRQ.M65›;›;›;  LOAD #D1:CASSETTE.M65›;› .PAGE "Keyboard IRQ Handler"›;  *= $FC19›  LIST  › .LOCAL ›;›; Keyboard IRQ processing routines›; Note all references to f1, f2,›; etc. and LED's are to 1200xl.›; The code for these is in all›; xl/xe rom's even though the›; hardware is not.›;›; On the 1200xl, bits 2 and 3 of›; PortB control LED's 1 (kbd)›; and 2 (charset). LED's are on›; when bits are off.›;›; A program using 130xe bank›; switching should be unaffected›; as long as the OS is in ROM.›; A custom OS which accesses the›; 1200xl functions, however, may›; result in unwanted changes in›; PortB.›;›;›KIR› TXA         Save registers› PHA › TYA › PHA › LDY PORTB   For led's› LDA KBCODE  Is key same as› CMP CH1     last accepted?› BNE ?GOTKEY Go if not.› LDX KEYDEL  Exit if bounce› BNE ?RESET  time not done.›;›?GOTKEY› LDX KEYDIS› CMP #$83    Control f1?› BNE ?NOTCF1› TXA         Toggle keyboard› EOR #$FF    disable flag.› STA KEYDIS  Nonzero=kbd off› BNE ?LED1ON Go if now off.› TYA         PortB to a› ORA #4      Set b2 (LED off)› BNE ?GOTCF1 Go always.›;›?LED1ON› TYA         PortB to a. Kill› AND #$FB    bit2 (LED1 on)›;›?GOTCF1› TAY         New PortB to y› BCS ?VALID  Go always›;›?NOTCF1› TXA         Recheck delay› BNE ?EXIT   Go if not done› LDA KBCODE  Get key again› TAX         and copy in x› CMP #159    Control 1?› BNE ?HELP?› LDA SSFLAG  Yes, toggle flag› EOR #$FF    (nonzero=freeze)› STA SSFLAG› BCS ?VALID  Go always›;›?HELP?› AND #$3F    Mask Shft/Ctrl› CMP #17     If not Help, go› BNE ?SCREN? check others›;      else save actual› STX HELPFG  key press here› BEQ ?VALID  only. Go always.›;›?STOWIT› STX CH      Update user and› STX CH1     last key reg's›;›?VALID› LDA #3      Valid key exit.› STA KEYDEL  Set bounce delay› LDA #0      and kill attract› STA ATRACT  mode›;›?RESET› LDA KRPDEL  Reset key› STA SRTIMR  repeat timer› LDA SDMCTL  Is screen on?› BNE ?EXIT   If so, exit› LDA DMASAV  Restore screen› STA SDMCTL  on any keypress›;›?EXIT› STY PORTB   Enable led's› PLA         Restore reg's› TAY › PLA › TAX › PLA › RTI ›;›?SCREN?› CPX #$84    Control f2?› BEQ ?GOTCF2› CPX #$94    Control f4?› BNE ?STOWIT Go if not.› LDA CHBAS   Else switch the› LDX CHSALT  character sets› STA CHSALT  Alt.=Old Active› STX CHBAS   Active=Old Alt.› CPX # >CHARSET2 Go if alt.› BEQ ?LED2ON set now active› TYA         PortB to a› ORA #8      Set bit3› TAY         Back to y› BNE ?VALID  Go always.›;›?LED2ON› TYA         PortB to a› AND #$F7    Kill b3 (LED on)› TAY         Back to y› JMP ?VALID›;›?GOTCF2› LDA SDMCTL  Toggle S:› BEQ ?EXIT   Go if off› STA DMASAV  Else save value› LDA #0      for auto restore› STA SDMCTL  and kill screen› BEQ ?EXIT   Go always›;›FDL› PHA         Display list› LDA COLOR2  interrupt code›  AEOR  COLRSH for fine scroll›  AAND  DRKMSK› STA WSYNC› STA COLPF1› PLA › RTI › .BYTE 0,0   Unused bytes›