home *** CD-ROM | disk | FTP | other *** search
- //
- // *************************************************************************
- // * *
- // * OMEGA C++ Windowing Class Library *
- // * ================================= *
- // * *
- // * Copyright 1991,92 Tom Clancy *
- // * Submitted to the public domain, April 1992 *
- // * *
- // *************************************************************************
- // * *
- // * Assembly Routines for Fast Screen Writing *
- // * *
- // *************************************************************************
- //
-
- #include <dos.h>
- #include <string.h>
- #include "fastwrit.hpp"
-
- int FWIDTH;
-
- void fastwritestr(int x, int y, char fg, char bk, char far *str, int vseg, int voff) {
-
- asm {
- push ax
- push bx
- push si
- push di
- push es
- push ds
- dec x
- dec y
- mov ax,[vseg]
- push ax
- pop es
- xor ax,ax
- add ax,y
- mov bx,FWIDTH
- mul bx
- mov bx,x
- shl bx,1
-
- add ax,bx
- add ax,[voff]
- mov di,ax
- push es
- push di
- }
-
- _CX=_fstrlen(str);
-
- asm {
- pop di
- pop es
- lds si,str
-
- xor ax,ax
- mov ah,bk
- shl ah,1
- shl ah,1
- shl ah,1
- shl ah,1
- add ah,fg
- }
-
- getnext:
-
- asm {
- lodsb
- stosw
- loop getnext
- pop ds
- pop es
- pop di
- pop si
- pop bx
- pop ax
- }
- }
-
-
- void plainwritestr(int x, int y, char far *str, int vseg, int voff) {
-
- asm {
- push ax
- push bx
- push si
- push di
- push es
- push ds
- dec x
- dec y
- mov ax,[vseg]
- push ax
- pop es
- xor ax,ax
- add ax,y
- mov bx,FWIDTH
- mul bx
- mov bx,x
- shl bx,1
-
- add ax,bx
- add ax,[voff]
- mov di,ax
- push es
- push di
- }
-
- _CX=_fstrlen(str);
-
- asm {
- pop di
- pop es
- lds si,str
-
- }
-
- getnext:
-
- asm {
- lodsb
- stosb
- inc di
- loop getnext
- pop ds
- pop es
- pop di
- pop si
- pop bx
- pop ax
- }
- }
-
- void fastwritech(int x, int y, char fg, char bk, unsigned char c, int vseg, int voff) {
-
-
- asm {
- push ax
- push bx
- push si
- push di
- push es
- push ds
- dec x
- dec y
- mov ax,[vseg]
- push ax
- pop es
- xor ax,ax
- add ax,y
- mov bx,FWIDTH
- mul bx
- mov bx,x
- shl bx,1
-
- add ax,bx
- add ax,[voff]
- mov di,ax
-
- xor ax,ax
- mov ah,bk
- shl ah,1
- shl ah,1
- shl ah,1
- shl ah,1
- add ah,fg
- mov al,c
- stosw
- pop ds
- pop es
- pop di
- pop si
- pop bx
- pop ax
- }
- }
-
- void plainwritech(int x, int y, unsigned char c, int vseg, int voff) {
-
-
- asm {
- push ax
- push bx
- push si
- push di
- push es
- push ds
- dec x
- dec y
- mov ax,[vseg]
- push ax
- pop es
- xor ax,ax
- add ax,y
- mov bx,FWIDTH
- mul bx
- mov bx,x
- shl bx,1
-
- add ax,bx
- add ax,[voff]
- mov di,ax
-
- mov al,c
- stosb
- pop ds
- pop es
- pop di
- pop si
- pop bx
- pop ax
- }
- }
-
- void fastattrib(int y, int x1, int x2, char fg, char bk, int vseg, int voff) {
-
- asm {
- push ax
- push bx
- push si
- push di
- push es
- push ds
- dec x1
- dec x2
- dec y
- mov ax,[vseg]
- push ax
- pop es
- xor ax, ax
- add ax,y
- mov bx,FWIDTH
- mul bx
- mov bx,x1
- shl bx,1
-
- add ax,bx
- add ax,[voff]
- mov di,ax
- push es
- push di
- }
-
- _CX=(x2-x1)+1;
-
- asm {
- pop di
- pop es
-
- xor ax,ax
- mov al,bk
- shl al,1
- shl al,1
- shl al,1
- shl al,1
- add al,fg
- }
-
- getnext:
-
- asm {
- inc di
- stosb
- loop getnext
- pop ds
- pop es
- pop di
- pop si
- pop bx
- pop ax
- }
- }
-
-
- void shadowchar(int x, int y, int vseg, int voff) {
- asm {
- push ax
- push bx
- push si
- push di
- push es
- push ds
- dec x
- dec y
- mov ax,[vseg]
- push ax
- pop es
- xor ax,ax
- add ax,y
- mov bx,FWIDTH
- mul bx
- mov bx,x
- shl bx,1
-
- add ax,bx
- add ax,[voff]
- mov di,ax
-
- push di
- mov si,di
- push es
- pop ds
-
- lodsw
-
- and ax,2047
-
- pop di
- stosw
- pop ds
- pop es
- pop di
- pop si
- pop bx
- pop ax
- }
- }
-