home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
GRAPHIC.ASM
/
VRTLINEB.ASM
< prev
Wrap
Assembly Source File
|
1989-05-03
|
3KB
|
108 lines
;void vertical_line_b(vrt_char,top_col,top_row,depth);
; unsigned char vrt_char,top_col,top_row,depth;
EXTRN _memory_model:byte
EXTRN _video_page:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _vertical_line_b
_vertical_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 the 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 0 and 1
jnbe B1 ;jump ahead if OK
jmp L1 ;else quit routine
B1: sub cl,2 ;adjust for end chars
mov bl,[bp+4] ;ln thickness code to BL
mov ch,0b3h ;assume single vert line
mov di,0d7ceh ;center chars for dbl ln
cmp bl,'D' ;is it a double line?
je C1 ;jump ahead if so
cmp bl,'d' ;is it a double line?
je C1 ;jump ahead if so
mov bl,0cdh ;dbl vert char to BL
jmp short E1 ;jump ahead
C1: mov bl,0cdh ;dbl vert char to BL
jne E1 ;now jump if not double
mov ch,0bah ;dbl vert char to CH
mov si,0d0cah ;chars for other end
cmp al,bl ;double horizontal char?
jne D1 ;jump ahead if not
mov al,0cbh ;char for double,double
jmp short G1 ;ready to go, jump ahead
D1: mov al,0d2h ;char for double,single
jmp short G1 ;ready to go, jump ahead
E1: mov di,0c5d8h ;center chars for dbl ln
mov si,0c1cfh ;chars for other end
cmp al,bl ;double horizontal char?
jne F1 ;jump ahead if not
mov al,0d1h ;char for single,single
jmp short G1 ;ready to go, jump ahead
F1: mov al,0c2h ;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,0c4cdh ;two horz chars in BP
or cl,cl ;any vert straights?
jz K1 ;jump ahead if not
H1: inc dh ;inc cursor row 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 ;vert straight char to AH
xchg dx,bp ;move horizontals to DX
xchg cx,di ;move center chars to CX
cmp al,dl ;double horizontal char?
je I1 ;jump ahead if so
cmp al,dh ;single horizontal char?
jne J1 ;jump ahead if not so
mov ah,ch ;vertical 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 L1 ;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
L1: pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_vertical_line_b endp
_TEXT ENDS
END