home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
comm
/
ykh121.zip
/
YKHSRC.ZIP
/
TXTLIB.ASM
< prev
next >
Wrap
Assembly Source File
|
1992-11-15
|
7KB
|
461 lines
; 3C4h index 2 (r/W): Sequencer: Map Mask Register
; bit 0 Enable writes to plane 0 if set
; 1 Enable writes to plane 1 if set
; 2 Enable writes to plane 2 if set
; 3 Enable writes to plane 3 if set
;
; 3CEh index 4 (r/W): Graphics: Read Map Select Register
; bit 0-1 Number of the plane read Mode 0 will read from.
.286c
INT_10H MACRO
PUSH BP
INT 10H
POP BP
ENDM
INT_10HP MACRO
PUSH AX
PUSH BX
PUSH CX
PUSH DX
PUSH BP
PUSH DS
PUSH ES
PUSH SI
PUSH DI
INT 10H
POP DI
POP SI
POP ES
POP DS
POP BP
POP DX
POP CX
POP BX
POP AX
ENDM
VIDEOSEG EQU 0B800H
TXTLIB_TEXT segment byte public 'CODE'
TXTLIB_TEXT ends
DGROUP group _DATA,_BSS
assume cs:TXTLIB_TEXT,ds:DGROUP
_DATA segment word public 'DATA'
_DATA ends
_BSS segment word public 'BSS'
_BSS ends
TXTLIB_TEXT segment byte public 'CODE'
;
oldmode db ?
;
;int far TXT_deinit();
;
_txt_deinit proc far
mov ax,3
int 10h
mov dx,3d4h
mov ax,000ah
out dx,ax
; 3d4h index Ah (r/W): CRTC: Cursor Start Register
; bit 0-4 First scanline of cursor within character.
; 5 (VGA) Turns Cursor off if set
xor ax,ax
ret
_txt_deinit endp
;
;int far TXT_init(unsigned scanlines,unsigned fg,unsigned bg,char far* filename);
;
_txt_init proc far
push bp
mov bp,sp
mov ax,3
int 10h
mov dx,3d4h
mov ax,100ah
out dx,ax
; 3d4h index Ah (r/W): CRTC: Cursor Start Register
; bit 0-4 First scanline of cursor within character.
; 5 (VGA) Turns Cursor off if set
xor ax,ax
pop bp
ret
_txt_init endp
;
; void far TXT_put(unsigned TXT,unsigned scanline, unsigned column)
;
_txt_put proc far
push bp
mov bp,sp
push es
push di
mov ax,VIDEOSEG
mov es,ax
mov ax,160
mul word ptr [bp+8]
add ax,[bp+10]
add ax,[bp+10]
mov di,ax
mov al,'X' ;AL = TXT character code
mov ah,30h
stosw
stosw
pop di
pop es
pop bp
ret
_txt_put endp
;
; void far ascii_put(unsigned ascii,unsigned scanline, unsigned column)
;
_txt_ascii_put proc far
push bp
mov bp,sp
push es
push di
mov ax,VIDEOSEG
mov es,ax
mov ax,160
mul word ptr [bp+8]
add ax,[bp+10]
add ax,[bp+10]
mov di,ax
mov ax,[bp+6] ;AL = ascii character code
mov ah,15
stosw
pop di
pop es
pop bp
ret
_txt_ascii_put endp
;
; void far TXT_clear(unsigned scanline, unsigned column,
; unsigned scanlines, unsigned columns);
;
_txt_clear proc far
push bp
mov bp,sp
push es
push di
mov ax,VIDEOSEG
mov es,ax
mov ax,160
mul word ptr [bp+6]
add ax,[bp+8]
add ax,[bp+8]
mov di,ax
mov dx,[bp+12]
xor bx,bx
sub bx,dx
sub bx,dx
add bx,160
xor ax,ax
@@clr: mov cx,dx
rep stosw
add di,bx
dec word ptr [bp+10]
jnz @@clr
pop di
pop es
pop bp
ret
_txt_clear endp
;
; void far TXT_set(unsigned scanline, unsigned column,
; unsigned scanlines, unsigned columns);
;
_txt_set proc far
push bp
mov bp,sp
push es
push di
mov ax,VIDEOSEG
mov es,ax
mov ax,160
mul word ptr [bp+6]
add ax,[bp+8]
add ax,[bp+8]
mov di,ax
mov dx,[bp+12]
xor bx,bx
sub bx,dx
sub bx,dx
add bx,160
mov ax,7fffh
jmp @@clr
;
; NO RET
;
_txt_set endp
;
; void far TXT_xor(unsigned scanline, unsigned column,
; unsigned scanlines, unsigned columns);
;
_txt_xor proc far
@@xorfoo:
push bp
mov bp,sp
push es
push di
mov ax,VIDEOSEG
mov es,ax
mov ax,160
mul word ptr [bp+6]
add ax,[bp+8]
add ax,[bp+8]
mov di,ax
mov dx,[bp+12]
xor bx,bx
sub bx,dx
sub bx,dx
add bx,160
@@clx: mov cx,dx
@@cly: xor byte ptr es:[di+1],7fh
add di,2
loop @@cly
add di,bx
dec word ptr [bp+10]
jnz @@clx
pop di
pop es
pop bp
ret
_txt_xor endp
;
; void far TXT_gray(unsigned scanline, unsigned column,
; unsigned scanlines, unsigned columns);
;
_txt_gray proc far
jmp @@xorfoo
ret
_txt_gray endp
;
; void far TXT_bold8(unsigned scanline, unsigned column,
; unsigned scanlines, unsigned columns);
;
_txt_bold8 proc far
jmp @@xorfoo
ret
_txt_bold8 endp
;
; void far TXT_underline(unsigned scanline, unsigned column,
; unsigned scanlines, unsigned columns);
;
_txt_underline proc far
jmp @@xorfoo
ret
_txt_underline endp
;
; void far TXT_fcopy(unsigned srcy, unsigned srcx,
; unsigned desty, unsigned destx,
; unsigned height, unsigned width );
;
_txt_fcopy proc far
push bp
mov bp,sp
push ds ;save data and extra segments
push si ;
push es ;
push di ;
mov si,VIDEOSEG ;set up segments for video transfer
mov es,si ;
mov ds,si ;
mov ax,160
mul word ptr [bp+6]
add ax,[bp+8]
add ax,[bp+8]
mov si,ax
mov ax,160
mul word ptr [bp+10]
add ax,[bp+12]
add ax,[bp+12]
mov di,ax
mov dx,[bp+16]
mov bx,80
sub bx,dx
shl bx,1
cld
@@cop1: mov cx,dx
rep movsw
add si,bx
add di,bx
dec word ptr [bp+14]
jnz @@cop1
@@copend:
pop di
pop es
pop si
pop ds
pop bp
ret
_txt_fcopy endp
;
; void far TXT_bcopy(unsigned srcy, unsigned srcx,
; unsigned desty, unsigned destx,
; unsigned height, unsigned width );
;
_txt_bcopy proc far
push bp
mov bp,sp
push ds ;save data and extra segments
push si ;
push es ;
push di ;
mov di,VIDEOSEG ;set up segments for video transfer
mov es,di ;
mov ds,di ;
mov ax,160
mul word ptr [bp+6]
add ax,[bp+8]
add ax,[bp+8]
mov si,ax
mov ax,160
mul word ptr [bp+10]
add ax,[bp+12]
add ax,[bp+12]
mov di,ax
mov ax,160
mul word ptr [bp+14]
sub ax,160
add ax,[bp+16]
add ax,[bp+16]
dec ax
dec ax
add si,ax
add di,ax
mov dx,[bp+16]
mov bx,80
sub bx,dx
shl bx,1
std
@@bcop1: mov cx,dx
rep movsw
sub si,bx
sub di,bx
dec word ptr [bp+14]
jnz @@bcop1
cld
pop di
pop es
pop si
pop ds
pop bp
ret
_txt_bcopy endp
;
TXTLIB_TEXT ends
public _txt_init
public _txt_deinit
public _txt_put
public _txt_ascii_put
public _txt_clear
public _txt_set
public _txt_xor
public _txt_gray
public _txt_bold8
public _txt_underline
public _txt_fcopy
public _txt_bcopy
end