home *** CD-ROM | disk | FTP | other *** search
- ; ST3FIX - Code by Shades who is actualy pretty ashamed of this shit..
- ;
- ; Coded mainly as a fix for ST3 cause it wont reload the palette from
- ; st3.set <bah!>
- ;
- ; st3 SAVES just fine .. fucker wont load it tho! ;-(
- ;
- ; This code is hereby thrown into the public domain .. the author
- ; is not responsible for anything it may do to your system at all
- ;
- ideal
- dosseg
- model small
- stack 32
- codeseg
-
- PROC Main
- jmp far Install
- ENDP Main
-
- State db 0
- OldInt9 dd 0
- filename db '\st3fix.pal',0
- buffer db 0,0,0
-
- PROC Int9ISR
- pushf
- call [cs:OldInt9]
- cmp [cs:State],0
- je @@Check
- ExitIsr:iret
- @@Check:mov [cs:State], -1
- push ax
- push ds
- mov ax, 40h
- mov ds, ax
- mov al, [ds:17h]
- and al, 9h
- cmp al, 9h
- je LoadPal
- mov al, [ds:17h]
- and al, 5h
- cmp al, 5h
- je SavePal
- pop ds
- pop ax
- mov [cs:State], 0
- iret
- LoadPal:
- push dx
- push cx
- push bx
- call DosCheck
- jc @@Er
- mov ax, cs
- mov ds, ax
- assume ds:@code
- mov ax, 3D00h
- mov dx, offset Filename
- int 21h
- jc @@Er
- mov bx, ax
- mov cx, 256
- @@l1: push cx
- mov ah, 3Fh
- mov cx, 3
- mov dx, offset Buffer
- int 21h
- pop cx
- mov dx, 3c8h
- mov al, cl
- out dx, al
- inc dx
- mov al, [cs:Buffer]
- out dx, al
- mov al, [cs:Buffer+1]
- out dx, al
- mov al, [cs:Buffer+2]
- out dx, al
- dec cx
- jnz @@l1
- mov ah, 3Eh
- int 21h
- @@Er:
- pop bx
- pop cx
- pop dx
- pop ds
- pop ax
- mov [cs:State], 0
- iret
- SavePal:
- push dx
- push cx
- push bx
- call DosCheck
- jc @@Er2
- mov ax, cs
- mov ds, ax
- assume ds:@code
- mov ax, 3C00h
- mov dx, offset Filename
- sub cx, cx
- int 21h
- jc @@Er2
- mov bx, ax
- mov cx, 256
- @@l2: push cx
- mov dx, 3c7h
- mov al, cl
- out dx, al
- inc dx
- inc dx
- in al, dx
- mov [cs:Buffer], al
- in al, dx
- mov [cs:Buffer+1], al
- in al, dx
- mov [cs:Buffer+2], al
- mov ah, 40h
- mov cx, 3
- mov dx, offset Buffer
- int 21h
- pop cx
- dec cx
- jnz @@l2
- mov ah, 3Eh
- int 21h
- @@er2:
- pop bx
- pop cx
- pop dx
- pop ds
- pop ax
- mov [cs:State], 0
- iret
- ENDP Int9ISR
-
- PROC DosCheck
- push es
- mov ah, 34h
- int 21h
- mov al, [es:bx]
- pop es
- cmp al, 0
- jne UnSafe
- clc
- ret
- UnSafe: stc
- ret
- ENDP DosCheck
-
- PROC Install
- mov ax, cs
- mov ds, ax
- mov es, ax
- mov ah, 09h
- mov dx, offset Message
- int 21h
- mov ax, 3509h
- int 21h
- mov [word CS:OldInt9], bx
- mov [word cs:OldInt9+2], es
- mov ax, 2509h
- mov dx, offset Int9ISR
- int 21h
-
- mov ah, 62h
- int 21h
- mov es, bx
- xor ax, ax
- xchg ax, [es:2Ch]
- or ax, ax
- jz NoEnv
- mov es, ax
- mov ah, 49h
- int 21h
- NoEnv:
- ; mov dx, offset Install
- ; add dx, 0fh
- ; mov cl, 4
- ; shr dx, cl
- mov ah, 31h
- mov dx, 50
- int 21h
-
- ENDP Install
-
- Message db ' ST3 Palette Fixerupper - CTRL-RSHIFT to save a palette',13,10
- db ' ALT-RSHIFT to load a palette',13,10,'$'
- end Main
-