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
/
ASSERT.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-12-08
|
12KB
|
298 lines
PAGE ,132
TITLE ASSERT.ASM
;UPDATE HISTORY:
;===============
;14/11/84 convert to v2 ci86
;29/11/84 fix bug in repl mode
; 4 dec 84 move PATTERN.ASM into this program
;27 Dec 84 move delay loop from gdc_nb to fifo_mt
;26 Apr 85 add enb_gr and dis_gr
include asmc.h
SEGEND CODE
SEGDEF DATA
include asmd.h
SEGEND DATA
SEGDEF CODE
PUBLIC gdc_nb, fifo_mt, g_off, g_on, a_mode
PUBLIC a_fgbg, a_alups, a_gbmsk, a_wmode
PUBLIC enb_gr, dis_gr, a_patrn
;********************************************************************
;* *
;* f u n c t i o n gdc_nb() *
;* *
;* gdc_not_busy will put a harmless command into the GDC and *
;* wait for the command to be read out of the command FIFO. *
;* This means that the GDC is not busy doing a write or read *
;* operation. *
;* *
;* entry: none *
;* exit: ax = 0 if more than approx 74ms elapsed *
;* without "gdc not busy" *
;********************************************************************
PROCDEF gdc_nb
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
ret ;ax = 1 == TRUE
PROCEND 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
push cx ;use cx as a time-out loop counter.
mov cx,8000H ;wait for FIFO not full or reasonable time.
L0: in al,56H ;first check if the FIFO is full.
and al,2
loopnz L0
mov ax,46FH
out 57H,al
L5: in al,56H
test al,ah
jz L5
pop cx
ret
PROCEND fifo_mt
;********************************************************************
;* *
;* f u n c t i o n g_off() *
;* *
;* purpose: disable graphics output *
;* *
;********************************************************************
PROCDEF g_off
exit_graf:
call dis_gr
and BYTE PTR gbmod,7FH ;disable graphics 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:
call enb_gr
mov al,BYTE PTR ws_type ;chk work_station loaded
or al,al
jz Leg
mov al,87H
out 0AH,al ;enable graphics on monochrome line
or BYTE PTR gbmod,80H ;enable graphics output in gbmod
jmp a_mode
Leg: ret
PROCEND g_on
;********************************************************************
;* *
;* f u n c t i o n s a_mode() *
;* *
;* purpose: set mode register to the value held in *
;* gbmod *
;* *
;********************************************************************
PROCDEF a_mode
mov al,0BFH ;address the mode register through
out 53H,al ;the indirect register
mov al,BYTE PTR gbmod
out 51H,al ;load the mode register
ret
PROCEND a_mode
;*****************************************************************************
;* *
;* f u n c t i o n a_fgbg() *
;* *
;* purpose: Load the Foreground;Background Register *
;* *
;*****************************************************************************
PROCDEF a_fgbg
mov al, 0F7H ;select the Foreground;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 Select Register *
;* *
;*****************************************************************************
PROCDEF a_alups
mov 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 value into ALU;PS Register
ret
PROCEND a_alups
;*****************************************************************************
;* *
;* F U N C T I O N a_gbmsk() *
;* *
;* purpose: 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 the 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 ;get old alups
and ah,0FH ;mask off plane writes
or al,ah ;add to new write mode
mov BYTE PTR alups,al ;and save.
call a_alups
mov al,0F0H ;enable fore_ground writes in case the 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 enb_gr() *
;* *
;* purpose: Enable graphics out to the screen. THIS IS NOT THE SAME AS *
; g_on(), you are still in graphics mode *
;* *
;*****************************************************************************
PROCDEF enb_gr
call gdc_nb
mov al,0DH
out 57H,al
ret
PROCEND enb_gr
;*****************************************************************************
;* *
;* F U N C T I O N dis_gr() *
;* *
;* purpose: Disable graphics out to the screen. THIS IS NOT THE SAME AS*
;* g_off(), you are still in graphics mode *
;* *
;*****************************************************************************
PROCDEF dis_gr
call gdc_nb
mov al,0CH
out 57H,al
ret
PROCEND dis_gr
;*****************************************************************************
; *
; f u n c t i o n a_patrn() *
; *
; purpose: Load the Pattern Multiplier 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
;when the repeat factor is:
;
; 1 2 3
; 0FFh |--------| |----------------| |------------------------|
; 0AAh |- - - - | |-- -- -- -- | |--- --- --- --- |
; 0F0h |---- | |-------- | |------------ |
; 0CDh |-- -- -| |---- ---- --| |------ ------ ---|
;
PROCDEF a_patrn
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 53H, al
mov al, 1[bx]
dec al ;adjust bl to be zero-relative
not al ;invert it [remember Pattern Register is
;multiplied by 16 minus multiplier value]
and al,0FH ;load the Pattern Multiplier
out 51H, al
mov al,0FBH ;select the Pattern Register
out 53H, al
mov al, [bx] ;get the pattern data
out 51H, al ;load the Pattern Register
pop cx
pop bx
ret
PROCEND a_patrn
include epilogue.h
END