; fibmac.asm - simple macro example ; generates words containing the Fibonacci sequence ; Celio G. May 2002 org 100h ; inform Nasm this is a .com file segment .text mov dx, msgn ; the address of or message passed in parameter %1 mov ah,9 ; ah=9 - "print string" sub-function int 21h ; call dos services mov ah,4Ch ; "terminate program" sub-function int 21h ; call dos services segment .data fibonacci: %assign i 0 %assign j 1 %rep 100 %if j > 65535 %exitrep %endif dw j %assign k j+i %assign i j %assign j k %endrep fibnum equ ($-fibonacci)/2 msgn: db (fibnum/10) +30h, (fibnum % 10)+30h msg: db ' Fibonacci numbers were generated',0dh,0ah,'$' ; $-terminated message