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
/
ASSERT.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-12-11
|
11KB
|
358 lines
PAGE ,132
TITLE ASSERT.ASM
;14/11/84 convert to v2 ci86
;29/11
/84 fix bug in repl mode
; 4 dec 84 move PATTERN.ASM into this progr
am
include asmc.h
SEGEND CODE
SEGDEF DATA
EXTRN gbmod_:BYTE, ws_number_:BYTE, fgbg_:BYTE, alups_:BYTE
EX
TRN gbmskl_:BYTE, ws_wmo_:BYTE
EXTRN l_type_:BYTE, pattbl_:BYTE
SEGEND DATA
SEGDEF CODE
PUBLIC gdc_nb_, fifo_mt
_, g_off_, g_on_, a_mode_
PUBLIC a_fgbg_, a_alups_, a_gbmsk_, a_wmod
e_
PUBLIC a_patrn_
;********************************************************************
;* *
;* f u n c t i o n
gdc_nb() *
;* *
;* gdc_not_busy will put a harmless comma
nd into the GDC and *
;* wait for the command to be read out of t
he command FIFO. *
;* This means that the GDC is not busy doing a
write or read *
;* operation. *
;* *
;* entry: non
e *
;* exit: ax = 0 if more than approx 74ms elapsed *
;*
without "gdc not busy" *
;********************************************************************
PROCDEF gdc_nb_
push
cx ;use cx as a time-out loop counter.
mov cx,8000H ;wait fo
r FIFO not full or reasonable time.
L0: in al,56H ;first check
if the FIFO is full.
and al,2
jz L1 ;jump if not.
loop L0
L1: call fifo_mt_ ;wait for fifo to empty
L2: in al,56H ;wait for vert. or horiz. sync
and al,60H
jz L2
in al,56H
and al,8 ;is GDC still drawing ?
jnz L2
pop cx
ret ;ax = 1 == TRUE
P
ROCEND gdc_nb_
;This routine is in as a fast check that the GDC's
fifo is empty but does
;not check anything else.
PROCDEF
fifo_mt_
mov ax,40DH
out 57H,al
L5: in al,56H
test al,ah
jz L5
ret
PROCEND fifo_mt_
;
********************************************************************
;* *
;* f u n c t i o n g_off_() *
;* *
;* p
urpose: disable graphics output *
;* *
;********************************************************************
PROCDE
F g_off_
exit_graf_:
and BYTE PTR gbmod_,7FH ;disable graphi
cs output in gbmod
call a_mode_ ;assert new mode register
mov al,83H
out 0AH,al ;turn off graphics on monochrome line
ret
PROCEND g_off_
;********************************************************************
;* *
;* f u n c t i o
n g_on_() *
;* *
;* purpose: enable graphics output *
;* *
;********************************************************************
PROCDEF g_on_
enter_graf_:
mov
al,BYTE PTR ws_number_ ;chk work_station loaded
or al,al
jz Lam
mov al,87H
out 0AH,al ;enable graphics on monoc
hrome line
or BYTE PTR gbmod_,80H ;enable graphics output in gb
mod
PROCEND g_on_
;********************************************************************
;* *
;* f u n c t i o n s
a_mode_() *
;* *
;* purpose: set mode register to the v
alue held in *
;* gbmod *
;* *
;********************************************************************
PROCDEF
a_mode_
mov al,0BFH ;address the mode register through
ou
t 53H,al ;the indirect register
mov al,BYTE PTR gbmod_
out 51H,al ;load the mode register
Lam: ret
PROCEND a_mo
de_
;*****************************************************************************
;* *
;* f u n c t i o n a_fgbg_() *
;*
*
;* purpose: Load the Foreground;Background Register *
;*
*
;*****************************************************************************
PROCDEF a_fgbg_
mov al, 0F7H ;select the Fo
reground;Background Register
out 53H, al
mov al, BYTE PTR
fgbg_
out 51H, al ;load the Foreground;Background Register
ret
PROCEND a_fgbg_
;*****************************************************************************
;* *
;* F U N C T I
O N a_alups_() *
;* *
;* purpose: Set the ALU ; Plane Se
lect Register *
;* *
;*****************************************************************************
PROCDEF a_alups_
mo
v al,0EFH ;select the ALU;PS Register
out 53H,al
mov al
, BYTE PTR alups_ ;move ALU;PS value to al
out 51H,al ;load v
alue into ALU;PS Register
ret
PROCEND a_alups_
;*****************************************************************************
;* *
;* F U N C T I O N a_gbmsk_() *
;* *
;* purp
ose: Set the graphics board mask to values held *
;* in gbmskl_
and gbmskh_ *
;* *
;*****************************************************************************
PROCDEF a_gbmsk_
mov
ax,WORD PTR gbmskl_ ;get the mask value to load
out 54H,al
mov al, ah
out 55H,al
ret
PROCEND a_gbmsk_
;*****************************************************************************
;* *
;* F U N C T I O N a_wmode_() *
;* *
;*
purpose: Juggle fgbg reg. & alups reg. to make GDC *
;* write t
he correct colours in the correct *
;* manner to the bit map. *
;* *
;*****************************************************************************
PROCDEF a_wmode_
push bp
mov
bp,sp
call gdc_nb_
mov al,BYTE PTR ws_wmo_ ;get the
write mode requested.
cmp al,3 ;check for erase mode.
jz
La0
mov cl,4
shl al,cl
mov ah,BYTE PTR alups_ ;ge
t old alups
and ah,0FH ;mask off plane writes
or al,ah
;add to new write mode
mov BYTE PTR alups_,al ;and save.
c
all a_alups_
mov al,0F0H ;enable fore_ground writes in case t
he last
jmp La1 ;write mode was erase.
La0: mov BYTE PTR
alups_,0 ;put alu into replace mode, all planes.
call a_alups_
xor al,al ;write zero's to all planes no matter what.
La1:
mov BYTE PTR fgbg_,al
call a_fgbg_
pop bp
ret
PROCEND a_wmode_
;*****************************************************************************
; *
; f u n c
t i o n a_patrn_() *
; *
; purpose: Load the Pattern Mul
tiplier and Pattern Register *
; for line drawing. *
; *
; caution: You must load the Pattern Multiplier before *
;
loading the Pattern Register *
; *
;*****************************************************************************
;
;The following
are some register values and the corresponding output patterns
;whe
n the repeat factor is:
;
; 1 2 3
; 0FFh |--------| |----------------
| |------------------------|
; 0AAh |- - - - | |-- -- -- -- | |--- --- ---
--- |
; 0F0h |---- | |-------- | |------------ |
; 0CDh |-
- -- -| |---- ---- --| |------ ------ ---|
;
PROCDEF a_patr
n_
push bx
push cx
mov cl,BYTE PTR l_type_
xor ch,ch
add cx,cx
lea bx, pattbl_
add
bx,cx
mov al,0FDH ;select the Pattern Multiplier
out 53
H, al
mov al, 1[bx]
dec al ;adjust bl to be zero-relati
ve
not al ;invert it [remember Pattern Register is
;multi
plied by 16 minus multiplier value]
and al,0FH ;load the Patte
rn Multiplier
out 51H, al
mov al,0FBH ;select the Pa
ttern Register
out 53H, al
mov al, [bx] ;get the patte
rn data
out 51H, al ;load the Pattern Register
pop c
x
pop bx
ret
PROCEND a_patrn_
include epilo
gue.h
END