Interruption clavier

smail -  
mbzrwt Messages postés 1 Statut Membre -
Bonjour,
entree d'une chaine caracteres avec le clavier ensuite on l'affiche et tout ca sans utiliser le buffer du clavier(en asm)
Configuration: Windows XP
Internet Explorer 6.0

2 réponses

  1. smail
     
    ;== Constantes et structures ===========================================

    INT_CTR = 20h ;Port du contrôleur d'interruption
    EOI = 20h ;Fin d'interruption
    KB_PORT = 60h ;Port du clavier

    ;== Début du programme proprement dit ==============================

    code segment para 'CODE' ;Définition du segment de code

    org 100h

    assume cs:code, ds:code, es:code, ss:code

    start: jmp getscan ;Branchement au début du programme

    ;== Programmcode =======================================================

    getscan: mov ah,09h ;Message de copyright
    mov dx,offset copyr
    int 21h

    mov ax,3509h ;Contenu du vecteur d'interruption 09h
    int 21h ;Interruption de DOS
    mov int9_seg,es ;Mémorise le segment et l'offset
    mov int9_ofs,bx ;du vecteur d'interruption 9h

    mov dx,offset nouvi9 ;Offset de la nouvelle routine d'int.
    mov ax,2509h ;Détourne le vecteur de
    int 21h ;l'interruption 09h

    ;push cs
    ;pop ds
    ;lea dx,hood
    ;mov cl,4
    ;shr dx,cl
    ;inc dx
    ;int 27H

    ;lds dx,int9_ptr ;Rétablit l'ancien gestionnaire -
    ;mov ax,2509h ; de l'interruption du clavier
    ;int 21h

    ;lea dx,hood
    ;mov cl,4
    ;shr dx,cl
    ;inc dx

    mov ax,4c00h
    int 2h

    ;== Données=============================================================
    Good :
    int9_ptr equ this dword ;Ancien vecteur d'interruption 9h
    int9_ofs dw 0 ;Offset de l'ancien gestionnaire
    int9_seg dw 0 ;Segment de l'ancien gestionnaire

    cmpt dw 0

    bafferVide db '* LE BAFFER EST VIDE *',0ah,0dh,24h

    copyr db '* PROGRAMME RESIDANT *',0ah,0dh,24h

    baffere db 60 dup(?)

    se db 0
    un db 1

    ;== Constantes et structures ===========================================

    INT_CTR = 20h ;Port du contrôleur d'interruption
    EOI = 20h ;Fin d'interruption
    KB_PORT = 60h ;Port du clavier

    ;== Gestionnaire de l'interruption 09h (Clavier) =======================

    nouvi9 proc far

    assume cs:code, ds:nothing, es:nothing, ss:nothing

    sti

    ;cmp un,0
    ;je finzz

    push ax
    push di

    ;========================================================================

    in al,KB_PORT ;Lit le scan code sur port clavier

    cmp al,128 ;Est-ce un code Release ?
    jnb find ;Non ---> en prend note

    cas: cmp al,28 ; scan code de Entrer
    jne NonEntrer

    mov bx,cmpt

    cmp bx,0
    jne bafferNonVide

    mov dl,0ah
    mov ah,02h
    int 21h

    mov dl,0dh
    mov ah,02h
    int 21h

    inc se

    jmp finzz

    bafferNonVide:

    mov cx,bx
    dec bx
    mov dl,0ah
    mov ah,02h
    int 21h

    mov dl,0dh
    mov ah,02h
    int 21h

    boucle :

    mov dl,baffere[bx]
    add dl,49
    mov ah,02h
    int 21h
    dec bx

    loop boucle

    xor ax,ax
    mov cmpt,ax

    jmp finzz
    NonEntrer:
    mov bx,cmpt
    mov baffere[bx],al
    inc cmpt

    finzz:

    cmp se,3
    jne nonse
    mov dx,int9_ofs ;R‚tablit l'ancien gestionnaire -
    push int9_seg
    pop ds
    mov ax,2509h ; de l'interruption du clavier
    int 21h

    mov ax,4C00h
    int 21H

    nonse:
    ;inc se
    ;xor un,01h
    ;mov un,bx

    ;====================================================================
    ;mov ah,02h ;Message de copyright
    ;mov dl,66
    ;int 21h

    find:
    pop di
    pop ax

    jmp [int9_ptr] ;du clavier

    nouvi9 endp
    hood :

    ;== Fin ================================================================

    code ends ;Fin du segment de code
    end start
    1
  2. mbzrwt Messages postés 1 Statut Membre
     
    Paix
    comment eliminer la repetition d'un carater, c'est-a-dir on apuiyant sur n'inport qu'elle touche meme maintenu un seul caracter doit etre imprimer.
    merci.
    0