home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
GRAPHIC.ASM
/
HRZLINEB.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
3KB
|
108 lines
;void horizontal_line_b(hrz_char,left_col,left_row,width);
; unsigned char hrz_char,left_col,left_row,width;
EXTRN _memory_model:byte
EXTRN _video_page:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _horizontal_line_b
_horizontal_line_b proc near
push bp ;
mov bp,sp ;set stack frame
push di ;
push si ;
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bp ;else add 2 to BP
inc bp ;
begin: mov bh,_video_page ;set page number
mov dl,[bp+6] ;column to DL
dec dl ;count from 0
mov dh,[bp+8] ;row to DH
dec dh ;count from 0
mov ah,2 ;function to set cursor
int 10h ;set the cursor
mov ah,8 ;func to read attri:char
int 10h ;now attri:char in AH:AL
mov cl,[bp+10] ;width to CL
cmp cl,1 ;test for 1 and 0
jnbe B1 ;jump ahead if OK
jmp M1 ;else quit
B1: sub cl,2 ;adjust for end chars
mov bl,[bp+4] ;ln thickness code to BL
mov ch,0c4h ;assume single horz line
mov di,0d8ceh ;center chars for dbl ln
cmp bl,'D' ;is it a double line?
je C1 ;jump ahead if so
cmp bl,'d' ;is it double?
je C1 ;jump ahead if so
mov bl,0bah ;dbl horz char to BL
jmp short E1 ;jump ahead
C1: mov bl,0bah ;dbl horz char to BL
mov ch,0cdh ;dbl horz char to CH
mov si,0b5b9h ;chars for other end
cmp al,bl ;double vertical char?
jne D1 ;jump ahead if not
mov al,0cch ;char for double,double
jmp short G1 ;ready to go, jump ahead
D1: mov al,0c6h ;char for double,single
jmp short G1 ;ready to go, jump ahead
E1: mov di,0c5d7h ;center chars for dbl ln
mov si,0b4b6h ;chars for other end
cmp al,bl ;double vertical char?
jne F1 ;jump ahead if not
mov al,0c7h ;char for single,single
jmp short G1 ;ready to go, jump ahead
F1: mov al,0c3h ;char for single,single
G1: mov bl,ah ;attribute to BL
mov ah,9 ;func to write char-attri
push cx ;save counter
mov cx,1 ;write 1 char
int 10h ;write the char and attri
pop cx ;restore counter
mov bp,0b3bah ;two vertical chars in BP
or cl,cl ;any horzntl straights?
jz K1 ;jump ahead if not
H1: inc dl ;inc cursor col setting
mov ah,2 ;function to set cursor
int 10h ;forward the cursor
mov ah,8 ;func to read attri:char
int 10h ;get attri:char (AH:AL)
mov ah,ch ;horz straight char to AH
xchg dx,bp ;move verticals to DX
xchg cx,di ;move center chars to CX
cmp al,dl ;double vertical char?
je I1 ;jump ahead if so
cmp al,dh ;single vertical char?
jne J1 ;jump ahead if not so
mov ah,ch ;horizontal char to AH
jmp short J1 ;go print it
I1: mov ah,cl ;double center char to AH
J1: mov al,ah ;transfer char to AL
xchg cx,di ;restore counter to CX
xchg dx,bp ;restore cursor pos to DX
mov ah,9 ;function to write char
push cx ;save CX values
mov cx,1 ;write 1 char
int 10h ;write the char and attri
pop cx ;restore CX values
or si,si ;has SI been set to 0?
jz M1 ;quit if so
dec cl ;decrement counter
jnz H1 ;loop until 0
K1: mov di,si ;end chars to DI
sub si,si ;clear SI as flag
jmp short H1 ;go write end char
M1: pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_horizontal_line_b endp
_TEXT ENDS
END