1 ;-----------------------------------------------------------
\r
3 ; MXRP.ASM - Rotate palette function
\r
4 ; Copyright (c) 1994 by Alessandro Scotti
\r
6 ;-----------------------------------------------------------
\r
10 PUBLIC mxRotatePalette
\r
12 MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'
\r
13 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING
\r
15 ;-----------------------------------------------------------
\r
17 ; Rotates the palette of the specified number of colors.
\r
20 ; Palette = pointer to palette
\r
21 ; Count = number of colors to rotate
\r
26 ; Note: if Step is positive palette is rotated left to right, otherwise
\r
29 mxRotatePalette PROC FAR
\r
32 Palette:DWORD = ARG_SIZE
\r
33 LOCAL Holder:BYTE:768 = AUTO_SIZE
\r
36 .push ds, si, es, di
\r
40 add bx, [Count] ; BX = Count*3
\r
42 lds si, [Palette] ; DS:SI -> palette
\r
45 lea di, Holder ; ES:DI -> local space
\r
51 jz @@Exit ; Nothing to do, exit
\r
56 add dx, ax ; DX = Step*3
\r
57 sub bx, dx ; BX = (Count-Step)*3
\r
62 mov es, WORD PTR Palette[2]
\r
64 dec di ; ES:DI -> last byte of palette
\r
82 neg dx ; DX = Step*3
\r
83 sub bx, dx ; BX = (Count-Step)*3
\r
98 mxRotatePalette ENDP
\r