;WINDOW--Demonstrates video window function
;keyboard writes into a window 20 chars wide
;and 9 chars high in middle of screen
;--------------------------------------------------
prognam segment
	assume cs:prognam
	push	ds
	sub	ax,ax
	push	ax
;clear screen,using scroll up function
	mov	ah,6	   ;scroll up function
	mov	al,0	   ;code to blank screen
	mov	ch,0	   ;upper left row
	mov	cl,0	   ;upper left column
	mov	dh,24	   ;lower right row
	mov	dl,79	   ;lower right column
	mov	bh,7	   ;blank line attribute
	int	10h	   ;video ROM call
;position cursor at bottom of window
pos_curse:
	mov	ah,2	   ;position cursor func.
	mov	dh,16	   ;starting row
	mov	dl,30	   ;starting column
	mov	bh,0	   ;current page
	int	10h	   ;video ROM call
;get characters from key board
	mov	cx,20	   ;set count to 20
get_char:
	mov	ah,1	   ;kbd input function
	int	21h	   ;call DOS
	cmp	al,3	   ;if char is ctrl_c
	jz	exit	   ;then exit
	loop	get_char
;scrooll up
	mov	ah,6	   ;scroll up function
	mov	al,1	   ;number of lines
	mov	ch,8	   ;upper left row
	mov	cl,30	   ;upper left column
	mov	dh,16	   ;lower right row
	mov	dl,50	   ;lower right column
	mov	bh,7	   ;normal attribute
	int	10h	   ;video ROM call
	jmp	pos_curse  ;go reset cursor
exit:	ret		   ;return
prognam ends
;---------------------------------------------------
	end	prognam	   ;end assembly
