home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
GRAPHIC.ASM
/
DRAWBOXB.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
5KB
|
163 lines
;void draw_box_b(hrz_char,vrt_char,top_x,top_y,width,depth,color);
; unsigned char hrz_char,vrt_char,top_x,top_y,width,depth,color;
EXTRN _memory_model:byte
EXTRN _error_code:byte
EXTRN _video_page:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _draw_box_b
_draw_box_b proc near
push bp ;
mov bp,sp ;set up 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 _error_code,1 ;1 = row out of range
mov dh,[bp+10] ;top left row
dec dh ;count from 0
cmp dh,24 ;in range?
jna A1 ;jump ahead if so
jmp P1 ;else quit
A1: inc _error_code ;2 = col out of range
mov dl,[bp+8] ;top left col
dec dl ;count from 0
cmp dl,79 ;in range?
jna B1 ;jump ahead if so
jmp P1 ;else quit
B1: inc _error_code ;3 = width out of range
mov bh,_video_page ;get page number
mov bl,[bp+16] ;attribute to BL
mov ah,2 ;func to set cursor
int 10h ;set initial cursor
mov cl,[bp+6] ;get vertical char type
cmp cl,'D' ;is it double?
je C1 ;jump ahead if so
cmp cl,'d' ;is it double?
je C1 ;jump ahead if so
mov al,0B3H ;single vert char
mov ch,0 ;flag single vert chars
jmp short D1 ;jump ahead
C1: mov al,0BAH ;double vert char
mov ch,1 ;flag double vert chars
D1: mov cl,[bp+4] ;get horz char type
mov ah,0cdh ;assume double horz char
cmp cl,'D' ;is it double?
je F1 ;jump ahead if so
cmp cl,'d' ;is it double?
je F1 ;jump ahead if so
mov ah,0C4H ;single horz char
cmp ch,0 ;single vert chars?
je E1 ;jump ahead if so
mov di,0d6b7h ;top dbl vert, sngl horz
mov si,0d3bdh ;bot dbl vert, sngl horz
jmp short H1 ;jump ahead
E1: mov di,0dabfh ;top sngl vert, sngl horz
mov si,0c0d9h ;bot sngl vert, sngl horz
jmp short H1 ;jump ahead
F1: cmp ch,0 ;single vert chars?
je G1 ;jump ahead if so
mov di,0c9bbh ;top dbl vert, dbl horz
mov si,0c8bch ;bot dbl vert, dbl horz
jmp short H1 ;jump ahead
G1: mov di,0d5b8h ;top sngl vert, dbl horz
mov si,0d4beh ;bot sngl vert, dbl horz
H1: mov [bp+4],di ;save top corners
mov [bp+6],si ;save bottom corners
mov [bp+10],ax ;save vert/horz chars
mov cx,1 ;number chars to write
mov al,[bp+5] ;top left char
mov ah,9 ;func to write
int 10h ;write the char
sub cx,cx ;
mov cl,[bp+12] ;width to CX
sub cx,2 ;adjust for end chars
cmp cx,78 ;in range?
jna I1 ;jump ahead if so
jmp P1 ;else quit
I1: inc _error_code ;4 = depth out of range
push cx ;save width for later
push dx ;save initial cursor pos
inc dl ;inc column
jcxz J1 ;jump ahead if zero
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov al,[bp+11] ;get horz char
int 10h ;write line of chars
J1: add dl,cl ;add offset to right end
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov cx,1 ;write 1 char
mov al,[bp+4] ;top right char
int 10h ;write it
push cx ;
sub cx,cx ;
mov cl,[bp+14] ;depth to DI
mov di,cx ;
pop cx ;
sub di,2 ;adjust for end chars
cmp di,23 ;in range?
ja O1 ;quit if not
mov _error_code,0 ;else no error
push di ;save depth counter
cmp di,0 ;test for zero depth
je L1 ;jump ahead if zero
K1: inc dh ;inc column
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov al,[bp+10] ;get vert char
int 10h ;write the char
dec di ;dec counter
jnz K1 ;loop till finished
L1: inc dh ;inc column
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov al,[bp+6] ;bottom right char
int 10h ;write it
pop di ;restore depth counter
pop dx ;restore initial cursor
or di,di ;test for zero depth
jz N1 ;jump ahead if zero
M1: inc dh ;inc column
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov al,[bp+10] ;get vertical char
int 10h ;write it
dec di ;dec counter
jnz M1 ;loop until finished
N1: inc dh ;inc row
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov al,[bp+7] ;bottom left char
int 10h ;write it
inc dl ;inc column
pop cx ;width
jcxz P1 ;quit if zero
mov ah,2 ;function number
int 10h ;reset cursor
mov ah,9 ;ready for write function
mov al,[bp+11] ;get horizontal char
int 10h ;write line of chars
jmp short P1 ;jump ahead
O1: add sp,4 ;balance stack
P1: pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_draw_box_b endp
_TEXT ENDS
END