0

Hi. Please help... I'm trying to display

*
**
***
****
*****

but it doesn't work.. What could be wrong? Here's my code:

.model small
.stack 100h
.data

	space db " ","$"
	newline db 13,10,"$"
	ast db "*","$"
.code
	mov ax,@data
	mov ds,ax

mov cl,1

again:
	mov bl,cl
	
	back:
		

		mov ah,09h
		lea dx,ast
		int 21h

		dec bl
		jne back

		mov ah, 09
		lea dx, newline
		int 21h

	
inc cl
jne again

	mov ah,4ch
	int 21h
end

Thanks..

3
Contributors
2
Replies
24
Views
6 Years
Discussion Span
Last Post by fuyulight
0

try this:

mov bl, 5
mov cl, 1
xor ch, ch
again: 
	back:
		mov ah,09h
		lea dx,ast
		int 21h
                inc ch
		cmp cl, ch
                je  back
 
		mov ah, 09
		lea dx, newline
		int 21h
 
 
xor ch, ch
inc cl
dec bl
cmp bl, 0
jne again

Also, you could do a much more efficient code with loop instruction, i just tried to maintain your initial code scheme... Also, in your original code you weren't using the jumps well, they must go after a comparisson (cmp) or they won't work

Edited by maxrio: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.