Blame | Last modification | View Log | Download | RSS feed
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001
00002 list p=18f4420
00003 #include p18f4420.inc
00001 LIST
00002
00003 ;==========================================================================
00004 ; MPASM PIC18F4420 processor include
00005 ;
00006 ; (c) Copyright 1999-2012 Microchip Technology, All rights reserved
00007 ;==========================================================================
00008
01446 LIST
00004 #include defs.inc
00327 LIST
00005 #include equ.inc
00145 LIST
00006
00007
00008 Startup code 0x0000
000000 EF?? F??? 00009 goto Start
000004 0000 00010 nop
00011
00012 HighISR code 0x0008
000008 B2F2 00013 btfsc INTCON, INT0IF
00000A D??? 00014 rcall KbdInt ; INT0 -> dato da tastiera
00000C B2F0 00015 btfsc INTCON3, INT2IF
00000E 00FF 00016 reset ; INT2 -> reset
000010 92F2 00017 bcf INTCON, INT0IF ; resetta flag INT0
000012 0011 00018 retfie FAST
00019
00020 LowISR code 0x0018
000018 A0F0 00021 btfss INTCON3, INT1IF
00001A 0010 00022 retfie ; INT non generato da INT1 (linea DRQ)
00001C 90F0 00023 bcf INTCON3, INT1IF
00001E 8E?? 00024 bsf KFRFlag, KFRFULL ; segnala registri da leggere
000020 0010 00025 retfie
00026
00027
00028 code
00029
000000 00030 KbdInt:
000000 D??? 00031 rcall RxKeyb ; riceve byte da tastiera
00032 SCLOCKL ; disabilita TX da tastiera
000002 988A M bcf LATB, KCLKO
000004 B0?? 00033 btfsc KStatus, KRESET ; test reset
000006 00FF 00034 reset ; ricevuto reset in -> reset
000008 B2?? 00035 btfsc KStatus, KTIMEO ; test timeout
00000A 0012 00036 return ; scarta dato ricevuto se timeout
00000C AE?? 00037 btfss KStatus, KBRX ; test ricezione full
00000E 0012 00038 return ; ricezione incompleta -> scarta dato
00039 ldw KStatus ; test errore ricezione
000010 50?? M movf KStatus, w
000012 0B0C 00040 andlw KBRXERR
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000014 E0?? 00041 bz KbdInt10 ; dato ricevuto OK
000016 0EFE 00042 movlw KBD_RESEND ; richiesta di re-invio alla tastiera
000018 D??? 00043 rcall TxKeyb
00001A B0?? 00044 btfsc KStatus, KRESET ; test reset
00001C 00FF 00045 reset ; ricevuto reset in -> reset
00001E 0012 00046 return ; ignora altri errori
00047
000020 00048 KbdInt10:
000020 0E00 00049 movlw 0x00 ; scarta codice 00 (overrun)
000022 5C?? 00050 subwf KBuf, W
000024 E0?? 00051 bz KbdInt99
000026 0EFF 00052 movlw 0xFF ; scarta codice FF (overrun/error)
000028 5C?? 00053 subwf KBuf, W
00002A E0?? 00054 bz KbdInt99
00002C 0EFE 00055 movlw KBD_RESEND ; scarta richiesta resend
00002E 5C?? 00056 subwf KBuf, W
000030 E0?? 00057 bz KbdInt99
000032 0EFA 00058 movlw KBD_ACK ; scarta ACK
000034 5C?? 00059 subwf KBuf, W
000036 E0?? 00060 bz KbdInt99
000038 0EAA 00061 movlw KBD_BAT ; scarta BAT
00003A 5C?? 00062 subwf KBuf, W
00003C E1?? 00063 bnz KbdInt11
00003E 8C?? 00064 bsf KbdFlag, KBBAT
000040 88?? 00065 bsf KbdFlag, KBBAT2
000042 9E?? 00066 bcf KbdFlag2, KBNOBAT
000044 D??? 00067 bra KbdInt99
00068
000046 00069 KbdInt11:
000046 0EFC 00070 movlw KBD_NOBAT ; scarta BAT failure
000048 5C?? 00071 subwf KBuf, W
00004A E1?? 00072 bnz KbdInt12
00004C 9C?? 00073 bcf KbdFlag, KBBAT
00004E 98?? 00074 bcf KbdFlag, KBBAT2
000050 8E?? 00075 bsf KbdFlag2, KBNOBAT
00076
000052 00077 KbdInt99:
00078 SCLOCKH ; abilita TX da tastiera
000052 888A M bsf LATB, KCLKO
000054 0012 00079 return
00080
000056 00081 KbdInt12: ; inserisce byte in coda
000056 0EF5 00082 movlw (RXBUFLEN - 9) ; lascia un limite di guardia di 8 bytes
000058 5C?? 00083 subwf RxCnt,W ; RxCnt - (RXBUFLEN - 9))
00005A B0D8 00084 btfsc STATUS, C ; C = 0 -> OK - spazio disponibile in coda
00005C 8E?? 00085 bsf RxFlag, RXOVR ; segnala condizione overrun
00086 ldw KBuf ; memorizza byte in coda
00005E 50?? M movf KBuf, w
000060 6EDE 00087 movwf POSTINC2
000062 2A?? 00088 incf RxCnt, f ; incrementa contatore bytes in coda
000064 0E3E 00089 movlw LOW(RxBufEnd) ; coda circolare - test puntatore
000066 5CD9 00090 subwf FSR2L, W ; FSR2L - LOW(RxBufEnd)
000068 0E01 00091 movlw HIGH(RxBufEnd) ; limite superiore H
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00006A 58DA 00092 subwfb FSR2H, W ; FSR2H - HIGH(RxBufEnd)
00006C B0D8 00093 btfsc STATUS, C ; C = 0 se FSR2 < RxBufEnd
00006E EE20 F040 00094 lfsr FSR2, RxBuffer ; reimposta puntatore a inizio buffer
00095
000072 00096 KbdInt20:
000072 AE?? 00097 btfss RxFlag, RXOVR ; se in condizioni di overrun disabilita TX
000074 D??? 00098 bra KbdInt99 ; riabilita trasmissione da tastiera
000076 0012 00099 return ; esce con CLK OUT LOW
00100
000078 00101 RxKeyb:
000078 6A?? 00102 clrf KStatus ; azzera status
00007A 0E08 00103 movlw D'8' ; contatore 8 bit
00007C 6E?? 00104 movwf KCnt
00007E 0E01 00105 movlw D'1' ; parity bit (odd)
000080 6E?? 00106 movwf KPar
000082 0E01 00107 movlw TMR0P4 ; TMR0 stop, prescaler = 4
000084 6ED5 00108 movwf T0CON ; modo 16 bit
000086 94F2 00109 bcf INTCON, TMR0IF ; azzera flag timeout
000088 0E9E 00110 movlw HIGH(T20MS) ; imposta timeout
00008A 6ED7 00111 movwf TMR0H ; caricare prima TMR0H
00008C 6E?? 00112 movwf T0CntH
00008E 0E58 00113 movlw LOW(T20MS)
000090 6ED6 00114 movwf TMR0L ; carica TMR0L/H
000092 6E?? 00115 movwf T0CntL
000094 8ED5 00116 bsf T0CON, TMR0ON ; start Timer 0
00117
000096 00118 RxKeyb1: ; attesa CLK IN -> LOW
000096 D??? 00119 rcall GetLine
000098 E6?? 00120 bmi RxKeyb1 ; CLK IN = HIGH - loop
00121
00009A 00122 RxKeyb2: ; loop attesa CLK IN -> HIGH
00009A D??? 00123 rcall GetLine
00009C E7?? 00124 bpl RxKeyb2 ; CLK IN = LOW - loop
00125
00009E 00126 RxKeyb3: ; loop attesa CLK IN -> LOW
00009E D??? 00127 rcall GetLine
0000A0 E6?? 00128 bmi RxKeyb3 ; CLK IN = HIGH - loop
0000A2 E3?? 00129 bnc RxKeyb4 ; no parity se DATA IN = LOW
0000A4 2A?? 00130 incf KPar, f ; incrementa parity
0000A6 80D8 00131 bsf STATUS, C ; forza CARRY = 1 (DATA IN = HIGH)
00132
0000A8 00133 RxKeyb4: ; aggiorna KBuf
0000A8 32?? 00134 rrcf KBuf, f ; KBuf<7> = CARRY
0000AA 2E?? 00135 decfsz KCnt, f ; decrementa contatore 8 bit
0000AC D??? 00136 bra RxKeyb2 ; loop 8 bit
00137
0000AE 00138 RxKeyb5: ; attesa CLK IN -> HIGH
0000AE D??? 00139 rcall GetLine
0000B0 E7?? 00140 bpl RxKeyb5 ; CLK IN = LOW - loop
00141
0000B2 00142 RxKeyb6: ; attesa CLK IN -> LOW
0000B2 D??? 00143 rcall GetLine
0000B4 E6?? 00144 bmi RxKeyb6 ; CLK IN = HIGH - loop
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000B6 34?? 00145 rlcf KCnt, W ; C = parity bit -> W<0> = parity bit
0000B8 1A?? 00146 xorwf KPar, f ; confronto parity ricevuta con parity calcolata
0000BA 30?? 00147 rrcf KPar, W ; C = confronto parity
0000BC E3?? 00148 bnc RxKeyb7 ; C = 0 -> parity OK
0000BE 84?? 00149 bsf KStatus, KPARY ; imposta errore parity
00150
0000C0 00151 RxKeyb7: ; attesa CLK IN -> HIGH
0000C0 D??? 00152 rcall GetLine
0000C2 E7?? 00153 bpl RxKeyb7 ; CLK IN = LOW - loop
00154
0000C4 00155 RxKeyb8: ; attesa CLK IN -> LOW
0000C4 D??? 00156 rcall GetLine
0000C6 E6?? 00157 bmi RxKeyb8 ; CLK IN = HIGH - loop
0000C8 E2?? 00158 bc RxKeyb9 ; C = 1 -> stop bit OK
0000CA 86?? 00159 bsf KStatus, KSTOP ; segnala errore bit stop errato
00160
0000CC 00161 RxKeyb9: ; attesa CLK IN -> HIGH - fine trasmissione
0000CC D??? 00162 rcall GetLine
0000CE E7?? 00163 bpl RxKeyb9 ; CLK IN = LOW - loop
0000D0 8E?? 00164 bsf KStatus, KBRX ; segnala ricezione completata
0000D2 9ED5 00165 bcf T0CON, TMR0ON ; stop Timer 0
0000D4 94F2 00166 bcf INTCON, TMR0IF ; azzera flag timeout
0000D6 0012 00167 return
00168
0000D8 00169 GetLine:
0000D8 B4F2 00170 btfsc INTCON, TMR0IF ; test timeout
0000DA D??? 00171 bra GetLine2 ; timeout
00172 ldw PORTB
0000DC 5081 M movf PORTB, w
0000DE 0B0D 00173 andlw RBMASK ; maschera bit utili
0000E0 6E?? 00174 movwf TmpB ; salva temporaneo
00175 ldw PORTB
0000E2 5081 M movf PORTB, w
0000E4 0B0D 00176 andlw RBMASK ; maschera bit utili
0000E6 62?? 00177 cpfseq TmpB ; confronta con lettura precedente
0000E8 D??? 00178 bra GetLine ; attesa linee stabili o timeout
0000EA A4?? 00179 btfss TmpB, RESIN ; test asserzione reset da host
0000EC D??? 00180 bra GetLine1 ; reset da host
0000EE 98D8 00181 bcf STATUS, N ; N = 0 se CLK IN = LOW
0000F0 B6?? 00182 btfsc TmpB, KCLKIN
0000F2 88D8 00183 bsf STATUS, N ; N = 1 se CLK IN = HIGH
0000F4 90D8 00184 bcf STATUS, C ; C = 0 se DATA IN = LOW
0000F6 B0?? 00185 btfsc TmpB, KDATAIN
0000F8 80D8 00186 bsf STATUS, C ; C = 1 se DATA IN = HIGH
0000FA 0012 00187 return ; C = DATA IN, N = CLK IN
00188
0000FC 00189 GetLine1:
0000FC 80?? 00190 bsf KStatus, KRESET ; segnala reset
0000FE 0006 00191 pop ; scarta indirizzo di ritorno
000100 0012 00192 return ; uscita
00193
000102 00194 GetLine2:
000102 82?? 00195 bsf KStatus, KTIMEO ; segnala timeout
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000104 9ED5 00196 bcf T0CON, TMR0ON ; stop Timer 0
000106 94F2 00197 bcf INTCON, TMR0IF ; azzera flag timeout
000108 0006 00198 pop ; scarta indirizzo di ritorno
00010A 0012 00199 return ; uscita
00200
00201
00010C 00202 TxKeyb:
00010C 6E?? 00203 movwf KBuf ; salva dato da trasmettere
00010E 6A?? 00204 clrf KStatus ; azzera status
000110 0E08 00205 movlw TMR0P0 ; TMR0 stop, no prescaler, modo 16 bit
000112 6ED5 00206 movwf T0CON
000114 94F2 00207 bcf INTCON, TMR0IF ; azzera flag timeout
000116 0EFE 00208 movlw HIGH(T100US) ; imposta timeout 100us
000118 6ED7 00209 movwf TMR0H ; caricare prima TMR0H
00011A 0E0C 00210 movlw LOW(T100US)
00011C 6ED6 00211 movwf TMR0L ; carica TMR0L/H
00011E 0E08 00212 movlw D'8' ; contatore 8 bit
000120 6E?? 00213 movwf KCnt
000122 0E01 00214 movlw D'1' ; parity bit (odd)
000124 6E?? 00215 movwf KPar
00216 SCLOCKL ; CLK OUT -> LOW - request to send
000126 988A M bcf LATB, KCLKO
000128 8ED5 00217 bsf T0CON, TMR0ON ; start Timer 0
00218
00012A 00219 TxKeyb1: ; ritardo 100us
00012A A4F2 00220 btfss INTCON, TMR0IF
00012C D??? 00221 bra TxKeyb1 ; loop ritardo
00222 SDATAL ; DATA OUT -> LOW (start bit)
00012E 9A8A M bcf LATB, KDATAO
000130 9ED5 00223 bcf T0CON, TMR0ON ; stop Timer 0
000132 94F2 00224 bcf INTCON, TMR0IF ; azzera flag timeout
000134 0E01 00225 movlw TMR0P4 ; TMR0 stop, prescaler = 4
000136 6ED5 00226 movwf T0CON ; modo 16 bit
000138 0E9E 00227 movlw HIGH(T20MS) ; imposta timeout
00013A 6ED7 00228 movwf TMR0H ; caricare prima TMR0H
00013C 0E58 00229 movlw LOW(T20MS)
00013E 6ED6 00230 movwf TMR0L ; carica TMR0L/H
000140 8ED5 00231 bsf T0CON, TMR0ON ; start Timer 0
00232 SCLOCKH ; CLK OUT -> HIGH (rilascia clock)
000142 888A M bsf LATB, KCLKO
00233
000144 00234 TxKeyb2: ; attesa CLK IN -> LOW
000144 D??? 00235 rcall GetLine
000146 E6?? 00236 bmi TxKeyb2 ; CLK IN = HIGH -> loop
00237
000148 00238 TxKeyb3: ; loop 8 bit
000148 32?? 00239 rrcf KBuf ; C = KBuf<0> - bit da inviare
00014A E3?? 00240 bnc TxKeyb4 ; C = 0 -> DATA OUT = LOW
00014C 2A?? 00241 incf KPar, f ; C = 1 -> aggiorna parity
00242 SDATAH ; DATA OUT = HIGH
00014E 8A8A M bsf LATB, KDATAO
000150 D??? 00243 bra TxKeyb5
00244
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000152 00245 TxKeyb4:
00246 SDATAL ; DATA OUT = LOW
000152 9A8A M bcf LATB, KDATAO
00247
000154 00248 TxKeyb5: ; invia bit
000154 D??? 00249 rcall GetLine ; attende CLK IN -> HIGH
000156 E7?? 00250 bpl TxKeyb5 ; CLK IN = LOW -> loop
00251
000158 00252 TxKeyb6:
000158 D??? 00253 rcall GetLine ; attende CLK IN -> LOW
00015A E6?? 00254 bmi TxKeyb6 ; CLK IN = HIGH -> loop
00015C 2E?? 00255 decfsz KCnt, f ; decrementa contatore 8 bit
00015E D??? 00256 bra TxKeyb3 ; loop 8 bit
000160 32?? 00257 rrcf KPar, f ; C = KPar<0> -> parity bit
000162 E3?? 00258 bnc TxKeyb7 ; C = 0 -> DATA OUT = LOW
00259 SDATAH ; DATA OUT = HIGH
000164 8A8A M bsf LATB, KDATAO
000166 D??? 00260 bra TxKeyb8
00261
000168 00262 TxKeyb7:
00263 SDATAL ; DATA OUT = LOW
000168 9A8A M bcf LATB, KDATAO
00264
00016A 00265 TxKeyb8:
00016A D??? 00266 rcall GetLine ; attende CLK IN -> HIGH
00016C E7?? 00267 bpl TxKeyb8 ; CLK IN = LOW -> loop
00268
00016E 00269 TxKeyb9:
00016E D??? 00270 rcall GetLine ; attende CLK IN -> LOW
000170 E6?? 00271 bmi TxKeyb9 ; CLK IN = HIGH -> loop
00272 SDATAH ; DATA OUT -> HIGH - stop bit
000172 8A8A M bsf LATB, KDATAO
00273
000174 00274 TxKeyb10:
000174 D??? 00275 rcall GetLine ; attende CLK IN -> HIGH
000176 E7?? 00276 bpl TxKeyb10 ; CLK IN = LOW -> loop
00277
000178 00278 TxKeyb11:
000178 D??? 00279 rcall GetLine ; attende CLK IN -> LOW
00017A E6?? 00280 bmi TxKeyb11 ; CLK IN = HIGH -> loop
00017C E3?? 00281 bnc TxKeyb12 ; C = 0 -> DATA IN = LOW - ack bit ok
00017E 88?? 00282 bsf KStatus, KBACK ; segnala errore ack bit
00283
000180 00284 TxKeyb12:
000180 D??? 00285 rcall GetLine ; attende CLK IN -> HIGH
000182 E7?? 00286 bpl TxKeyb12 ; CLK IN = LOW -> loop
000184 8C?? 00287 bsf KStatus, KBTX ; segnala trasmissione completata
000186 9ED5 00288 bcf T0CON, TMR0ON ; stop Timer 0
000188 94F2 00289 bcf INTCON, TMR0IF ; azzera flag timeout
00018A 0012 00290 return
00291
00018C 00292 GetKbd:
00018C EC?? F??? 00293 call RxKeyb ; ricezione entro timeout
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000190 B0?? 00294 btfsc KStatus, KRESET ; test reset
000192 00FF 00295 reset ; ricevuto reset in -> reset
000194 B2?? 00296 btfsc KStatus, KTIMEO ; test timeout
000196 D??? 00297 bra GetKbd10 ; errore ricezione
00298 ldw KStatus ; test errore ricezione
000198 50?? M movf KStatus, w
00019A 0B0C 00299 andlw KBRXERR
00019C E1?? 00300 bnz GetKbd10 ; dato ricevuto errato
00019E 90D8 00301 bcf STATUS, C ; C = = -> OK
0001A0 0012 00302 return
0001A2 00303 GetKbd10:
0001A2 80D8 00304 bsf STATUS, C ; C = 1 -> errore
0001A4 0012 00305 return
00306
0001A6 00307 SendLed:
0001A6 0EED 00308 movlw KBD_SETLED
0001A8 D??? 00309 rcall SendKbd
0001AA E2?? 00310 bc SendKbd10
00311 ldw LedSt
0001AC 50?? M movf LedSt, w
00312
0001AE 00313 SendKbd:
0001AE D??? 00314 rcall TxKeyb
0001B0 B0?? 00315 btfsc KStatus, KRESET ; test reset
0001B2 00FF 00316 reset ; ricevuto reset in -> reset
0001B4 B2?? 00317 btfsc KStatus, KTIMEO ; test timeout
0001B6 D??? 00318 bra SendKbd10 ; errore
0001B8 AC?? 00319 btfss KStatus, KBTX ; test trasmissione OK
0001BA D??? 00320 bra SendKbd10 ; trasmissione fallita - errore
0001BC AC?? 00321 btfss KStatus, KBTX ; test trasmissione OK
0001BE D??? 00322 bra SendKbd10 ; trasmissione fallita - errore
0001C0 B8?? 00323 btfsc KStatus, KBACK ; test errore ACK
0001C2 D??? 00324 bra SendKbd10 ; errore ACK
0001C4 D??? 00325 rcall GetKbd ; ricezione da tastiera
0001C6 E2?? 00326 bc SendKbd10 ; errore ricezione
0001C8 0EFA 00327 movlw KBD_ACK ; test ACK tastiera
0001CA 62?? 00328 cpfseq KBuf
0001CC D??? 00329 bra SendKbd10 ; errore
0001CE 90D8 00330 bcf STATUS, C ; C = = -> OK
0001D0 0012 00331 return
0001D2 00332 SendKbd10:
0001D2 80D8 00333 bsf STATUS, C ; C = 1 -> errore
0001D4 0012 00334 return
00335
0001D6 00336 InitIO:
0001D6 9CD0 00337 bcf RCON, 6
0001D8 82D0 00338 bsf RCON, 1
0001DA 6AF2 00339 clrf INTCON ; disabilita interrupt
0001DC 6AF1 00340 clrf INTCON2 ; RB0, RB1, RB2 int su fronte negativo
0001DE 6AF0 00341 clrf INTCON3
0001E0 6A9E 00342 clrf PIR1
0001E2 6AA1 00343 clrf PIR2
0001E4 6A9D 00344 clrf PIE1
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0001E6 6AA0 00345 clrf PIE2
0001E8 6AC2 00346 clrf ADCON0 ; disabilita modulo A/D
0001EA 6892 00347 setf DDRA ; tutte le porte in input
0001EC 6893 00348 setf DDRB
0001EE 6894 00349 setf DDRC
0001F0 6895 00350 setf DDRD
0001F2 6896 00351 setf DDRE
0001F4 0E0F 00352 movlw B'00001111' ; tutte le porte I/O sono digitali
0001F6 6EC1 00353 movwf ADCON1
0001F8 6889 00354 setf LATA ; tutte le porte I/O a livello alto
0001FA 688A 00355 setf LATB
0001FC 688B 00356 setf LATC
0001FE 688C 00357 setf LATD
000200 6A8D 00358 clrf LATE ; porta RE a livello basso in uscita
000202 0EC3 00359 movlw B'11000011' ; RA<0:1> input, le altre output
000204 6E92 00360 movwf DDRA
000206 0ECF 00361 movlw B'11001111' ; RB<4:5> in output, le altre in input
000208 6E93 00362 movwf DDRB
00020A 6A94 00363 clrf DDRC ; porta C in uscita
00020C 9C8B 00364 bcf LATC, KBVOFF ; resetta alimentazione tastiera
00020E 6A96 00365 clrf DDRE ; porta E in uscita
000210 6AF8 00366 clrf TBLPTRU ; FLASH solo < 64K
000212 D??? 00367 rcall InitData ; inizializza variabili
00368
000214 00369 Init1: ; attesa linea reset in alta
000214 A481 00370 btfss PORTB, RESIN
000216 D??? 00371 bra Init1
00372
000218 8ED0 00373 bsf RCON, IPEN ; abilita int. priorizzati
00021A 9EF1 00374 bcf INTCON2, RBPU ; disabilita pull-up su porta B
00021C 8EF0 00375 bsf INTCON3, INT2IP ; alta priority per INT2 su RB2 (reset in)
00021E 9CF0 00376 bcf INTCON3, INT1IP ; bassa priority per INT1 su RB1 (linea DRQ)
000220 88F2 00377 bsf INTCON, INT0IE ; abilita INT0 su RB0 high priority (DATA IN)
000222 86F0 00378 bsf INTCON3, INT1IE ; abilita INT1 su RB1 (linea DRQ)
000224 88F0 00379 bsf INTCON3, INT2IE ; abilita INT2 su RB2 (linea reset in)
000226 8C8B 00380 bsf LATC, KBVOFF ; termina impulso negativo VCC tastiera
000228 0E0C 00381 movlw LOW(T100US) ; imposta ritardo 100us
00022A 6E?? 00382 movwf T0CntL
00022C 0EFE 00383 movlw HIGH(T100US)
00022E 6E?? 00384 movwf T0CntH
000230 D??? 00385 rcall Delay_us ; ritardo 100us
000232 9E8B 00386 bcf LATC, KBVON ; attiva alimentazione tastiera
000234 0E9C 00387 movlw LOW(T20US) ; imposta ritardo 20us
000236 6E?? 00388 movwf T0CntL
000238 0EFF 00389 movlw HIGH(T20US)
00023A 6E?? 00390 movwf T0CntH
00023C D??? 00391 rcall Delay_us ; ritardo 20us
00023E 8E8B 00392 bsf LATC, KBVON ; termina impulso negativo
000240 0EB0 00393 movlw LOW(T40MS) ; imposta ritardo 40ms per stabilizzare VCC
000242 6E?? 00394 movwf T0CntL
000244 0E3C 00395 movlw HIGH(T40MS)
000246 6E?? 00396 movwf T0CntH
000248 D??? 00397 rcall Delay_ms ; ritardo 40ms
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 9
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00024A 92F2 00398 bcf INTCON, INT0IF ; resetta flag INT0 (eventuali impulsi spuri)
00024C 0E07 00399 movlw TMR0P256 ; TMR0 stop, prescaler = 256, modo 16 bit
00024E 6ED5 00400 movwf T0CON
000250 94F2 00401 bcf INTCON, TMR0IF ; azzera flag timeout
000252 0E8D 00402 movlw HIGH(T1500MS) ; imposta timeout 1500ms
000254 6ED7 00403 movwf TMR0H ; caricare prima TMR0H
000256 0E90 00404 movlw LOW(T1500MS)
000258 6ED6 00405 movwf TMR0L ; carica TMR0L/H
00025A 8ED5 00406 bsf T0CON, TMR0ON ; start Timer 0
00407
00025C 00408 Init2: ; loop attesa tastiera entro timeout 1500ms
00025C B4F2 00409 btfsc INTCON, TMR0IF
00025E D??? 00410 bra Init4 ; timeout
000260 B2F0 00411 btfsc INTCON3, INT2IF
000262 00FF 00412 reset ; INT2 -> reset
000264 A2F2 00413 btfss INTCON, INT0IF
000266 D??? 00414 bra Init2 ; loop
000268 9ED5 00415 bcf T0CON, TMR0ON ; stop Timer 0
00026A 94F2 00416 bcf INTCON, TMR0IF ; azzera flag timeout
00026C EC?? F??? 00417 call RxKeyb ; INT0 -> riceve dato da tastiera
000270 B0?? 00418 btfsc KStatus, KRESET ; test reset
000272 00FF 00419 reset ; ricevuto reset in -> reset
000274 B2?? 00420 btfsc KStatus, KTIMEO ; test timeout
000276 D??? 00421 bra Init4 ; scarta dato ricevuto se timeout
000278 AE?? 00422 btfss KStatus, KBRX ; test ricezione full
00027A D??? 00423 bra Init4 ; ricezione incompleta -> scarta dato
00424 ldw KStatus ; test errore ricezione
00027C 50?? M movf KStatus, w
00027E 0B0C 00425 andlw KBRXERR
000280 E1?? 00426 bnz Init4 ; dato ricevuto errato
000282 0EAA 00427 movlw KBD_BAT ; test BAT OK
000284 62?? 00428 cpfseq KBuf
000286 D??? 00429 bra KNoBAT ; no BAT OK !
000288 8C?? 00430 bsf KbdFlag, KBBAT ; imposta flag BAT OK
00028A 88?? 00431 bsf KbdFlag, KBBAT2 ; imposta flag BAT OK
00028C D??? 00432 bra Init3
00433
00028E 00434 KNoBAT:
00028E 0EFC 00435 movlw KBD_NOBAT ; test BAT failure
000290 62?? 00436 cpfseq KBuf
000292 D??? 00437 bra Init3
000294 8E?? 00438 bsf KbdFlag2, KBNOBAT ; imposta flag BAT FAILURE
00439
000296 00440 Init3:
000296 8E?? 00441 bsf KbdFlag, KBFND ; imposta flag tastiera presente
00442
000298 00443 Init4: ; KBFND indica tastiera prsente - se il flag e' resettato
00444 ; occorre fare ulteriore verifica della tastiera
000298 9ED5 00445 bcf T0CON, TMR0ON ; stop Timer 0
00029A 94F2 00446 bcf INTCON, TMR0IF ; azzera flag timeout
00029C 92F2 00447 bcf INTCON, INT0IF ; resetta flag INT0
00029E AE?? 00448 btfss KbdFlag, KBFND ; se tastiera presente salta ulteriore verifica
0002A0 D??? 00449 rcall KbVerf ; verifica tastiera
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 10
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0002A2 92F2 00450 bcf INTCON, INT0IF ; resetta flag INT0
0002A4 AE?? 00451 btfss KbdFlag, KBFND ; se tastiera presente la inizializza
0002A6 D??? 00452 bra Init10 ; altrimenti esce
0002A8 AC?? 00453 btfss KbdFlag, KBBAT ; tastiera ok ?
0002AA D??? 00454 bra Init10 ; no -> esce
00455
00456 ; a questo punto tastiera presente e funzionante
00457 ; si legge ID tastiera
0002AC 92F2 00458 bcf INTCON, INT0IF ; resetta flag INT0
0002AE 0EF2 00459 movlw KBD_GETID
0002B0 EC?? F??? 00460 call SendKbd
0002B4 E2?? 00461 bc Init6 ; errore
0002B6 EC?? F??? 00462 call GetKbd ; riceve ID LOW
0002BA E2?? 00463 bc Init6 ; errore
00464 ldw KBuf
0002BC 50?? M movf KBuf, w
0002BE 6E?? 00465 movwf KbdIDL ; salva ID LOW
0002C0 EC?? F??? 00466 call GetKbd ; riceve ID LOW
0002C4 E2?? 00467 bc Init6 ; errore
00468 ldw KBuf
0002C6 50?? M movf KBuf, w
0002C8 6E?? 00469 movwf KbdIDH ; salva ID HIGH
0002CA 0EAB 00470 movlw KBD_IDL ; test ID
0002CC 62?? 00471 cpfseq KbdIDL
0002CE D??? 00472 bra Init6 ; ID LOW errato
0002D0 0E83 00473 movlw KBD_IDH ; test ID
0002D2 62?? 00474 cpfseq KbdIDH
0002D4 D??? 00475 bra Init6 ; ID HIGH errato
0002D6 8A?? 00476 bsf KbdFlag, KBVID ; imposta flag ID valido
00477
0002D8 00478 Init6:
0002D8 92F2 00479 bcf INTCON, INT0IF ; resetta flag INT0
0002DA 0EED 00480 movlw KBD_SETLED ; spegne LED
0002DC EC?? F??? 00481 call SendKbd
0002E0 E2?? 00482 bc Init61
0002E2 0E00 00483 movlw 0x00
0002E4 EC?? F??? 00484 call SendKbd
0002E8 E2?? 00485 bc Init61
0002EA 80?? 00486 bsf KbdFlag, KBLEDOK
00487
0002EC 00488 Init61:
0002EC 92F2 00489 bcf INTCON, INT0IF ; resetta flag INT0
0002EE 0EF0 00490 movlw KBD_SETSC ; imposta scancode 02
0002F0 EC?? F??? 00491 call SendKbd
0002F4 E2?? 00492 bc Init62
0002F6 0E02 00493 movlw 0x02
0002F8 EC?? F??? 00494 call SendKbd
0002FC E2?? 00495 bc Init62
0002FE 82?? 00496 bsf KbdFlag, KBSCOK
00497
000300 00498 Init62:
000300 92F2 00499 bcf INTCON, INT0IF ; resetta flag INT0
000302 0EF3 00500 movlw KBD_TYPERATE ; imposta typerate
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 11
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000304 EC?? F??? 00501 call SendKbd
000308 E2?? 00502 bc Init63
00030A 0E0B 00503 movlw KBD_DEFRATE
00030C EC?? F??? 00504 call SendKbd
000310 E2?? 00505 bc Init63
000312 86?? 00506 bsf KbdFlag, KBRATE
00507
000314 00508 Init63:
000314 92F2 00509 bcf INTCON, INT0IF ; resetta flag INT0
000316 0EF4 00510 movlw KBD_ENABLE ; abilita scanning tastiera
000318 EC?? F??? 00511 call SendKbd
00031C E2?? 00512 bc Init10
00031E 84?? 00513 bsf KbdFlag, KBENABLE
00514
000320 00515 Init10:
00516 SCLOCKL ; disabilita TX da tastiera
000320 988A M bcf LATB, KCLKO
000322 0E03 00517 movlw 0x03 ; registro KFR 3
000324 6E8D 00518 movwf LATE
00519 ldw KbdFlag
000326 50?? M movf KbdFlag, w
000328 EC?? F??? 00520 call KFRWrite
00032C 92F2 00521 bcf INTCON, INT0IF ; resetta flag INT0
00032E 90F0 00522 bcf INTCON3, INT1IF ; resetta flag INT1
000330 92F0 00523 bcf INTCON3, INT2IF ; resetta flag INT2
000332 8EF2 00524 bsf INTCON, GIEH ; abilita INT high priority
000334 8CF2 00525 bsf INTCON, GIEL ; abilita INT low priority
000336 0012 00526 return
00527
000338 00528 InitData:
000338 EE00 F000 00529 lfsr FSR0, 0x0 ; azzera RAM banco 0, 1 & 2
00033C 0E03 00530 movlw 0x03 ; banco 3 non esiste !
00531
00033E 00532 InitData1:
00033E 6AEE 00533 clrf POSTINC0
000340 62EA 00534 cpfseq FSR0H
000342 D??? 00535 bra InitData1
00536
000344 0E04 00537 movlw 0x04 ; contatore registri
000346 6E?? 00538 movwf KFRRdCnt
000348 6A8D 00539 clrf LATE ; azzera indirizzo KFR
00034A 6A95 00540 clrf DDRD ; porta D in uscita
00034C 6A8C 00541 clrf LATD ; porta D tutti i bit bassi
00542
00034E 00543 InitData2:
00034E 0000 00544 nop ; scrittura su registro
000350 0000 00545 nop
000352 928B 00546 bcf LATC, KFRWE ; impulso write
000354 0000 00547 nop
000356 828B 00548 bsf LATC, KFRWE
000358 0000 00549 nop
00035A 2A8D 00550 incf LATE,f ; incrementa indirizzo
00035C 2E?? 00551 decfsz KFRRdCnt, f ; loop
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 12
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00035E D??? 00552 bra InitData2
000360 EE20 F040 00553 lfsr FSR2, RxBuffer ; imposta puntatore iniziale testa buffer RX
000364 EE10 F040 00554 lfsr FSR1, RxBuffer ; imposta puntatore iniziale coda buffer RX
000368 0E3E 00555 movlw LOW(TxBuffer) ; imposta puntatore Head, Tail TX a inizio buffer
00036A 6E?? 00556 movwf TxHeadL
00036C 6E?? 00557 movwf TxTailL
00036E 0E01 00558 movlw HIGH(TxBuffer)
000370 6E?? 00559 movwf TxHeadH
000372 6E?? 00560 movwf TxTailH
000374 0012 00561 return
00562
000376 00563 Delay_ms:
000376 0E01 00564 movlw TMR0P4 ; TMR0 stop, prescaler = 4, modo 16 bit
000378 D??? 00565 bra Delay_xx
00566
00037A 00567 Delay_us:
00037A 0E08 00568 movlw TMR0P0 ; TMR0 stop, no prescaler, modo 16 bit
00037C 00569 Delay_xx:
00037C 6ED5 00570 movwf T0CON
00037E 94F2 00571 bcf INTCON, TMR0IF ; azzera flag timeout
00572 ldw T0CntH ; imposta timeout high
000380 50?? M movf T0CntH, w
000382 6ED7 00573 movwf TMR0H ; caricare prima TMR0H
00574 ldw T0CntL
000384 50?? M movf T0CntL, w
000386 6ED6 00575 movwf TMR0L ; carica TMR0L/H
000388 8ED5 00576 bsf T0CON, TMR0ON ; start Timer 0
00577
00038A 00578 Delay_xx1: ; loop
00038A A4F2 00579 btfss INTCON, TMR0IF ; attende flag overflow
00038C D??? 00580 bra Delay_xx1 ; loop ritardo
00038E 9ED5 00581 bcf T0CON, TMR0ON ; stop Timer 0
000390 94F2 00582 bcf INTCON, TMR0IF ; azzera flag timeout
000392 0012 00583 return
00584
000394 00585 KbVerf:
000394 0EEE 00586 movlw KBD_ECHO ; test tastiera tramite ECHO
000396 EC?? F??? 00587 call TxKeyb
00039A B0?? 00588 btfsc KStatus, KRESET ; test reset
00039C 00FF 00589 reset ; ricevuto reset in -> reset
00039E B2?? 00590 btfsc KStatus, KTIMEO ; test timeout
0003A0 0012 00591 return ; tastiera non presente
0003A2 AC?? 00592 btfss KStatus, KBTX ; test trasmissione OK
0003A4 0012 00593 return ; trasmissione fallita - si assume NO tastiera
0003A6 EC?? F??? 00594 call RxKeyb ; ricezione ECHO entro timeout
0003AA B0?? 00595 btfsc KStatus, KRESET ; test reset
0003AC 00FF 00596 reset ; ricevuto reset in -> reset
0003AE B2?? 00597 btfsc KStatus, KTIMEO ; test timeout
0003B0 0012 00598 return ; tastiera non presente
0003B2 8E?? 00599 bsf KbdFlag, KBFND ; si assume tastiera presente
0003B4 AE?? 00600 btfss KStatus, KBRX ; test ricezione full
0003B6 0012 00601 return ; ricezione incompleta -> failure tastiera
00602 ldw KStatus ; test errore ricezione
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 13
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0003B8 50?? M movf KStatus, w
0003BA 0B0C 00603 andlw KBRXERR
0003BC E1?? 00604 bnz KbVerf2 ; dato ricevuto errato -> failure tastiera
0003BE 0EEE 00605 movlw KBD_ECHO ; test ECHO
0003C0 62?? 00606 cpfseq KBuf
0003C2 0012 00607 return ; failure tastiera
0003C4 8C?? 00608 bsf KbdFlag, KBBAT ; imposta flag BAT OK
0003C6 00609 KbVerf2:
0003C6 0012 00610 return
00611
0003C8 00612 KbdProc:
0003C8 0E00 00613 movlw 0x00 ; test presenza bytes nella coda di ricezione
0003CA 5C?? 00614 subwf RxCnt, W
0003CC E1?? 00615 bnz KbdProc0 ; coda non vuota
0003CE 9E?? 00616 bcf RxFlag, RXOVR ; rimuove blocco TX (coda vuota)
00617 SCLOCKH ; abilita TX da tastiera
0003D0 888A M bsf LATB, KCLKO
0003D2 0012 00618 return
0003D4 00619 KbdProc0:
0003D4 BE?? 00620 btfsc TxFlag, TXOVR ; buffer TX pronto ?
0003D6 0012 00621 return ; NO - attende posto
00622 ldw POSTINC1 ; legge byte da coda -> FSR1 ptr coda di ricezio
ne
0003D8 50E6 M movf POSTINC1, w
0003DA 6E?? 00623 movwf RxData
0003DC 9EF2 00624 bcf INTCON, GIEH ; disabilita INT
0003DE 9CF2 00625 bcf INTCON, GIEL
0003E0 06?? 00626 decf RxCnt, F ; aggiorna contatore bytes in coda
0003E2 9E?? 00627 bcf RxFlag, RXOVR ; rimuove blocco TX (coda vuota)
00628 SCLOCKH ; abilita TX da tastiera
0003E4 888A M bsf LATB, KCLKO
0003E6 8EF2 00629 bsf INTCON, GIEH ; abilita INT
0003E8 8CF2 00630 bsf INTCON, GIEL
00631 ; si assume che TBLPTR non cambia entro il ciclo
0003EA A8?? 00632 btfss RxFlag, RXEXT1 ; sequenza E1 pending ?
0003EC D??? 00633 bra KbdProc1 ; NO
0003EE 0009 00634 tblrd *+ ; legge byte da memoria ed incrementa ptr
00635 ldw TABLAT
0003F0 50F5 M movf TABLAT, w
0003F2 5C?? 00636 subwf RxData, W ; confronta con dato ricevuto
0003F4 A4D8 00637 btfss STATUS, Z ; Z = 1 se coincide
0003F6 86?? 00638 bsf RxFlag, RXE1ERR ; segnala errore in sequenza E1
0003F8 2E?? 00639 decfsz E1Cnt, F ; decrementa contatore
0003FA D??? 00640 bra UpdBufPtr
0003FC 00641 E1Test:
0003FC A6?? 00642 btfss RxFlag, RXE1ERR ; errore nella sequenza E1 ?
0003FE D??? 00643 bra PauseKey ; NO - tasto PAUSE premuto
000400 00644 ClrRX: ; termina scansione corrente - inizio nuova
000400 0E80 00645 movlw RXMASK ; azzera tutti i flag ricezione
000402 16?? 00646 andwf RxFlag, F
000404 00647 UpdBufPtr:
000404 0E3E 00648 movlw LOW(RxBufEnd) ; coda circolare - test puntatore
000406 5CE1 00649 subwf FSR1L, W ; FSR1L - LOW(RxBufEnd)
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 14
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000408 0E01 00650 movlw HIGH(RxBufEnd) ; FSR1H - HIGH(RxBufEnd)
00040A 58E2 00651 subwfb FSR1H, W ; C = 0 se FSR1 < RxBufEnd
00040C B0D8 00652 btfsc STATUS, C ; OK
00040E EE10 F040 00653 lfsr FSR1, RxBuffer ; reimposta puntatore a inizio buffer
000412 0012 00654 return
000414 00655 PauseKey:
000414 0E09 00656 movlw PAUSECODE ; imposta codice tasto PAUSE
000416 6E?? 00657 movwf RxCode
000418 D??? 00658 rcall GetKeyTbl
00041A D??? 00659 bra KbdProc14 ; gestione tasti toggle
00041C 00660 KbdProc1:
00041C 0EF0 00661 movlw KBD_BRK ; test break
00041E 5C?? 00662 subwf RxData, W
000420 E1?? 00663 bnz KbdProc2
000422 8C?? 00664 bsf RxFlag, RXBRK ; F0 break pending
000424 D??? 00665 bra UpdBufPtr
000426 00666 KbdProc2:
000426 0EE0 00667 movlw KBD_EXT ; test codice esteso
000428 5C?? 00668 subwf RxData, W
00042A E1?? 00669 bnz KbdProc3
00042C 0E80 00670 movlw RXMASK ; azzera tutti i flag ricezione
00042E 16?? 00671 andwf RxFlag, F
000430 8A?? 00672 bsf RxFlag, RXEXT ; imposta E0 pending
000432 D??? 00673 bra UpdBufPtr
000434 00674 KbdProc3:
000434 0EE1 00675 movlw KBD_EXT1 ; test codice esteso
000436 5C?? 00676 subwf RxData, W
000438 E1?? 00677 bnz KbdProc4
00043A 0E80 00678 movlw RXMASK ; azzera tutti i flag ricezione
00043C 16?? 00679 andwf RxFlag, F
00043E 88?? 00680 bsf RxFlag, RXEXT1 ; imposta E1 pending
000440 0E?? 00681 movlw LOW EXT1TBL ; imposta ptr tabella sequenza E1
000442 6EF6 00682 movwf TBLPTRL
000444 0E?? 00683 movlw HIGH EXT1TBL
000446 6EF7 00684 movwf TBLPTRH
000448 0E07 00685 movlw E1SEQCNT ; imposta numero bytes sequenza E1
00044A 6E?? 00686 movwf E1Cnt
00044C D??? 00687 bra UpdBufPtr
00044E 00688 KbdProc4:
00044E AA?? 00689 btfss RxFlag, RXEXT ; codice esteso E0 pending ?
000450 D??? 00690 bra KbdProc6 ; NO - codice normale o break
000452 0E?? 00691 movlw LOW EXTTBL ; imposta ptr tabella sequenza E0
000454 6EF6 00692 movwf TBLPTRL
000456 0E?? 00693 movlw HIGH EXTTBL
000458 6EF7 00694 movwf TBLPTRH
00045A 68?? 00695 setf E1Cnt ; indice tabella E0 (inizializzato a 0xFF)
00045C 00696 KbdProc5:
00045C 2A?? 00697 incf E1Cnt, F ; update indice
00045E 0009 00698 tblrd *+ ; legge byte da memoria ed incrementa ptr
000460 0EFF 00699 movlw 0xFF ; test fine tabella
000462 5CF5 00700 subwf TABLAT, W
000464 E0?? 00701 bz ClrRX ; termina sequenza
00702 ldw TABLAT
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 15
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000466 50F5 M movf TABLAT, w
000468 5C?? 00703 subwf RxData, W ; confronta con dato ricevuto
00046A E1?? 00704 bnz KbdProc5 ; loop next
00705 ; trovato codice esteso
00046C 0E?? 00706 movlw LOW EXTRLTBL ; imposta ptr tabella rilocazione E0
00046E 24?? 00707 addwf E1Cnt, W ; aggiunge indice
000470 6EF6 00708 movwf TBLPTRL
000472 0E?? 00709 movlw HIGH EXTRLTBL
000474 6EF7 00710 movwf TBLPTRH
000476 6AE8 00711 clrf WREG
000478 22F7 00712 addwfc TBLPTRH, F
00047A 0009 00713 tblrd *+ ; codice rilocato
00714 ldw TABLAT
00047C 50F5 M movf TABLAT, w
00047E D??? 00715 bra KbdProc10
000480 00716 KbdProc6: ; codice normale
000480 0E?? 00717 movlw LOW DEFTBL ; imposta ptr tabella sequenza normale
000482 6EF6 00718 movwf TBLPTRL
000484 0E?? 00719 movlw HIGH DEFTBL
000486 6EF7 00720 movwf TBLPTRH
000488 68?? 00721 setf E1Cnt ; indice tabella (inizializzato a 0xFF)
00048A 00722 KbdProc7:
00048A 2A?? 00723 incf E1Cnt, F ; update indice
00048C 0009 00724 tblrd *+ ; legge byte da memoria ed incrementa ptr
00048E 0EFF 00725 movlw 0xFF ; test fine tabella
000490 5CF5 00726 subwf TABLAT, W
000492 E0?? 00727 bz KbdProc8 ; codice da non rilocare
00728 ldw TABLAT
000494 50F5 M movf TABLAT, w
000496 5C?? 00729 subwf RxData, W ; confronta con dato ricevuto
000498 E1?? 00730 bnz KbdProc7 ; loop next
00731 ; trovato codice da rilocare
00049A 0E?? 00732 movlw LOW DEFRLTBL ; imposta ptr tabella rilocazione
00049C 24?? 00733 addwf E1Cnt, W ; aggiunge indice
00049E 6EF6 00734 movwf TBLPTRL
0004A0 0E?? 00735 movlw HIGH DEFRLTBL
0004A2 6EF7 00736 movwf TBLPTRH
0004A4 6AE8 00737 clrf WREG
0004A6 22F7 00738 addwfc TBLPTRH, F
0004A8 0009 00739 tblrd *+ ; codice rilocato
00740 ldw TABLAT
0004AA 50F5 M movf TABLAT, w
0004AC D??? 00741 bra KbdProc10
0004AE 00742 KbdProc8: ; rilocazione degli scan code 70..7E in 60..6E
0004AE 0E70 00743 movlw 0x70
0004B0 5C?? 00744 subwf RxData, W
00745 ldw RxData ; W = codice non rilocato
0004B2 50?? M movf RxData, w
0004B4 E3?? 00746 bnc KbdProc10 ; OK (< 70)
0004B6 0E7F 00747 movlw 0x7F ; max. codice di scansione 0x7E
0004B8 5C?? 00748 subwf RxData, W
0004BA E2?? 00749 bc ClrRX ; codice non valido (>= 7F) - azzera ed esce
0004BC 0E10 00750 movlw 0x10 ; rilocazione codice in 60..6E
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 16
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0004BE 5C?? 00751 subwf RxData, W ; W = codice rilocato
0004C0 00752 KbdProc10: ; IN -> W = codice
0004C0 6E?? 00753 movwf E1Cnt ; codice
0004C2 0E?? 00754 movlw LOW CVTTBL ; imposta ptr tabella conversione
0004C4 24?? 00755 addwf E1Cnt, W ; aggiunge indice
0004C6 6EF6 00756 movwf TBLPTRL
0004C8 0E?? 00757 movlw HIGH CVTTBL
0004CA 6EF7 00758 movwf TBLPTRH
0004CC 6AE8 00759 clrf WREG
0004CE 22F7 00760 addwfc TBLPTRH, F
0004D0 0009 00761 tblrd *+ ; codice rilocato
00762 ldw TABLAT
0004D2 50F5 M movf TABLAT, w
0004D4 6E?? 00763 movwf RxCode ; nuovo codice
0004D6 E6?? 00764 bmi ClrRX ; codice non valido - azzera flag ed esce
0004D8 0E7B 00765 movlw ('z' + 1) ; massimo codice 7A ('z')
0004DA 5C?? 00766 subwf RxCode, W
0004DC E2?? 00767 bc ClrRX ; codice non valido
00768
00769 ; RxCode contiene ora un codice compreso tra 00 e 7A
00770 ; codici 00 - 41 utilizzati per accesso tabella KEYTBL
00771 ; codici 42 - 56 utilizzati per accesso mappe US/IT
00772 ; codici 57 - 60 non validi
00773 ; codici 61 - 7A lettere 'a'..'z'
00774 ; codici 00 - 05 -> flag shift/alt/ctrl
00775 ; codici 06 - 09 -> tasti toggle (LOCK e PAUSE)
00776
0004DE 9C?? 00777 bcf TxFlag, SKPCTLB ; azzera flag skip SHIFT/ALT/CTL
0004E0 9A?? 00778 bcf TxFlag, SKPALTB
0004E2 98?? 00779 bcf TxFlag, SKPSHFB
0004E4 9C?? 00780 bcf MapCfg, MAPALPHA ; tasto non alfabetico
0004E6 0E61 00781 movlw 'a' ; test carattere alfabetico
0004E8 5C?? 00782 subwf RxCode, W
0004EA E3?? 00783 bnc MKeyTst ; no alpha - test codice mappe US/IT
0004EC 6A?? 00784 clrf TxData0 ; flag codice ASCII
00785 ldw RxCode ; 'a'..'z'
0004EE 50?? M movf RxCode, w
0004F0 6E?? 00786 movwf TxData1 ; codice ASCII tasto
0004F2 0E20 00787 movlw 0x20 ; converte in maiuscolo
0004F4 5C?? 00788 subwf RxCode, W ; 'A'..'Z'
0004F6 6E?? 00789 movwf Caps
0004F8 8C?? 00790 bsf MapCfg, MAPALPHA ; tasto alfabetico
0004FA D??? 00791 bra KbdProc40 ; gestione tasto alpha
00792
0004FC 00793 MKeyTst:
0004FC 0E42 00794 movlw MAPCODE ; test codice in 42..56 (mappe US/IT)
0004FE 5C?? 00795 subwf RxCode, W
000500 E3?? 00796 bnc NKeyTst ; CODE < MAPCODE - no tasto mappe US/IT
000502 6E?? 00797 movwf RxData ; salva CODE - MAPCODE (indice 0)
000504 0E57 00798 movlw (MAPCODEMAX + 1)
000506 5C?? 00799 subwf RxCode, W
000508 E3?? 00800 bnc MapTst ; CODE < MAPCODEMAX + 1 - tasto mappe US/IT
00050A D??? 00801 bra ClrRX ; codice non valido
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 17
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00050C 00802 MapTst:
00803 ; gestione mappe US/IT
00050C 90D8 00804 bcf STATUS, C ; azzera carry
00050E 36?? 00805 rlcf RxData, f ; * 2
000510 88?? 00806 bsf TxFlag, SKPSHFB ; skip test SHIFT
000512 BE?? 00807 btfsc MapCfg, MAPITB ; configurazione mappa IT ?
000514 D??? 00808 bra ITMap ; SI
000516 BE?? 00809 btfsc ShfSt, ASHFB ; SHIFT ?
000518 2A?? 00810 incf RxData, F ; SI - incrementa indice
00051A 0E?? 00811 movlw LOW USTBL ; imposta ptr tabella conversione mappa US
00051C 24?? 00812 addwf RxData, W ; aggiunge indice
00051E 6EF6 00813 movwf TBLPTRL
000520 0E?? 00814 movlw HIGH USTBL
000522 6EF7 00815 movwf TBLPTRH
000524 6AE8 00816 clrf WREG
000526 22F7 00817 addwfc TBLPTRH, F
000528 0008 00818 tblrd * ; codice tasto
00819 ldw TABLAT
00052A 50F5 M movf TABLAT, w
00052C 6E?? 00820 movwf TxData1 ; codice tasto
00052E 6A?? 00821 clrf TxData0 ; flag ASCII
000530 D??? 00822 bra KbdProc41 ; gestione tasto
000532 00823 ITMap:
000532 0E00 00824 movlw 0x00
000534 6E?? 00825 movwf TxData1
000536 6A?? 00826 clrf TxData0
000538 D??? 00827 bra KbdProc41 ; gestione tasto
00828
00053A 00829 NKeyTst:
00830 ; gestione tasti NO-REPEAT: PWR, SLEEP, WAKEUP, APP
00831 ; L-GUI, R-GUI, ESC, PRINT SCRN
00053A 0E18 00832 movlw WAKECODE
00053C 5C?? 00833 subwf RxCode, W
00053E E3?? 00834 bnc NMITst ; RxCode < WAKECODE
000540 6E?? 00835 movwf RxData ; RxData = RxCode - WAKECODE
000542 0E20 00836 movlw (ESCCODE + 1)
000544 5C?? 00837 subwf RxCode, W
000546 E2?? 00838 bc NMITst ; RxCode >= (ESCCODE + 1)
000548 0E?? 00839 movlw LOW RPTTBL ; imposta ptr tabella flag RPTTBL
00054A 24?? 00840 addwf RxData, W ; aggiunge indice
00054C 6EF6 00841 movwf TBLPTRL
00054E 0E?? 00842 movlw HIGH RPTTBL
000550 6EF7 00843 movwf TBLPTRH
000552 6AE8 00844 clrf WREG
000554 22F7 00845 addwfc TBLPTRH, F
000556 0008 00846 tblrd * ; flag tasto
00847 ldw TABLAT
000558 50F5 M movf TABLAT, w
00055A 6E?? 00848 movwf RxData ; flag
00055C BC?? 00849 btfsc RxFlag, RXBRK ; test tasto rilasciato
00055E D??? 00850 bra NKeyRls ; SI
000560 14?? 00851 andwf RptSt, W ; flag tasto premuto attivo ?
000562 E0?? 00852 bz NKeySet ; NO - prima attivazione
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 18
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000564 D??? 00853 bra ClrRX ; tasto repeat - scarta codice
000566 00854 NKeySet:
00855 ldw RxData ; set bit in RptSt
000566 50?? M movf RxData, w
000568 12?? 00856 iorwf RptSt, F
00056A E1?? 00857 bnz NMITst
00056C 00858 NKeyRls:
00056C 1C?? 00859 comf RxData, W ; complementa maschera per azzerare bit
00056E 16?? 00860 andwf RptSt, F ; azzera bit
00861
000570 00862 NMITst:
00863 ; CTRL + BREAK, ALT + SYSREQ, WAKE UP, PWR, SLEEP sono tasti NMI
00864 ; vengono rilevati solo dopo il loro rilascio
000570 D??? 00865 rcall GetKeyTbl
000572 52?? 00866 movf TxData1, F ; test se codice = 0
000574 E1?? 00867 bnz NMITst1
000576 D??? 00868 bra ClrRX ; tasto nullo - scarta codice
000578 00869 NMITst1:
000578 0EC0 00870 movlw 0xC0 ; test tasto NMI
00057A 5C?? 00871 subwf TxData0, W ; flag tasto
00057C E1?? 00872 bnz KbdProc12 ; no tasto NMI
00057E AC?? 00873 btfss RxFlag, RXBRK ; codice break ?
000580 D??? 00874 bra ClrRX ; NO - scarta codice
000582 9C?? 00875 bcf RxFlag, RXBRK ; azzera flag
000584 D??? 00876 bra KbdProc60 ; gestione tasto NMI
00877
000586 00878 KbdProc12:
00879 ; gestione tasti SHIFT/ALT/CTRL
00880 ; TxData0 = flag tasto
00881 ; TxData1 = codice tasto
000586 0E80 00882 movlw 0x80 ; test invio status flag
000588 5C?? 00883 subwf TxData0, W
00058A E1?? 00884 bnz KbdProc14 ; no SHIFT/ALT/CTRL
00885 ldw CtlSt ; salva flag attuali
00058C 50?? M movf CtlSt, w
00058E 6E?? 00886 movwf TCtlSt
000590 0EC0 00887 movlw (ASHFM | ALTCTLM) ; maschera bit necessari
000592 14?? 00888 andwf ShfSt, W
000594 6E?? 00889 movwf TShfSt
00890 ldw TxData1 ; flag tasto
000596 50?? M movf TxData1, w
000598 6E?? 00891 movwf RxData ; flag attuale
00059A 1C?? 00892 comf RxData, W ; complementa maschera per azzerare bit
00059C 16?? 00893 andwf CtlSt, F ; azzera bit
00894 ldw RxData ; carica maschera bit attivi
00059E 50?? M movf RxData, w
0005A0 AC?? 00895 btfss RxFlag, RXBRK ; lascia bit azzerati se tasto rilasciato
0005A2 12?? 00896 iorwf CtlSt, F ; tasto premuto: imposta bit
0005A4 9E?? 00897 bcf CtlSt, AALTB ; azzera bit di ALT e CTRL
0005A6 9C?? 00898 bcf CtlSt, ACTLB
0005A8 0E24 00899 movlw ALTKM ; test L-ALT OR R-ALT
0005AA 14?? 00900 andwf CtlSt, W
0005AC A4D8 00901 btfss STATUS, Z ; Z = 1 -> no ALT
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 19
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0005AE 8E?? 00902 bsf CtlSt, AALTB ; imposta bit ALT (L o R)
0005B0 0E12 00903 movlw CTRLKM ; test L-CTRL OR R-CTRL
0005B2 14?? 00904 andwf CtlSt, W
0005B4 A4D8 00905 btfss STATUS, Z ; Z = 1 -> no CTRL
0005B6 8C?? 00906 bsf CtlSt, ACTLB ; imposta bit CTRL (L o R)
0005B8 9E?? 00907 bcf ShfSt, ASHFB ; azzera bit SHIFT
0005BA 9C?? 00908 bcf ShfSt, ALTCTLB ; azzera bit ALT OR CTRL
0005BC 0E09 00909 movlw SHIFTKM ; test L-SHIFT OR R-SHIFT
0005BE 14?? 00910 andwf CtlSt, W
0005C0 A4D8 00911 btfss STATUS, Z ; Z = 1 -> no SHIFT
0005C2 8E?? 00912 bsf ShfSt, ASHFB ; imposta bit SHIFT (L o R)
0005C4 0EC0 00913 movlw ALLALTCTLM ; test ALT OR CTRL
0005C6 14?? 00914 andwf CtlSt, W
0005C8 A4D8 00915 btfss STATUS, Z ; Z = 1 -> no ALT OR CTRL
0005CA 8C?? 00916 bsf ShfSt, ALTCTLB ; imposta bit ALT OR CTRL (L o R)
00917 ldw CtlSt ; confronta flag attuali con flag precedenti
0005CC 50?? M movf CtlSt, w
0005CE 62?? 00918 cpfseq TCtlSt
0005D0 D??? 00919 bra KbdProc13 ; flag cambiato
0005D2 0EC0 00920 movlw (ASHFM | ALTCTLM)
0005D4 14?? 00921 andwf ShfSt, W ; maschera bit necessari
0005D6 5C?? 00922 subwf TShfSt, W ; confronta con vecchio flag
0005D8 E1?? 00923 bnz KbdProc13 ; flag cambiato
0005DA D??? 00924 bra ClrRX ; flag non cambiati -> scarta codice
0005DC 00925 KbdProc13: ; invia nuovi flag all' host
00926 ; formato -> 100000<76-ShfSt> + CtlSt
00927 ldw CtlSt
0005DC 50?? M movf CtlSt, w
0005DE 6E?? 00928 movwf TxData1
00929 ldw ShfSt ; trasla bit 7 e 6 in bit 1 e 0
0005E0 50?? M movf ShfSt, w
0005E2 6E?? 00930 movwf RxData
0005E4 42?? 00931 rrncf RxData, F ; bit 6
0005E6 42?? 00932 rrncf RxData, F ; bit 5
0005E8 42?? 00933 rrncf RxData, F ; bit 4
0005EA 42?? 00934 rrncf RxData, F ; bit 3
0005EC 42?? 00935 rrncf RxData, F ; bit 2
0005EE 40?? 00936 rrncf RxData, W ; bit 1 -> W
0005F0 0B03 00937 andlw B'00000011'
0005F2 12?? 00938 iorwf TxData0, F
00939
0005F4 00940 PutKey: ; inserisce word codice tasto nella coda TX
0005F4 0EE0 00941 movlw (TXMAXCNT - 1) ; test spazio disponibile
0005F6 5C?? 00942 subwf TxCnt, W ; W = TxCnt - (TMAXCNT - 1)
0005F8 B0D8 00943 btfsc STATUS, C ; W >= 0 -> C = 1
0005FA 8E?? 00944 bsf TxFlag, TXOVR ; segnala overrun buffer TX
00945 ldw TxHeadL ; imposta ptr head al buffer
0005FC 50?? M movf TxHeadL, w
0005FE 6EE9 00946 movwf FSR0L
00947 ldw TxHeadH
000600 50?? M movf TxHeadH, w
000602 6EEA 00948 movwf FSR0H
00949 ldw TxData0 ; primo byte in coda
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 20
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000604 50?? M movf TxData0, w
000606 6EEE 00950 movwf POSTINC0
00951 ldw TxData1 ; secondo byte in coda
000608 50?? M movf TxData1, w
00060A 6EEE 00952 movwf POSTINC0
00060C 2A?? 00953 incf TxCnt, F ; aggiorna contatore word nel buffer TX
00954 ldw FSR0L ; aggiorna ptr
00060E 50E9 M movf FSR0L, w
000610 6E?? 00955 movwf TxHeadL
00956 ldw FSR0H
000612 50EA M movf FSR0H, w
000614 6E?? 00957 movwf TxHeadH
000616 0E00 00958 movlw LOW(TxBufEnd) ; coda circolare - test puntatore
000618 5C?? 00959 subwf TxHeadL, W ; TxHeadL - LOW(TxBufEnd)
00061A 0E03 00960 movlw HIGH(TxBufEnd) ; TxHeadH - HIGH(TxBufEnd)
00061C 58?? 00961 subwfb TxHeadH, W ; C = 0 se TxHead < TxBufEnd
00061E A0D8 00962 btfss STATUS, C ; test buffer
000620 D??? 00963 bra ClrRX ; C = 0 -> OK
000622 0E3E 00964 movlw LOW(TxBuffer) ; reimposta puntatore a inizio buffer
000624 6E?? 00965 movwf TxHeadL
000626 0E01 00966 movlw HIGH(TxBuffer)
000628 6E?? 00967 movwf TxHeadH
00062A D??? 00968 bra ClrRX ; azzera flag ed esce
00969
00062C 00970 KbdProc14:
00971 ; gestione tasti TOGGLE
00062C 0E90 00972 movlw 0x90 ; test invio toggle
00062E 5C?? 00973 subwf TxData0, W ; test tasti LOCK o PAUSE
000630 E1?? 00974 bnz KbdProc16
00975 ldw TglSt ; salva flag toggle attuali
000632 50?? M movf TglSt, w
000634 6E?? 00976 movwf TTglSt
00977 ldw LockSt
000636 50?? M movf LockSt, w
000638 6E?? 00978 movwf TLockSt
00063A 0E09 00979 movlw PAUSECODE ; test PAUSE
00063C 5C?? 00980 subwf RxCode, W
00063E E1?? 00981 bnz NoPause ; no tasto PAUSE
000640 78?? 00982 btg TglSt, PAUSB ; toggle bit ad ogni pressione PAUSE
000642 D??? 00983 bra KbdProc15
000644 00984 NoPause:
000644 BC?? 00985 btfsc RxFlag, RXBRK ; test tasto rilasciato
000646 D??? 00986 bra ToggleRls ; SI
000648 14?? 00987 andwf LockSt, W ; flag tasto premuto attivo ?
00064A E0?? 00988 bz ToggleBit ; NO - prima attivazione
00064C D??? 00989 bra ClrRX ; tasto repeat - scarta codice
00064E 00990 ToggleBit:
00991 ldw TxData1 ; toggle bit in TglSt
00064E 50?? M movf TxData1, w
000650 1A?? 00992 xorwf TglSt, F
000652 12?? 00993 iorwf LockSt, F ; setta bit in LockSt
000654 E1?? 00994 bnz TstLock
000656 00995 ToggleRls:
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 21
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000656 1C?? 00996 comf TxData1, W ; complementa maschera per azzerare bit
000658 16?? 00997 andwf LockSt, F ; azzera bit
00065A 00998 TstLock:
00999 ldw TglSt ; confronta con toggle precedente
00065A 50?? M movf TglSt, w
00065C 5C?? 01000 subwf TTglSt, W
00065E E1?? 01001 bnz LedUpd
000660 D??? 01002 bra ClrRX ; toggle non modificato - scarta codice
000662 01003 LedUpd:
000662 EC?? F??? 01004 call SetLed1
000666 A0?? 01005 btfss KbdFlag, KBLEDOK ; comando LED riuscito
000668 D??? 01006 bra ClrRX ; ignora tasto ed esce
00066A 01007 KbdProc15: ; invia toggle ad host
01008 ; formato -> 10010000 + TglSt
01009 ldw TglSt
00066A 50?? M movf TglSt, w
00066C 6E?? 01010 movwf TxData1
00066E D??? 01011 bra PutKey
01012
000670 01013 KbdProc16:
01014 ; gestione tasti tastierino numerico (KP)
000670 0E20 01015 movlw KP0CODE
000672 5C?? 01016 subwf RxCode, W
000674 E3?? 01017 bnc KbdProc20 ; no tasto numerico
000676 0E2B 01018 movlw INSCODE
000678 5C?? 01019 subwf RxCode, W
00067A E2?? 01020 bc KbdProc20 ; no tasto numerico
01021 ; se NUM-LOCK OFF i tasti numerici diventano tasti cursore (escluso 5)
00067C AC?? 01022 btfss TglSt, NUMLB
00067E D??? 01023 bra KbdProc18 ; NUM-LOCK OFF -> converte in codice cursore
01024 ; se NUM-LOCK ON e premuto il solo tasto SHIFT converte in codice cursore
000680 AE?? 01025 btfss ShfSt, ASHFB
000682 D??? 01026 bra KbdProc20 ; no SHIFT -> tasto numerico
000684 BC?? 01027 btfsc ShfSt, ALTCTLB ; premuti ALT e/o CTRL ?
000686 D??? 01028 bra KbdProc20 ; si - tasto numerico
000688 88?? 01029 bsf TxFlag, SKPSHFB ; flag skip test SHIFT
00068A 8A?? 01030 bsf TxFlag, SKPALTB ; flag skip test ALT
00068C 8C?? 01031 bsf TxFlag, SKPCTLB ; flag skip test CTRL
01032
00068E 01033 KbdProc18:
00068E 0E0B 01034 movlw CRSLEN ; converte in codice tasto cursore
000690 26?? 01035 addwf RxCode, F
000692 D??? 01036 rcall GetKeyTbl ; legge nuovamente codice/flag tasto
000694 52?? 01037 movf TxData1, F ; test se codice tasto = 0
000696 E1?? 01038 bnz KbdProc20
000698 D??? 01039 bra ClrRX ; scarta codice nullo
01040
00069A 01041 KbdProc20:
01042 ; toggle tasto INSERT - soltanto senza SHIFT/ALT/CTRL
00069A 0E2B 01043 movlw INSCODE
00069C 5C?? 01044 subwf RxCode, W
00069E E1?? 01045 bnz KbdProc22
0006A0 B8?? 01046 btfsc TxFlag, SKPSHFB ; INSERT su tastierino numerico ?
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 22
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0006A2 D??? 01047 bra KbdProc21 ; si - non testa SHIFT
0006A4 0EC0 01048 movlw SHFALL
0006A6 14?? 01049 andwf ShfSt, W ; test SHIFT/ALT/CTRL
0006A8 E1?? 01050 bnz KbdProc22 ; no toggle
0006AA 01051 KbdProc21:
0006AA BC?? 01052 btfsc RxFlag, RXBRK ; test tasto rilasciato
0006AC D??? 01053 bra KbdProc22
0006AE 74?? 01054 btg TglSt, INSTB ; toggle bit INSERT
01055
0006B0 01056 KbdProc22:
01057 ; imposta flag in TglSt per ESC e PRINT SCRN
0006B0 0E1E 01058 movlw PRTCODE
0006B2 5C?? 01059 subwf RxCode, W
0006B4 E0?? 01060 bz KbdProc23
0006B6 0E1F 01061 movlw ESCCODE
0006B8 5C?? 01062 subwf RxCode, W
0006BA E1?? 01063 bnz KbdProc24
0006BC 01064 KbdProc23:
0006BC 0E03 01065 movlw ESCPRNM ; imposta flag ESC e PRINT SCRN
0006BE 14?? 01066 andwf RptSt, W ; da RptSt a TglSt
0006C0 12?? 01067 iorwf TglSt, F
01068
0006C2 01069 KbdProc24:
01070 ; gestione tasti CR, TAB, SHIFT-CR, SHIFT-TAB, '<' e '>' mappa IT
0006C2 0E0A 01071 movlw CRCODE
0006C4 5C?? 01072 subwf RxCode, W
0006C6 E3?? 01073 bnc KbdProc26 ; RxCode < CRCODE
0006C8 0E10 01074 movlw KPBARCODE
0006CA 5C?? 01075 subwf RxCode, W
0006CC E2?? 01076 bc KbdProc26 ; RxCode >= KPBARCODE
0006CE AE?? 01077 btfss ShfSt, ASHFB ; SHIFT ?
0006D0 D??? 01078 bra KbdProc25 ; NO
0006D2 BC?? 01079 btfsc ShfSt, ALTCTLB ; CTRL/ALT ?
0006D4 D??? 01080 bra KbdProc25 ; SI
0006D6 2A?? 01081 incf RxCode, F ; SHIFT -> increnmenta codice
0006D8 01082 KbdProc25:
0006D8 D??? 01083 rcall GetKeyTbl ; legge nuovamente codice/flag tasto
0006DA 52?? 01084 movf TxData1, F ; test se codice tasto = 0
0006DC E1?? 01085 bnz KbdProc50 ; gestione tasto
0006DE D??? 01086 bra ClrRX ; scarta codice nullo
01087
0006E0 01088 KbdProc26:
01089 ; tasti funzione - a questo punto CODE < MAPCODE (42)
0006E0 0E36 01090 movlw FNCCODE ; range tasti funzione 36..41
0006E2 5C?? 01091 subwf RxCode, W
0006E4 E3?? 01092 bnc KbdProc50 ; gestione tasti per codici < FNCCODE (36)
01093
01094 ; FX -> A0..AB
01095 ; SHIFT + FX -> AC..B7
01096 ; CTL + FX -> B8..C3
01097 ; ALT + FX -> C4..CF
01098 ; CTL + SHIFT + FX -> D0..DB
01099 ; CTL + ALT + FX -> DC..E7
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 23
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
01100 ; ALT + SHIFT + FX -> E8..F3
01101 ; CTL + ALT + SHIFT + FX -> F4..FF
01102
0006E6 AE?? 01103 btfss ShfSt, ASHFB
0006E8 D??? 01104 bra FnNoShf
0006EA 0E0C 01105 movlw D'12' ; SHIFT + Fx
0006EC AC?? 01106 btfss ShfSt, ALTCTLB ; ALT o CTRL ?
0006EE D??? 01107 bra FnAdd ; no - SHIFT + FX
0006F0 0E30 01108 movlw D'48'
0006F2 AE?? 01109 btfss CtlSt, AALTB ; ALT ?
0006F4 D??? 01110 bra FnAdd ; no - SHIFT + CTRL + Fx
0006F6 0E48 01111 movlw D'72'
0006F8 AC?? 01112 btfss CtlSt, ACTLB ; CTRL ?
0006FA D??? 01113 bra FnAdd ; no - SHIFT + ALT + Fx
0006FC 0E54 01114 movlw D'84' ; SHIFT + ALT + CTRL + Fx
0006FE D??? 01115 bra FnAdd
000700 01116 FnNoShf:
000700 0E00 01117 movlw D'0' ; Fx
000702 AC?? 01118 btfss ShfSt, ALTCTLB ; ALT o CTRL ?
000704 D??? 01119 bra FnAdd ; no - FX
000706 0E18 01120 movlw D'24'
000708 AE?? 01121 btfss CtlSt, AALTB ; ALT ?
00070A D??? 01122 bra FnAdd ; no - CTRL + Fx
00070C 0E24 01123 movlw D'36'
00070E AC?? 01124 btfss CtlSt, ACTLB ; CTRL ?
000710 D??? 01125 bra FnAdd ; no - ALT + Fx
000712 0E3C 01126 movlw D'60' ; ALT + CTRL + Fx
000714 01127 FnAdd:
000714 26?? 01128 addwf TxData1, F
000716 D??? 01129 bra KeySnd ; tasti funzione inviati senza altri test
01130
000718 01131 KbdProc40: ; gestione tasto alfabetico
01132 ldw Caps ; 'A'..'Z'
000718 50?? M movf Caps, w
00071A 01133 KbdProc41: ; gestione tasto ASCII non-alpha
00071A 6E?? 01134 movwf RxData ; codice tasto attuale (TxData1)
00071C 0E40 01135 movlw '@'
00071E 5C?? 01136 subwf RxData, W
000720 E3?? 01137 bnc KbdProc50 ; key < '@' (40)
000722 0E60 01138 movlw '`'
000724 5C?? 01139 subwf RxData, W
000726 E2?? 01140 bc KbdProc50 ; key >= '`' (60)
000728 AE?? 01141 btfss CtlSt, AALTB ; ALT ?
00072A D??? 01142 bra KbdProc42 ; NO
00072C 0E1F 01143 movlw 0x1F
00072E 14?? 01144 andwf RxData, W ; converte in 00..1F
000730 0F60 01145 addlw 0x60 ; converte in 60..7F
000732 6E?? 01146 movwf TxData1 ; codice controllo
000734 0EA0 01147 movlw 0xA0 ; flag codice controllo
000736 6E?? 01148 movwf TxData0
000738 D??? 01149 bra KbdProc50
00073A 01150 KbdProc42:
00073A AC?? 01151 btfss CtlSt, ACTLB ; CTRL ?
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 24
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00073C D??? 01152 bra KbdProc43 ; NO
00073E 0E1F 01153 movlw 0x1F
000740 14?? 01154 andwf RxData, W ; converte in 00..1F
000742 6E?? 01155 movwf TxData1 ; codice ASCII
000744 6A?? 01156 clrf TxData0 ; flag codice ASCII
000746 D??? 01157 bra KbdProc50
000748 01158 KbdProc43:
01159 ; test SHIFT / CAPS-LOCK per tasti alfabetici
000748 AC?? 01160 btfss MapCfg, MAPALPHA
00074A D??? 01161 bra KbdProc50 ; no tasto alfabetico
01162 ldw ShfSt ; SHIFT
00074C 50?? M movf ShfSt, w
00074E 18?? 01163 xorwf TglSt, W ; confronta con CAPS LOCK
000750 0B80 01164 andlw 0x80 ; interessa bit 7 soltanto
000752 E0?? 01165 bz KbdProc50 ; o NO SHIFT oppure CAPS LOCK + SHIFT -> a..z
01166 ldw Caps ; o SHIFT oppure CAPS LOCK -> A..Z
000754 50?? M movf Caps, w
000756 6E?? 01167 movwf TxData1
01168
000758 01169 KbdProc50:
01170 ; ALT 0..9 -> 30..39
01171 ; CTRL 0..9 -> 40..49
01172 ; CTRL + ALT 0..9 -> 50..59
000758 BE?? 01173 btfsc TxData0, 7
00075A D??? 01174 bra Key10 ; codice di controllo
00075C 0E30 01175 movlw '0' ; test tasto numerico
00075E 5C?? 01176 subwf TxData1, W
000760 6E?? 01177 movwf RxData ; 0..9
000762 E3?? 01178 bnc Key06
000764 0E3A 01179 movlw ('9' + 1)
000766 5C?? 01180 subwf TxData1, W
000768 E2?? 01181 bc Key06
00076A AE?? 01182 btfss CtlSt, AALTB ; ALT ?
00076C D??? 01183 bra Key01 ; NO
00076E 0E30 01184 movlw ALTKEY0 ; ALT + 0..9
000770 BC?? 01185 btfsc CtlSt, ACTLB ; CTRL + ALT ?
000772 0E50 01186 movlw ALTCTLKEY0 ; CTRL + ALT + 0..9
000774 D??? 01187 bra Key02
000776 01188 Key01:
000776 AC?? 01189 btfss CtlSt, ACTLB ; CTRL ?
000778 D??? 01190 bra KeySnd ; NO - lascia inalterato il tasto
00077A 0E40 01191 movlw CTLKEY0 ; CTRL + 0..9
00077C 01192 Key02:
00077C 24?? 01193 addwf RxData, W
00077E 6E?? 01194 movwf TxData1 ; codice controllo
000780 0EA0 01195 movlw 0xA0 ; flag codice controllo
000782 6E?? 01196 movwf TxData0
000784 D??? 01197 bra KeySnd ; invia tasto
000786 01198 Key06:
000786 0E1B 01199 movlw KB_ESCAPE ; ESC, TAB, +, -
000788 5C?? 01200 subwf TxData1, W
00078A E0?? 01201 bz Key10
00078C 0E09 01202 movlw KB_TAB
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 25
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00078E 5C?? 01203 subwf TxData1, W
000790 E0?? 01204 bz Key10
000792 0E2B 01205 movlw '+'
000794 5C?? 01206 subwf TxData1, W
000796 E0?? 01207 bz Key10
000798 0E2D 01208 movlw '-'
00079A 5C?? 01209 subwf TxData1, W
00079C E1?? 01210 bnz KeySnd
00079E 01211 Key10:
00079E 0E70 01212 movlw SKPALL ; tasti cursore da tastierino numerico
0007A0 14?? 01213 andwf TxFlag, W ; non vengono testati per SHIFT/CTRL/ALT
0007A2 0870 01214 sublw SKPALL
0007A4 E0?? 01215 bz KeySnd
0007A6 0E?? 01216 movlw LOW SPCKEY ; imposta ptr tabella tasti speciali
0007A8 6EF6 01217 movwf TBLPTRL
0007AA 0E?? 01218 movlw HIGH SPCKEY
0007AC 6EF7 01219 movwf TBLPTRH
0007AE 68?? 01220 setf E1Cnt ; indice tabella (inizializzato a 0xFF)
0007B0 01221 Key11:
0007B0 2A?? 01222 incf E1Cnt, F ; update indice
0007B2 0009 01223 tblrd *+ ; legge byte da memoria ed incrementa ptr
0007B4 0EFF 01224 movlw 0xFF ; test fine tabella
0007B6 5CF5 01225 subwf TABLAT, W
0007B8 E0?? 01226 bz KeySnd ; termina sequenza
01227 ldw TxData1 ; confronta con tasto
0007BA 50?? M movf TxData1, w
0007BC 5CF5 01228 subwf TABLAT, W
0007BE E1?? 01229 bnz Key11 ; loop
0007C0 0EC0 01230 movlw B'11000000'
0007C2 14?? 01231 andwf CtlSt, W ; test ALT e/o CTRL
0007C4 E0?? 01232 bz Key13 ; test SHIFT
0007C6 08C0 01233 sublw B'11000000' ; CTRL + ALT ?
0007C8 E1?? 01234 bnz Key12 ; NO
0007CA 0E03 01235 movlw 0x03 ; CTRL + ALT
0007CC D??? 01236 bra Key15
0007CE 01237 Key12:
0007CE 0E01 01238 movlw 0x01
0007D0 BE?? 01239 btfsc CtlSt, AALTB
0007D2 D??? 01240 bra Key15 ; ALT
0007D4 0E02 01241 movlw 0x02
0007D6 D??? 01242 bra Key15 ; CTRL
0007D8 01243 Key13:
0007D8 AE?? 01244 btfss ShfSt, ASHFB
0007DA D??? 01245 bra KeySnd ; no SHIFT - non modifica tasto
0007DC 0E00 01246 movlw 0x00
0007DE 01247 Key15:
0007DE 90D8 01248 bcf STATUS, C
0007E0 36?? 01249 rlcf E1Cnt, F
0007E2 36?? 01250 rlcf E1Cnt, F ; * 4
0007E4 26?? 01251 addwf E1Cnt, F
0007E6 0E?? 01252 movlw LOW SPCKEY2 ; imposta ptr tabella SPCKEY2
0007E8 24?? 01253 addwf E1Cnt, W ; aggiunge indice
0007EA 6EF6 01254 movwf TBLPTRL
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 26
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0007EC 0E?? 01255 movlw HIGH SPCKEY2
0007EE 6EF7 01256 movwf TBLPTRH
0007F0 6AE8 01257 clrf WREG
0007F2 22F7 01258 addwfc TBLPTRH, F
0007F4 0009 01259 tblrd *+ ; codice
01260 ldw TABLAT
0007F6 50F5 M movf TABLAT, w
0007F8 E0?? 01261 bz KeySnd ; tasto null
0007FA 6E?? 01262 movwf TxData1
0007FC 0E?? 01263 movlw LOW SPCKEY3 ; imposta ptr tabella SPCKEY3
0007FE 24?? 01264 addwf E1Cnt, W ; aggiunge indice
000800 6EF6 01265 movwf TBLPTRL
000802 0E?? 01266 movlw HIGH SPCKEY3
000804 6EF7 01267 movwf TBLPTRH
000806 6AE8 01268 clrf WREG
000808 22F7 01269 addwfc TBLPTRH, F
00080A 0009 01270 tblrd *+ ; codice
01271 ldw TABLAT
00080C 50F5 M movf TABLAT, w
00080E 6E?? 01272 movwf TxData0
000810 0EC0 01273 movlw 0xC0
000812 5C?? 01274 subwf TxData0, W
000814 E0?? 01275 bz KbdProc60
01276
000816 01277 KeySnd:
000816 BC?? 01278 btfsc RxFlag, RXBRK ; test tasto rilasciato
000818 8C?? 01279 bsf TxData0, KEYRLS ; SI - imposta bit rilascio
00081A A8?? 01280 btfss TxData0, KEYTGL ; invia flag toggle low ?
00081C D??? 01281 bra PutKey ; NO
01282 ldw TglSt
00081E 50?? M movf TglSt, w
000820 0B0F 01283 andlw B'00001111'
000822 12?? 01284 iorwf TxData0, F ; 4 bit bassi corrispondono ai 4 bit di TglSt
000824 D??? 01285 bra PutKey
01286
000826 01287 KbdProc60:
01288 ; setta NMI all' host
000826 6A?? 01289 clrf Caps ; contatore temporaneo
000828 01290 KbdProc61:
000828 A280 01291 btfss PORTA, HLNMI ; host busy
00082A D??? 01292 bra NMISnd ; NMI non attivo - attiva
00082C 3E?? 01293 incfsz Caps, F ; attende host libero
00082E D??? 01294 bra KbdProc61
000830 EF?? F??? 01295 goto ClrRX ; scarta codice NMI
000834 01296 NMISnd:
000834 0E02 01297 movlw 0x02 ; porta NMI
000836 6E8D 01298 movwf LATE ; indirizzo KFR
01299 ldw TxData1 ; codice NMI
000838 50?? M movf TxData1, w
00083A D??? 01300 rcall KFRWrite ; codice in porta NMI
00083C 9882 01301 bcf PORTC, KFRSSN ; attiva NMI host
00083E 0000 01302 nop
000840 8882 01303 bsf PORTC, KFRSSN
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 27
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000842 D??? 01304 bra ClrRX
01305
000844 01306 GetKeyTbl:
000844 0E?? 01307 movlw LOW KEYTBL ; imposta ptr tabella conversione KEYTBL
000846 24?? 01308 addwf RxCode, W ; aggiunge indice
000848 6EF6 01309 movwf TBLPTRL
00084A 0E?? 01310 movlw HIGH KEYTBL
00084C 6EF7 01311 movwf TBLPTRH
00084E 6AE8 01312 clrf WREG
000850 22F7 01313 addwfc TBLPTRH, F
000852 0008 01314 tblrd * ; codice tasto
01315 ldw TABLAT
000854 50F5 M movf TABLAT, w
000856 6E?? 01316 movwf TxData1 ; codice tasto
000858 0E?? 01317 movlw LOW FLGTBL ; imposta ptr tabella conversione FLGTBL
00085A 24?? 01318 addwf RxCode, W ; aggiunge indice
00085C 6EF6 01319 movwf TBLPTRL
00085E 0E?? 01320 movlw HIGH FLGTBL
000860 6EF7 01321 movwf TBLPTRH
000862 6AE8 01322 clrf WREG
000864 22F7 01323 addwfc TBLPTRH, F
000866 0008 01324 tblrd * ; flag tasto
01325 ldw TABLAT
000868 50F5 M movf TABLAT, w
00086A 6E?? 01326 movwf TxData0 ; flag tasto
00086C 0012 01327 return
01328
01329
00086E 01330 KFRWrite:
00086E 6E8C 01331 movwf LATD ; byte da scrivere nel registro
000870 6A95 01332 clrf DDRD ; porta D in uscita
000872 0000 01333 nop
000874 0000 01334 nop ; dato stabile
000876 928B 01335 bcf LATC, KFRWE ; impulso write
000878 0000 01336 nop
00087A 828B 01337 bsf LATC, KFRWE
00087C 0000 01338 nop
00087E 0012 01339 return
01340
000880 01341 KFRRead:
000880 6895 01342 setf DDRD ; Porta D input
000882 6A8D 01343 clrf LATE ; indirizzo file reg. = 0
000884 0E04 01344 movlw 0x04 ; contatore registri
000886 6E?? 01345 movwf KFRRdCnt
000888 EE?? F0?? 01346 lfsr FSR0, KFRRd0 ; puntatore registro 0
00088C 01347 KFRRead1:
00088C 908B 01348 bcf LATC, KFRRD ; lettura registro
00088E 0000 01349 nop
000890 0000 01350 nop
000892 01351 KFRRead2:
01352 ldw PORTD ; legge porta D
000892 5083 M movf PORTD, w
000894 6283 01353 cpfseq PORTD ; attende dato stabile
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 28
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000896 D??? 01354 bra KFRRead2
000898 808B 01355 bsf LATC, KFRRD ; linea lettura alta
00089A 6EEE 01356 movwf POSTINC0 ; memorizza dato registro
00089C 2A8D 01357 incf LATE, f ; incrementa indirizzo
00089E 2E?? 01358 decfsz KFRRdCnt, f ; loop
0008A0 D??? 01359 bra KFRRead1
0008A2 6A8D 01360 clrf LATE
0008A4 9E?? 01361 bcf KFRFlag, KFRFULL ; azzera flag richiesta servizio
0008A6 0EE1 01362 movlw 0xE1 ; set lock led
0008A8 5C?? 01363 subwf KFRRd0, W
0008AA E1?? 01364 bnz Cmd0
0008AC D??? 01365 rcall SetLed
0008AE 6A?? 01366 clrf KFRRd3 ; errore ?
0008B0 B0?? 01367 btfsc KbdFlag, KBLEDOK
0008B2 68?? 01368 setf KFRRd3
0008B4 D??? 01369 bra CmdRsp
0008B6 01370 Cmd0:
0008B6 0EC1 01371 movlw 0xC1 ; start scanning
0008B8 5C?? 01372 subwf KFRRd0, W
0008BA E1?? 01373 bnz Cmd1
01374 SCLOCKH
0008BC 888A M bsf LATB, KCLKO
0008BE D??? 01375 bra CmdEnd
0008C0 01376 Cmd1:
0008C0 0EC2 01377 movlw 0xC2 ; RESET
0008C2 5C?? 01378 subwf KFRRd0, W
0008C4 E1?? 01379 bnz Cmd2
0008C6 9EF2 01380 bcf INTCON, GIEH ; disabilita INT high priority
0008C8 9CF2 01381 bcf INTCON, GIEL ; disabilita INT low priority
0008CA 9C8B 01382 bcf LATC, KBVOFF ; impulso negativo VCC tastiera
0008CC 0E07 01383 movlw TMR0P256 ; TMR0 stop, prescaler = 256, modo 16 bit
0008CE 6ED5 01384 movwf T0CON
0008D0 94F2 01385 bcf INTCON, TMR0IF ; azzera flag timeout
0008D2 0E8D 01386 movlw HIGH(T1500MS) ; imposta timeout 1500ms
0008D4 6ED7 01387 movwf TMR0H ; caricare prima TMR0H
0008D6 0E90 01388 movlw LOW(T1500MS)
0008D8 6ED6 01389 movwf TMR0L ; carica TMR0L/H
0008DA 8ED5 01390 bsf T0CON, TMR0ON ; start Timer 0
0008DC 01391 Wait1:
0008DC A4F2 01392 btfss INTCON, TMR0IF
0008DE D??? 01393 bra Wait1 ; timeout
01394
01395 ;bsf LATC, KBVOFF
0008E0 968B 01396 bcf LATC, KFRSRP ; azzera linea DRQ verso host
0008E2 0000 01397 nop
0008E4 0000 01398 nop
0008E6 868B 01399 bsf LATC, KFRSRP
0008E8 00FF 01400 reset
0008EA 01401 Cmd2:
0008EA D??? 01402 bra CmdEnd
0008EC 01403 CmdRsp:
0008EC 0E03 01404 movlw 0x03
0008EE 6E8D 01405 movwf LATE
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 29
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
01406 ldw KFRRd3
0008F0 50?? M movf KFRRd3, w
0008F2 D??? 01407 rcall KFRWrite
0008F4 D??? 01408 bra CmdEnd
01409
0008F6 01410 CmdEnd:
0008F6 968B 01411 bcf LATC, KFRSRP ; azzera linea DRQ verso host
0008F8 0000 01412 nop
0008FA 0000 01413 nop
0008FC 868B 01414 bsf LATC, KFRSRP
0008FE 0012 01415 return
01416
000900 01417 SetLed:
01418 ldw TglSt
000900 50?? M movf TglSt, w
000902 6E?? 01419 movwf TTglSt
01420 ldw KFRRd1
000904 50?? M movf KFRRd1, w
000906 6E?? 01421 movwf TglSt
000908 01422 SetLed1:
01423 ldw TglSt
000908 50?? M movf TglSt, w
00090A 6E?? 01424 movwf LedSt
00090C 42?? 01425 rrncf LedSt, F
00090E 42?? 01426 rrncf LedSt, F
000910 42?? 01427 rrncf LedSt, F
000912 42?? 01428 rrncf LedSt, F
000914 40?? 01429 rrncf LedSt, W
000916 0B07 01430 andlw B'00000111'
000918 6E?? 01431 movwf LedSt
01432 ldw LATB ; salva porta B
00091A 508A M movf LATB, w
00091C 6E?? 01433 movwf TPortB
01434 SCLOCKL ; inibisce TX da tastiera
00091E 988A M bcf LATB, KCLKO
000920 9EF2 01435 bcf INTCON, GIEH ; disabilita INT high priority
000922 9CF2 01436 bcf INTCON, GIEL ; disabilita INT low priority
000924 EC?? F??? 01437 call SendLed
000928 A8?? 01438 btfss TPortB, KCLKO ; disabilita TX da tast. se era disabilitato
01439 SCLOCKL
00092A 988A M bcf LATB, KCLKO
00092C 92F2 01440 bcf INTCON, INT0IF ; resetta flag INT0
00092E 8EF2 01441 bsf INTCON, GIEH ; abilita INT high priority
000930 8CF2 01442 bsf INTCON, GIEL ; abilita INT low priority
000932 E3?? 01443 bnc SetLed2 ; comando LED riuscito
01444 ldw TTglSt ; errore -> ignora tasto
000934 50?? M movf TTglSt, w
000936 6E?? 01445 movwf TglSt ; reimposta flag toggle precedente
01446 ldw TLockSt
000938 50?? M movf TLockSt, w
00093A 6E?? 01447 movwf LockSt
00093C 90?? 01448 bcf KbdFlag, KBLEDOK ; comando LED fallito
00093E 0012 01449 return ; fail
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 30
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000940 01450 SetLed2:
000940 80?? 01451 bsf KbdFlag, KBLEDOK
000942 0012 01452 return
01453
000944 01454 SndProc: ; invia word nella coda TX ad host
000944 B080 01455 btfsc PORTA, HLINT ; host busy ?
000946 0012 01456 return ; si
01457 ldw TxTailL ; imposta ptr head al buffer
000948 50?? M movf TxTailL, w
00094A 6EE9 01458 movwf FSR0L
01459 ldw TxTailH
00094C 50?? M movf TxTailH, w
00094E 6EEA 01460 movwf FSR0H
01461 ldw POSTINC0
000950 50EE M movf POSTINC0, w
000952 6E?? 01462 movwf TxData0
01463 ldw POSTINC0
000954 50EE M movf POSTINC0, w
000956 6E?? 01464 movwf TxData1
000958 6A8D 01465 clrf LATE ; indirizzo KFR = 0
01466 ldw TxData0 ; flag tasto
00095A 50?? M movf TxData0, w
00095C D??? 01467 rcall KFRWrite
00095E 0E01 01468 movlw 0x01 ; indirizzo KFR = 1
000960 6E8D 01469 movwf LATE
01470 ldw TxData1 ; codice tasto
000962 50?? M movf TxData1, w
000964 D??? 01471 rcall KFRWrite
000966 9A82 01472 bcf PORTC, KFRSSI ; attiva INT host
000968 0000 01473 nop
00096A 8A82 01474 bsf PORTC, KFRSSI
00096C 06?? 01475 decf TxCnt, F ; aggiorna contatore word nel buffer TX
01476 ldw FSR0L ; aggiorna ptr
00096E 50E9 M movf FSR0L, w
000970 6E?? 01477 movwf TxTailL
01478 ldw FSR0H
000972 50EA M movf FSR0H, w
000974 6E?? 01479 movwf TxTailH
000976 0E00 01480 movlw LOW(TxBufEnd) ; coda circolare - test puntatore
000978 5C?? 01481 subwf TxTailL, W ; TxTailL - LOW(TxBufEnd)
00097A 0E03 01482 movlw HIGH(TxBufEnd) ; TxTailH - HIGH(TxBufEnd)
00097C 58?? 01483 subwfb TxTailH, W ; C = 0 se TxTail < TxBufEnd
00097E A0D8 01484 btfss STATUS, C ; test buffer
000980 0012 01485 return ; C = 0 -> OK
000982 0E3E 01486 movlw LOW(TxBuffer) ; reimposta puntatore a inizio buffer
000984 6E?? 01487 movwf TxTailL
000986 0E01 01488 movlw HIGH(TxBuffer)
000988 6E?? 01489 movwf TxTailH
00098A 0012 01490 return
01491
00098C 01492 Start:
00098C 0100 01493 movlb 0x00
00098E EC?? F??? 01494 call InitIO
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 31
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000992 9A89 01495 bcf LATA, RA5 ; bit READY
01496
000994 01497 Main:
000994 A88A 01498 btfss LATB, KCLKO ; se TX disabilitato salta
000996 D??? 01499 bra Main2
000998 EC?? F??? 01500 call KbdProc
00099C 66?? 01501 tstfsz TxCnt ; coda TX vuota
00099E D??? 01502 rcall SndProc ; invia word codice ad host
0009A0 01503 Main2:
0009A0 BE?? 01504 btfsc KFRFlag, KFRFULL ; host richiede servizio ?
0009A2 D??? 01505 rcall KFRRead ; si - lettura registro KFR
0009A4 D??? 01506 bra Main
01507
01508 #include romtbl.inc
00001
00002 ;NOLIST
00003
00004
00005 RomTbl code_pack
00006 ; Fill
000000 00 00 00 00 00 00007 dw 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
00 00 00 00 00
00 00 00 00 00
00
00008
00009 ; mappa codici ASCII tastiera USA
000010 00010 USTBL:
000010 60 7E 00011 DB "`", "~"
000012 31 21 00012 DB "1", "!"
000014 32 40 00013 DB "2", "@"
000016 34 24 00014 DB "4", "$"
000018 33 23 00015 DB "3", "#"
00001A 35 25 00016 DB "5", "%"
00001C 36 5E 00017 DB "6", "^"
00001E 37 26 00018 DB "7", "&"
000020 38 2A 00019 DB "8", "*"
000022 2C 3C 00020 DB ",", "<"
000024 30 29 00021 DB "0", ")"
000026 39 28 00022 DB "9", "("
000028 2E 3E 00023 DB ".", ">"
00002A 2F 3F 00024 DB "/", "?"
00002C 3B 3A 00025 DB ";", ":"
00002E 2D 5F 00026 DB "-", "_"
000030 27 22 00027 DB "'", "\""
000032 5B 7B 00028 DB "[", "{"
000034 3D 2B 00029 DB "=", "+"
000036 5D 7D 00030 DB "]", "}"
000038 5C 7C 00031 DB "\\", "|"
00032
00033 ; tabella tasti speciali SHIFT, ALT, CTRL, CTRL+ALT
00003A 00034 SPCKEY2:
00003A 01 02 03 04 00035 DB KB_SHIFTPRT, KB_ALTPRT, KB_CTLPRT, KB_ALTCTLPRT
00003E 05 06 07 08 00036 DB KB_SHIFTHOME, KB_ALTHOME, KB_CTLHOME, KB_ALTCTLHOME
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 32
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000042 09 0A 0B 0C 00037 DB KB_SHIFTINS, KB_ALTINS, KB_CTLINS, KB_ALTCTLINS
000046 0D 0E 0F 10 00038 DB KB_SHIFTPGUP, KB_ALTPGUP, KB_CTLPGUP, KB_ALTCTLPGUP
00004A 11 12 13 14 00039 DB KB_SHIFTPGDWN, KB_ALTPGDWN, KB_CTLPGDWN, KB_ALTCTLPGDWN
00004E 15 16 17 80 00040 DB KB_SHIFTEND, KB_ALTEND, KB_CTLEND, KB_ALTCTLEND
000052 18 19 1A 81 00041 DB KB_SHIFTDEL, KB_ALTDEL, KB_CTLDEL, KB_ALTCTLDEL
000056 1B 1C 1D 82 00042 DB KB_SHIFTBKS, KB_ALTBKS, KB_CTLBKS, KB_ALTCTLBKS
00005A 00 1E 1F 88 00043 DB 0x00, KB_ALTESC, KB_CTLESC, KB_ALTCT
LESC
00005E 00 20 21 22 00044 DB 0x00, KB_ALTTAB, KB_CTLTAB, KB_ALTCT
LTAB
000062 00 23 24 25 00045 DB 0x00, KB_ALTPLUS, KB_CTLPLUS, KB_ALTCT
LPLUS
000066 00 26 27 28 00046 DB 0x00, KB_ALTMINUS, KB_CTLMINUS, KB_ALTCTLMINUS
00047
00048 ; tabella flag tasti speciali SHIFT, ALT, CTRL, CTRL+ALT
00006A 00049 SPCKEY3:
00006A A0 A0 A0 A0 00050 DB 0xA0, 0xA0, 0xA0, 0xA0
00006E A0 A0 A0 A0 00051 DB 0xA0, 0xA0, 0xA0, 0xA0
000072 A0 A0 A0 A0 00052 DB 0xA0, 0xA0, 0xA0, 0xA0
000076 A0 A0 A0 A0 00053 DB 0xA0, 0xA0, 0xA0, 0xA0
00007A A0 A0 A0 A0 00054 DB 0xA0, 0xA0, 0xA0, 0xA0
00007E A0 A0 A0 C0 00055 DB 0xA0, 0xA0, 0xA0, 0xC0
000082 A0 A0 A0 C0 00056 DB 0xA0, 0xA0, 0xA0, 0xC0
000086 A0 A0 A0 C0 00057 DB 0xA0, 0xA0, 0xA0, 0xC0
00008A A0 A0 A0 C0 00058 DB 0xA0, 0xA0, 0xA0, 0xC0
00008E A0 A0 A0 A0 00059 DB 0xA0, 0xA0, 0xA0, 0xA0
000092 A0 A0 A0 A0 00060 DB 0xA0, 0xA0, 0xA0, 0xA0
000096 A0 A0 A0 A0 00061 DB 0xA0, 0xA0, 0xA0, 0xA0
00062
00063 ; tabella tasti speciali
00009A 00064 SPCKEY:
00009A 83 00065 DB KB_PRTSCN
00009B 85 00066 DB KB_HOME
00009C 86 00067 DB KB_INSERT
00009D 88 00068 DB KB_PGUP
00009E 8A 00069 DB KB_PGDOWN
00009F 8C 00070 DB KB_END
0000A0 8E 00071 DB KB_DELETE
0000A1 90 00072 DB KB_BACKSPACE
0000A2 1B 00073 DB KB_ESCAPE
0000A3 09 00074 DB KB_TAB
0000A4 2B 00075 DB '+'
0000A5 2D 00076 DB '-'
0000A6 FF 00077 DB 0xFF
00078
00079 ; SEQUENZA E0 12 E0 7C PRTSCR DOWN (SIMULA SHIFT *)
00080 ; SEQUENZA E0 F0 7C E0 F0 12 PRTSCR UP
00081 ; SEQUENXA E1 14 77 E1 F0 14 F0 77 PAUSE (SIMULA L-CTRL NUMLOCK)
00082 ; E1 indica tasti no-repeat
00083
00084 ; PRIORITA' MODIFICATORI: ALT CTRL SHIFT CAPS/NUMLOCK
00085
00086 ; Tabella codici prefissati da E1 - Tasto PAUSE (solo make)
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 33
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00087 ; scan code: E1 14 77 E1 F0 14 F0 77 - di seguito la sequenza aspettata
0000A7 00088 EXT1TBL:
0000A7 14 77 E1 F0 14 00089 db 0x14, 0x77, 0xE1, 0xF0, 0x14, 0xF0, 0x77
F0 77
00090
00091 ; Tabella codici estesi (prefisso E0)
00092 ; NOTA: codice make PRNT -> E0 12 E0 7C (simula SHIFT *)
00093 ; codice break PRNT -> E0 F0 7C E0 F0 12
00094 ; Tutte le sequenze E0 12 / E0 F0 12 / E0 59 / E0 F0 59
00095 ; vengono scartate
00096 ; Per la combinazione CTRL BREAK (E0 7E E0 F0 7E) viene analizzata
00097 ; solo la parte che simula il rilascio (E0 F0 7E)
0000AE 00098 EXTTBL:
0000AE 7C 00099 DB 0x7C ; PRNT RILOCATO $00
0000AF 11 00100 DB 0x11 ; R-ALT RILOCATO $10
0000B0 14 00101 DB 0x14 ; R-CTRL RILOCATO $0F
0000B1 70 00102 DB 0x70 ; INS RILOCATO $13
0000B2 71 00103 DB 0x71 ; DEL RILOCATO $08
0000B3 6C 00104 DB 0x6C ; HOME RILOCATO $17
0000B4 69 00105 DB 0x69 ; END RILOCATO $18
0000B5 7A 00106 DB 0x7A ; PG-DOWN RILOCATO $19
0000B6 7D 00107 DB 0x7D ; PG-UP RILOCATO $20
0000B7 75 00108 DB 0x75 ; CSR-UP RILOCATO $28
0000B8 6B 00109 DB 0x6B ; CSR-LEFT RILOCATO $30
0000B9 72 00110 DB 0x72 ; CSR-DOWN RILOCATO $38
0000BA 74 00111 DB 0x74 ; CSR-RIGHT RILOCATO $39
0000BB 5A 00112 DB 0x5A ; KP-ENTER RILOCATO $5A
0000BC 4A 00113 DB 0x4A ; KP / RILOCATO $5F
0000BD 1F 00114 DB 0x1F ; L=GUI RILOCATO $1F
0000BE 27 00115 DB 0x27 ; R-GUI RILOCATO $27
0000BF 2F 00116 DB 0x2F ; APPS RILOCATO $2F
0000C0 37 00117 DB 0x37 ; PWR RILOCATO $37
0000C1 3F 00118 DB 0x3F ; SLEEP RILOCATO $3F
0000C2 5E 00119 DB 0x5E ; WAKE RILOCATO $5E
0000C3 7E 00120 DB 0x7E ; CTRL-BREAK RILOCATO $48
0000C4 FF 00121 DB 0xFF ; FINE TABELLA
00122
00123 ; Tabella rilocazione codici estesi (prefisso E0)
0000C5 00124 EXTRLTBL:
0000C5 00 00125 DB 0x00 ; PRNT RILOCATO $00
0000C6 10 00126 DB 0x10 ; R-ALT RILOCATO $10
0000C7 0F 00127 DB 0x0F ; R-CTRL RILOCATO $0F
0000C8 13 00128 DB 0x13 ; INS RILOCATO $13
0000C9 08 00129 DB 0x08 ; DEL RILOCATO $08
0000CA 17 00130 DB 0x17 ; HOME RILOCATO $17
0000CB 18 00131 DB 0x18 ; END RILOCATO $18
0000CC 19 00132 DB 0x19 ; PG-DOWN RILOCATO $19
0000CD 20 00133 DB 0x20 ; PG-UP RILOCATO $20
0000CE 28 00134 DB 0x28 ; CSR-UP RILOCATO $28
0000CF 30 00135 DB 0x30 ; CSR-LEFT RILOCATO $30
0000D0 38 00136 DB 0x38 ; CSR-DOWN RILOCATO $38
0000D1 39 00137 DB 0x39 ; CSR-RIGHT RILOCATO $39
0000D2 5A 00138 DB 0x5A ; KP-ENTER RILOCATO $5A
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 34
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000D3 5F 00139 DB 0x5F ; KP / RILOCATO $5F
0000D4 1F 00140 DB 0x1F ; L=GUI RILOCATO $1F
0000D5 27 00141 DB 0x27 ; R-GUI RILOCATO $27
0000D6 2F 00142 DB 0x2F ; APPS RILOCATO $2F
0000D7 37 00143 DB 0x37 ; PWR RILOCATO $37
0000D8 3F 00144 DB 0x3F ; SLEEP RILOCATO $3F
0000D9 5E 00145 DB 0x5E ; WAKE RILOCATO $5E
0000DA 48 00146 DB 0x48 ; CTRL-BREAK RILOCATO $48
00147
00148 ; Codici normali da rilocare
00149 ; I codici da 70 a 7E vanno rilocati in 60 - 6E
0000DB 00150 DEFTBL:
0000DB 83 00151 DB 0x83 ; F7 RILOCATO $02
0000DC 84 00152 DB 0x84 ; ALT SYSREQ RILOCATO $40
0000DD 66 00153 DB 0x66 ; BACKSPACE RILOCATO $47
0000DE 69 00154 DB 0x69 ; KP 1 RILOCATO $4F
0000DF 6B 00155 DB 0x6B ; KP 4 RILOCATO $50
0000E0 6C 00156 DB 0x6C ; KP 7 RILOCATO $51
0000E1 61 00157 DB 0x61 ; IT <> RILOCATO $53 (TASTO 45)
0000E2 FF 00158 DB 0xFF ; FINE TABELLA
00159
00160 ; Tabella rilocazione codici normali
0000E3 00161 DEFRLTBL:
0000E3 02 00162 DB 0x02 ; F7 RILOCATO $02
0000E4 40 00163 DB 0x40 ; ALT SYSREQ RILOCATO $40
0000E5 47 00164 DB 0x47 ; BACKSPACE RILOCATO $47
0000E6 4F 00165 DB 0x4F ; KP 1 RILOCATO $4F
0000E7 50 00166 DB 0x50 ; KP 4 RILOCATO $50
0000E8 51 00167 DB 0x51 ; KP 7 RILOCATO $51
0000E9 53 00168 DB 0x53 ; IT <> RILOCATO $53
00169
00170 ; seconda tabella di conversione (da codice scansione rilocato a semi ASCII)
00171 ; indice accesso da 00 a 6E
00172 ; la tabella ritorna un codice tra 00 e 7A esclusi 0B, 0F e range 57..60
00173 ; i codici relativi alle lettere a..z vengono restituiti come 'a'..'z'
00174 ; i codici 42..56 sono quelli da distinguere tra mappa US e mappa IT
00175 ; i valori 0xFF indicano codice non valido
0000EA 00176 CVTTBL
0000EA 1E 00177 DB PRTCODE ; 00 *PRNT
0000EB 3E 00178 DB 0x3E ; 01 F9
0000EC 3C 00179 DB 0x3C ; 02 *F7
0000ED 3A 00180 DB 0x3A ; 03 F5
0000EE 38 00181 DB 0x38 ; 04 F3
0000EF 36 00182 DB FNCCODE ; 05 F1
0000F0 37 00183 DB 0x37 ; 06 F2
0000F1 41 00184 DB 0x41 ; 07 F12
0000F2 35 00185 DB 0x35 ; 08 *DEL
0000F3 3F 00186 DB 0x3F ; 09 F10
0000F4 3D 00187 DB 0x3D ; 0A F8
0000F5 3B 00188 DB 0x3B ; 0B F6
0000F6 39 00189 DB 0x39 ; 0C F4
0000F7 0E 00190 DB 0x0E ; 0D TAB
0000F8 42 00191 DB 0x42 ; 0E `~ IT \|
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 35
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0000F9 04 00192 DB 0x04 ; 0F *R-CTRL
0000FA 05 00193 DB 0x05 ; 10 *R-ALT
0000FB 02 00194 DB 0x02 ; 11 L- ALT
0000FC 00 00195 DB 0x00 ; 12 L-SHIFT
0000FD 2B 00196 DB INSCODE ; 13 *INS
0000FE 01 00197 DB 0x01 ; 14 L-CTRL
0000FF 71 00198 DB 'q' ; 15 qQ
000100 43 00199 DB 0x43 ; 16 1! IT 1!
000101 32 00200 DB 0x32 ; 17 *HOME
000102 2C 00201 DB 0x2C ; 18 *END
000103 2E 00202 DB 0x2E ; 19 *PG-DOWN
000104 7A 00203 DB 'z' ; 1A zZ
000105 73 00204 DB 's' ; 1B sS
000106 61 00205 DB 'a' ; 1C aA
000107 77 00206 DB 'w' ; 1D wW
000108 44 00207 DB 0x44 ; 1E 2@ IT 2"
000109 1C 00208 DB 0x1C ; 1F *L-GUI
00010A 34 00209 DB 0x34 ; 20 *PG-UP
00010B 63 00210 DB 'c' ; 21 cC
00010C 78 00211 DB 'x' ; 22 xX
00010D 64 00212 DB 'd' ; 23 dD
00010E 65 00213 DB 'e' ; 24 eE
00010F 45 00214 DB 0x45 ; 25 4$ IT 4$
000110 46 00215 DB 0x46 ; 26 3# IT 3 LIRA
000111 1B 00216 DB 0x1B ; 27 *R-GUI
000112 33 00217 DB 0x33 ; 28 *CSR-UP
000113 14 00218 DB 0x14 ; 29 SPACE
000114 76 00219 DB 'v' ; 2A vV
000115 66 00220 DB 'f' ; 2B fF
000116 74 00221 DB 't' ; 2C tT
000117 72 00222 DB 'r' ; 2D rR
000118 47 00223 DB 0x47 ; 2E 5% IT 5% (EURO)
000119 1D 00224 DB 0x1D ; 2F *APPS
00011A 2F 00225 DB 0x2F ; 30 *CSR-LEFT
00011B 6E 00226 DB 'n' ; 31 nN
00011C 62 00227 DB 'b' ; 32 bB
00011D 68 00228 DB 'h' ; 33 hH
00011E 67 00229 DB 'g' ; 34 gG
00011F 79 00230 DB 'y' ; 35 yY
000120 48 00231 DB 0x48 ; 36 6^ IT 6&
000121 1A 00232 DB 0x1A ; 37 *PWR
000122 2D 00233 DB 0x2D ; 38 *CSR-DOWN
000123 31 00234 DB 0x31 ; 39 *CSR-RIGHT
000124 6D 00235 DB 'm' ; 3A mM
000125 6A 00236 DB 'j' ; 3B jJ
000126 75 00237 DB 'u' ; 3C uU
000127 49 00238 DB 0x49 ; 3D 7& IT 7/
000128 4A 00239 DB 0x4A ; 3E 8* IT 8(
000129 19 00240 DB 0x19 ; 3F *SLEEP
00012A 17 00241 DB SYSCODE ; 40 *ALT SYSREQ
00012B 4B 00242 DB 0x4B ; 41 ,< IT ,:
00012C 6B 00243 DB 'k' ; 42 kK
00012D 69 00244 DB 'i' ; 43 iI
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 36
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00012E 6F 00245 DB 'o' ; 44 oO
00012F 4C 00246 DB 0x4C ; 45 0) IT 0=
000130 4D 00247 DB 0x4D ; 46 9( IT 9)
000131 15 00248 DB 0x15 ; 47 *BACKSPACE
000132 16 00249 DB CBRKCODE ; 48 *CTRL-BREAK
000133 4E 00250 DB 0x4E ; 49 .> IT .:
000134 4F 00251 DB 0x4F ; 4A /? IT -_
000135 6C 00252 DB 'l' ; 4B lL
000136 50 00253 DB 0x50 ; 4C ;: IT oc@
000137 70 00254 DB 'p' ; 4D pP
000138 51 00255 DB 0x51 ; 4E -_ IT '?
000139 21 00256 DB 0x21 ; 4F *KP 1
00013A 24 00257 DB 0x24 ; 50 *KP 4
00013B 27 00258 DB 0x27 ; 51 *KP 7
00013C 52 00259 DB 0x52 ; 52 '" IT ao#
00013D 0C 00260 DB 0x0C ; 53 *IT <>
00013E 53 00261 DB 0x53 ; 54 [{ IT ee[{
00013F 54 00262 DB 0x54 ; 55 =+ IT i^
000140 FF 00263 DB 0xFF ; 56
000141 FF 00264 DB 0xFF ; 57
000142 06 00265 DB CAPSCODE ; 58 CAPS LOCK
000143 03 00266 DB 0x03 ; 59 R-SHIFT
000144 0A 00267 DB CRCODE ; 5A ENTER <*KP ENTER>
000145 55 00268 DB 0x55 ; 5B ]} IT +*]}
000146 FF 00269 DB 0xFF ; 5C
000147 56 00270 DB 0x56 ; 5D \| IT paragrafo u
000148 18 00271 DB 0x18 ; 5E *WAKE
000149 10 00272 DB KPBARCODE ; 5F *<KP />
00014A 20 00273 DB KP0CODE ; 60 *KP 0
00014B 2A 00274 DB 0x2A ; 61 *KP .
00014C 22 00275 DB 0x22 ; 62 *KP 2
00014D 25 00276 DB 0x25 ; 63 *KP 5
00014E 26 00277 DB 0x26 ; 64 *KP 6
00014F 28 00278 DB 0x28 ; 65 *KP 8
000150 1F 00279 DB ESCCODE ; 66 *ESC
000151 07 00280 DB 0x07 ; 67 *NUM-LOCK
000152 40 00281 DB 0x40 ; 68 *F11
000153 11 00282 DB 0x11 ; 69 *KP +
000154 23 00283 DB 0x23 ; 6A *KP 3
000155 12 00284 DB 0x12 ; 6B *KP -
000156 13 00285 DB 0x13 ; 6C *KP *
000157 29 00286 DB 0x29 ; 6D *KP 9
000158 08 00287 DB 0x08 ; 6E *SCROLL-LOCK
000159 FF 00288 DB 0xFF
00289
00290 ; tabella flag RptSt per tasti NO REPEAT
00015A 00291 RPTTBL:
00015A 20 00292 DB WAKEM ; WAKE UP
00015B 40 00293 DB SLEEPM ; SLEEP
00015C 80 00294 DB PWRM ; POWER
00015D 08 00295 DB RGUIM ; R-GUI
00015E 10 00296 DB LGUIM ; L-GUI
00015F 04 00297 DB GUIAPPM ; GUI APP
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 37
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000160 01 00298 DB PRINTM ; PRINT SCRN
000161 02 00299 DB ESCAPEM ; ESC
00300
00301 ; tabella conversione codici restituiti da CVTTBL a tasti effettivi
000162 00302 KEYTBL:
00303 ; questi indici impostano i flag di CtlSt e ShfSt
00304 ; rispecchiano lo stato di pressione/rilascio tasti SHIFT,ALT e CTRL
000162 01 00305 DB LSHFM ; 00 L-SHIFT
000163 02 00306 DB LCTLM ; 01 L-CTRL
000164 04 00307 DB LALTM ; 02 L-ALT
000165 08 00308 DB RSHFM ; 03 R-SHIFT
000166 10 00309 DB RCTLM ; 04 R-CTRL
000167 20 00310 DB RALTM ; 05 R-ALT
00311
00312 ; questi indici impostano i flag di TglSt
00313 ; rispecchiano lo stato dei tasti CAPS-LOCK/NUM-LOCK/SCROLL-LOCK/PAUSE
00314 ; NOTA: PAUSE non ha codice di rilascio
000168 80 00315 DB CAPSM ; 06 CAPS-LOCK
000169 40 00316 DB NUMLM ; 07 NUM-LOCK
00016A 20 00317 DB SCRLM ; 08 SCROLL-LOCK
00318 ; il tasto PAUSE va trattato come un tasto toggle
00016B 10 00319 DB PAUSM ; 09 PAUSE
00320
00321 ; i tasti seguenti vanno testati con lo shift
00016C 0D 00322 DB KB_CR ; 0A ENTER
00016D 8D 00323 DB KB_SHCR ; 0B SHIFT ENTER
00016E 3C 00324 DB '<' ; 0C IT <
00016F 3E 00325 DB '>' ; 0D SHIFT IT >
000170 09 00326 DB KB_TAB ; 0E TAB
000171 89 00327 DB KB_SHTAB ; 0F SHIFT TAB
00328
00329 ; questi indici non vanno trattati eccetto ESC/PRINT SCRN
00330 ; per il tasto esc va impostato il flag premuto/rilasciato
000172 2F 00331 DB '/' ; 10 KP /
000173 2B 00332 DB '+' ; 11 KP +
000174 2D 00333 DB '-' ; 12 KP -
000175 2A 00334 DB '*' ; 13 KP *
000176 20 00335 DB ' ' ; 14 SPACE
000177 90 00336 DB KB_BACKSPACE ; 15 BACKSPACE
000178 83 00337 DB KB_CTRLBREAK ; 16 CTRL BREAK
000179 84 00338 DB KB_ALTSYSREQ ; 17 ALT SYS REQ
00017A 85 00339 DB KB_WAKE ; 18 WAKE
00017B 86 00340 DB KB_SLEEP ; 19 SLEEP
00017C 87 00341 DB KB_PWR ; 1A PWR
00017D 80 00342 DB KB_RIGHTGUI ; 1B R-GUI
00017E 81 00343 DB KB_LEFTGUI ; 1C L-GUI
00017F 82 00344 DB KB_GUIMENU ; 1D APPS/MENU
000180 83 00345 DB KB_PRTSCN ; 1E PRTSCN/SYSRQ
000181 1B 00346 DB KB_ESCAPE ; 1F ESC
00347
00348 ; tasti numerici vanno trattati specialmente
000182 30 00349 DB '0' ; 20 KP 0
000183 31 00350 DB '1' ; 21 KP 1
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 38
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
000184 32 00351 DB '2' ; 22 KP 2
000185 33 00352 DB '3' ; 23 KP 3
000186 34 00353 DB '4' ; 24 KP 4
000187 35 00354 DB '5' ; 25 KP 5
000188 36 00355 DB '6' ; 26 KP 6
000189 37 00356 DB '7' ; 27 KP 7
00018A 38 00357 DB '8' ; 28 KP 8
00018B 39 00358 DB '9' ; 29 KP 9
00018C 2E 00359 DB '.' ; 2A KP .
00360
00361 ; tasti cursore: INSERT va trattato specialmente (toggle bit)
00018D 86 00362 DB KB_INSERT ; 2B INS
00018E 8C 00363 DB KB_END ; 2C END
00018F 8B 00364 DB KB_CSRDOWN ; 2D CSR DOWN
000190 8A 00365 DB KB_PGDOWN ; 2E PG DOWN
000191 8F 00366 DB KB_CSRLEFT ; 2F CSR LEFT
000192 00 00367 DB 0x00 ; 30 - TASTO NULL
000193 87 00368 DB KB_CSRRIGHT ; 31 CSR RIGHT
000194 85 00369 DB KB_HOME ; 32 HOME
000195 84 00370 DB KB_CSRUP ; 33 CSR UP
000196 88 00371 DB KB_PGUP ; 34 PG UP
000197 8E 00372 DB KB_DELETE ; 35 DEL
00373
00374 ; tasti funzione
000198 A0 00375 DB KB_F1 ; 36 F1
000199 A1 00376 DB KB_F2 ; 37 F2
00019A A2 00377 DB KB_F3 ; 38 F3
00019B A3 00378 DB KB_F4 ; 39 F4
00019C A4 00379 DB KB_F5 ; 3A F5
00019D A5 00380 DB KB_F6 ; 3B F6
00019E A6 00381 DB KB_F7 ; 3C F7
00019F A7 00382 DB KB_F8 ; 3D F8
0001A0 A8 00383 DB KB_F9 ; 3E F9
0001A1 A9 00384 DB KB_F10 ; 3F F10
0001A2 AA 00385 DB KB_F11 ; 40 F11
0001A3 AB 00386 DB KB_F12 ; 41 F12
00387
00388 ; tabella flag codice corrispondente a KEYTBL
00389 ; 0x00 -> codice ASCII
00390 ; 0x10 -> codice ASCII + flag toggle 4 bit low
00391 ; 0x80 -> invia status shift/alt/ctrl
00392 ; 0x90 -> invia status toggle
00393 ; 0xA0 -> codice di controllo
00394 ; 0xB0 -> codice di controllo + flag toggle 4 bit low
00395 ; 0xC0 -> codice tasto NMI
0001A4 00396 FLGTBL:
00397 ; questi valori non sono usati - il tasto viene trattato a parte
0001A4 80 00398 DB 0x80 ; 00 L-SHIFT
0001A5 80 00399 DB 0x80 ; 01 L-CTRL
0001A6 80 00400 DB 0x80 ; 02 L-ALT
0001A7 80 00401 DB 0x80 ; 03 R-SHIFT
0001A8 80 00402 DB 0x80 ; 04 R-CTRL
0001A9 80 00403 DB 0x80 ; 05 R-ALT
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 39
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0001AA 90 00404 DB 0x90 ; 06 CAPS-LOCK
0001AB 90 00405 DB 0x90 ; 07 NUM-LOCK
0001AC 90 00406 DB 0x90 ; 08 SCROLL-LOCK
0001AD 90 00407 DB 0x90 ; 09 PAUSE
0001AE 00 00408 DB 0x00 ; 0A ENTER
0001AF A0 00409 DB 0xA0 ; 0B SHIFT ENTER
0001B0 00 00410 DB 0x00 ; 0C IT <
0001B1 00 00411 DB 0x00 ; 0D SHIFT IT >
0001B2 00 00412 DB 0x00 ; 0E TAB
0001B3 A0 00413 DB 0xA0 ; 0F SHIFT TAB
0001B4 00 00414 DB 0x00 ; 10 KP /
0001B5 00 00415 DB 0x00 ; 11 KP +
0001B6 00 00416 DB 0x00 ; 12 KP -
0001B7 00 00417 DB 0x00 ; 13 KP *
0001B8 00 00418 DB 0x00 ; 14 SPACE
0001B9 A0 00419 DB 0xA0 ; 15 BACKSPACE
0001BA C0 00420 DB 0xC0 ; 16 CTRL BREAK
0001BB C0 00421 DB 0xC0 ; 17 ALT SYS REQ
0001BC C0 00422 DB 0xC0 ; 18 WAKE
0001BD C0 00423 DB 0xC0 ; 19 SLEEP
0001BE C0 00424 DB 0xC0 ; 1A PWR
0001BF A0 00425 DB 0xA0 ; 1B R-GUI
0001C0 A0 00426 DB 0xA0 ; 1C L-GUI
0001C1 A0 00427 DB 0xA0 ; 1D APPS/MENU
0001C2 B0 00428 DB 0xB0 ; 1E PRTSCN/SYSRQ
0001C3 10 00429 DB 0x10 ; 1F ESC
0001C4 00 00430 DB 0x00 ; 20 KP 0
0001C5 00 00431 DB 0x00 ; 21 KP 1
0001C6 00 00432 DB 0x00 ; 22 KP 2
0001C7 00 00433 DB 0x00 ; 23 KP 3
0001C8 00 00434 DB 0x00 ; 24 KP 4
0001C9 00 00435 DB 0x00 ; 25 KP 5
0001CA 00 00436 DB 0x00 ; 26 KP 6
0001CB 00 00437 DB 0x00 ; 27 KP 7
0001CC 00 00438 DB 0x00 ; 28 KP 8
0001CD 00 00439 DB 0x00 ; 29 KP 9
0001CE 00 00440 DB 0x00 ; 2A KP .
0001CF B0 00441 DB 0xB0 ; 2B INS
0001D0 A0 00442 DB 0xA0 ; 2C END
0001D1 A0 00443 DB 0xA0 ; 2D CSR DOWN
0001D2 A0 00444 DB 0xA0 ; 2E PG DOWN
0001D3 A0 00445 DB 0xA0 ; 2F CSR LEFT
0001D4 A0 00446 DB 0xA0 ; 30 - TASTO NULL
0001D5 A0 00447 DB 0xA0 ; 31 CSR RIGHT
0001D6 A0 00448 DB 0xA0 ; 32 HOME
0001D7 A0 00449 DB 0xA0 ; 33 CSR UP
0001D8 A0 00450 DB 0xA0 ; 34 PG UP
0001D9 A0 00451 DB 0xA0 ; 35 DEL
0001DA A0 00452 DB 0xA0 ; 36 F1
0001DB A0 00453 DB 0xA0 ; 37 F2
0001DC A0 00454 DB 0xA0 ; 38 F3
0001DD A0 00455 DB 0xA0 ; 39 F4
0001DE A0 00456 DB 0xA0 ; 3A F5
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 40
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0001DF A0 00457 DB 0xA0 ; 3B F6
0001E0 A0 00458 DB 0xA0 ; 3C F7
0001E1 A0 00459 DB 0xA0 ; 3D F8
0001E2 A0 00460 DB 0xA0 ; 3E F9
0001E3 A0 00461 DB 0xA0 ; 3F F10
0001E4 A0 00462 DB 0xA0 ; 40 F11
0001E5 A0 00463 DB 0xA0 ; 41 F12
00464
01509
01510 end
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 41
SYMBOL TABLE
LABEL VALUE
A 00000000
AALTB 00000007
AALTM 00000080
ABDEN 00000000
ABDOVF 00000007
ACCESS 00000000
ACKDT 00000005
ACKEN 00000004
ACKSTAT 00000006
ACQT0 00000003
ACQT1 00000004
ACQT2 00000005
ACTLB 00000006
ACTLM 00000040
ADCON0 00000FC2
ADCON1 00000FC1
ADCON2 00000FC0
ADCS0 00000000
ADCS1 00000001
ADCS2 00000002
ADDEN 00000003
ADEN 00000003
ADFM 00000007
ADIE 00000006
ADIF 00000006
ADIP 00000006
ADMSK1 00000001
ADMSK2 00000002
ADMSK3 00000003
ADMSK4 00000004
ADMSK5 00000005
ADON 00000000
ADRES 00000FC3
ADRESH 00000FC4
ADRESL 00000FC3
ALLALTCTLM 000000C0
ALTCTLB 00000006
ALTCTLKEY0 00000050
ALTCTLM 00000040
ALTKEY0 00000030
ALTKM 00000024
AN0 00000000
AN1 00000001
AN10 00000001
AN11 00000004
AN12 00000000
AN2 00000002
AN3 00000003
AN4 00000005
AN5 00000000
AN6 00000001
AN7 00000002
AN8 00000002
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 42
SYMBOL TABLE
LABEL VALUE
AN9 00000003
ASHFB 00000007
ASHFM 00000080
BANKED 00000001
BAUDCON 00000FB8
BAUDCTL 00000FB8
BCLIE 00000003
BCLIF 00000003
BCLIP 00000003
BF 00000000
BGST 00000005
BOR 00000000
BRG16 00000003
BRGH 00000002
BSR 00000FE0
C 00000000
C1INV 00000004
C1OUT_CMCON 00000006
C1OUT_PORTA 00000004
C2INV 00000005
C2OUT_CMCON 00000007
C2OUT_PORTA 00000005
CAPSB 00000007
CAPSCODE 00000006
CAPSM 00000080
CBRKCODE 00000016
CCP1 00000002
CCP1CON 00000FBD
CCP1IE 00000002
CCP1IF 00000002
CCP1IP 00000002
CCP1M0 00000000
CCP1M1 00000001
CCP1M2 00000002
CCP1M3 00000003
CCP1X 00000005
CCP1Y 00000004
CCP2CON 00000FBA
CCP2IE 00000000
CCP2IF 00000000
CCP2IP 00000000
CCP2M0 00000000
CCP2M1 00000001
CCP2M2 00000002
CCP2M3 00000003
CCP2X 00000005
CCP2Y 00000004
CCP2_PORTB 00000003
CCP2_PORTC 00000001
CCPR1 00000FBE
CCPR1H 00000FBF
CCPR1L 00000FBE
CCPR2 00000FBB
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 43
SYMBOL TABLE
LABEL VALUE
CCPR2H 00000FBC
CCPR2L 00000FBB
CFGS 00000006
CHS0 00000002
CHS1 00000003
CHS2 00000004
CHS3 00000005
CIS 00000003
CK 00000006
CKE 00000006
CKP 00000004
CLKI 00000007
CLKO 00000006
CM0 00000000
CM1 00000001
CM2 00000002
CMCON 00000FB4
CMIE 00000006
CMIF 00000006
CMIP 00000006
CNTMSTMR0 (0x10000 - ((count * D'625')) / D'32')
CNTTMR0 (0x10000 - ((count * D'1250')))
CNTUSTMR0 (0x10000 - (count * 5))
CRCODE 0000000A
CREN 00000004
CRSLEN 0000000B
CS 00000002
CSRC 00000007
CTLKEY0 00000040
CTRLKM 00000012
CVR0 00000000
CVR1 00000001
CVR2 00000002
CVR3 00000003
CVRCON 00000FB5
CVREF 00000002
CVREN 00000007
CVROE 00000006
CVRR 00000005
CVRSS 00000004
CVTTBL 000000EA
Caps 0000002C
ClrRX 00000400
Cmd0 000008B6
Cmd1 000008C0
Cmd2 000008EA
CmdEnd 000008F6
CmdRsp 000008EC
CtlSt 00000022
D 00000005
DC 00000001
DC1B0 00000004
DC1B1 00000005
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 44
SYMBOL TABLE
LABEL VALUE
DC2B0 00000004
DC2B1 00000005
DDRA TRISA
DDRB TRISB
DDRC TRISC
DDRD TRISD
DDRE TRISE
DEFRLTBL 000000E3
DEFTBL 000000DB
DONE 00000001
D_A 00000005
D_NOT_A 00000005
Delay_ms 00000376
Delay_us 0000037A
Delay_xx 0000037C
Delay_xx1 0000038A
E1Cnt 0000000A
E1PtrH 00000009
E1PtrL 00000008
E1SEQCNT 00000007
E1Test 000003FC
ECCP1AS 00000FB6
ECCP1DEL 00000FB7
ECCPAS 00000FB6
ECCPAS0 00000004
ECCPAS1 00000005
ECCPAS2 00000006
ECCPASE 00000007
EEADR 00000FA9
EECON1 00000FA6
EECON2 00000FA7
EEDATA 00000FA8
EEIE 00000004
EEIF 00000004
EEIP 00000004
EEPGD 00000007
ESCAPEM 00000002
ESCB 00000001
ESCCODE 0000001F
ESCM 00000002
ESCPRNM 00000003
EXT1TBL 000000A7
EXTRLTBL 000000C5
EXTTBL 000000AE
FAST 00000001
FERR 00000002
FLGTBL 000001A4
FLT0 00000000
FLTS 00000002
FNCCODE 00000036
FREE 00000004
FSR0 00000000
FSR0H 00000FEA
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 45
SYMBOL TABLE
LABEL VALUE
FSR0L 00000FE9
FSR1 00000001
FSR1H 00000FE2
FSR1L 00000FE1
FSR2 00000002
FSR2H 00000FDA
FSR2L 00000FD9
FnAdd 00000714
FnNoShf 00000700
GCEN 00000007
GIE 00000007
GIEH 00000007
GIEL 00000006
GIE_GIEH 00000007
GO 00000001
GO_DONE 00000001
GO_NOT_DONE 00000001
GUIAPPM 00000004
GetKbd 0000018C
GetKbd10 000001A2
GetKeyTbl 00000844
GetLine 000000D8
GetLine1 000000FC
GetLine2 00000102
HDRQIN 00000001
HLINT 00000000
HLNMI 00000001
HLVDCON 00000FD2
HLVDEN 00000004
HLVDIE 00000002
HLVDIF 00000002
HLVDIN 00000005
HLVDIP 00000002
HLVDL0 00000000
HLVDL1 00000001
HLVDL2 00000002
HLVDL3 00000003
IBF 00000007
IBOV 00000005
IDLEN 00000007
INDF0 00000FEF
INDF1 00000FE7
INDF2 00000FDF
INSCODE 0000002B
INSTB 00000002
INSTM 00000004
INT0 00000000
INT0E 00000004
INT0F 00000001
INT0IE 00000004
INT0IF 00000001
INT1 00000001
INT1E 00000003
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 46
SYMBOL TABLE
LABEL VALUE
INT1F 00000000
INT1IE 00000003
INT1IF 00000000
INT1IP 00000006
INT1P 00000006
INT2 00000002
INT2E 00000004
INT2F 00000001
INT2IE 00000004
INT2IF 00000001
INT2IP 00000007
INT2P 00000007
INTCON 00000FF2
INTCON2 00000FF1
INTCON3 00000FF0
INTEDG0 00000006
INTEDG1 00000005
INTEDG2 00000004
INTSRC 00000007
IOFS 00000002
IPEN 00000007
IPR1 00000F9F
IPR2 00000FA2
IRCF0 00000004
IRCF1 00000005
IRCF2 00000006
IRVST 00000005
ITMap 00000532
IVRST 00000005
Init1 00000214
Init10 00000320
Init2 0000025C
Init3 00000296
Init4 00000298
Init6 000002D8
Init61 000002EC
Init62 00000300
Init63 00000314
InitData 00000338
InitData1 0000033E
InitData2 0000034E
InitIO 000001D6
KBACK 00000004
KBBAT 00000006
KBBAT2 00000004
KBD_ACK 000000FA
KBD_BAT 000000AA
KBD_BRK 000000F0
KBD_DEFRATE 0000000B
KBD_DEFRATE2 00000037
KBD_ECHO 000000EE
KBD_ENABLE 000000F4
KBD_EXT 000000E0
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 47
SYMBOL TABLE
LABEL VALUE
KBD_EXT1 000000E1
KBD_GETID 000000F2
KBD_IDH 00000083
KBD_IDL 000000AB
KBD_NOBAT 000000FC
KBD_RESEND 000000FE
KBD_RESET 000000FF
KBD_SETLED 000000ED
KBD_SETSC 000000F0
KBD_TYPERATE 000000F3
KBENABLE 00000002
KBFND 00000007
KBI0 00000004
KBI1 00000005
KBI2 00000006
KBI3 00000007
KBLEDOK 00000000
KBNOBAT 00000007
KBRATE 00000003
KBRX 00000007
KBRXERR 0000000C
KBSCOK 00000001
KBTX 00000006
KBVID 00000005
KBVOFF 00000006
KBVON 00000007
KB_ALTBKS 0000001C
KB_ALTCTLBKS 00000082
KB_ALTCTLDEL 00000081
KB_ALTCTLEND 00000080
KB_ALTCTLESC 00000088
KB_ALTCTLHOME 00000008
KB_ALTCTLINS 0000000C
KB_ALTCTLMINUS 00000028
KB_ALTCTLPGDWN 00000014
KB_ALTCTLPGUP 00000010
KB_ALTCTLPLUS 00000025
KB_ALTCTLPRT 00000004
KB_ALTCTLTAB 00000022
KB_ALTDEL 00000019
KB_ALTEND 00000016
KB_ALTESC 0000001E
KB_ALTHOME 00000006
KB_ALTINS 0000000A
KB_ALTMINUS 00000026
KB_ALTPGDWN 00000012
KB_ALTPGUP 0000000E
KB_ALTPLUS 00000023
KB_ALTPRT 00000002
KB_ALTSYSREQ 00000084
KB_ALTTAB 00000020
KB_BACKSPACE 00000090
KB_CR 0000000D
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 48
SYMBOL TABLE
LABEL VALUE
KB_CSRDOWN 0000008B
KB_CSRLEFT 0000008F
KB_CSRRIGHT 00000087
KB_CSRUP 00000084
KB_CTLBKS 0000001D
KB_CTLDEL 0000001A
KB_CTLEND 00000017
KB_CTLESC 0000001F
KB_CTLHOME 00000007
KB_CTLINS 0000000B
KB_CTLMINUS 00000027
KB_CTLPGDWN 00000013
KB_CTLPGUP 0000000F
KB_CTLPLUS 00000024
KB_CTLPRT 00000003
KB_CTLTAB 00000021
KB_CTRLBREAK 00000083
KB_DELETE 0000008E
KB_END 0000008C
KB_ESCAPE 0000001B
KB_F1 000000A0
KB_F10 000000A9
KB_F11 000000AA
KB_F12 000000AB
KB_F2 000000A1
KB_F3 000000A2
KB_F4 000000A3
KB_F5 000000A4
KB_F6 000000A5
KB_F7 000000A6
KB_F8 000000A7
KB_F9 000000A8
KB_GUIMENU 00000082
KB_HOME 00000085
KB_INSERT 00000086
KB_LEFTGUI 00000081
KB_PGDOWN 0000008A
KB_PGUP 00000088
KB_PRTSCN 00000083
KB_PWR 00000087
KB_RIGHTGUI 00000080
KB_SHCR 0000008D
KB_SHIFTBKS 0000001B
KB_SHIFTDEL 00000018
KB_SHIFTEND 00000015
KB_SHIFTHOME 00000005
KB_SHIFTINS 00000009
KB_SHIFTPGDWN 00000011
KB_SHIFTPGUP 0000000D
KB_SHIFTPRT 00000001
KB_SHTAB 00000089
KB_SLEEP 00000086
KB_TAB 00000009
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 49
SYMBOL TABLE
LABEL VALUE
KB_WAKE 00000085
KBuf 0000001B
KCLKIN 00000003
KCLKO 00000004
KCnt 00000018
KDATAIN 00000000
KDATAO 00000005
KEYCTL 00000007
KEYCTL2 00000005
KEYRLS 00000006
KEYTBL 00000162
KEYTGL 00000004
KFRFULL 00000007
KFRFlag 00000002
KFRRD 00000000
KFRRd0 00000004
KFRRd1 00000005
KFRRd2 00000006
KFRRd3 00000007
KFRRdCnt 00000003
KFRRead 00000880
KFRRead1 0000088C
KFRRead2 00000892
KFRSRP 00000003
KFRSSI 00000005
KFRSSN 00000004
KFRWE 00000001
KFRWrite 0000086E
KNoBAT 0000028E
KP0CODE 00000020
KPARY 00000002
KPBARCODE 00000010
KPar 00000019
KRESET 00000000
KSTOP 00000003
KStatus 0000001A
KTIMEO 00000001
KbVerf 00000394
KbVerf2 000003C6
KbdFlag 0000001D
KbdFlag2 0000001E
KbdIDH 00000001
KbdIDL 00000000
KbdInt 00000000
KbdInt10 00000020
KbdInt11 00000046
KbdInt12 00000056
KbdInt20 00000072
KbdInt99 00000052
KbdProc 000003C8
KbdProc0 000003D4
KbdProc1 0000041C
KbdProc10 000004C0
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 50
SYMBOL TABLE
LABEL VALUE
KbdProc12 00000586
KbdProc13 000005DC
KbdProc14 0000062C
KbdProc15 0000066A
KbdProc16 00000670
KbdProc18 0000068E
KbdProc2 00000426
KbdProc20 0000069A
KbdProc21 000006AA
KbdProc22 000006B0
KbdProc23 000006BC
KbdProc24 000006C2
KbdProc25 000006D8
KbdProc26 000006E0
KbdProc3 00000434
KbdProc4 0000044E
KbdProc40 00000718
KbdProc41 0000071A
KbdProc42 0000073A
KbdProc43 00000748
KbdProc5 0000045C
KbdProc50 00000758
KbdProc6 00000480
KbdProc60 00000826
KbdProc61 00000828
KbdProc7 0000048A
KbdProc8 000004AE
Key01 00000776
Key02 0000077C
Key06 00000786
Key10 0000079E
Key11 000007B0
Key12 000007CE
Key13 000007D8
Key15 000007DE
KeySnd 00000816
LALTB 00000002
LALTM 00000004
LATA 00000F89
LATA0 00000000
LATA1 00000001
LATA2 00000002
LATA3 00000003
LATA4 00000004
LATA5 00000005
LATA6 00000006
LATA7 00000007
LATB 00000F8A
LATB0 00000000
LATB1 00000001
LATB2 00000002
LATB3 00000003
LATB4 00000004
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 51
SYMBOL TABLE
LABEL VALUE
LATB5 00000005
LATB6 00000006
LATB7 00000007
LATC 00000F8B
LATC0 00000000
LATC1 00000001
LATC2 00000002
LATC3 00000003
LATC4 00000004
LATC5 00000005
LATC6 00000006
LATC7 00000007
LATD 00000F8C
LATD0 00000000
LATD1 00000001
LATD2 00000002
LATD3 00000003
LATD4 00000004
LATD5 00000005
LATD6 00000006
LATD7 00000007
LATE 00000F8D
LATE0 00000000
LATE1 00000001
LATE2 00000002
LCTLB 00000001
LCTLM 00000002
LGUIM 00000010
LSHFB 00000000
LSHFM 00000001
LVDCON 00000FD2
LVDEN 00000004
LVDIE 00000002
LVDIF 00000002
LVDIN 00000005
LVDIP 00000002
LVDL0 00000000
LVDL1 00000001
LVDL2 00000002
LVDL3 00000003
LVV0 00000000
LVV1 00000001
LVV2 00000002
LVV3 00000003
LedSt 00000026
LedUpd 00000662
LockSt 00000025
MAPALPHA 00000006
MAPCODE 00000042
MAPCODEMAX 00000056
MAPITB 00000007
MCLR 00000003
MKeyTst 000004FC
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 52
SYMBOL TABLE
LABEL VALUE
Main 00000994
Main2 000009A0
MapCfg 0000002B
MapTst 0000050C
N 00000004
NKeyRls 0000056C
NKeySet 00000566
NKeyTst 0000053A
NMISnd 00000834
NMITst 00000570
NMITst1 00000578
NOT_A 00000005
NOT_ADDRESS 00000005
NOT_BOR 00000000
NOT_CS 00000002
NOT_DONE 00000001
NOT_MCLR 00000003
NOT_PD 00000002
NOT_POR 00000001
NOT_RBPU 00000007
NOT_RD 00000000
NOT_RI 00000004
NOT_SS 00000005
NOT_T1SYNC 00000002
NOT_T3SYNC 00000002
NOT_TO 00000003
NOT_W 00000002
NOT_WR 00000001
NOT_WRITE 00000002
NUMLB 00000006
NUMLM 00000040
NVCODE 00000060
NoPause 00000644
OBF 00000006
OERR 00000001
OSC1 00000007
OSC2 00000006
OSCCON 00000FD3
OSCFIE 00000007
OSCFIF 00000007
OSCFIP 00000007
OSCTUNE 00000F9B
OSTS 00000003
OV 00000003
P 00000004
P1A 00000002
P1B 00000005
P1C 00000006
P1D 00000007
P1M0 00000006
P1M1 00000007
PAUSB 00000004
PAUSECODE 00000009
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 53
SYMBOL TABLE
LABEL VALUE
PAUSM 00000010
PC 00000FF9
PCFG0 00000000
PCFG1 00000001
PCFG2 00000002
PCFG3 00000003
PCL 00000FF9
PCLATH 00000FFA
PCLATU 00000FFB
PD 00000002
PDC0 00000000
PDC1 00000001
PDC2 00000002
PDC3 00000003
PDC4 00000004
PDC5 00000005
PDC6 00000006
PEIE 00000006
PEIE_GIEL 00000006
PEN 00000002
PGC 00000006
PGD 00000007
PGM 00000005
PIE1 00000F9D
PIE2 00000FA0
PIR1 00000F9E
PIR2 00000FA1
PLLEN 00000006
PLUSW0 00000FEB
PLUSW1 00000FE3
PLUSW2 00000FDB
POR 00000001
PORTA 00000F80
PORTB 00000F81
PORTC 00000F82
PORTD 00000F83
PORTE 00000F84
POSTDEC0 00000FED
POSTDEC1 00000FE5
POSTDEC2 00000FDD
POSTINC0 00000FEE
POSTINC1 00000FE6
POSTINC2 00000FDE
PR2 00000FCB
PREINC0 00000FEC
PREINC1 00000FE4
PREINC2 00000FDC
PRINTM 00000001
PRNSCB 00000000
PRNSCM 00000001
PROD 00000FF3
PRODH 00000FF4
PRODL 00000FF3
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 54
SYMBOL TABLE
LABEL VALUE
PRSEN 00000007
PRTCODE 0000001E
PSA 00000003
PSP0 00000000
PSP1 00000001
PSP2 00000002
PSP3 00000003
PSP4 00000004
PSP5 00000005
PSP6 00000006
PSP7 00000007
PSPIE 00000007
PSPIF 00000007
PSPIP 00000007
PSPMODE 00000004
PSSAC0 00000002
PSSAC1 00000003
PSSBD0 00000000
PSSBD1 00000001
PWM1CON 00000FB7
PWRM 00000080
PauseKey 00000414
PutKey 000005F4
R 00000002
RA0 00000000
RA1 00000001
RA2 00000002
RA3 00000003
RA4 00000004
RA5 00000005
RA6 00000006
RA7 00000007
RALTB 00000005
RALTM 00000020
RB0 00000000
RB1 00000001
RB2 00000002
RB3 00000003
RB4 00000004
RB5 00000005
RB6 00000006
RB7 00000007
RBIE 00000003
RBIF 00000000
RBIP 00000000
RBMASK 0000000D
RBPU 00000007
RC0 00000000
RC1 00000001
RC2 00000002
RC3 00000003
RC4 00000004
RC5 00000005
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 55
SYMBOL TABLE
LABEL VALUE
RC6 00000006
RC7 00000007
RCEN 00000003
RCIDL 00000006
RCIE 00000005
RCIF 00000005
RCIP 00000005
RCMT 00000006
RCON 00000FD0
RCREG 00000FAE
RCSTA 00000FAB
RCTLB 00000004
RCTLM 00000010
RD 00000000
RD0 00000000
RD1 00000001
RD16 00000007
RD2 00000002
RD3 00000003
RD4 00000004
RD5 00000005
RD6 00000006
RD7 00000007
RE0 00000000
RE1 00000001
RE2 00000002
RE3 00000003
RESIN 00000002
RGUIM 00000008
RI 00000004
RPTTBL 0000015A
RSEN 00000001
RSHFB 00000003
RSHFM 00000008
RX 00000007
RX9 00000006
RX9D 00000000
RXBRK 00000006
RXBUFLEN 000000FE
RXDTP 00000005
RXE1ERR 00000003
RXEXT 00000005
RXEXT1 00000004
RXMASK 00000080
RXOVR 00000007
R_NOT_W 00000002
R_W 00000002
RptSt 0000002A
RxBufEnd 0000013E
RxBuffer 00000040
RxCnt 0000000C
RxCode 0000001F
RxData 0000000B
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 56
SYMBOL TABLE
LABEL VALUE
RxFlag 0000000D
RxKeyb 00000078
RxKeyb1 00000096
RxKeyb2 0000009A
RxKeyb3 0000009E
RxKeyb4 000000A8
RxKeyb5 000000AE
RxKeyb6 000000B2
RxKeyb7 000000C0
RxKeyb8 000000C4
RxKeyb9 000000CC
S 00000003
SBOREN 00000006
SCK 00000003
SCKP 00000004
SCL 00000003
SCLOCKH
SCLOCKL
SCRLB 00000005
SCRLM 00000020
SCS0 00000000
SCS1 00000001
SDA 00000004
SDATAH
SDATAL
SDI 00000004
SDO 00000005
SEN 00000000
SENDB 00000003
SHFALL 000000C0
SHIFTKM 00000009
SKPALL 00000070
SKPALTB 00000005
SKPCTLB 00000006
SKPSHFB 00000004
SLEEPM 00000040
SMP 00000007
SP0 00000000
SP1 00000001
SP2 00000002
SP3 00000003
SP4 00000004
SPBRG 00000FAF
SPBRGH 00000FB0
SPCKEY 0000009A
SPCKEY2 0000003A
SPCKEY3 0000006A
SPEN 00000007
SREN 00000005
SS 00000005
SSPADD 00000FC8
SSPBUF 00000FC9
SSPCON1 00000FC6
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 57
SYMBOL TABLE
LABEL VALUE
SSPCON2 00000FC5
SSPEN 00000005
SSPIE 00000003
SSPIF 00000003
SSPIP 00000003
SSPM0 00000000
SSPM1 00000001
SSPM2 00000002
SSPM3 00000003
SSPOV 00000006
SSPSTAT 00000FC7
STATUS 00000FD8
STKFUL 00000007
STKOVF 00000007
STKPTR 00000FFC
STKUNF 00000006
SWDTE 00000000
SWDTEN 00000000
SYNC 00000004
SYSCODE 00000017
SendKbd 000001AE
SendKbd10 000001D2
SendLed 000001A6
SetLed 00000900
SetLed1 00000908
SetLed2 00000940
ShfSt 00000020
SndProc 00000944
Start 0000098C
T016BIT 00000006
T08BIT 00000006
T0CKI 00000004
T0CON 00000FD5
T0CS 00000005
T0CntH 00000017
T0CntL 00000016
T0IE 00000005
T0IF 00000002
T0PS0 00000000
T0PS1 00000001
T0PS2 00000002
T0PS3 00000003
T0SE 00000004
T100US 0000FE0C
T13CKI 00000000
T1500MS 00008D90
T1CKI 00000000
T1CKPS0 00000004
T1CKPS1 00000005
T1CON 00000FCD
T1OSCEN 00000003
T1OSI 00000001
T1OSO 00000000
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 58
SYMBOL TABLE
LABEL VALUE
T1RUN 00000006
T1SYNC 00000002
T20MS 00009E58
T20US 0000FF9C
T2CKPS0 00000000
T2CKPS1 00000001
T2CON 00000FCA
T2OUTPS0 00000003
T2OUTPS1 00000004
T2OUTPS2 00000005
T2OUTPS3 00000006
T3CCP1 00000003
T3CCP2 00000006
T3CKPS0 00000004
T3CKPS1 00000005
T3CON 00000FB1
T3SYNC 00000002
T40MS 00003CB0
TABLAT 00000FF5
TBLPTR 00000FF6
TBLPTRH 00000FF7
TBLPTRL 00000FF6
TBLPTRU 00000FF8
TCtlSt 00000023
TLockSt 00000028
TMR0 00000FD6
TMR0H 00000FD7
TMR0IE 00000005
TMR0IF 00000002
TMR0IP 00000002
TMR0L 00000FD6
TMR0ON 00000007
TMR0P0 00000008
TMR0P256 00000007
TMR0P4 00000001
TMR1 00000FCE
TMR1CS 00000001
TMR1H 00000FCF
TMR1IE 00000000
TMR1IF 00000000
TMR1IP 00000000
TMR1L 00000FCE
TMR1ON 00000000
TMR2 00000FCC
TMR2IE 00000001
TMR2IF 00000001
TMR2IP 00000001
TMR2ON 00000002
TMR3 00000FB2
TMR3CS 00000001
TMR3H 00000FB3
TMR3IE 00000001
TMR3IF 00000001
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 59
SYMBOL TABLE
LABEL VALUE
TMR3IP 00000001
TMR3L 00000FB2
TMR3ON 00000000
TO 00000003
TOPRAM 00000300
TOS 00000FFD
TOSH 00000FFE
TOSL 00000FFD
TOSU 00000FFF
TOUTPS0 00000003
TOUTPS1 00000004
TOUTPS2 00000005
TOUTPS3 00000006
TPortB 00000029
TRISA 00000F92
TRISA0 00000000
TRISA1 00000001
TRISA2 00000002
TRISA3 00000003
TRISA4 00000004
TRISA5 00000005
TRISA6 00000006
TRISA7 00000007
TRISB 00000F93
TRISB0 00000000
TRISB1 00000001
TRISB2 00000002
TRISB3 00000003
TRISB4 00000004
TRISB5 00000005
TRISB6 00000006
TRISB7 00000007
TRISC 00000F94
TRISC0 00000000
TRISC1 00000001
TRISC2 00000002
TRISC3 00000003
TRISC4 00000004
TRISC5 00000005
TRISC6 00000006
TRISC7 00000007
TRISD 00000F95
TRISD0 00000000
TRISD1 00000001
TRISD2 00000002
TRISD3 00000003
TRISD4 00000004
TRISD5 00000005
TRISD6 00000006
TRISD7 00000007
TRISE 00000F96
TRISE0 00000000
TRISE1 00000001
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 60
SYMBOL TABLE
LABEL VALUE
TRISE2 00000002
TRMT 00000001
TShfSt 00000024
TTglSt 00000027
TUN0 00000000
TUN1 00000001
TUN2 00000002
TUN3 00000003
TUN4 00000004
TX 00000006
TX9 00000006
TX9D 00000000
TXBUFLEN 000001C2
TXCKP 00000004
TXEN 00000005
TXIE 00000004
TXIF 00000004
TXIP 00000004
TXMAXCNT 000000E1
TXOVR 00000007
TXREG 00000FAD
TXSTA 00000FAC
TglSt 00000021
TmpB 0000001C
ToggleBit 0000064E
ToggleRls 00000656
TstLock 0000065A
TxBufEnd 00000300
TxBuffer 0000013E
TxCnt 00000013
TxData0 00000014
TxData1 00000015
TxFlag 00000012
TxHeadH 0000000F
TxHeadL 0000000E
TxKeyb 0000010C
TxKeyb1 0000012A
TxKeyb10 00000174
TxKeyb11 00000178
TxKeyb12 00000180
TxKeyb2 00000144
TxKeyb3 00000148
TxKeyb4 00000152
TxKeyb5 00000154
TxKeyb6 00000158
TxKeyb7 00000168
TxKeyb8 0000016A
TxKeyb9 0000016E
TxTailH 00000011
TxTailL 00000010
UA 00000001
USTBL 00000010
UpdBufPtr 00000404
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 61
SYMBOL TABLE
LABEL VALUE
VCFG0 00000004
VCFG1 00000005
VDIRMAG 00000007
VPP 00000003
VREFN 00000002
VREFP 00000003
W 00000000
WAKECODE 00000018
WAKEM 00000020
WCOL 00000007
WDTCON 00000FD1
WR 00000001
WREG 00000FE8
WREN 00000002
WRERR 00000003
WUE 00000001
Wait1 000008DC
Z 00000002
_BOREN_NOSLP_2L 000000FD
_BOREN_OFF_2L 000000F9
_BOREN_ON_2L 000000FB
_BOREN_SBORDIS_2L 000000FF
_BORV_0_2L 000000E7
_BORV_1_2L 000000EF
_BORV_2_2L 000000F7
_BORV_3_2L 000000FF
_CCP2MX_PORTBE_3H 000000FE
_CCP2MX_PORTC_3H 000000FF
_CONFIG1H 00300001
_CONFIG2H 00300003
_CONFIG2L 00300002
_CONFIG3H 00300005
_CONFIG4L 00300006
_CONFIG5H 00300009
_CONFIG5L 00300008
_CONFIG6H 0030000B
_CONFIG6L 0030000A
_CONFIG7H 0030000D
_CONFIG7L 0030000C
_CP0_OFF_5L 000000FF
_CP0_ON_5L 000000FE
_CP1_OFF_5L 000000FF
_CP1_ON_5L 000000FD
_CPB_OFF_5H 000000FF
_CPB_ON_5H 000000BF
_CPD_OFF_5H 000000FF
_CPD_ON_5H 0000007F
_DEBUG_OFF_4L 000000FF
_DEBUG_ON_4L 0000007F
_DEVID1 003FFFFE
_DEVID2 003FFFFF
_EBTR0_OFF_7L 000000FF
_EBTR0_ON_7L 000000FE
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 62
SYMBOL TABLE
LABEL VALUE
_EBTR1_OFF_7L 000000FF
_EBTR1_ON_7L 000000FD
_EBTRB_OFF_7H 000000FF
_EBTRB_ON_7H 000000BF
_FCMEN_OFF_1H 000000BF
_FCMEN_ON_1H 000000FF
_IDLOC0 00200000
_IDLOC1 00200001
_IDLOC2 00200002
_IDLOC3 00200003
_IDLOC4 00200004
_IDLOC5 00200005
_IDLOC6 00200006
_IDLOC7 00200007
_IESO_OFF_1H 0000007F
_IESO_ON_1H 000000FF
_LPT1OSC_OFF_3H 000000FB
_LPT1OSC_ON_3H 000000FF
_LVP_OFF_4L 000000FB
_LVP_ON_4L 000000FF
_MCLRE_OFF_3H 0000007F
_MCLRE_ON_3H 000000FF
_OSC_ECIO6_1H 000000F5
_OSC_EC_1H 000000F4
_OSC_HSPLL_1H 000000F6
_OSC_HS_1H 000000F2
_OSC_INTIO67_1H 000000F8
_OSC_INTIO7_1H 000000F9
_OSC_LP_1H 000000F0
_OSC_RCIO6_1H 000000F7
_OSC_RC_1H 000000F3
_OSC_XT_1H 000000F1
_PBADEN_OFF_3H 000000FD
_PBADEN_ON_3H 000000FF
_PWRT_OFF_2L 000000FF
_PWRT_ON_2L 000000FE
_STVREN_OFF_4L 000000FE
_STVREN_ON_4L 000000FF
_WDTPS_1024_2H 000000F5
_WDTPS_128_2H 000000EF
_WDTPS_16384_2H 000000FD
_WDTPS_16_2H 000000E9
_WDTPS_1_2H 000000E1
_WDTPS_2048_2H 000000F7
_WDTPS_256_2H 000000F1
_WDTPS_2_2H 000000E3
_WDTPS_32768_2H 000000FF
_WDTPS_32_2H 000000EB
_WDTPS_4096_2H 000000F9
_WDTPS_4_2H 000000E5
_WDTPS_512_2H 000000F3
_WDTPS_64_2H 000000ED
_WDTPS_8192_2H 000000FB
MPASM 5.44 MAIN.ASM 5-22-2013 16:45:20 PAGE 63
SYMBOL TABLE
LABEL VALUE
_WDTPS_8_2H 000000E7
_WDT_OFF_2H 000000FE
_WDT_ON_2H 000000FF
_WRT0_OFF_6L 000000FF
_WRT0_ON_6L 000000FE
_WRT1_OFF_6L 000000FF
_WRT1_ON_6L 000000FD
_WRTB_OFF_6H 000000FF
_WRTB_ON_6H 000000BF
_WRTC_OFF_6H 000000FF
_WRTC_ON_6H 000000DF
_WRTD_OFF_6H 000000FF
_WRTD_ON_6H 0000007F
_XINST_OFF_4L 000000BF
_XINST_ON_4L 000000FF
__18F4420 00000001
bmi bn
bpl bnn
ldw
Errors : 0
Warnings : 0 reported, 0 suppressed
Messages : 0 reported, 0 suppressed