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

50 lines
804 B
NASM

; multi-segment executable file template.
data segment
; add your data here!
pkey db "press any key...$"
num1 db 0Ah
num2 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 al, num1
mov cl, num2
cmp al, cl
jl fine
inizio-ciclo:
add ris, al
loop inizio-ciclo
fine:
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.