home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
WNDTOOL5.ZIP
/
FASTPRT.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-24
|
7KB
|
152 lines
;
;Title:Fastprt
BASIC_SETUP MACRO
PUSH BP
MOV BP,SP
PUSH AX
PUSH BX
PUSH DX
PUSH CX
PUSH SI
PUSH DI
PUSH DS
PUSH ES
ENDM
BASIC_CLEANUP MACRO
CLD
POP ES
POP DS
POP DI
POP SI
POP DX
POP CX
POP BX
POP AX
POP BP
ENDM
Bios_data SEGMENT At 40H ; set up labels to determine whether
ORG 10H ; to display in color or monochrome
Equip_flag LABEL WORD
ORG 4AH ; 40 or 80 column display
Crt_clms LABEL WORD
ORG 63H
Addr_6845 LABEL WORD ; pointer to video card ports
Bios_data ENDS
;
Code SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:Code,DS:Code
PUBLIC Fastprt
Fastprt PROC FAR
Basic_setup ; save bp for far return
MOV BX,[BP+8] ; get addr of col% storage
MOV DI,[BX] ; get the column value
DEC DI ; adjust for locate format
MOV BX,[BP+10] ; get addr of row% storage
MOV AX,[BX] ; get the row value
DEC AX ; adjust for locate format
MOV BX,[BP+12] ; set ptr to string descriptor
MOV CX,[BX] ; get length of string
JCXZ Exit ; done if null string
MOV SI,[BX+2] ; si = first character of var$
MOV BX,Bios_data ; set ready to determine video card
MOV ES,BX ; and number of columns
MUL ES:Crt_clms ; ax = col% times words per line
ADD DI,AX ; di = words from start of screen
SHL DI,1 ; shift for attribute byte
; CX has the count of characters to write
; SI points to the string to print
; DI points to the starting screen position
MOV AX,0B000H ;default to mono card
MOV BX,ES:Equip_flag
AND BX,30H
CMP BX,30H ; monochrome?
JE Mono ; jump if so
MOV AX,0B800H ; set to color card
MOV DX,ES:Addr_6845 ; point to 6845 base port
ADD DX,6 ; point to status port
MOV BX,[BP+6] ; get color attribute
MOV BX,[BX]
MOV ES,AX ; point es to video
CALL Print_string
JMP Exit
mono:
MOV DX,ES:Addr_6845 ; point to 6845 base port
ADD DX,6 ; point to status port
MOV BX,[BP+6] ; get color attribute
MOV BX,[BX]
MOV ES,AX ; point es to video
movestr:
MOVSB ; print a character
MOV ES:[DI],BL ; move attribute
INC DI ; skip attribute byte
LOOP Movestr ; repeat until end of string
exit:
Basic_cleanup
RET 8
Fastprt ENDP
;
Print_string PROC NEAR ; wait for horizontal retrace
CLI ; turn off interrupts
test_low:
IN AL,DX ; get status
JMP SHORT $+2
TEST AL,1 ; is it low?
JNZ Test_low ; if not, try again
test_hi:
IN AL,DX ; get status
JMP SHORT $+2
TEST AL,1 ; is it high?
JZ Test_hi ; if not, try again
MOVSB ; print a character
STI
NOP
CLI
tst_low2:
IN AL,DX ; get status
JMP SHORT $+2
TEST AL,1 ; is it low?
JNZ Tst_low2 ; if not, try again
tst_hi2:
IN AL,DX ; get status
JMP SHORT $+2
TEST AL,1 ; is it high?
JZ Tst_hi2 ; if not, try again
MOV ES:[DI],BL ; move attribute
INC DI ; skip attribute byte
STI ; turn interrupts back on
LOOP PRINT_STRING ; repeat until end of string
RET ; return to the fastprt procedure
Print_string ENDP
Code ENDS
END