Assembly/21-03-22/compito4 @ 21-03-22.asm

53 lines
863 B
NASM

; multi-segment executable file template.
data segment
; add your data here!
pkey db "press any key...$"
vet1 db 02h, 0Fh, 2Dh
num1 db 03h
ris db 00h
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov ax, 00h
mov cx, 00h
mov cl, num1
cmp cl, 1h
jge inizio-ciclo
jmp fine
inizio-ciclo:
add al, vet1[si]
inc si
loop inizio-ciclo
fine:
mov ris, al
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.