;*** Example of macros that implement a for loop
;*** FORMAC macro and ENDFOR macro

formac     macro       i, first_i, last_i, start_l, end_l
           mov         i,first_i
start_l:   cmp         i,last_i
           ja          end_l
           inc         i

endfor     macro       start_l, end_l
           jmp         start_l

stack      segment     stack
           dw          16 dup(?)
stack      ends

code       segment
           assume      cs:code
main       proc        far
;The following uses the for/endfor macros to display 3 a's on screen
           formac      si,1,3,ps,pf
              mov      ah,2
              mov      dl,'a'
              int      21h
           endfor      ps,pf
           mov         ax,4c00h
           int         21h
main       endp
code       ends
           end         main