• Support PF! Buy your school textbooks, materials and every day products Here!

16 Bit Assembler Vertical Bar Loop

  • Thread starter Babiloo
  • Start date
  • #1
1
0

Homework Statement


Create a program that displays a vertical bar character ‘|’ moving left to right in 79 positions across the screen, then back right to left across the screen.


Homework Equations


(16 bit Assembler)


The Attempt at a Solution


Code:
	.model small
	.stack 100h
	.data
bar	db	8,' ','|','$'
bar2	db	8,' ',8,8,'|','$'
		x dw 500

	.code
bars 	proc
	mov 	AX, @data
	mov 	ds, AX

	mov 	dl,'|'	
	mov	ah,2h
	int	21h

	mov	cl,79

	again:

	mov	ah,9h
	lea 	dx,bar
	int	21h

	call	waste
	dec	cl
	Jnz again

	mov	ah,9h
	lea 	dx,bar2
	int	21h

	call	waste
	dec	cl
	Jnz again

bars	endp
	waste	proc

	push	ax
	push	bx
	push 	cx
	push	dx

	again2:

	mov	cx,79
	
	again3:

	mov	ax,79
	mul	x
	dec	cx
	jnz	again3
	dec	ax
	jnz	again2
	
	pop	dx
	pop 	cx
	pop	bx
	pop 	ax

	ret
waste 	endp
	end 	waste
	end 	bars
 

Answers and Replies

  • #2
.Scott
Homework Helper
2,536
914
So "waste" just wastes time.
You do have a bug. Your loop for reversing the direction goes to "again" instead of the top of the second "mov ah,9h".
 

Related Threads on 16 Bit Assembler Vertical Bar Loop

  • Last Post
Replies
3
Views
30K
Replies
0
Views
4K
  • Last Post
Replies
5
Views
14K
  • Last Post
Replies
6
Views
2K
Replies
2
Views
10K
Replies
1
Views
5K
Replies
2
Views
523
Replies
4
Views
3K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
3
Views
749
Top