-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixmouse.asm
50 lines (36 loc) · 993 Bytes
/
fixmouse.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
proc SavePal
;Palbuffer: a buffer that will hold current RGB values of palette.
;Saves current palette in Palbuffer.
doPush ax,dx,di,cx
xor al, al
mov dx, 3C7h ;send to this port first palette cell to read.
out dx, al ;Read from index 0
mov di, offset Palbuffer
mov dx, 3C9h ;Palette port, in this case to read.
mov cx, 256*3
copypal1:
in al, dx ;in - read from port, out - write to port
mov [di], al
inc di
loop copypal1
doPop cx,di,dx,ax
ret
endp SavePal
proc RestorePal
;Palbuffer: a 256*3 buffer with saved RGB values of a 256 color palette.
;Changes program palette to the one in the Palbuffer.
doPush ax,dx,si,cx
xor al, al
mov dx, 3c8h ;send to this port from which palette cell to start writing.
out dx, al ;Write from index 0
mov si, offset Palbuffer
mov dx, 3C9h ;Palette port, in this case to write to.
mov cx, 256*3
restorepal1:
mov al, [si]
out dx, al
inc si
loop restorepal1
doPop cx,si,dx,ax
ret
endp RestorePal