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
/
grlibfor.arj
/
GTEXT.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-12-11
|
10KB
|
380 lines
PAGE ,132
;GTEXT.ASM
;UPDATE HISTORY
;==============
;15 nov 84 Conver
t to C86 V2.2
include asmc.h
SEGEND CODE
SE
GDEF DATA
EXTRN t_x_:WORD, t_y_:WORD, t_col_:BYTE, gbmod_:BYTE,
sh_p_lin_:BYTE
EXTRN ymax_:WORD, xmax_:WORD, curl0_:BYTE, curl2_:BY
TE
EXTRN y_start_:WORD,x_start_:WORD
EXTRN tfonts_:BYTE, t_font_
:BYTE, gbmskl_:BYTE
SEGEND DATA
SEGDEF CODE
P
UBLIC 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_:NEA
R, a_gbmsk_:NEAR, a_cur_:NEAR
EXTRN fifo_mt_:NEAR, cxy2cp_:NEAR
ENDIF
;************************************************************************
;* *
;* F U N C T I O N gtext_(x, y, s
tring) *
;* int x, y; *
;* char *string; *
;* *
;* purpose: print a string of text at a specific 'xy' *
;* po
sition. X & Y are defined as pixel locations *
;* at the bottom le
ft of the character cell. *
;* *
;* entry: 6[bp] 'x' posit
ion *
;* 8[bp] 'y' position *
;* 10[bp] pointer to NULL te
rminated string *
;* *
;************************************************************************
PROCDEF gtext_
pus
h 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 sur
e we inc 'si'.
test BYTE PTR gbmod_,2
jz Lt0 ;jump if a
lready in text mode else
and BYTE PTR gbmod_,0FDH ;assert text
mode.
call a_mode_
Lt0: lodsb
or al,al ;check fo
r 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: writ
e graphics text *
;* entry: 6[bp] character to be written *
;* *
;* conditions: 1) text cursor is correctly placed *
;*
2) fgbg and alups already defined *
;* 3) text font has been sele
cted *
;************************************************************************
PROCDEF gchar_
push si
push b
p
mov bp,sp
mov ax,6[bp]
cmp al,1FH ;unprin
table character0
ja L0 ;jump if not.
call L20 ;see i
f it's one of the control chars
jmp L11 ; we can handle, then e
xit.
L0: test al,80H ;is character within table0
jz L1
;jump if not.
jmp L11 ;if yes just exit.
;adjust co-ordi
nates in t_x_ & t_y_ and assert the cursor.
L1: mov ax,WORD P
TR 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.
sub ax,10 ;move 'y' to
top left of character cell.
jns L1a
xor ax,ax
L1a:
mov WORD PTR y_start_,ax
call cxy2cp_
mov ax, 6[bp]
sub al,20H ;table starts with a space at 0.
xor ah,ah
shl ax,1
mov bx,ax ;bx = al * 2
shl ax,1
sh
l 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
inc al
L4: dec al
jz L5
add si,960 ;add font table size to table offset
jmp L4
L5
: add si,bx ;si now points to the 10DB table entry
test
WORD PTR t_x_,8
jnz L3a
mov WORD PTR gbmskl_,000FFH
jmp L3b
L3a: mov WORD PTR gbmskl_,0FF00H
L3b: call gdc_n
b_
call a_gbmsk_ ;assert the graf board mask
cld ;
make sure lodsb incs si.
mov al,0FEH ;reset the char ram counte
r.
out 53H,al
out 51H,al
lodsw ;fetch both bytes.
out 52H,al ;put the byte into both 1 and 2 char ram bytes.
out 52H, al
mov al,ah
out 52H, al ;put theDB into both
1 and 2 char ram bytes.
out 52H, al
mov al,0FEH ;reset t
he char ram counter.
out 53H,al
out 51H,al
call
a_cur_ ;assert the cursor command.
mov al,4CH ;assert the {04
c command.
out 57H,al
xor al,al ;assert the down direct
inon to write.
out 56H,al
inc al ;do it 2 write cycles.
out 56H,al
dec al
out 56H,al
mov al,22H
;assert the wdat command.
out 57H,al
mov al,0FFH
out
56H,al
out 56H,al
call gdc_nb_
mov cx,8
;eight scan lines.
L8: lodsb ;fetch theDB.
out 52H, a
l ;put theDB into both 1 and 2 char ram bytes.
out 52H, al
loop L8
mov al,4CH ;assert the figs command.
out 5
7H,al
mov al,00 ;assert the down directinon to write.
ou
t 56H,al
mov ax,7 ;do 8 write cycles.
out 56H,al
mov al,ah
out 56H,al
mov al,22H ;assert the wdat com
mand.
out 57H,al
mov al,0FFH
out 56H,al
out
56H,al
;Now adjust the text character position & test for word wr
apping
mov ax, WORD PTR t_x_
add ax,8 ;character w
idth
cmp WORD PTR xmax_,ax ;have we gone past the end of the l
ine0
jns L9
xor ax,ax ;back to start of line
L9:
mov WORD PTR t_x_,ax
jnz L11 ;exit if we don't have to go to
a new line.
mov ax,WORD PTR t_y_
sub ax,10 ;move to n
ext character line
or ax,ax ;are we on last line already0
jns L10
xor ax,ax
L10: mov WORD PTR t_y_,ax
L11:
pop bp
pop si
ret
;Control character handler [
ax contains the character]:
; 007 bell
; 008 back_space
; 009 tab
; 00a line_feed [also does a carriage_return]
; 00c clear_screen [********* not yet *********]
; 00d carriage_return
L20: cmp al,7 ;is it a bell ?
jnz L30
L21: mov
cl,2
mov dl, al
int 0E0H
ret
L30: cmp a
l,8 ;is it back_space ?
jnz L40
cmp WORD PTR t_x_, 0
jnz L31
mov ax,7
jmp L21
L31: sub WORD PTR
t_x_,8
ret
L40: cmp al,9 ;is it tab ?
jnz L5
0
mov ax, WORD PTR t_x_
and ax, 0FFC0H ;go back to las
t multiple of 64
add ax,64 ;next tab position
cmp WORD
PTR xmax_,ax
jns L41
mov ax,7
jmp L21
L41:
mov WORD PTR t_x_,ax
ret
L50: cmp al,0AH ;is it line
_feed ?
jnz L60
L51: mov ax,WORD PTR t_y_
sub ax,
10
or ax,ax
jns L52
mov ax,7
jmp L21
L52: mov WORD PTR t_y_, ax
ret
L60: cmp al,0CH ;is
it clear_screen ?
jnz L70
mov WORD PTR t_y_,10 ;for n
ow, just home cursor.
mov WORD PTR t_x_,10
L61: ret
L70: cmp al,0DH ;is it carriage_return ?
jnz L61 ;exit i
f not.
mov WORD PTR t_x_,0
jmp L51
PROCEND gch
ar_
include epilogue.h
END