altro problema. l'esercizio richiedeva anche di acquisire 5 elementi per un vettore e farne la media.
va tutto bene, ma dopo che eseguo mi stampa sullo schermo "media: T" com'è possibile? come risolvo?
codice:
; multi-segment executable file template.
data segment
DIM EQU 10
NOME db 10 dup(?)
msg db "Inserire nome e cognome: $"
DIM EQU 5
NUM db 0
msg_2 db "Inserire numeri del vettore: $"
d db 5
msg_3 db "Media: $ "
; add your data here!
pkey db "press any key...$"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
lea dx, msg
mov ah, 9
int 21h
mov ax, 0
mov cx, 10
mov si, 0
ciclo:mov ah, 1
int 21h
mov NOME[si], al
inc si
loop ciclo
mov dl, 13
mov ah, 2
int 21h
mov dl, 10
mov ah, 2
int 21h
lea dx, msg_2
mov ah, 9
int 21h
mov ax, 0
mov cx, 5
mov si, 0
ciclo2: mov ah, 1
int 21h
sub al,48
mov NUM[si], al
inc si
loop ciclo2
mov dl, 13
mov ah, 2
int 21h
mov dl, 10
mov ah, 2
int 21h
mov ax, 0
mov cx, 5
mov si, 0
media:add al, NUM[si]
inc si
loop media
div d
lea dx, msg_3
mov ah, 9
int 21h
add al, 48
mov dl, al
mov ah, 2
int 21h
; add your code here
lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.