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

62 lines
989 B
NASM

; multi-segment executable file template.
data segment
; add your data here!
pkey db "prss any key...$"
vet1 db 03h, 07h, 0Ah, 02h
num1 db 05h
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 bx, 00h
mov al, num1
inizio-ciclo:
dec al
cmp al, 0h
je fine-ciclo
add bl, vet1[si]
inc si
jmp inizio-ciclo
fine-ciclo:
cmp bl, 21h
jg sub5
add bl, 0Ah
jmp fine
sub5:
sub bl, 05h
jmp fine
fine:
mov ris, bl
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.