marooh
Messages postés122Date d'inscriptionvendredi 8 octobre 2010StatutMembreDernière intervention16 novembre 2011
-
17 oct. 2010 à 04:04
cs_ghuysmans99
Messages postés3982Date d'inscriptionjeudi 14 juillet 2005StatutMembreDernière intervention30 juin 2013
-
18 oct. 2010 à 18:49
Bonjour,
j'ai écrit un code assembleur qui consiste à créer un tableau de 20 cases , de les remplir,de trouver le maximum et de faire la moyenne.mais en compilant j'ai eu des erreurs que je n'ai pas pu corriger.si vous voulez bien m'aider
voici le code
.386
.model small
.stack 100h
.data
phrase db 10,13,"Nous avons besoin de l'age de 20 individus pour commencer$"
phrase1 db 10,13,"Entrez l'age:$"
tabealu db 20 dup (0)
.code
main proc
mov ax,@data
mov ds,ax
mov dx,offset phrase
mov ah,09h
int 21h
mov dx,offset phrase1
mov ah,09h
int 21h
mov bx,0
mov ax,0
boucle:
mov byte ptr[ds:tableau+bx],01h
inc bx
cmp ax,19
jne boucle
mov ax,0
boucle2:
mov dl,byte ptr [ds:tableau+bx]
inc bx
cmp ax,19
jne boucle2
mov ax,4c00h
int21h
Maximum proc uses bx,cx,ax,dx
a:ptr, \
n:dword
mov bx,a
mov cx,0
mov ax,[bx]
while1:
cmp cx,n
jge endwhile1
if_1:
mov dx,[bx+4*cx]
cmp dx,ax
jle endif_1
mov ax,[bx+4*cx]
endif_1:
inc cx
jmp while1
endwhile1:
ret
Maximum endp
end maximum
sum:
mov ebx,tableau
mov dx,0
mov ecx,19
lp:
add,dl[ebx]
jnc next
inc dh
next:
inc ebx
loop lp
shr dx, cl
int21h
main endp
end
marooh
Messages postés122Date d'inscriptionvendredi 8 octobre 2010StatutMembreDernière intervention16 novembre 2011 17 oct. 2010 à 17:48
en utilisant tasm 32 j'ai eu ces erreurs là:
(22)undefined symbol:tableau
(28)la meme chose
(33)illegal instruction
(38)uses has no effect without language
(49)operand type does not match
(53)illegal indexing mode
(57)illegal indexing mode
(68)open procedure :main
marooh
Messages postés122Date d'inscriptionvendredi 8 octobre 2010StatutMembreDernière intervention16 novembre 2011 17 oct. 2010 à 22:18
j'ai modifié ce code avec de longues heures de travail et j'ai réglé quelque problèmes mais il reste ceux dont j'ignore la façon de corriger
voici les erreurs:
(43)illegal number
(87)operand types do not match
(104)operand types do not match
(108)illegal indexing mode
(111)illegal indexing mode
et voici le code
.386
.model small
.stack 100h
.data
phrase db 10,13,"Nous avons besoin de l'age de 20 individus pour commencer$"
phrase1 db 10,13,"Entrez l'age:$"
tableau db 20 dup (0)
n db 19
.code
main proc
mov ax,@data
mov ds,ax
mov dx,offset phrase
mov ah,09h
int 21h
mov ch,n
debut_de_boucle:
mov dx,offset phrase1
mov ah,09h
int 21h
affnbr:
push bp
mov bp, sp
push ax
push bx
push cx
push dx
push si
mov bx, [bp+4]
mov ecx, 10000
mov si, 0
repeter:
mov dx, 0
mov ax, bx
div cx
cmp ax, 0
jne affiche
cmp si, 1
jne fin_si
affiche:
add ax, '0'
push ax
call affiche_caractere
add sp, 2
mov si, 1
fin_si:
mov bx, dx
mov dx, 0
mov ax, cx
mov cx, 10
div cx
mov cx, ax
cmp cx, 1
jne suite
mov si, 1
suite:
cmp cx, 0
jne repeter
pop si
pop dx
pop cx
pop bx
pop ax
pop bp
endaffnbr: