Histogramme de la fréquence des lettres et des chiffres rencontrées pendant la lecture d'un fichier quelconque

Description

Cette source affiche un histogramme de la fréquence des lettres et des chiffres rencontrées pendant la lecture d'un fichier quelconque.
En abscisse on trouvera la lettre ou le chiffre, en ordonnée sa fréquence.

Source / Exemple :


;**************************************************************************************;
;*									DSSDEMO                                           *;
;**************************************************************************************;
;* Nom : Nicolas Pirard																  *;
;* Développé le : 08/05/2005														  *;
;* Dernière MAJ : 10/05/2005     													  *;
;**************************************************************************************;
;* 																		  *;
;* Ecrire un programme qui affiche un histogramme de la fréquence des lettres et des  *; 
;* chiffres rencontrées pendant la lecture d'un fichier quelconque.					  *;
;* En abscisse on trouvera la lettre ou le chiffre, en ordonnée sa fréquence.	      *;
;* Les miniscules et majuscules ne sont pas différenciées.							  *;
;**************************************************************************************;

;**************************************************************************************;
;* Assembler : TASM					                      							  *;
;*             TLINK       				                   							  *;
;**************************************************************************************;                                               
  
  .MODEL SMALL                                                       
  .STACK 128                                                                                                                         

;------------------------ Données -----------------------------------------*

   .DATA
  
  ;---Titre + phrase à afficher
  titre1		db 13,10,13,10,'      ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»',13,10,'$'
  titre2		db             '      º								        º ',13,10,'$'
  titre3		db             '      º    HISTORIGRAMME DE LA FREQUENCE DES LETTRES ET DES CHIFFRES    º ',13,10,'$'
  titre4		db             '      º								        º ',13,10,'$'
  titre5		db             '      ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ',13,10,13,10,13,10,'$'
  acqui         db 13,10,'Entrer chemin et nom fichier : ','$'
  CONTENU	  	db  13,10,10,'Contenu du fichier : ',13,10,'$'
  
  ;---FICHIER
  fich			db 51
  fichlu		db ?
  Fichier		db 51 dup(0)					  ;chemin et non du fichier
  Handle		dw  ?,'$'                         ; Handle du Fichier
  buffer        db  60000 dup(?),'$'

  ;---Histogramme
  flechehaut	db  '    ^',13,10,'$'
  lettreetchiffre db '     A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9',13,10,13,10,'$'
  ligne		    db '    ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>  ',13,10,'$'
  espace2		db  '  $'
  passligne		db  13,10,'$'
  lignev		db  '³$'
  lignev2		db  '    ³$'
  ligneo		db  '-$'
  bloc			db  'Û $'
  
  frequence		dw  0d,'$'
  freq			dw  0d,'$'
  
  compa	        db  10d,'$'
  cmp1	        db  0d,'$'
  grand			dw  0d,'$'
  tempor		dw  0d,'$'
  
  ;---Converssion décimale de la frequence
  dix2			dw  10d
  cent          dw  100d
  mil           dw  1000d
  millier     	dw  ?,'$'
  centaine    	dw  ?,'$'
  dixaine    	dw  ?,'$'
  unite      	dw  ?,'$'
  
  ;---Compteur
  compteura     dw  0d,'$'
  compteura2    db  0d,'$'
  compteurb		dw  0d,'$'
  compteurb2	db  0d,'$'
  compteurc		dw  0d,'$'
  compteurc2	db  0d,'$'
  compteurd		dw  0d,'$'
  compteurd2	db  0d,'$'
  compteure		dw  0d,'$'
  compteure2	db  0d,'$'
  compteurf		dw  0d,'$'
  compteurf2	db  0d,'$'
  compteurg		dw  0d,'$'
  compteurg2	db  0d,'$'
  compteurh		dw  0d,'$'
  compteurh2	db  0d,'$'
  compteuri		dw  0d,'$'
  compteuri2	db  0d,'$'
  compteurj		dw  0d,'$'
  compteurj2	db  0d,'$'
  compteurk		dw  0d,'$'
  compteurk2	db  0d,'$'
  compteurl		dw  0d,'$'
  compteurl2	db  0d,'$'
  compteurm		dw  0d,'$'
  compteurm2	db  0d,'$'
  compteurn		dw  0d,'$'
  compteurn2	db  0d,'$'
  compteuro		dw  0d,'$'
  compteuro2	db  0d,'$'
  compteurp		dw  0d,'$'
  compteurp2	db  0d,'$'
  compteurq		dw  0d,'$'
  compteurq2	db  0d,'$'
  compteurr		dw  0d,'$'
  compteurr2	db  0d,'$'
  compteurs		dw  0d,'$'
  compteurs2	db  0d,'$'
  compteurt		dw  0d,'$'
  compteurt2	db  0d,'$'
  compteuru		dw  0d,'$'
  compteuru2	db  0d,'$'
  compteurv		dw  0d,'$'
  compteurv2	db  0d,'$'
  compteurw		dw  0d,'$'
  compteurw2	db  0d,'$'
  compteurx		dw  0d,'$'
  compteurx2	db  0d,'$'
  compteury		dw  0d,'$'
  compteury2	db  0d,'$'
  compteurz		dw  0d,'$'
  compteurz2	db  0d,'$'
  compteur0		dw  0d,'$'
  compteur02	db  0d,'$'
  compteur1		dw  0d,'$'
  compteur12	db  0d,'$'
  compteur2		dw  0d,'$'
  compteur22	db  0d,'$'
  compteur3		dw  0d,'$'
  compteur32	db  0d,'$'
  compteur4		dw  0d,'$'
  compteur42	db  0d,'$'
  compteur5		dw  0d,'$'
  compteur52	db  0d,'$'
  compteur6		dw  0d,'$'
  compteur62	db  0d,'$'
  compteur7		dw  0d,'$'
  compteur72	db  0d,'$'
  compteur8		dw  0d,'$'
  compteur82	db  0d,'$'
  compteur9		dw  0d,'$'
  compteur92	db  0d,'$'
  
  diz			db  0d

  
;---------------------------------------------------------------*
;*-------------------- Programme -------------------------------*
;*--------------------------------------------------------------*   
  
      .CODE         
    
 DEBUT:  
          mov AX,@DATA      ; début du programme
          mov DS,AX         ; DS contient l'adresse du debut du segment de donnee par rapport au debut de la RAM
          mov es,ax

;-----Acquisition du chemin d'accès et du nom du fichier----*
  
  lea dx,acqui              ;Affiche "Entrer le chemin d'accès et nom du fichier : 
  mov ah,09h
  int 21h
    
  mov ah,0Ah		
  lea dx,fich
  int 21h
  
  xor bx,bx					;mise à zéro de BX
  mov bl,fichlu				;copie le nombre de caractère lu dans BL
  mov fichier+[bx],0		;à la fin de la chaine on rajoute le caractère 0

;-------------OUVERTURE DU FICHIER-----------------*

  xor CX,CX	           ; Remize à 0 de CX qui est l'attribut du fichier
  lea DX,Fichier       ; Place le chemein d'accès au fichier dans DX
  mov AH,3Dh	       ; Fonction d'ouverture du fichier
  int 21h
  mov Handle,ax        ; Sauvegarde du Handel du Fichier
  

;-------------- Affiche le fichier --------------*
   
  mov 	bx,Handle    
  mov 	ah,3Fh
  mov   cx,60000
  lea   dx,buffer
  int 	21h

  ;lea dx,CONTENU	
  ;mov ah,09h	    ;Affiche "Contenu du fichier
  ;int 21h
  
  ;lea dx,buffer
  ;mov ah,09h        ;Affiche buffer => le fichier
  ;int 21h
  

 
;------------ Compte le nombre de lettre et de chiffre ------------*
  
   
  ;---- Charge les caractères du buffer ----*
  CLD                        ; Direction flag=0 (DI et SI s'incrémente) 
  LEA si,buffer
  
;--------------- Comparaison ---------------*
tet: 
  LODSB
  
  jmp rep1
  lettrea:  
  INC compteura
  jmp tet
  rep1:
  cmp al,'a'
  je lettrea
  cmp al,'A'
  je lettrea
  cmp al,'à'
  je lettrea
  cmp al,'â'
  je lettrea
  jmp rep2
  lettreb:  
  INC compteurb
  jmp tet
  rep2:
  cmp al,'b'
  je lettreb
  cmp al,'B'
  je lettreb
  jmp rep3
  lettrec:  
  INC compteurc
  jmp tet
  rep3:
  cmp al,'c'
  je lettrec
  cmp al,'C'
  je lettrec
  cmp al,'ç'
  je lettrec
  jmp rep4
  lettred:  
  INC compteurd
  jmp tet
  rep4:
  cmp al,'d'
  je lettred
  cmp al,'D'
  je lettred
  jmp rep5
  lettree:  
  INC compteure
  jmp tet
  rep5:
  cmp al,'e'
  je lettree
  cmp al,'E'
  je lettree
  cmp al,'é'
  je lettree
  cmp al,'è'
  je lettree
  cmp al,'ê'
  je lettree
  jmp rep6
  lettref:  
  INC compteurf
  jmp tet
  rep6:
  cmp al,'f'
  je lettref
  cmp al,'F'
  je lettref
  jmp rep7
  lettreg:  
  INC compteurg
  jmp tet
  rep7:
  cmp al,'g'
  je lettreg
  cmp al,'G'
  je lettreg
  jmp rep8
  lettreh:  
  INC compteurh
  jmp tet
  rep8:
  cmp al,'h'
  je lettreh
  cmp al,'H'
  je lettreh
  jmp rep9
  lettrei:  
  INC compteuri
  jmp tet
  rep9:
  cmp al,'i'
  je lettrei
  cmp al,'I'
  je lettrei
  cmp al,'î'
  je lettrei
  cmp al,'ï'
  je lettrei
  jmp rep10
  lettrej:  
  INC compteurj
  jmp tet
  rep10:
  cmp al,'j'
  je lettrej
  cmp al,'J'
  je lettrej
  jmp rep11
  lettrek:  
  INC compteurk
  jmp tet
  rep11:
  cmp al,'k'
  je lettrek
  cmp al,'K'
  je lettrek
  jmp rep12
  lettrel:  
  INC compteurl
  jmp tet
  rep12:
  cmp al,'l'
  je lettrel
  cmp al,'L'
  je lettrel
  jmp rep13
  lettrem:  
  INC compteurm
  jmp tet
  rep13:
  cmp al,'m'
  je lettrem
  cmp al,'M'
  je lettrem
  jmp rep14 
  lettren:  
  INC compteurn
  jmp tet
  rep14:
  cmp al,'n'
  je lettren
  cmp al,'N'
  je lettren
  jmp rep15
  lettreo:  
  INC compteuro
  jmp tet
  rep15:
  cmp al,'o'
  je lettreo
  cmp al,'O'
  je lettreo
  cmp al,'ô'
  je lettreo
  jmp rep16
  lettrep:  
  INC compteurp
  jmp tet
  rep16:
  cmp al,'p'
  je lettrep
  cmp al,'P'
  je lettrep
  jmp rep17
  lettreq:  
  INC compteurq
  jmp tet
  rep17:
  cmp al,'q'
  je lettreq
  cmp al,'Q'
  je lettreq
  jmp rep18
  lettrer:  
  INC compteurr
  jmp tet
  rep18:
  cmp al,'r'
  je lettrer
  cmp al,'R'
  je lettrer
  jmp rep19
  lettres:  
  INC compteurs
  jmp tet
  rep19:
  cmp al,'s'
  je lettres
  cmp al,'S'
  je lettres
  jmp rep20
  lettret:  
  INC compteurt
  jmp tet
  rep20:
  cmp al,'t'
  je lettret
  cmp al,'T'
  je lettret
  jmp rep21
  lettreu:  
  INC compteuru
  jmp tet
  rep21:
  cmp al,'u'
  je lettreu
  cmp al,'U'
  je lettreu
  cmp al,'û'
  je lettreu
  cmp al,'ü'
  je lettreu
  jmp rep22
  lettrev:  
  INC compteurv
  jmp tet
  rep22:
  cmp al,'v'
  je lettrev
  cmp al,'V'
  je lettrev
  jmp rep23
  lettrew:  
  INC compteurw
  jmp tet
  rep23:
  cmp al,'w'
  je lettrew
  cmp al,'W'
  je lettrew
  jmp rep24
  lettrex:  
  INC compteurx
  jmp tet
  rep24:
  cmp al,'x'
  je lettrex
  cmp al,'X'
  je lettrex
  jmp rep25
  lettrey:  
  INC compteury
  jmp tet
  rep25:
  cmp al,'y'
  je lettrey
  cmp al,'Y'
  je lettrey
  jmp rep26
  lettrez:  
  INC compteurz
  jmp tet
  rep26:
  cmp al,'z'
  je lettrez
  cmp al,'Z'
  je lettrez
  jmp rep27
  chiffre1:  
  INC compteur1
  jmp tet
  rep27:
  cmp al,'1'
  je chiffre1
  jmp rep28
  chiffre2:  
  INC compteur2
  jmp tet
  rep28:
  cmp al,'2'
  je chiffre2
  jmp rep29
  chiffre3:  
  INC compteur3
  jmp tet
  rep29:
  cmp al,'3'
  je chiffre3
  jmp rep30
  chiffre4:  
  INC compteur4
  jmp tet
  rep30:
  cmp al,'4'
  je chiffre4
  jmp rep31
  chiffre5:  
  INC compteur5
  jmp tet
  rep31:
  cmp al,'5'
  je chiffre5
  jmp rep32
  jmp ch6
test1:
jmp tet

ch6:
  chiffre6:  
  INC compteur6
  jmp tet
  rep32:
  cmp al,'6'
  je chiffre6
  jmp rep33
  chiffre7:  
  INC compteur7
  jmp tet
  rep33:
  cmp al,'7'
  je chiffre7
  jmp rep34
  chiffre8:  
  INC compteur8
  jmp tet
  rep34:
  cmp al,'8'
  je chiffre8
  jmp rep35
  chiffre9:  
  INC compteur9
  jmp tet
  rep35:
  cmp al,'9'
  je chiffre9
  jmp rep36
  chiffre0:  
  INC compteur0
  jmp tet
  rep36:
  cmp al,'0'
  je chiffre0
  cmp al,'$'
  jne test1
  
  CALL add30h
  
   ;-------------Cherche le plus grand compteur-------*
  add grand,30h
  
  mov ax,compteura
  call plusgrand
  mov ax,compteurb
  call plusgrand
  mov ax,compteurc
  call plusgrand
  mov ax,compteurd
  call plusgrand
  mov ax,compteure
  call plusgrand
  mov ax,compteurf
  call plusgrand
  mov ax,compteurg
  call plusgrand
  mov ax,compteurh
  call plusgrand
  mov ax,compteuri
  call plusgrand
  mov ax,compteurj
  call plusgrand
  mov ax,compteurk
  call plusgrand
  mov ax,compteurl
  call plusgrand
  mov ax,compteurm
  call plusgrand
  mov ax,compteurn
  call plusgrand
  mov ax,compteuro
  call plusgrand
  mov ax,compteurp
  call plusgrand
  mov ax,compteurq
  call plusgrand
  mov ax,compteurr
  call plusgrand
  mov ax,compteurs
  call plusgrand
  mov ax,compteurt
  call plusgrand
  mov ax,compteuru
  call plusgrand
  mov ax,compteurv
  call plusgrand
  mov ax,compteurw
  call plusgrand
  mov ax,compteurx
  call plusgrand
  mov ax,compteury
  call plusgrand
  mov ax,compteurz
  call plusgrand
  mov ax,compteur0
  call plusgrand
  mov ax,compteur1
  call plusgrand
  mov ax,compteur2
  call plusgrand
  mov ax,compteur3
  call plusgrand
  mov ax,compteur4
  call plusgrand
  mov ax,compteur5
  call plusgrand
  mov ax,compteur6
  call plusgrand
  mov ax,compteur7
  call plusgrand
  mov ax,compteur8
  call plusgrand
  mov ax,compteur9
  call plusgrand
  
 
  ;--------Calcule de l'échelle-----------------------------*
  xor ax,ax
  mov tempor,10d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja petit3
  jmp s10
  petit3:
  mov diz,1d
  mov frequence,9d
  mov freq,1d
  jmp okechelle
  s10:
   
  mov tempor,50d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p50
  jmp s50
  p50:
  mov diz,5d
  mov frequence,45d
  mov freq,5d
  jmp okechelle 
  s50:

  mov tempor,100d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p100
  jmp s100
  p100:
  mov diz,10d
  mov frequence,90d
  mov freq,10d
  jmp okechelle 
  s100:
  
  mov tempor,200d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p200
  jmp s200
  p200:
  mov diz,20d
  mov frequence,180d
  mov freq,20d
  jmp okechelle 
  s200:
  
  mov tempor,300d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p300
  jmp s300
  p300:
  mov diz,30d
  mov frequence,270d
  mov freq,30d
  jmp okechelle 
  s300:
  
  mov tempor,400d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p400
  jmp s400
  p400:
  mov diz,40d
  mov frequence,360d
  mov freq,40d
  jmp okechelle 
  s400:
  
  mov tempor,500d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p500
  jmp s500
  p500:
  mov diz,50d
  mov frequence,450d
  mov freq,10d
  jmp okechelle 
  s500:
  
  mov tempor,1000d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p1000
  jmp s1000
  p1000:
  mov diz,100d
  mov frequence,900d
  mov freq,100d
  jmp okechelle 
  s1000:
  
  mov tempor,2500d
  add tempor,30h
  mov ax,tempor
  cmp ax,grand
  ja p2500
  jmp s2500
  p2500:
  mov diz,250d
  mov frequence,2250d
  mov freq,250d
  jmp okechelle 
  s2500:
  
  
  
  okechelle:
  
  CALL sub30h
  
 ;-------------Divise les compteurs par le nombre adéquoi (trouvé ds le calcul de l'échelle)------------*
 ;Pour que l'échelle se remette sur 10
   
  mov ax,compteura
  div diz
  mov compteura2,al
  
  mov ax,compteurb
  div diz
  mov compteurb2,al
  
  mov ax,compteurc
  div diz
  mov compteurc2,al
  
  mov ax,compteurd
  div diz
  mov compteurd2,al
  
  mov ax,compteure
  div diz
  mov compteure2,al
  
  mov ax,compteurf
  div diz
  mov compteurf2,al
  
  mov ax,compteurg
  div diz
  mov compteurg2,al
  
  mov ax,compteurh
  div diz
  mov compteurh2,al
  
  mov ax,compteuri
  div diz
  mov compteuri2,al
  
  mov ax,compteurj
  div diz
  mov compteurj2,al
  
  mov ax,compteurk
  div diz
  mov compteurk2,al
  
  mov ax,compteurl
  div diz
  mov compteurl2,al
  
  mov ax,compteurm
  div diz
  mov compteurm2,al
  
  mov ax,compteurn
  div diz
  mov compteurn2,al
  
  mov ax,compteuro
  div diz
  mov compteuro2,al
  
  mov ax,compteurp
  div diz
  mov compteurp2,al
  
  mov ax,compteurq
  div diz
  mov compteurq2,al
  
  mov ax,compteurr
  div diz
  mov compteurr2,al
  
  mov ax,compteurs
  div diz
  mov compteurs2,al
  
  mov ax,compteurt
  div diz
  mov compteurt2,al
  
  mov ax,compteuru
  div diz
  mov compteuru2,al
  
  mov ax,compteurv
  div diz
  mov compteurv2,al
  
  mov ax,compteurw
  div diz
  mov compteurw2,al
  
  mov ax,compteurx
  div diz
  mov compteurx2,al
  
  mov ax,compteury
  div diz
  mov compteury2,al
  
  mov ax,compteurz
  div diz
  mov compteurz2,al
  
  mov ax,compteur1
  div diz
  mov compteur12,al
  
  mov ax,compteur2
  div diz
  mov compteur22,al
  
  mov ax,compteur3
  div diz
  mov compteur32,al
  
  mov ax,compteur4
  div diz
  mov compteur42,al
  
  mov ax,compteur5
  div diz
  mov compteur52,al
  
  mov ax,compteur6
  div diz
  mov compteur62,al
  
  mov ax,compteur7
  div diz
  mov compteur72,al
  
  mov ax,compteur8
  div diz
  mov compteur82,al
  
  mov ax,compteur9
  div diz
  mov compteur92,al
 
  CALL add30h2
  
  ;------------- Affichage de l'histogramme ---------------*
    
  ;---Affiche cadre + titre
  lea dx,titre1
  mov ah,09h
  int 21h
  
  lea dx,titre2
  mov ah,09h
  int 21h
  
  lea dx,titre3
  mov ah,09h
  int 21h
  
  lea dx,titre4
  mov ah,09h
  int 21h
  
  lea dx,titre5
  mov ah,09h
  int 21h
  
  lea dx,flechehaut		; Affiche la flèche vers le haut
  mov ah,09h
  int 21h
  
  
  lea dx,lignev2		; Affiche ligne verticale
  mov ah,09h
  int 21h
  
  lea dx,passligne		; Passage à la ligne
  mov ah,09h
  int 21h
  
    
  add compa,30h
  add cmp1,30h
   
  
lignesuivante:
 
  call convfreq         ;Conversion décimale de la fréquence pour pouvoir l'afficher
  
  xor ax,ax
  mov ax,freq
  sub frequence,ax
  
  dec compa				; DECREMENTE compa pour passé a la ligne suivante

  lea dx,lignev			; Affiche ligne verticale
  mov ah,09h
  int 21h
  
  mov ah,compa			; Place compa dans ah pour la comparaison
  
  
  ;---COMPARE LETTRE A---*
  cmp compteura2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oka                ; Si + petit affiche espace
  jmp noa				; Si + grand affiche bloc
  
  oka:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letb
  
  noa:
  lea dx,bloc
  mov ah,09h
  int 21h
  
letb:
 ;---COMPARE LETTRE B---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurb2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okb
  jmp nob
  
  okb:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letc
  
  nob:
  lea dx,bloc
  mov ah,09h
  int 21h
  
letc:
  
  ;---COMPARE LETTRE C---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurc2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okc
  jmp noc
  
  okc:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letd
  
  noc:
  lea dx,bloc
  mov ah,09h
  int 21h
  
letd:
  
  ;---COMPARE LETTRE D---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurd2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okd
  jmp nod
  
  okd:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp lete
  
  nod:
  lea dx,bloc
  mov ah,09h
  int 21h
  
lete:
  
  ;---COMPARE LETTRE E---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteure2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oke
  jmp noe
  
  oke:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letf
  
  noe:
  lea dx,bloc
  mov ah,09h
  int 21h

letf:
  
  ;---COMPARE LETTRE F---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurf2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okf
  jmp nof
  
  okf:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letg
  
  nof:
  lea dx,bloc
  mov ah,09h
  int 21h
  
letg:
  
  ;---COMPARE LETTRE G---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurg2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okg
  jmp nog
  
  okg:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp leth
  
  nog:
  lea dx,bloc
  mov ah,09h
  int 21h
  
leth:

;---COMPARE LETTRE H---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurh2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okh
  jmp noh
  
  okh:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp leti
  
  noh:
  lea dx,bloc
  mov ah,09h
  int 21h

letI:
  
;---COMPARE LETTRE I---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteuri2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oki
  jmp noi
  
  oki:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letj
  
  noi:
  lea dx,bloc
  mov ah,09h
  int 21h
 
letJ:
  
;---COMPARE LETTRE J---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurj2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okj
  jmp noj
  
  okj:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letk
  
  noj:
  lea dx,bloc
  mov ah,09h
  int 21h

letk:
  
;---COMPARE LETTRE K---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurk2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okk
  jmp nok
  
  okk:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letl
  
  nok:
  lea dx,bloc
  mov ah,09h
  int 21h

letl:
  
;---COMPARE LETTRE L---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurl2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okl
  jmp nol
  
  okl:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letm
  
  nol:
  lea dx,bloc
  mov ah,09h
  int 21h
 
letm:
  
;---COMPARE LETTRE M---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurm2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okm
  jmp nom
  
  okm:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letn
  
  nom:
  lea dx,bloc
  mov ah,09h
  int 21h

letn:
  
;---COMPARE LETTRE N---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurn2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okn
  jmp non
  
  okn:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp leto
  
  non:
  lea dx,bloc
  mov ah,09h
  int 21h
 
leto:
  
;---COMPARE LETTRE O---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteuro2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oko
  jmp noo
  
  oko:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letp
  
  noo:
  lea dx,bloc
  mov ah,09h
  int 21h

letp:
 
;---COMPARE LETTRE P---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurp2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okp
  jmp nonp
  
  okp:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letq
  
  nonp:
  lea dx,bloc
  mov ah,09h
  int 21h

letq:
  
;---COMPARE LETTRE Q---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurq2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okq
  jmp noq
  
  okq:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letr
  
  noq:
  lea dx,bloc
  mov ah,09h
  int 21h

letr:
  
;---COMPARE LETTRE R---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurr2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okr
  jmp nor
  
  okr:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp lets
  
  nor:
  lea dx,bloc
  mov ah,09h
  int 21h

lets:
  
;---COMPARE LETTRE S---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurs2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oks
  jmp nos
  
  oks:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp lett
  
  nos:
  lea dx,bloc
  mov ah,09h
  int 21h

lett:
  
;---COMPARE LETTRE T---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurt2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okt
  jmp nont
  
  okt:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letu
  
  nont:
  lea dx,bloc
  mov ah,09h
  int 21h

letu:
  
;---COMPARE LETTRE U---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteuru2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oku
  jmp nou
  
  oku:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letv
  
  nou:
  lea dx,bloc
  mov ah,09h
  int 21h

letv:
  
;---COMPARE LETTRE V---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurv2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okv
  jmp nov
  
  okv:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letw
  
  nov:
  lea dx,bloc
  mov ah,09h
  int 21h
  
letw:
  
;---COMPARE LETTRE W---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurw2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okw
  jmp now
  
  okw:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letx
  
  now:
  lea dx,bloc
  mov ah,09h
  int 21h

letx:
  
;---COMPARE LETTRE X---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurx2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okx
  jmp nox
  
  okx:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp lety
  
  nox:
  lea dx,bloc
  mov ah,09h
  int 21h
 
lety:
 
;---COMPARE LETTRE Y---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteury2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB oky
  jmp noy
  
  oky:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp letz
  
  noy:
  lea dx,bloc
  mov ah,09h
  int 21h
  
letz:

;---COMPARE LETTRE Z---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteurz2,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okz
  jmp noz
  
  okz:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass0
  
  noz:
  lea dx,bloc
  mov ah,09h
  int 21h

jmp chifpass0
court2:
jmp lignesuivante
  
chifpass0:

;---COMPARE CHIFFRE 0---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur02,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre0
  jmp nochiffre0
  
  okchiffre0:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass1
  
  nochiffre0:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass1:

;---COMPARE CHIFFRE 1---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur12,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre1
  jmp nochiffre1
  
  okchiffre1:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass2
  
  nochiffre1:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass2:

;---COMPARE CHIFFRE 2---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur22,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre2
  jmp nochiffre2
  
  okchiffre2:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass3
  
  nochiffre2:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass3:

;---COMPARE CHIFFRE 3---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur32,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre3
  jmp nochiffre3
  
  okchiffre3:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass4
  
  nochiffre3:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass4:

;---COMPARE CHIFFRE 4---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur42,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre4
  jmp nochiffre4
  
  okchiffre4:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass5
  
  nochiffre4:
  lea dx,bloc
  mov ah,09h
  int 21h
  
 chifpass5:

;---COMPARE CHIFFRE 5---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur52,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre5
  jmp nochiffre5
  
  okchiffre5:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass6
  
  nochiffre5:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass6:

;---COMPARE CHIFFRE 6---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur62,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre6
  jmp nochiffre6
  
  okchiffre6:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass7
  
  nochiffre6:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass7:

;---COMPARE CHIFFRE 7---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur72,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre7
  jmp nochiffre7
  
  okchiffre7:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass8
  
  nochiffre7:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass8:

;---COMPARE CHIFFRE 8---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur82,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre8
  jmp nochiffre8
  
  okchiffre8:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp chifpass9
  
  nochiffre8:
  lea dx,bloc
  mov ah,09h
  int 21h
  
chifpass9:

;---COMPARE CHIFFRE 9---*
  mov ah,compa			; Place compa dans ah pour la comparaison
  cmp compteur92,ah		; Comparaison : si compteur est plus grand ou égale au n° de ligne il affiche un bloc sinon espace
  JB okchiffre9
  jmp nochiffre9
  
  okchiffre9:
  lea dx,espace2
  mov ah,09h
  int 21h
  jmp finboucle
    
  nochiffre9:
  lea dx,bloc
  mov ah,09h
  int 21h
  
  finboucle:
  lea dx,passligne		; Passage à la ligne
  mov ah,09h
  int 21h
  
  inc cmp1
  cmp cmp1,'9'
  je FIN
  
  jmp court2

FIN:
  
  lea dx,ligne		; Passage à la ligne
  mov ah,09h
  int 21h
  
  lea dx,lettreetchiffre
  mov ah,09h
  int 21h
  
  
;-------------FERMETURE DU FICHIER-----------------*
   
  mov 	bx,Handle    
  mov 	ah,3Eh
  int 	21h
  

;------------------------FIN-----------------------------------------*

  mov ax,4C00h       ;Appel de la fonction 4ch pour revenir au DOS
  int 21h          
  
  
  convfreq proc near
  
  mov ax,frequence
  
  xor dx,dx
  div mil		       ;divise le resultat par 1000
  mov millier,ax
  
  mov ax,dx
  
  xor dx,dx
  div cent		       ;divise le resultat par 100
  mov centaine,ax
  
  mov ax,dx
  
  xor dx,dx
  div dix2	       ;divise le resultat par 100
  mov dixaine,ax
  
  mov unite,dx
  
  add millier,48d
  add centaine,48d
  add dixaine,48d
  add unite,48d
  
  ;Affichage
  mov dx,millier
  mov ah,02h        ;Affiche caractère
  int 21h

  mov dx,centaine      
  mov ah,02h        ;Affiche caractère
  int 21h
  
  mov dx,dixaine
  mov ah,02h        ;Affiche caractère
  int 21h

  mov dx,unite       
  mov ah,02h        ;Affiche caractère
  int 21h
  
  RET
  convfreq ENDP
  
  
  
  plusgrand   proc near
  cmp ax,grand
  JA grand2       ;Si + grand on le place ds grand
  jmp petit	      ;Si + petit passe au plus petit
  grand2:
  mov grand,ax
  petit:
  RET
  plusgrand ENDP
  
  
  add30h proc near
  
  ADD compteura,30h
  ADD compteurb,30h
  ADD compteurc,30h
  ADD compteurd,30h
  ADD compteure,30h
  ADD compteurf,30h
  ADD compteurg,30h
  ADD compteurh,30h
  ADD compteuri,30h
  ADD compteurj,30h
  ADD compteurk,30h
  ADD compteurl,30h
  ADD compteurm,30h
  ADD compteurn,30h
  ADD compteuro,30h
  ADD compteurp,30h
  ADD compteurq,30h
  ADD compteurr,30h
  ADD compteurs,30h
  ADD compteurt,30h
  ADD compteuru,30h
  ADD compteurv,30h
  ADD compteurw,30h
  ADD compteurx,30h
  ADD compteury,30h
  ADD compteurz,30h
  ADD compteur0,30h
  ADD compteur1,30h
  ADD compteur2,30h
  ADD compteur3,30h
  ADD compteur4,30h
  ADD compteur5,30h
  ADD compteur6,30h
  ADD compteur7,30h
  ADD compteur8,30h
  ADD compteur9,30h
  RET
  add30h ENDP      
  
  
  sub30h proc near
  
  SUB compteura,30h
  SUB compteurb,30h
  SUB compteurc,30h
  SUB compteurd,30h
  SUB compteure,30h
  SUB compteurf,30h
  SUB compteurg,30h
  SUB compteurh,30h
  SUB compteuri,30h
  SUB compteurj,30h
  SUB compteurk,30h
  SUB compteurl,30h
  SUB compteurm,30h
  SUB compteurn,30h
  SUB compteuro,30h
  SUB compteurp,30h
  SUB compteurq,30h
  SUB compteurr,30h
  SUB compteurs,30h
  SUB compteurt,30h
  SUB compteuru,30h
  SUB compteurv,30h
  SUB compteurw,30h
  SUB compteurx,30h
  SUB compteury,30h
  SUB compteurz,30h
  SUB compteur0,30h
  SUB compteur1,30h
  SUB compteur2,30h
  SUB compteur3,30h
  SUB compteur4,30h
  SUB compteur5,30h
  SUB compteur6,30h
  SUB compteur7,30h
  SUB compteur8,30h
  SUB compteur9,30h
  
  RET
  sub30h ENDP    
  
  
    add30h2 proc near
  
  ADD compteura2,30h
  ADD compteurb2,30h
  ADD compteurc2,30h
  ADD compteurd2,30h
  ADD compteure2,30h
  ADD compteurf2,30h
  ADD compteurg2,30h
  ADD compteurh2,30h
  ADD compteuri2,30h
  ADD compteurj2,30h
  ADD compteurk2,30h
  ADD compteurl2,30h
  ADD compteurm2,30h
  ADD compteurn2,30h
  ADD compteuro2,30h
  ADD compteurp2,30h
  ADD compteurq2,30h
  ADD compteurr2,30h
  ADD compteurs2,30h
  ADD compteurt2,30h
  ADD compteuru2,30h
  ADD compteurv2,30h
  ADD compteurw2,30h
  ADD compteurx2,30h
  ADD compteury2,30h
  ADD compteurz2,30h
  ADD compteur02,30h
  ADD compteur12,30h
  ADD compteur22,30h
  ADD compteur32,30h
  ADD compteur42,30h
  ADD compteur52,30h
  ADD compteur62,30h
  ADD compteur72,30h
  ADD compteur82,30h
  ADD compteur92,30h
  RET
  add30h2 ENDP
  
  
  
  END debut

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.