; Copyright (c) 1996 Brian Fisher ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; 1. Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; 3. The name of the author may not be used to endorse or promote products ; derived from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;*************************************************************************** ;* ;* ;*** Setpal, fadeto,fadetopal ;* ;* .286 Ideal Model Small Public Setpal,fadeto,fadetopal Codeseg doneyet dw 0 red db 0 green db 0 blue db 0 paloff dw 0 palseg dw 0 proc Setpal ; palbuff() ; 6 push bp mov bp,sp push ds si es di cld mov bx,[ss:bp+06] mov si,[ds:bx+0ah] mov ds,[ds:bx+02h] mov dx,03dah mov cx,768 rtr: in al,dx test al,08h jnz rtr tra: in al,dx test al,08h jz tra mov dx,03c8h mov al,0 out dx,al inc dx setit: outsb inc si loop setit pop di es si ds bp retf 2 endp setpal Proc Fadeto ; buff(), red, green, blue ; 12 10 8 6 push bp mov bp,sp push ds si es di cld mov ax,[ss:bp+10] mov [red],al mov ax,[ss:bp+08] mov [green],al mov ax,[ss:bp+06] mov [blue],al mov dx,03c7h mov al,0 out dx,al mov dx,03c9h mov cx,768 mov bx,[ss:bp+12] mov si,[ds:bx+0ah] mov es,[ds:bx+02h] mov ds,[ds:bx+02h] mov bx,si mov di,bx rep insb fadeloop: mov si,bx mov di,bx mov dx,0 mov cx,256 redloop: lodsb mov ah,[red] cmp al,ah ja rdown jb rup inc dx jmp grnloop rdown: dec al jmp grnloop rup: inc al grnloop: stosb lodsb mov ah,[green] cmp al,ah ja gdown jb gup inc dx jmp bluloop gdown: dec al jmp bluloop gup: inc al bluloop: stosb lodsb mov ah,[blue] cmp al,ah ja bdown jb bup inc dx jmp nextclr bdown: dec al jmp nextclr bup: inc al nextclr: stosb loop redloop mov [doneyet],dx mov si,bx mov dx,03dah mov cx,768 retr: in al,dx test al,08h jnz retr trac: in al,dx test al,08h jz trac mov dx,03c8h mov al,0 out dx,al inc dx rep outsb mov ax,[doneyet] cmp ax,768 jb fadeloop pop di es si ds bp retf 8 endp fadeto Proc Fadetopal; pal(), buff() push bp mov bp,sp push ds si es di cld mov dx,03c7h mov al,0 out dx,al mov dx,03c9h mov cx,768 mov bx,[ss:bp+06] mov di,[ds:bx+0ah] mov es,[ds:bx+02h] mov bx,[ss:bp+08] mov si,[ds:bx+0ah] mov ds,[ds:bx+02h] mov [cs:paloff],si mov [cs:palseg],ds rep insb sub di,768 fadeit: mov dx,0 mov cx,768 mov ds,[cs:palseg] mov si,[cs:paloff] clrloop: lodsw mov ah,al mov al,[es:di] cmp al,ah ja down jb up inc dx jmp next down: dec al jmp next up: inc al next: stosb loop clrloop mov [doneyet],dx mov dx,03dah mov cx,768 sub di,768 mov si,di mov ax,es mov ds,ax retra: in al,dx test al,08h jnz retra trace: in al,dx test al,08h jz trace mov dx,03c8h mov al,0 out dx,al inc dx rep outsb mov ax,[doneyet] cmp ax,768 jb fadeit pop di es si ds bp retf 4 endp fadetopal end