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

📄 cur_key.txt

📁 80386单片机
💻 TXT
字号:
From: Inbar Raz
Subj: Accessing the cursor keys
____________________________________________________________________________

Hello everyone.

I have seen a debate here about accessing the cursor keys. Well, having
written a resident dialer that allows you to dial from the cursor keys, I am
posting here a segment of its source, to display the use of the cursor keys.

If anyone wants the full source, lemme know.

--------------------------------- cut here ---------------------------------

Kbd:    mov     ah,010h
        int     16h                             ; Extended kbd read

        cmp     al,01Bh                         ; ESCape?
        jz      GoodBye1

        cmp     al,00Dh                         ; Done?
        jz      Done1

        cmp     ax,00E08h                       ; Backspace?
        jnz     Label1

        mov     bx,offset NumBuf
        cmp     NumPtr,bx
        jbe     Kbd                             ; Beginning of line?

        dec     NumPtr
        mov     si,NumPtr
        mov     byte ptr [si],000h              ;  from buffer too

        jmp     Kbd

Done1:  jmp     Done

Label1: cmp     al,000h                         ; Extended ASCII?
        jnz     Label2

        cmp     ah,047h                         ; Keypad?
        jb      Kbd

        cmp     ah,052h                         ;  - " -
        ja      Kbd

        mov     bx,offset XlatTbl
        sub     bx,047h                         ; To make up for partiality
        mov     al,ah
        xlat                                    ; Translate key
                                                ; Table is brought in the end

        cmp     al,000h                         ; If illegal,
        jz      Kbd                             ;  get a new one

Echo:   mov     bx,offset NumBuf

<<< some irrelevant code >>>

Label3: mov     si,NumPtr

<<< some irrelevant code >>>

Label2: cmp     al,02Dh
        jz      Echo                            ; '-'

        cmp     ah,026h
        jnz     Label5

        and     al,04Fh
        cmp     al,04Ch
        jnz     Kbd1

        mov     bx,offset NumBuf
        cmp     NumPtr,bx
        jne     Kbd1                            ; Beginning of line?

        mov     AllDone,001h

        jmp     Echo

Label5: cmp     al,030h
        jb      Kbd1

        cmp     al,039h
        jna     Echo

        jmp     Kbd1

Done:   mov     si,NumPtr

; Translation table:

XlatTbl db      037h, 038h, 039h, 0, 034h, 035h
        db      036h, 0, 031h, 032h, 033h, 030h

--------------------------------- cut here ---------------------------------

Inbar Raz

⌨️ 快捷键说明

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