16 Bit Assembler Vertical Bar Loop

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Babiloo
Messages
1
Reaction score
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
 
Physics news on Phys.org