home *** CD-ROM | disk | FTP | other *** search
-
- include grphdrvr.inc
-
- ;******************************************************************************}
- ; TEGL Windows ToolKit II }
- ; Copyright (C) 1991, TEGL Systems Corporation }
- ; All Rights Reserved. }
- ;******************************************************************************}
-
- .data
-
- extrn ActiveTEGLMode : dword
-
- .code
-
- pcxheader struc
- manufacturer db ?
- version db ?
- encoding db ?
- bitsperpixel db ?
- xmin dw ?
- ymin dw ?
- xmax dw ?
- ymax dw ?
- HDPI dw ?
- VDPI dw ?
- colormap db 48 dup(?)
- reserved db ?
- NPlanes db ?
- pcxbpl dw ?
- paletteinfo dw ?
- HscreenSize dw ?
- VscreenSize dw ?
- filler db 54 dup(?)
- pcxheader ends
-
-
- egapcx4plane PROC far pcxbuff:dword,baseoffset:word,maxlines:word,maxwidth:word
- public egapcx4plane
- local pcxbpline:word,vertlines:word,bpline:word
-
- push ds
- push si
- push es
- push di
-
- mov dx,3ceh ; dx := graphics controller i/o port
-
- mov ax,3 ; ah := value for data rotate/function
- out dx,ax
-
- mov ax,0805h ; ah := 8 (read mode 1, write mode 0)
- out dx,ax ; al := 5 (mode register)
-
- mov ax,0007 ; ah := 0 (don't care for all maps;
- out dx,ax ; cpu reads always return 0ffh)
- ; al := 7 (color don't care reg number)
-
- mov ax,0ff08h ; ah := 0ffh (value for bit mask reg)
- out dx,ax ; set up bit mask reg
-
- mov dl,0c4h ; dx := 3c4h (sequence i/o port)
-
-
- mov ax,@data
- mov es,ax
- les di,es:ActiveTEGLmode
- mov ax,es:[di].vbytesperline
- mov bpline,ax
-
-
- lds si,pcxbuff ; get pcx buffer
- mov ax,baseoffset
- shr ax,1
- shr ax,1
- shr ax,1
- shr ax,1
- add ax,0a000h ; hard wired for EGA
- mov es,ax
- xor di,di
-
- mov ax,ds:[si].ymax
- sub ax,ds:[si].ymin
- inc ax
- mov vertlines,ax
-
- mov ax,ds:[si].pcxbpl
- mov pcxbpline,ax
-
- mov ax,maxwidth
- shr ax,1
- shr ax,1
- shr ax,1
- mov maxwidth,ax
-
- add si,128
- xor cx,cx
-
- cld
- egapcx4_00: mov ax,0102h ; ah := 1000b (value for map mask reg)
- egapcx4_01: push ax
- push di
- xor bx,bx ; bytes on line
- out dx,ax
-
- egapcx4_02: lodsb ; get 1 byte
- mov ah,al
- and ah,0c0h
- cmp ah,0c0h
- je egapcx4_03
-
- cmp bx,maxwidth
- jge egapcx4_02a
- stosb
- egapcx4_02a: inc bx
- cmp bx,pcxbpline
- jl egapcx4_02
- jmp short egapcx4_04
-
- ; count byte
- egapcx4_03: and al,03fh
- mov cl,al
- lodsb ; get data byte
-
- egapcx4_03b: cmp bx,maxwidth
- jge egapcx4_03a
- stosb
- egapcx4_03a: inc bx
- loop egapcx4_03b
- cmp bx,pcxbpline
- jl egapcx4_02
-
- egapcx4_04: pop di
- pop ax
-
- shl ah,1
- test ah,10h
- jz egapcx4_01
-
- egapcx4_05: add di,bpline
- normalize es,di,bx
- normalize ds,si,bx
-
- dec maxlines
- jz egapcx4_06
-
- dec vertlines
- jnz egapcx4_00
-
- egapcx4_06: mov ax,0f02h
- out dx,ax
-
- mov dl,0ceh
- mov ax,003
- out dx,ax
-
- mov ax,0005
- out dx,ax
-
- mov ax,0f07h
- out dx,ax
-
- mov ax,0ff08h
- out dx,ax
-
- pop di
- pop es
- pop si
- pop ds
-
- ret
- egapcx4plane ENDP
-
-
- egapcx1plane PROC far pcxbuff:dword,baseoffset:word,maxlines:word,maxwidth:word
- public egapcx1plane
- local pcxbpline:word,vertlines:word,bpline:word
-
- push ds
- push si
- push es
- push di
-
- mov dx,3ceh ; dx := graphics controller i/o port
-
- mov ax,0a05h ; al := mode register number
- ; ah := write mode 2 (bits 0-1)
- ; read mode 1 (bit 4)
- out dx,ax
-
-
- mov ax,3 ; ah := value for data rotate/function
- out dx,ax
-
- mov ax,0007 ; ah := 0 (don't care for all maps;
- out dx,ax ; cpu reads always return 0ffh)
- ; al := 7 (color don't care reg number)
-
- ; mov ax,0ff08h ; ah := 0ffh (value for bit mask reg)
- ; out dx,ax ; set up bit mask reg
-
- mov ax,@data
- mov es,ax
- les di,es:ActiveTEGLmode
- mov ax,es:[di].vbytesperline
- mov bpline,ax
-
-
- lds si,pcxbuff ; get pcx buffer
- mov ax,0a000h
- mov es,ax
- mov di,baseoffset
-
- mov ax,ds:[si].ymax
- sub ax,ds:[si].ymin
- inc ax
- mov vertlines,ax
-
- mov ax,ds:[si].pcxbpl
- mov pcxbpline,ax
-
- mov ax,maxwidth
- shr ax,1
- shr ax,1
- shr ax,1
- mov maxwidth,ax
-
- add si,128
- xor cx,cx
-
- cld
- egapcx1_00: xor bx,bx
- push di
-
- egapcx1_01: lodsb ; get 1 byte
- mov ah,al
- and ah,0c0h
- cmp ah,0c0h
- je egapcx1_04
-
- cmp bx,maxwidth
- jge egapcx1_01a
-
- mov ah,al
- mov al,8
- out dx,ax
- and byte ptr es:[di],15
- inc di
-
- egapcx1_01a: inc bx
- cmp bx,pcxbpline
- jl egapcx1_01
- jmp short egapcx1_02
-
- ; count byte
- egapcx1_04: and al,03fh
- mov cl,al
- lodsb ; get data byte
-
- mov ah,al
- mov al,8
- out dx,ax
- egapcx1_03: cmp bx,maxwidth
- jge egapcx1_03a
-
- and byte ptr es:[di],15
- inc di
-
- egapcx1_03a: inc bx
- loop egapcx1_03
-
- cmp bx,pcxbpline
- jl egapcx1_01
-
- egapcx1_02: pop di
-
- egapcx1_05: add di,bpline
- ; normalize es,di,bx
-
- dec maxlines
- jz egapcx1_06
-
- dec vertlines
- jnz egapcx1_00
-
- egapcx1_06: mov ax,0ff08h ; default bit mask
- out dx,ax
-
- mov ax,0005 ; default mode register
- out dx,ax
-
- mov ax,0003 ; default data rotate/function select
- out dx,ax
-
- mov ax,0f07h ; default color don't care
- out dx,ax
-
- pop di
- pop es
- pop si
- pop ds
-
- ret
- egapcx1plane ENDP
- end