1 ;-----------------------------------------------------------
\r
3 ; MXGM.ASM - Gamma correction
\r
4 ; Copyright (c) 1994 by Alessandro Scotti
\r
6 ;-----------------------------------------------------------
\r
10 PUBLIC mxGammaCorrect
\r
12 MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'
\r
13 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING
\r
15 mx_tblGamma LABEL BYTE
\r
16 DB 00, 10, 14, 17, 19, 21, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34
\r
17 DB 35, 36, 37, 37, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 46
\r
18 DB 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55
\r
19 DB 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63
\r
21 ;-----------------------------------------------------------
\r
23 ; Correct palette colors (gamma is 2.3).
\r
26 ; CPal = pointer to color palette
\r
27 ; GPal = pointer to destination (gamma corrected) palette
\r
28 ; Count = number of colors to convert
\r
32 ; Note: CPal and GPal may point to the same buffer.
\r
34 mxGammaCorrect PROC FAR
\r
37 SPal:DWORD = ARG_SIZE
\r
40 .push ds, si, es, di
\r
43 jcxz @@Exit ; Exit now if nothing to do
\r
46 mov bx, OFFSET mx_tblGamma ; Setup BX for XLAT instruction
\r
48 mov ax, cx ; AX = Count
\r
49 add cx, cx ; CX = Count*2
\r
50 add cx, ax ; CX = Count*3
\r