60 lines
997 B
NASM
60 lines
997 B
NASM
; multi-segment executable file template.
|
|
|
|
data segment
|
|
; add your data here!
|
|
pkey db "press any key...$"
|
|
num1 db 03h
|
|
num2 db 04h
|
|
ris db 00h
|
|
count db 0Ah
|
|
ends
|
|
|
|
stack segment
|
|
dw 128 dup(0)
|
|
ends
|
|
|
|
code segment
|
|
start:
|
|
; set segment registers:
|
|
mov ax, data
|
|
mov ds, ax
|
|
mov es, ax
|
|
|
|
; add your code here
|
|
|
|
mov al, num1
|
|
mov bl, num2
|
|
mov cl, count
|
|
|
|
inizio-ciclo:
|
|
add al, bl
|
|
dec cl
|
|
cmp cl, 00h
|
|
je fine-ciclo:
|
|
jmp inizio-ciclo
|
|
|
|
fine-ciclo:
|
|
mov ris, al
|
|
cmp ris, 32h
|
|
jl add10
|
|
sub ris, 05h
|
|
jmp fine
|
|
add10:
|
|
add ris, 0Ah
|
|
jmp fine
|
|
|
|
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.
|