+++ /dev/null
-;-----------------------------------------------------------\r
-;\r
-; MXGM.ASM - Gamma correction\r
-; Copyright (c) 1994 by Alessandro Scotti\r
-;\r
-;-----------------------------------------------------------\r
-WARN PRO\r
-INCLUDE MODEX.DEF\r
-\r
-PUBLIC mxGammaCorrect\r
-\r
-MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
- ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
-\r
-mx_tblGamma LABEL BYTE\r
- DB 00, 10, 14, 17, 19, 21, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34\r
- DB 35, 36, 37, 37, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 46\r
- DB 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55\r
- DB 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63\r
-\r
-;-----------------------------------------------------------\r
-;\r
-; Correct palette colors (gamma is 2.3).\r
-;\r
-; Input:\r
-; CPal = pointer to color palette\r
-; GPal = pointer to destination (gamma corrected) palette\r
-; Count = number of colors to convert\r
-; Output:\r
-; none\r
-;\r
-; Note: CPal and GPal may point to the same buffer.\r
-;\r
-mxGammaCorrect PROC FAR\r
- ARG Count:WORD, \\r
- DPal:DWORD, \\r
- SPal:DWORD = ARG_SIZE\r
- ASSUME ds:NOTHING\r
- .enter 0\r
- .push ds, si, es, di\r
-\r
- mov cx, [Count]\r
- jcxz @@Exit ; Exit now if nothing to do\r
- lds si, [SPal]\r
- les di, [DPal]\r
- mov bx, OFFSET mx_tblGamma ; Setup BX for XLAT instruction\r
- cld\r
- mov ax, cx ; AX = Count\r
- add cx, cx ; CX = Count*2\r
- add cx, ax ; CX = Count*3\r
-@@Loop:\r
- lodsb\r
- xlat mx_tblGamma\r
- stosb\r
- loop @@Loop\r
-\r
-@@Exit:\r
- .pop ds, si, es, di\r
- .leave ARG_SIZE\r
-mxGammaCorrect ENDP\r
-\r
-MX_TEXT ENDS\r
-END\r