]> 4ch.mooo.com Git - 16.git/blob - 16/x/mxsp.asm
p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
[16.git] / 16 / x / mxsp.asm
1 ;-----------------------------------------------------------\r
2 ;\r
3 ; MXSP.ASM - Set palette function\r
4 ; Copyright (c) 1993,1994 by Alessandro Scotti\r
5 ;\r
6 ;-----------------------------------------------------------\r
7 WARN    PRO\r
8 INCLUDE MODEX.DEF\r
9 \r
10 PUBLIC  mxSetPalette\r
11 \r
12 MX_TEXT         SEGMENT USE16 PARA PUBLIC 'CODE'\r
13                 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
14 \r
15 ;-----------------------------------------------------------\r
16 ;\r
17 ; Updates the VGA palette.\r
18 ;\r
19 ; Input:\r
20 ;       Buffer          = pointer to palette data (R,G,B)\r
21 ;       Start           = index of first color to set\r
22 ;       Count           = number of color to set\r
23 ; Output:\r
24 ;       none\r
25 ;\r
26 mxSetPalette    PROC    FAR\r
27         ARG     Count:WORD,             \\r
28                 Start:WORD,             \\r
29                 Buffer:DWORD            = ARG_SIZE\r
30         ASSUME  ds:NOTHING\r
31         .enter  0\r
32         .push   ds, si\r
33 \r
34         lds     si, [Buffer]\r
35         mov     cx, [Count]\r
36         mov     ax, [Start]\r
37         mov     dx, 3C8h                ; PEL write address register\r
38         out     dx, al\r
39         inc     dx\r
40         cld\r
41         cli                             ; Disable interrupts\r
42 @@Loop:\r
43         lodsb\r
44         out     dx, al                  ; Red\r
45         lodsb\r
46         out     dx, al                  ; Green\r
47         lodsb\r
48         out     dx, al                  ; Blue\r
49         loop    @@Loop                  ; Loop until done\r
50         sti                             ; Enable interrupts\r
51 \r
52         .pop    ds, si\r
53         .leave  ARG_SIZE\r
54 mxSetPalette    ENDP\r
55 \r
56 MX_TEXT         ENDS\r
57 END\r