Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;nested loop practise
- .model small
- .stack 100h
- include 'emu8086.inc'
- .data
- n_line db 0ah,0dh,"$" ;for new line
- rows db 5d
- columns db 3d
- i db ?
- j db ?
- .code
- main proc
- mov ax,@data
- mov ds,ax
- print "MasumBhai"
- printn
- ;for (int i = 1; i <= rows; ++i)
- ;Assembly type
- ; int i;
- ; for(;i<=rows;)
- ; {
- ; i++
- ; }
- @first_loop_init:
- mov i,1d
- mov bl,rows;
- @first_loop:
- cmp i,bl
- jg @stop
- @second_loop_init:
- mov j,1d;
- mov cl,columns
- @second_loop:
- cmp j,cl
- jg @second_loop_finish
- print "# "
- inc j
- jmp @second_loop
- @second_loop_finish:
- lea dx,n_line ;new line
- mov ah,9
- int 21h
- inc i
- jmp @first_loop
- @stop:
- mov ah,4ch
- int 21h ;terminate with return code
- main endp
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement