Soyez le premier à donner votre avis sur cette source.
Vue 11 640 fois - Téléchargée 1 008 fois
;NASM-IDE ASM Assistant Assembler Project File BITS 16 ;Set code generation to 16 bit mode ORG 0x0100 ;Set code start address to 0100h SEGMENT .text ;;;;;;;;;;;;;;;;;;;;;; ;Entr?e clavier ;Input Data from keyboard ;*****************;;;;; labbg: push labbeg push len_labbeg ;;;;; Affichage titre a l'?cran call Pint0921h begin: push zon0h push len_zon0h ;;;;; Affichage message a l'?cran call Pint0921h lop0: mov al,0ch ;;;;; Keybord buff?ris? mov dx,buf1 mov ah,0ah int 0x21 cmp byte [buf1+1],8 jbe st00 mov al,07h ;;; byte bell mov ah,0eh int 10h mov cl,[buf1+1] mov bh,0 ;;;; Traitement cas > 8 bytes mov al,' ' mov ah,0Ah int 10h jmp lop0 st00: xor ecx,ecx mov cl,[buf1+1] xor si,si mov bx,buf1+2 des1: mov al,[bx] mov byte [bufzs+si],al cmp cl,1 je Ctldata0 inc si inc bx loop des1 Ctldata0: xor ecx,ecx mov cl,[buf1+1] xor esi,esi xor edi,edi xor eax,eax Ctldata1: push cx mov al,[bufzs+si] mov cx,lent_nmbhc mov di,nmbhc repne scasb pop cx je stt0 jmp eror stt0: mov bp,di sub bp,nmbhc dec bp cmp bp,15 jbe stt1 mov bl,[nmbhc+bp-6] mov byte [bufzs+si],bl stt1: inc si loop Ctldata1 jmp sut0 ;;;;traitement minuscule (lowcase) eror: push lab_err push lent_lab_err call Pint0921h ;;;;;;error not Hexa jmp begin sut0: xor cx,cx mov cl,[buf1+1] push bufzs push bufz push cx call movbyte ;;;;;;;;; ;***************** xor eax,eax Valh: xor ecx,ecx xor si, si mov cl,[buf1+1] xor ebx,ebx sub cl,1 jz onee bcl00: xor eax,eax mov al,[bufz+si] cmp al,'A' jnb Ablp1 sub al,'0' jmp Ablp2 Ablp1: sub al,'A' ;;convert ascii to hex add al,10 Ablp2: add ebx,eax shl ebx,4 inc si loop bcl00 onee: xor eax,eax mov al,[bufz+si] cmp al,'A' jnb Ablp21 sub al,'0' jmp Ablp22 Ablp21: sub al,'A' add al,10 Ablp22: add ebx,eax ;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;Affichage en d?cimal ;;:::::::::::::::::::::::: mov eax,ebx ;;;;;;;;;;;;;;;;;; xor esi,esi xor edi,edi xor ecx,ecx mov ebx,10 xor ecx,ecx mov ecx,1 mov si,0 xor edx,edx Lop1: xor edx,edx div ebx ;;convert en decimal cmp eax,ebx jb par10 add dl,'0' mov [affdec+si], dl inc ecx inc si jmp Lop1 par10: add dl,'0' mov [affdec+si], dl inc si inc ecx add al,'0' mov [affdec+si], al par11: push zon0 push len_zon0 call Pint0921h ;;;;;;;;;;;; xor ax,ax xor dx,dx xor di,di mov ax,cx mov bx,3 mov byte [flg],0 div bx ;;;;;;; par12: mov al,[affdec+si] mov ah,0eh int 10h dec si inc di cmp byte [flg],1 je st12 cmp di,dx je frmt st12: cmp di,3 jne lop12 frmt: mov al,' ' mov ah,0eh int 10h mov byte [flg],1 xor di,di ;;;;;format output 9 999 999 lop12: loop par12 ;;;;;;;;;;;;;;;; call Crlf jmp begin %include "utilit.asm" %include "interup.asm" %include "crlf.asm" SEGMENT .dat lab_err db 'Err0 : Not Hexa number' mem1 db '$' nmbhc db '0123456789ABCDEFabcdef' zon0 db '-- Decimal value : ' mem3 db '$' zon0h db '-- Enter Hex value (Ctrl+C Exit) : ' mem4 db '$' flg db 0 mem5 db '$' len_zon0 equ $-zon0 len_zon0h equ $-zon0h lent_lab_err equ $-lab_err lent_nmbhc equ 22 labbeg db '***** Convert Hex to decimal',0ah,0dh db '***** Version 11.2004 ********',0ah,0dh db 'e-mail:GriechMoloud@yahoo.fr ',0ah,0dh db '_____________________________$',0ah,0dh len_labbeg equ $-labbeg SEGMENT .bss ;Uninitialised data segment affdec resb 15 buf1 resb 15 bufzs resb 15 bufz resb 10
22 nov. 2004 à 14:03
Bon Programme ! mais essaye de faire une conversion /hexa => binaire/ c peut être plus dur ?
Bon COURAGE et bonne programmation !
@+
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.