亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? kbscan.asm

?? 該程序為USB HUB程序
?? ASM
?? 第 1 頁 / 共 2 頁
字號:
;FILE:KEYSCAN.ASM
;
;
; contains the key scanning algorithm for the keyboard scan matrix
;
;REVISION HISTORY
;
;8/13/98
; changed sense of usb connect bit in port 3
;========================================================================
;                       KEYBOARD SCAN TASK
; The keyboard is organized as 8 rows by 16 columns.  The I/O ports are
; assigned as:
; P2
; bit7               bit0
; r7 r6 r5 r4 r3 r2 r1 r0
;
; P1                             P0
; bit7       bit4           bit0 bit7                 bit0
; c15 c14 c13 c12 c11 c10 c9 c8  c7 c6 c5 c4 c3 c2 c1 c0
;
; The three LEDs are on port 3 bits[2:0]
; 
; The keycode table is organized as 16 columns with 8 rows per column.
;       ksc_x_index selects a column from 0 to 15
;       ksc_y_index selects a row from 0 to 7
;========================================================================
;------------------------------------------------------------------------
; ram variables to support the scan matrix
;------------------------------------------------------------------------
LEFT_CTRL_BIT:		equ		01h
LEFT_SHIFT_BIT:		equ		02h
LEFT_ALT_BIT:		equ		04h
LEFT_GUI_BIT:		equ		08h
RIGHT_CTRL_BIT:		equ		10h
RIGHT_SHIFT_BIT:	equ		20h
RIGHT_ALT_BIT:		equ		40h
RIGHT_GUI_BIT:		equ		80h
APP_BIT:			equ		01h


;========================================================================
; FUNCTION: ksc_putkey
;
; calls either ps2key_putkey or usbkey_putkey, depending upon the
; keyboard currently being supported.
;
;
;========================================================================

ksc_putkey:
    push    A
    mov     A,[dual_ifc_keyboard]
    cmp     A,PS2_KEYBOARD
    pop     A
    jnz     .usb
IFDEF   PS2KB
    call ps2key_putkey
ENDIF    
    ret
.usb:
IFDEF   USBKB
    call   usbkey_putkey
ENDIF    
    ret

;========================================================================
; FUNCTION: ksc_scan_keys
;
; Keyboard scanning function
;
;========================================================================
ksc_scan_keys:
	call ksc_Debounce_Task          ; task for debounce
	
	mov A, 0                        ; init. phantom key flag to false
	mov [ksc_phantom], A
	mov [ksc_col_hits],A
	mov [ksc_row_hits],A
    mov [ksc_changes],A                
    mov [ksc_key_count],A
    mov [ksc_x_index],A

	mov X, 16                       ; 16 columns
	call ksc_StartScan              ; write initial scan pattern

.column_loop:
;   DELAY 1                         ; 16 x 10us + alpha = less 200us
	iord  PORT2_DATA_REG            ; read input port
	cpl                             ; complement so down switch is '1'
	mov [ksc_mod1], A               ; save the port 2 data
;   DELAY 25	
;	iord  PORT2_DATA_REG            ; read input port
;	cpl                     
;	and [ksc_mod1], A               ; and with last look
	jz	.nokeysdown                 ; if keys are down in this column

    push A
    call    count_ones
    add A,[ksc_key_count]
    mov [ksc_key_count],A
    pop A
    or  [ksc_row_hits],A            ; keep track of all rows with keys down
    inc [ksc_col_hits]              ; and count of columns with a key down
    
.nokeysdown:
    mov A,[ksc_changes]             ; if key changes have already been found in a previous column
    cmp A, 0
    jnz .key_has_changed            ; skip to next column to scan for phantom situation
                                    ; else
	mov A, [X + ksc_image - 1]      ; get previous column data
	xor A, [ksc_mod1]               ; compare with current data
	mov [ksc_changes], A            ; and save positions where a change occurred
	cmp A, 0                        ; test for state change
	jnz .key_has_changed            ; if no key state change
    inc  [ksc_x_index]              ; increment the column
.key_has_changed:
	call ksc_NextPattern            ; write a new scan pattern
	dec X                           ; done yet?
	jnz .column_loop
.exit:

    mov A,[ksc_changes]                
    cmp A,0                         ; did we find any key changes from the above scan?
    jz  .exit1                      ; no, exit now
                                    ; yes, was there a phantom situation during the above scan?
    call check_phantom              ;
    jc  .exit1                      ; yes, exit now, because we cannot determine state of keys
    mov  A,[ksc_x_index]            ; else restore X to the proper column index
    cpl A                           ; based on the value of ksc_x_index
    add A,17
    mov X,A
    call ksc_KeyChanged             ; then call ksc_KeyChanged to record key changes
    CLEARC
.exit1:
	ret

;========================================================================
; initialize all columns to begin a keyboard scan
;       0 in c[0]
;       1 in c[19:1]
;       clear ksc_x_index to indicate column under test
;========================================================================
ksc_StartScan:
	push A                          ; save accumulator on stack
	mov A, feh                      ; write a zero to c[0]
	iowr  PORT0_DATA_REG            ; write ones to c[7:1]
	mov [ksc_p0out], A              ; remember what was written to Port0

	mov A, ffh                      ; write all ones to c[15:8]
	iowr  PORT1_DATA_REG     
	mov [ksc_p1out], A              ; remember what was written to Port1

	pop A                           ; restore accumulator from stack
	ret                             ; return

;========================================================================
; Write the columns with the next pattern in the keyboard scan.
; the pattern is generated as a left shift to walk the columns from zero
; to 15.  Increment the ksc_x_index to track the column under test.
;
;Port 1                         Port 0
;bit7                     bit0  bit7               bit0
;c15 c14 c13 c12 c11 c10 c9 c8  c7 c6 c5 c4 c3 c2 c1 c0
;========================================================================
ksc_NextPattern:
	push A                          ; save accumulator on stack
	mov A, 0ffh                     ; set the carry bit
	rlc     
	mov A, [ksc_p0out]              ; load c[7:0] data
	rlc                             ; rotate left 
	mov [ksc_p0out], A              ; update memory copy
	iowr  PORT0_DATA_REG
	mov A, [ksc_p1out]              ; load c[15:8] data
	rlc                             ; rotate left 
	mov [ksc_p1out], A              ; update memory copy
	iowr PORT1_DATA_REG 

	pop A                           ; restore accumulator from stack
	ret                             ; ret

;========================================================================
; A column had one or more buttons that changed state (up to down or down
; to up).  Scan the rows to find out which one(s) changed.
;========================================================================
ksc_KeyChanged:
	push A
	mov A, 0                        ; zero the row index
	mov [ksc_y_index], A

	mov A, 1                        ; initialize the scan bit
.row_loop:
	push A                          ; save scan bit on stack
	and A, [ksc_changes]            ; test bit position in row data
	jz .next_row                    ; keep testing
	call ksc_FoundKey               ; found a key
.next_row:
	inc [ksc_y_index]               ; increment row
	pop A                           ; restore scan bit
	rlc                             ; rotate left to test next bit
	jnc .row_loop

.done_KeyChanged:
	pop A
	ret                             ; return




;========================================================================
; We have a key identified by an ksc_x_index and a ksc_y_index.  Combine the two
; into a single index and lookup the keycode, check if up or down change.
;========================================================================
ksc_FoundKey:
	push A                              ; save accumulator on stack
	mov A, X
	mov [ksc_matrix_addr], A            ; save current scanned column
	pop A                               ; restore and save accumulator on stack
	push A

	and A, [X + ksc_image - 1]          ; see whether up or down change
	mov A, 00h                          ; key went up
	jnz .calc_matrix             
	mov	A,[dual_ifc_keyboard]			; key went down
	cmp	A,USB_KEYBOARD                  ; if we are a usb interface
	jz	.process                        ; process the key make
	TSTBIT PS2_SCAN_KBD,ps2_flags		; otherwize,if the keyboard is disabled (ps2)
	jz		.done_FoundKey      		; discard all key makes
.process:
	mov A, FFh                          ; process this key make
.calc_matrix:                             ; calculate offset into code matrix
	mov [ksc_down_up], A                ; set flag
	mov X, [ksc_matrix_addr]            ; restore current column
	mov A, [ksc_x_index]                ; load column number
	asl                                 ; multiply by eight
	asl
	asl
	add A, [ksc_y_index]                ; add in the row index
	mov [ksc_matrix_addr], A            ; store

; test debounce array for match
	call ksc_Debounce_test              ; check if debounce in progress on this key
	jnz .update_image			        ; if it is (zero flag set)
	jmp .done_FoundKey                  ; exit, do not process this key

.update_image:                                      
	pop A                               ; retrieve and save test bit
	push A
	xor [X + ksc_image - 1], A          ; update key switch ksc_image
	
	call ksc_Debounce_keys              ; push matrix address on debounce array

.get_code:
 ;   mov A,[ksc_down_up]                 ; all key breaks pass through unmolested
 ;   cmp A,0h
 ;   jnz   .make
 ;   dec    [ksc_key_count]
 ;   jmp     .put
;.make:
;   inc     [ksc_key_count]
.put:
;	mov A, [dual_ifc_option]			; depending on option 
;	and A, KEYBOARD_ID_BIT
	mov A, [ksc_matrix_addr]
;	jz  .kbd1	
;	index  at101_tbl1					; get matrix info for kbd type 2
;	jmp		.continue
;.kbd1:
	index  at101_tbl					; or kbd type 1
.continue:
	call  ksc_putkey



.done_FoundKey:
	pop A                               ; restore accumulator
	ret                                 ; return

;quick and dirty routine to count the number of 1's in a byte.
;the table below gives the number of 1's in the nibble from 0 - 15
XPAGEOFF

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区不卡精品| 奇米一区二区三区| 国产欧美一区在线| 久久这里都是精品| 久久久久久久久久久电影| 精品国产91乱码一区二区三区| 欧美猛男男办公室激情| 欧美精品自拍偷拍| 欧美www视频| 国产欧美精品国产国产专区| 日本一区二区免费在线观看视频 | 色菇凉天天综合网| 91天堂素人约啪| 欧美视频在线一区二区三区 | 日韩免费福利电影在线观看| 日韩欧美在线综合网| 久久综合网色—综合色88| 久久精子c满五个校花| 国产精品福利一区二区| 一区二区三区鲁丝不卡| 日韩国产欧美在线播放| 国产一区二区久久| 91视频在线观看免费| 欧美日韩精品二区第二页| 日韩欧美久久久| 国产精品国产三级国产aⅴ原创 | 不卡区在线中文字幕| 欧美在线啊v一区| 欧美一区二区国产| 亚洲国产高清不卡| 日韩av一区二区在线影视| 国产成人免费视| 欧美日本在线一区| 欧美激情中文不卡| 午夜欧美视频在线观看| 国产乱码字幕精品高清av| 91麻豆国产福利精品| 精品国产一区二区三区不卡| 中文字幕亚洲区| 经典三级一区二区| 欧美视频一区二区在线观看| 久久久三级国产网站| 亚洲一区二区三区在线| 成人午夜视频网站| 欧美一卡二卡三卡四卡| 有码一区二区三区| 成人激情动漫在线观看| 日韩三级高清在线| 性做久久久久久久免费看| 99视频一区二区三区| 久久欧美一区二区| 麻豆中文一区二区| 成人精品在线视频观看| 精品午夜久久福利影院| 日韩美一区二区三区| 国内精品久久久久影院薰衣草| 久久久久99精品国产片| 91亚洲精品久久久蜜桃网站| 亚洲6080在线| 久久这里只有精品首页| 99国产精品久| 日韩av一二三| 亚洲国产精品ⅴa在线观看| 在线视频一区二区三| 久久精工是国产品牌吗| 国产精品不卡一区| 欧美一级黄色大片| a在线播放不卡| 日韩精品五月天| 国产精品丝袜久久久久久app| 91麻豆国产自产在线观看| 免费xxxx性欧美18vr| 中文字幕亚洲一区二区av在线 | 日韩av一区二区在线影视| 国产婷婷色一区二区三区在线| 欧美中文字幕亚洲一区二区va在线| 久久精品国产99| 亚洲综合免费观看高清完整版在线| 日韩精品一区二区三区蜜臀| 91小视频免费看| 国产激情视频一区二区三区欧美| 亚洲午夜精品网| 国产精品久久久久婷婷二区次| 7777精品伊人久久久大香线蕉最新版 | 中文av字幕一区| 欧美一区二区成人6969| 色综合视频在线观看| 国产成a人亚洲| 麻豆91在线观看| 午夜私人影院久久久久| 国产精品久久看| 久久精品人人做人人爽人人| 欧美一区二区在线播放| 欧美三级乱人伦电影| av不卡一区二区三区| 国产成人午夜精品影院观看视频 | 91精品国产高清一区二区三区蜜臀 | 免费观看在线色综合| 亚洲精品日日夜夜| 日本一区二区动态图| 久久精品在线免费观看| 精品理论电影在线观看 | 久久精子c满五个校花| 日韩欧美视频在线| 4438x亚洲最大成人网| 欧美又粗又大又爽| 91香蕉视频黄| 91老师片黄在线观看| av电影一区二区| av日韩在线网站| 成人av电影在线网| 福利视频网站一区二区三区| 国产美女娇喘av呻吟久久| 精品一区二区三区视频在线观看| 免费欧美日韩国产三级电影| 奇米888四色在线精品| 香蕉久久一区二区不卡无毒影院| 亚洲亚洲人成综合网络| 亚洲一级在线观看| 亚洲123区在线观看| 午夜电影网一区| 日本欧美久久久久免费播放网| 日韩中文字幕av电影| 奇米色一区二区三区四区| 麻豆精品久久精品色综合| 激情国产一区二区| 国产高清亚洲一区| 99在线精品免费| 欧美在线免费观看视频| 在线播放欧美女士性生活| 日韩一区二区电影网| 久久毛片高清国产| 中文字幕va一区二区三区| 亚洲欧美一区二区久久 | 在线一区二区三区做爰视频网站| 日本乱人伦aⅴ精品| 欧美精选午夜久久久乱码6080| 欧美一级爆毛片| 久久综合中文字幕| 自拍av一区二区三区| 亚洲风情在线资源站| 久久精品999| 99r精品视频| 在线播放91灌醉迷j高跟美女| 精品乱码亚洲一区二区不卡| 中文字幕va一区二区三区| 亚洲综合av网| 蜜臀a∨国产成人精品| 成人在线综合网| 欧美日韩激情一区| 国产网站一区二区三区| 一区二区三区丝袜| 狠狠网亚洲精品| 欧美亚男人的天堂| www国产成人| 亚洲福利视频一区二区| 国产成人av福利| 69堂成人精品免费视频| 亚洲欧洲日韩在线| 麻豆国产欧美日韩综合精品二区 | 亚洲欧美综合另类在线卡通| 日韩国产欧美在线视频| 成人国产在线观看| 91精品国产免费久久综合| 欧美国产综合色视频| 午夜免费欧美电影| 波多野结衣中文字幕一区 | 91成人免费在线视频| 欧美精品一区二区三区蜜桃视频| 亚洲综合成人网| 成人av免费在线播放| 欧美精品一区二区三区在线播放| 一区二区在线观看视频 | 欧美精品自拍偷拍动漫精品| 国产精品伦理一区二区| 久久精品999| 欧美日韩高清不卡| 亚洲精品国产视频| 国产99久久久精品| 日韩免费视频一区二区| 婷婷成人激情在线网| 欧洲日韩一区二区三区| 日韩毛片精品高清免费| 成人一级片网址| 久久综合久久鬼色中文字| 日本不卡在线视频| 欧美浪妇xxxx高跟鞋交| 亚洲卡通动漫在线| 91污片在线观看| 国产精品久久久久影院老司| 国产91对白在线观看九色| 久久―日本道色综合久久| 久久99久久99| 精品国产乱码久久久久久牛牛| 奇米色777欧美一区二区| 欧美视频完全免费看| 亚洲成av人片在线观看| 欧美日韩精品一区二区| 午夜视频在线观看一区二区三区| 精品视频在线看|