58 lines
921 B
NASM
58 lines
921 B
NASM
; multi-segment executable file template.
|
|
|
|
data segment
|
|
; add your data here!
|
|
pkey db "press any key...$"
|
|
num1 db 02h
|
|
num2 db 0Dh
|
|
num3 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 bx, 00h
|
|
mov cx, 00h
|
|
|
|
mov al, num1
|
|
mov bl, num2
|
|
mov cl, num3
|
|
|
|
cmp bl, al
|
|
jl fine
|
|
|
|
inizio-ciclo:
|
|
cmp cl, 00h
|
|
je fine:
|
|
sub bl, al
|
|
dec cl
|
|
jmp inizio-ciclo:
|
|
|
|
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.
|