home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.update.uu.se
/
ftp.update.uu.se.2014.03.zip
/
ftp.update.uu.se
/
pub
/
rainbow
/
msdos
/
decus
/
RB140
/
grlib03a.arj
/
GTEXT.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-12-08
|
6KB
|
273 lines
PAGE ,132
TITLE GTEXT.ASM
;UPDATE HISTORY
;==============
;15 nov 84 Convert to C86 V2.2
;21-dec-84 fix some things
include asmc.h
SEGEND CODE
SEGDEF DATA
include asmd.h
Lj DW Lshsw, Lshdw, Ldhsw, Ldhdw
SEGEND DATA
SEGDEF CODE
PUBLIC gtext, gchar
IF @bigmodel
EXTRN gdc_nb:FAR, chk_col:FAR, a_mode:FAR, a_gbmsk:FAR, a_cur:FAR
EXTRN fifo_mt:FAR, cxy2cp:FAR
ELSE
EXTRN gdc_nb:NEAR, chk_col:NEAR, a_mode:NEAR, a_gbmsk:NEAR, a_cur:NEAR
EXTRN fifo_mt:NEAR, cxy2cp:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N gtext(x, y, string) *
;* int x, y, style; *
;* *
;* purpose: print a string of text at a specific 'xy' *
;* position. X & Y are defined as pixel locations *
;* at the bottom left of the character cell. *
;* *
;* entry: 6[bp] 'x' position *
;* 8[bp] 'y' position *
;* 10[bp] pointer to NULL terminated string *
;* *
;************************************************************************
PROCDEF gtext
push si
push bp
mov bp,sp
mov ax,6[bp] ;get 'x' position
mov WORD PTR t_x,ax ;and save.
mov ax,8[bp] ;get 'y' position
mov WORD PTR t_y,ax ;and save.
call gdc_nb
mov al,BYTE PTR t_col
call chk_col
mov si,10[bp] ;point to start of string
cld ;make sure we inc 'si'.
test BYTE PTR gbmod,2
jz Lt0 ;jump if already in text mode else
and BYTE PTR gbmod,0FDH ;assert text mode.
call a_mode
Lt0: lodsb
or al,al ;check for the end of string.
jz Lt1 ;quit if it is.
push ax
call gchar
add sp,2
jmp Lt0
Lt1: pop bp
pop si
ret
PROCEND gtext
;************************************************************************
;* *
;* f u n c t i o n gchar(char) *
;* *
;* purpose: write graphics text *
;* entry: 8[bp] character to be written *
;* *
;* conditions: 1) text cursor is correctly placed *
;* 2) fgbg and alups already defined *
;* 3) text font has been selected *
;* 4) text scale (t_sca) has been set *
;* t_sca will determine the style to be used to display *
;* the character: *
;* 0 = single height, single width *
;* 1 = single height, double width *
;* 2 = double height, single width *
;* 3 = double height, double width *
;************************************************************************
PROCDEF gchar
push di
push si
push bp
mov bp,sp
mov ax,cs:eseg_sav ;just in case.
mov es,ax
;adjust co-ordinates in t_x & t_y.
mov ax,WORD PTR t_x ;get column number
and ax,0FFF0H
mov WORD PTR x_start,ax
mov ax,WORD PTR ymax
sub ax,WORD PTR t_y ;t_y specified as bot_left of ch cell.
mov bx,9
cmp BYTE PTR t_sca,2
js L0
add bx,10
L0: sub ax,bx ;move 'y' to top left of character cell.
jns L1
xor ax,ax
L1: mov WORD PTR y_start,ax
mov ax, 8[bp]
xor ah,ah
shl ax,1
mov bx,ax ;bx = al * 2
shl ax,1
shl ax,1 ;ax = al * 8
add bx,ax ;bx = al * 10
lea si, tfonts ;point to start of font table
mov al,BYTE PTR t_font ;get font type
xor ah,ah
shl ax,1 ;make it a word offset
add si,ax ;and get the address of the font area
mov si,WORD PTR [si]
add si,bx ;si now points to the character in the
lea di,gp_buff ;font area
test BYTE PTR t_sca, 1
jz L1a
mov WORD PTR gbmskl,0000H
jmp L1c
L1a: test WORD PTR t_x,8
jnz L1b
mov WORD PTR gbmskl,000FFH
jmp L1c
L1b: mov WORD PTR gbmskl,0FF00H
L1c: cld
mov al, BYTE PTR t_sca
and al,03H
shl al,1
xor ah,ah
lea bx,WORD PTR Lj
add bx,ax
mov cx,10 ;number of scan lines
call [bx]
;output the bytes at gp_buff via the character ram.
call gdc_nb
call a_gbmsk ;assert the graf board mask
call cxy2cp ;assert the xy drawing position.
add WORD PTR t_x,8
test BYTE PTR t_sca,1
jz L1d
add WORD PTR t_x,8
L1d:
lea si,gp_buff
cmp BYTE PTR t_sca,2
jns Lgta
mov bx,20
jmp Lgtb
Lgta: mov bx,40
Lgtb: mov dl,0
Lgt1: mov cx,16 ;always 16 bytes first time round.
Lgt2: call gdc_nb
mov al,0FEH ;reset the char ram counter.
out 53H,al
out 51H,al
push cx
Lgt3: lodsb ;load CX number of bytes
out 52H,al
loop Lgt3
mov al,0FEH ;reset the char ram counter.
out 53H,al
out 51H,al
mov al,4CH ;assert the figs command.
out 57H,al
xor al,al ;assert the down directinon to write.
out 56H,al
pop ax ;find the number of word writes - 1
shr ax,1
dec ax
out 56H,al
mov al,ah
out 56H,al
mov al,22H ;assert the wdat command.
out 57H,al
mov al,0FFH
out 56H,al
out 56H,al
or dl,dl
jnz Lgt4
sub bx,16
cmp bx,16
jns Lgt1
mov cx,bx
mov dl,1
jmp Lgt2
Lgt4: pop bp
pop si
pop di
ret
;The following 4 routines do the bit and byte shuffles with
;the resulting bytes to output at gp_buff.
Lshsw: lodsb
mov ah,al
stosw
loop Lshsw
ret
Lshdw: push cx
mov cx,8
lodsb
xor dx,dx
Lshdw1: shr dx,1
shr dx,1
shr al,1
jnc Lshdw2
or dx,0C000H
Lshdw2: loop Lshdw1
mov ax,dx
xchg ah,al
stosw
pop cx
loop Lshdw
ret
Ldhsw: lodsb
mov ah,al
stosw
stosw
loop Ldhsw
ret
Ldhdw: push cx
mov cx,8
lodsb
xor dx,dx
Ldhdw1: shr dx,1
shr dx,1
shr al,1
jnc Ldhdw2
or dx,0C000H
Ldhdw2: loop Ldhdw1
mov ax,dx
xchg ah,al
stosw
stosw
pop cx
loop Ldhdw
ret
PROCEND gchar
include epilogue.h
END