; video procedures
title video.asm
;
public set_mode		; input: AL=mode
public set_mode1	; no clear screen version
public clear_scr	; clear screen
public set_cur		; position cursoe
;
.model small
if1
	include ..\mac\basic.mac
endif
.stack 100h
.data
.code
;+++++++++++++++++++++++++++++++++++++++++++++
; sets video mode and clear screen
; 	input: al=mode
; 	output: none
;+++++++++++++++++++++++++++++++++++++++++++++
set_mode proc
  save <ax>
  xor ah,ah	; fn=0, set mode
  int 10h
  restore <ax>
  ret
set_mode endp

;+++++++++++++++++++++++++++++++++++++++++++++
; sets video mode but preserve screen
; input: al=mode
; output: none
;+++++++++++++++++++++++++++++++++++++++++++++
set_mode1 proc
  save <ax>
  xor ah,ah	; fn=0, set mode
  or al,80h	; do not clear screen
  int 10h
  restore <ax>
  ret
set_mode1 endp

;+++++++++++++++++++++++++++++++++++++++++++++
;	CLEAR SCREEN
;	------------
;	input: bh=colors (e.g. 30h)
;+++++++++++++++++++++++++++++++++++++++++++++
clear_scr proc
	save <ax,bx,cx,dx>
	mov ax,0600h	; request clear screen
	; mov bh,30h	; colors
	mov cx,00	; full
	mov dx,184fh	;   screen
	int 10h
	restore <dx,cx,bx,ax>
	ret
clear_scr endp

;******************************************************
;	SET TEXT CURSOR
;	---------------
;******************************************************
set_cur	proc
	mov ah,02h	; set cursor position function
	mov bh,0	; page 0
	mov dh,0	; row
	mov dl,25	; col
	int 10h
	ret
set_cur endp
;+++++++++++++++++++++++++++++++++++++++++++++
;+++++++++++++++++++++++++++++++++++++++++++++
end