begin process at 2010 02 09 23:09:11
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Applications ms-dos

 > JEU DOS POUR APPRENDRE LES TOUCHES DU CLAVIER.

JEU DOS POUR APPRENDRE LES TOUCHES DU CLAVIER.


 Description

Cliquez pour voir la capture en taille normale
Ce programme vous aide à manipuler les interuptions du système.
  1- Vous montre une technique en mode texte - comme si on  est en mode graphique - pour effacer l'écran.
  2- Programme vos propres routines d'intérruptions - ici routine clavier.
  3- Sauvegarer l'ancien routines, et la réstorée à la fin du programme.
  4- Comment faire la gestion de l'écran.
  5- Une téchnique pour faire une animation des caractères. une tombée. et un éclattement.

le programme est écrit pour MASM 2.0, et n'includ aucun *.inc
trés simple à comprendre.

Source

  • TOUCH_ESC EQU 129
  • TOUCH_FIN EQU 1
  • CAPACITE EQU 2*80*25
  • ECRAN EQU 0B800H
  • pile segment stack
  • db 32 dup (0)
  • pile ends
  • extra segment
  • extra ends
  • data segment
  • AUSSI DB 0
  • BOOM DB "\|/-\***"
  • UNO db "AZERTYUIOP"
  • DUE db "QSDFGHJKLM"
  • TRE db "WXCVBN"
  • TOUMOT db 0
  • scoor db 0
  • GAME db 13,10,"************ GAME OVER *************|",13,10
  • DB " Votre scoor est : $"
  • effac db 13,13,13,10," Mon 1Sr jeux",13,10
  • db " Aprendre les touches du clavier",13,10
  • db " jeux.asm (c) by Madani-2001 $"
  • MES_END db " POITS . c'est BON ", 13,10," Merci FIN "
  • DB " . Veulez-vous quiter ? (Y/N) $"
  • LETTRE DB "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIKLMNOPQRSTUVWXYZ"
  • DB "ABCDEFGHIJKLMNOPQRSTUVWYZABCDFGHIJKLMNOPQSTUVWXYZ"
  • MOT db ?
  • Temps dw 310
  • v_al db ?
  • v_dl db ?
  • colon db ?
  • page_cours db ?
  • touche db 0
  • clavier db 1
  • touch_ascii equ this dword
  • cent db 30h
  • dixenes db 30h
  • unit db 30h
  • finish db "$"
  • INT9_PTR equ this dword
  • int9_ofs dw 0
  • int9_seg dw 0
  • data ends
  • code segment
  • assume cs:code, ds:data, ss:pile, es:extra
  • PRINC PROC FAR
  • mov ax, data
  • mov ds, ax
  • mov ax, ECRAN
  • mov es, ax
  • lEA DX, effac
  • mov ah, 9
  • int 21h
  • mov ah,1
  • int 21h
  • mov ah, 0fh
  • int 10h
  • mov page_cours, bh
  • xor di, di
  • mov al, 20h
  • mov ah, 74h
  • mov cx, CAPACITE
  • cld
  • aayyy: STOSW
  • xor dx, dx
  • azert: dec dx
  • jnz azert
  • dec cx
  • dec cx
  • jnz aayyy
  • lea dx, effac
  • mov ah, 9
  • int 21h
  • mov ax, 3509h
  • int 21h
  • mov int9_ofs, bx
  • mov int9_seg, es
  • mov bx, 09Ffh
  • grd1: mov cx, 0ffffh
  • ptt1: loop ptt1
  • dec bx
  • jnz grd1
  • mov ax, ECRAN
  • mov es, ax
  • xor di, di
  • mov al, 20h
  • mov ah, 074h
  • mov cx, CAPACITE
  • cld
  • rep STOSW
  • push ds
  • push cs
  • pop ds
  • mov dx, offset int09h
  • mov ax, 2509h
  • int 21h
  • pop ds
  • AFFICHAGE:
  • cmp clavier, 0
  • je t_fin1
  • ; ****************************************
  • mov ah, 2ch
  • int 21h
  • mov al, dl
  • cmp dl, 79
  • ja corige
  • SUITE:
  • mov Si, offset LETTRE
  • XOR AH, AH
  • ADD SI, AX
  • MOV al, [SI]
  • mov mot, al
  • mov colon, dl
  • jmp ssaut
  • t_fin1: jmp fin1
  • corige: push ax
  • mov al, dl
  • xor ah, ah
  • mov dl, 80
  • div dl
  • mov dl, ah
  • pop ax
  • jmp suite
  • ssaut:
  • xor dh, dh
  • encor: mov bh, page_cours
  • mov dl, colon
  • mov ah, 02
  • int 10h
  • mov ah, 2
  • mov dl, MOT
  • int 21h
  • mov dl, colon
  • mov ah, 2
  • int 10h
  • mov bx, Temps
  • popop: mov cx, 0ffffh
  • azqs: loop azqs
  • dec bx
  • jnz popop
  • mov dl, 20h
  • mov ah, 2
  • int 21h
  • jmp temrre
  • encor0: jmp encor
  • temrre:
  • ; ------------------------------------------------
  • push si
  • push bx
  • mov bl, touche
  • cmp bl, 144
  • jb faute
  • cmp bl, 153
  • ja suite0
  • sub bl, 144
  • xor bh, bh
  • lea si, uno
  • add si, bx
  • mov bl, [SI]
  • mov toumot, bl
  • faute:jmp sortie
  • suite0:cmp bl, 158
  • jb faute
  • cmp bl, 167
  • ja suite2
  • sub bl, 158
  • xor bh, bh
  • lea si, due
  • add si, bx
  • mov bl, [SI]
  • MOV TOUMOT, BL
  • sortie:jmp sortie2
  • suite2:cmp bl, 172
  • jb faute
  • cmp bl, 177
  • ja faute
  • sub bl, 172
  • xor bh, bh
  • lea si, tre
  • add si, bx
  • mov bl, [SI]
  • mov toumot, bl
  • sortie2: pop bx
  • pop si
  • ; -------------------------------------------
  • mov bl, toumot
  • cmp bl, mot
  • je bravo
  • AHMED:
  • inc dh
  • cmp dh, 25
  • jne encor0
  • jmp GamOvr
  • ; *****************************************
  • bravo: mov al, scoor
  • inc al
  • mov scoor, al
  • mov CX, 8
  • lea di, BOOM
  • ECLAT:
  • mov dl, colon
  • mov ah, 2
  • int 10h
  • PUSH CX
  • mov bx, 80
  • ppp: mov cx, 0ffffh
  • aqs: loop aqs
  • dec bx
  • jnz ppp
  • POP CX
  • mov ah, 2
  • mov DL, [DI]
  • int 21h
  • inc di
  • LOOP ECLAT
  • mov dl, colon
  • mov ah, 2
  • int 10h
  • mov dl, 20h
  • mov ah, 2
  • int 21h
  • mov bx, temps
  • DEC BX
  • mov temps, bx
  • jmp AFFICHAGE
  • GamOvr:
  • lEA DX, GAME
  • mov ah, 9
  • int 21h
  • mov bx, 999
  • popo1p: mov cx, 0ffffh
  • azq1s: loop azq1s
  • dec bx
  • jnz popo1p
  • fin1:
  • mov dl, scoor
  • mov al, dl
  • xor ah, ah
  • mov dl, 10
  • div dl
  • add ah, 30h
  • mov unit, ah
  • xor ah, ah
  • mov dl, 10
  • div dl
  • add ah, 30h
  • mov dixenes, ah
  • add al,30h
  • mov cent, al
  • lea dx, touch_ascii
  • mov ah, 9
  • int 21h
  • fin: push ds
  • cli
  • mov ax, 2509h
  • mov dx, int9_ofs
  • mov ds, int9_seg
  • int 21h
  • pop ds
  • lea dx, mes_end
  • mov ah, 9
  • int 21h
  • mov ax, 4c00h
  • int 21h
  • PRINC ENDP
  • INT09H PROC FAR
  • push ax
  • in al, 60h
  • mov ds:touche, al
  • cmp al, TOUCH_FIN
  • jne i9_end0
  • mov ds:clavier, 0
  • jmp i9_end
  • i9_end0: cmp al,TOUCH_ESC
  • JNE i9_end
  • mov ds:clavier, 0
  • i9_end: pop ax
  • jmp [int9_ptr]
  • INT09H ENDP
  • CODE ENDS
  • END PRINC
    TOUCH_ESC  EQU  129
    TOUCH_FIN  EQU  1
    CAPACITE  EQU 2*80*25
    ECRAN  EQU 0B800H

    pile  segment  stack
             db 32 dup (0)
    pile   ends

   extra   segment
   extra   ends

    data  segment

    AUSSI DB  0
    BOOM  DB "\|/-\***"
    UNO db "AZERTYUIOP"
    DUE db "QSDFGHJKLM"
    TRE db "WXCVBN"
    TOUMOT   db   0
    scoor    db   0
    GAME  db 13,10,"************  GAME OVER  *************|",13,10
          DB "         Votre scoor est :   $"
    effac db  13,13,13,10,"        Mon 1Sr jeux",13,10      
          db  "     Aprendre les touches du clavier",13,10
          db  "  jeux.asm (c) by Madani-2001 $"
    MES_END db  "  POITS . c'est  BON  ", 13,10," Merci    FIN  "
           DB   " . Veulez-vous quiter ? (Y/N)  $"
    LETTRE DB "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIKLMNOPQRSTUVWXYZ"
           DB "ABCDEFGHIJKLMNOPQRSTUVWYZABCDFGHIJKLMNOPQSTUVWXYZ"
    MOT   db  ?
    Temps dw 310
    v_al  db  ?
    v_dl  db  ?
    colon db  ?
    page_cours    db  ?
    touche  db  0
    clavier db  1
    touch_ascii equ this dword
       cent   db   30h
       dixenes db 30h
       unit  db  30h
       finish  db  "$"

    INT9_PTR  equ this dword
       int9_ofs  dw  0
       int9_seg  dw  0

  data   ends


 code  segment
    assume  cs:code, ds:data, ss:pile, es:extra
   PRINC     PROC    FAR
        mov  ax,  data
        mov  ds, ax 
        mov ax, ECRAN
        mov es, ax
            
           lEA  DX, effac
            mov ah, 9
            int  21h
      mov ah,1
      int 21h

      mov  ah, 0fh
      int  10h
      mov  page_cours, bh

      xor di, di
      mov al, 20h
      mov ah, 74h
      mov cx, CAPACITE
      cld 
  aayyy: STOSW
         xor  dx, dx
  azert: dec  dx
         jnz  azert
         dec  cx
         dec  cx
         jnz  aayyy

    lea  dx, effac
    mov  ah, 9
    int  21h
      mov  ax, 3509h
      int  21h
      mov  int9_ofs, bx
      mov  int9_seg, es

          mov  bx, 09Ffh
      grd1: mov cx, 0ffffh    
      ptt1: loop ptt1
           dec bx
           jnz grd1

      mov  ax, ECRAN
      mov  es,  ax
      xor di, di
      mov al, 20h
      mov ah, 074h
      mov cx, CAPACITE
      cld 
      rep STOSW

   push  ds
   push  cs
   pop   ds
   mov  dx, offset  int09h
   mov  ax,  2509h
   int  21h
   pop  ds

  AFFICHAGE:
      cmp  clavier,  0
      je   t_fin1
  ; ****************************************
        mov ah, 2ch
        int 21h
        mov al, dl
        cmp dl, 79
        ja  corige
     SUITE:
          mov  Si, offset LETTRE
          XOR  AH, AH
          ADD  SI, AX
          MOV  al, [SI]
          mov  mot,  al
          mov  colon, dl

      jmp ssaut
   t_fin1: jmp fin1
      corige: push ax
              mov  al, dl
              xor  ah, ah
              mov  dl, 80
              div  dl
              mov  dl, ah
              pop  ax
              jmp  suite
      ssaut:

           xor  dh, dh
    encor:  mov  bh, page_cours
          mov  dl, colon
          mov  ah, 02
          int  10h

          mov  ah, 2
          mov  dl, MOT
          int  21h

          mov  dl, colon
          mov  ah, 2
          int  10h


           mov  bx, Temps
     popop: mov  cx, 0ffffh
      azqs: loop azqs
          dec  bx
          jnz  popop

          mov  dl, 20h
          mov  ah,  2
          int  21h

          jmp  temrre
    encor0: jmp  encor
     temrre:
   ;  ------------------------------------------------
          push  si
          push  bx
          mov  bl, touche
          cmp  bl, 144
          jb   faute
          cmp  bl, 153
          ja   suite0
          sub  bl, 144
          xor  bh, bh
          lea  si, uno
          add  si, bx
          mov  bl, [SI]
          mov  toumot, bl
    faute:jmp  sortie
    suite0:cmp  bl, 158
          jb   faute
          cmp  bl, 167
          ja   suite2
          sub  bl, 158
          xor  bh, bh
          lea  si, due
          add  si, bx
          mov  bl, [SI]
          MOV  TOUMOT, BL
  sortie:jmp   sortie2
  suite2:cmp   bl, 172
         jb   faute
         cmp  bl, 177
         ja   faute
         sub  bl, 172
         xor  bh, bh
         lea  si, tre
         add  si, bx
         mov  bl, [SI]
         mov  toumot, bl
  
  sortie2: pop  bx
           pop  si
 ;  -------------------------------------------
             mov  bl, toumot
             cmp  bl, mot
             je   bravo

        AHMED:
          inc  dh
          cmp dh, 25
          jne  encor0
         jmp  GamOvr
 ; *****************************************

   bravo: mov  al, scoor
          inc  al
          mov  scoor, al

          mov  CX, 8
          lea  di, BOOM
   ECLAT:
          mov  dl, colon
          mov  ah, 2
          int  10h
               PUSH  CX
          mov  bx, 80
     ppp: mov  cx, 0ffffh
      aqs: loop aqs
          dec  bx
          jnz  ppp
               POP  CX
          mov  ah, 2
          mov  DL, [DI]
          int  21h
          inc  di
          LOOP  ECLAT
 
          mov  dl, colon
          mov  ah, 2
          int  10h

          mov  dl, 20h
          mov  ah,  2
          int  21h

          mov  bx, temps
          DEC  BX
          mov  temps, bx
      jmp  AFFICHAGE

 GamOvr:
            
           lEA  DX, GAME
            mov ah, 9
            int  21h

           mov  bx, 999
     popo1p: mov  cx, 0ffffh
      azq1s: loop azq1s
          dec  bx
          jnz  popo1p

   fin1: 
           mov  dl, scoor
           mov  al, dl
           xor  ah, ah
           mov  dl, 10
           div  dl
           add  ah, 30h
           mov  unit, ah
           xor  ah, ah
           mov  dl, 10
           div  dl
           add  ah, 30h
           mov dixenes, ah
           add  al,30h
           mov  cent, al
          lea  dx, touch_ascii
          mov  ah, 9
          int  21h



 fin:   push   ds
        cli  
        mov  ax, 2509h
        mov  dx, int9_ofs
        mov  ds, int9_seg
        int  21h
        pop  ds
        
        lea  dx, mes_end
        mov ah, 9
        int  21h
        
        mov  ax, 4c00h
        int   21h

    PRINC   ENDP 


  INT09H  PROC  FAR
     push  ax
        in   al, 60h
        mov  ds:touche, al
        cmp  al, TOUCH_FIN
        jne  i9_end0
     mov  ds:clavier,  0
       jmp   i9_end
   i9_end0: cmp al,TOUCH_ESC
            JNE i9_end
            mov  ds:clavier, 0
    i9_end: pop  ax
           jmp  [int9_ptr]
  INT09H    ENDP
  
  

  CODE  ENDS
 END  PRINC

 Conclusion


     C'est un programme DOS  ........
Pour compiler ce programme il faut :
    1- avoire les deux executables : TASM.EXE , et TLINK.EXE.
    2-   executez la commande :
          TASM  Nom_Fichier.asm
          TLINK  Nom_fichier.OBJ

/*    Le fichioer *.OBJ est le résultat du TASM.EXE  sur le *.asm   */
/*    Le fichier *.exe est le résultats du TLINK.exe sur le *.obj     */

   3-  Ce programme ne s'éxecute que sous le mode MS-DOS.

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !
  • JEU.ASMTélécharger ce fichier [Réservé aux membres club]Voir ce fichier6 811 octets
  • JEU.EXETélécharger ce fichier [Réservé aux membres club]1 464 octets
  • TASM.EXETélécharger ce fichier [Réservé aux membres club]105 881 octets
  • TLINK.EXETélécharger ce fichier [Réservé aux membres club]53 414 octets

Télécharger le zip


 Sources de la même categorie

Source avec une capture LECTURE CHAINE ET COMPARAISON[MASM] par w4kfu
Source avec une capture LECTURE TOUCHE CLAVIER[MASM] par w4kfu
Source avec Zip UN RESOLVEUR SUDUKO AVEC ASSEMBLEUR NASM par msavyo1
Source avec Zip TESTEUR DE COMPATIBILITTÉ VESA (SUPER VGA) par bofur
Source avec Zip COMMUNICATION SÉRIE RS232 AVEC INTERRUPTIONS par bouffa

Commentaires et avis

Commentaire de LordBob le 26/03/2004 06:52:04

des commentaires aurraient été les bienvenue pour aider les grand débutant en ASM !!!
car la tu n'apprend rien !!!

Commentaire de letrouveur le 06/10/2009 20:57:13

Les lettre défilent trop vite ! on n'a mem pas le temp de voir se qui est écrit
sinon pas mal !

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,577 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales