RosettaCodeData/Task/Loops-For/8086-Assembly/loops-for.8086
2023-07-01 13:44:08 -04:00

24 lines
610 B
Text

StarSub:
mov ah,02h ;needed to prime the interrupt command for printing to screen
mov ch,1 ;outer loop counter
outer_loop:
mov cl,ch ;refresh the inner loop counter, by copying the value of the outer loop counter to it.
;each time the inner loop finishes, it will last one iteration longer the next time.
inner_loop:
mov dl,02Ah ;ascii for *
int 21h ;tells DOS to print the contents of dl to the screen
dec cl
jnz inner_loop
mov dl,13 ;Carriage Return
int 21h
mov dl,10 ;New Line
int 21h
inc ch ;make the outer loop counter bigger for next time.
cmp ch,5
jnz outer_loop
ret