home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
screen
/
qkwrite.asm
< prev
next >
Wrap
Assembly Source File
|
1987-02-22
|
3KB
|
107 lines
; QKWRITE.ASM
;
; by Dirk Lesko
;
;
; Copyright (c) 1987 Dirk Andrew Lesko, All Rights Reserved
; * modified from a version by Michael Brill
;
PAGE 60,132
PUBLIC QKWRITE
extrn _ret:far
include extenda.mac
;***************************************************
dl_code segment byte public
assume cs:dl_code,ds:nothing,es:nothing
;---------------------------------------------------
;
; Syntax: call qkwrite with <expN>,<expN>,<expC>,<expN>
; Return: nothing
; Params: <expN> - integer row
; <expN> - integer col
; <expC> - character string
; <expN> - integer attribute
;
; Notes : none
;
;
;
;-----------------
QKWRITE PROC FAR
push bp ;save
mov bp,sp ;
push ds ; Clippers
push es ; registers
get_pcount ;how many params ?
cmp ax,4 ;are their 4 ?
je _cont ; yes, go on
jmp _done ; no go home
_cont:
get_int 4 ;get attribute
push ax ; save it
get_char 3 ;get string
push bx ; and
push ax ; save it
get_int 2 ;get col
push ax ; save it
get_int 1 ;get row
push ax ; save it
pop ax ;get row
mov bl,160 ;160 bytes per row
mul bl ; so multiply by that amount
pop cx ;get column
shl cx,1 ; ready it for screen offset
add cx,ax ; this is our offset into screen buffer
mov di,cx ; di is dest. index of screen buffer
pop ds ;get string segment
pop si ;get string offset
mov ax,0b000h ;assume mono
mov es,ax ; screen buffer
cld ;clear out the direction flag
mov ah,15 ;lets check monitor type
int 10h ;video interrupt
cmp al,7 ;is this mono?
pop ax ;(sneak the attribute in here)
xchg ah,al ; (and put it into ah)
je _mono ; if mono, go write the string
mov bx,0b800h ; otherwise, setup for color
mov es,bx ; screen buffer
mov dx,3dah ;check this port for vertical retrace
jmp short _color ;continue on for color
_mono: lodsb ;get next byte of string, put in al
cmp al,0 ;if null, end of string....
jz _done ;....so return to caller
cmp di,4000 ;if end of screen buffer.....
ja _done ;....return to caller too
stosw ;if not null, word byte to monitor ram
jmp _mono ;and return for the next character
_color:
in al,dx ;read in vertical retrace status
test al,8 ;if retrace bit is set on....
je _color ;....go back and re-poll bit
lodsb ;get next byte from string, put in al
cmp al,0 ;if null, end of string......
jz _done ;....so return to caller
cmp di,4000 ;are we at the end of the screen?
ja _done ; yes, so we're done
stosw ;otherwise, write word to monitor ram
jmp _color ;and return for the next character
_done:
pop es ;restore
pop ds ; Clippers
pop bp ; registers
call _ret ;let Clipper check stack
ret ;far return to Clipper
QKWRITE ENDP
;-----------------------------------------------------------
dl_code ends
;***********************************************************
END