⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jb8-psu.asm

📁 MC68HC608JB8的固件例程源程序.zip
💻 ASM
📖 第 1 页 / 共 2 页
字号:
*
VP_Col      ds      1           ; ptr to current column
VP_Row      ds      1           ; ptr to current row
*
* (if blank key at col i / row j, then j-th bit of Q_ColMsk[i] = 0)
Q_ColMsk    ds      K_ColMax    ; column masks of blank keys
*
*
* --- Ghost Key Detector -------------------------------------------------
VC_One      ds      1           ; bit '1' counter
VP_ChkCol   ds      1           ; storage row values of check column
*
V_GkeyRow   ds      1           ; ghost keys overlap pattern
V_Gkeymsk   ds      1           ; ghost key rows mask
*
V_LED_PTD       ds      1       ; Image of PTD_LED
b_SCRL          equ 2           ;  =1    SCROLL lock enable
b_CAPS          equ 3           ;  =1    CAPS lock enable
b_NUM           equ 4           ;  =1    NUM lock enable

* --- Scan Matrix Keyboard -----------------------------------------------
*
VS_Scan         ds      1       ; Keyboard Scan Status Byte
;b_PKPress       equ     0       ;  1- key press detected for prev. scan
;b_CKPress       equ     1       ;  1- key press detected for curr. scan
;b_Kghost        equ     3       ;  1- ghost key detected
b_K_Fn_Fnd      equ     2
b_K_Fn_Tggl     equ     4
b_Fn_State	equ     5
b_Fn_Ctrl       equ     5       ;  PS2 use
b_Kovf          equ     6       ;  1- kbd report overflow
b_Fn_Alt        equ     7       ;  PS2 use
*
*
V_3_Zero        ds      1       ; Process of tri-zeros
b_Send_Ovr      equ     4       ; 1 - all bytes are sent
b_InH_3Z        equ     5       ; indicate the ON/OFF state
b_3Z_Key_P      equ     6       ; indicate the '000' key is pressed
b_3z_Key        equ     7       ; the Tri-zero key is pressed
*
*
*
* -----------------------------------------------
COMRAMEND       equ     *


* -- PS2 RAM -------------------------------------------------------------
* --- Device Status ------------------------------------------------------
V_DevStat       ds      1       ; device status byte
b_KbdOff        equ 0           ;  =1    kbd disable
*
* --- KBD PS/2 Serial Rx Handler -----------------------------------------
V_RxKBD     ds      1           ; KBD Rx Status Byte
b_RxByte     equ 0              ;  1= new Rx data fm KBC
b_WData      equ 1              ;  1= wait for data byte
b_LRxRst     equ 1              ;  1= last receive byte is RESET command
b_RxErr      equ 4              ;  receive error (KBD_IN routine)
*
V_RxByte    ds      1           ; Rx byte(from KBC)
*
VC_Parity   ds      1           ; 1's counter for parity check
                                ; (shared by KBD Tx & Rx Handlers)
*
Q_KbcCmd    ds      2           ; buffer for cmd:data pair
*
*
* --- KBD PS/2 Serial Tx Handler -----------------------------------------
V_TxKBD     ds      1           ; KBD Tx Status Byte
b_TxByte     equ 0              ;  1= Tx completed
b_TxInt      equ 1              ;  1= Tx interrupted by KBC Tx
*
V_TxByte    ds      1           ; Tx byte(to KBC)
*
V_LastTx    ds      1           ; last Tx byte(for RESEND cmd)


*
* --- Repeat Key Handler -------------------------------------------------
V_RptStat   ds      1           ; Repeat Key Status Register
b_Delay      equ 0              ;  =1  delay count down in progress
b_Repeat     equ 1              ;  =1  repeat count down in progress
b_RptNow     equ 2              ;  =1  signal to echo Repeat Key
*
V_RptKey    ds      1           ; current repeat key
V_PKeyNum   ds      1           ; previous repeat key
*
K_TypDef    Equ     %00101101   ; typematic default
                                ; (500ms and 10.9 char/s)
*
V_TYPcode   ds      1           ; typematic code
                                ;  bit 6-5 :  repeat delay code
                                ;      4-0 :  repeat rate code
*
VC_Repeat   ds      1           ; repeat delay/rate counter     [unit:4ms]
*
V_RPTrate   ds      1           ; repeat rate count             [unit:4ms]
*
V_RPTdly    ds      1           ; repeat delay count            [unit:4ms]
*
*
* --- FIFO Buffer Queue --------------------------------------------------
* - buffer queue to store KBD scan codes, which will be sent to KBC
*
K_FIFO_SIZE equ     {16+1}      ; Q_FIFO size(reserve 1 byte for separator)
Q_FIFO      ds      K_FIFO_SIZE ; FIFO buffer queue
*
VP_FIFOin   ds      1           ; i/p ptr for Q_FIFO
VP_FIFOout  ds      1           ; o/p ptr for Q_FIFO
*
V_FIFOtmp   ds      1           ; temp. storage for FIFO
*
*
* --- Scan Codes Buffer Queue --------------------------------------------
* - buffer queue to store scan codes for a key #
*
K_QC_SIZE   equ     10          ; Q_CODE size
Q_CODE      ds      K_QC_SIZE   ; Scan Codes buffer queue
*
VP_CDin     ds      1           ; i/p ptr for Q_CODE
VP_CDout    ds      1           ; o/p ptr for Q_CODE
*
V_Kcode     ds      1           ; key code
*
*
* --- Delay Routines -----------------------------------------------------
V_DlyNus   ds      1            ; temp. byte in delay routines
*
Q_Fn_Stat       ds      16;	{K_N_Fn_Keys} ; Fn key status
*
*
*
PS2RAMEND       EQU     *
* ====== End of PS2 RAM area ============================================


.PAGE
* ------ New I/O Definition ----------------------------------------------

* --- Port A -------------------------------------------------------------
Port_Row	equ	PTA	; Key Matrix - Scan Row 0-7	[o/d]
*
*
* --- Port B -------------------------------------------------------------
* (Key Matrix - Scan Column 0-7)				[o/d]
*
* --- Port C -------------------------------------------------------------
* (Key Matrix - Scan Column 8-16)				[o/d]
*
*
* --- Port D -------------------------------------------------------------
b_MseClk        equ 0           ; P/S 2 Mouse Clock (not used)
b_MseData	equ 1		; P/S 2 Mouse Data (not used)
b_LSCRL         equ 2           ;  -0 SCRLlock LED on            [o/p]
b_LCAP		equ 3           ;  -0 CAP lock LED on            [o/p]
b_LNUM		equ 4           ;  -0 NUM lock LED on            [o/p]
*
*

.PAGE
* ------ Variables Definition --------------------------------------------
*
        org     COMRAMEND
*
* --- [RAM Routine] copy content of VD_Opd1[x] to VD_Opd2 ----------------
* - called in DEV_HANDLER routine
* equivalent to :  lda     <V_OFF_LDA_H:L>,x
*                  sta     <V_OFF_STA>
*                  rts
Long_IDX        equ     *       ; <for Device Command Handler>
V_LDA           ds      1       ; Opcode of LDA(16-bit Idx) = $D6
V_Off_LDA_H     ds      1       ; Offset(High byte) LDA
V_Off_LDA_L     ds      1       ; Offset(Low byte) LDA
V_STA           ds      1       ; Opcode of STA(direct) = $B7
V_Off_STA       ds      1       ; Offset STA
V_RTS           ds      1       ; Opcode of RTS = $81
*
*
* (dec. by timer Ch1 interrupt - every 4ms)
K_EP12_T_OUT	equ	30	; Time out every 120ms
VC_EP_T_OUT	ds      1       ; Counter for Endpoint 1 & 2 Timeout
*
KC_1s           equ     20      ; dec. by 50ms delay loop
VC_1s           ds      1       ; counter for 1s delay
*
*
* --- Delay Loops --------------------------------------------------------
* DELAY routines using instruction cycles
K_Td20us    equ     20                      ; DLY_20us loop       [us]
K_Nd20us    equ     {K_Td20us*K_Fcpu/1000}  ;                     [cnts]
*
K_N5ms          equ     {5*K_Ftim}      ; timer coutns for 5ms  [cnt]
*
K_N12ms         equ     {12*K_Ftim}     ; timer counts for 12ms [cnt]
*
*
* --- USB Descriptor Type ------------------------------------------------
K_DType_DEV     equ     1       ; DEVICE
K_DType_CFG     equ     2       ; CONFIGURATION
K_DType_STG     equ     3       ; STRING
K_DType_IF      equ     4       ; INTERFACE     -

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -