; video macros
;	using extended ascii sets to draw boxes, etc
;
if1
	include basic.mac
endif

;*****************************************************
; single lines:
;*****************************************************
cor_nw equ 0dah
cor_ne equ 0bfh
cor_sw equ 0c0h
cor_se equ 0d9h
ver equ 0b3h
hor equ 0c4h
;


;*****************************************************
; Advance the cursor n times
;   If n is negative, this actually goes backwards
;*****************************************************
cur_right macro n
	save <ax,bx,cx,dx>
	mov ah,3	; read cursor pos
	mov bh,0
	int 10h
	add dl,n	; advance cursor
	mov ah,2	; set cursor pos
	int 10h
	restore <dx,cx,bx,ax>
	endm

;*****************************************************
; Move the cursor down n times 
;   If n is negative, this actually moves upwards 
;*****************************************************
cur_down macro n
        save <ax,bx,cx,dx>   
        mov ah,3        ; read cursor pos   
        mov bh,0 
        int 10h 
        add dh,n        ; advance cursor
        mov ah,2        ; set cursor pos 
        int 10h 
        restore <dx,cx,bx,ax> 
        endm 
 
;*****************************************************
; draw horizontal line of length n
;	in intense white on black background
;	cursor is moved to end of line
;*****************************************************
hor_line macro n
	save <ax,bx,cx>
	mov ah,9
	mov al,hor
	mov bh,0
	mov bl,0fh      ; foreground black, background white
	mov cx,25
	int 10h
	cur_right n	; advance cursor
	cur_right -1
	restore <cx,bx,ax>
	endm

;*****************************************************
; draw vertical line of length n
;	in intense white on black background
;	cursor is moved to end of line
;*****************************************************
ver_line macro n
	save <ax,bx,cx>
	rept n
	mov ah,9
	mov al,ver
	mov bh,0
	mov bl,0fh      ; foreground black, background white
	mov cx,1
	int 10h
	cur_down 1
	endm
	cur_up 1	; place cursor
	restore <cx,bx,ax>
	endm
