Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created November 24, 2012 07:22
Show Gist options
  • Save tuttlem/4138777 to your computer and use it in GitHub Desktop.
Save tuttlem/4138777 to your computer and use it in GitHub Desktop.
Smoke - palette
setup_palette:
mov cx, 255 ; 256 colour indicies to set
next_colour_idx:
mov al, 255 ; setup al so that we're setting
sub al, cl ; colour indicies from low to high
mov dx, 3c7h ; this port selects the colour index
; that we'll set r,g,b for
out dx, al
mov dx, 3c9h ; this port sets the r,g,b components
; for the selected index
shr al, 2 ; rgb intensities are in range of 0..63
; so, divide by 4 to adjust
out dx, al ; set the red
out dx, al ; set the green
out dx, al ; set the blue
dec cx ; move onto the next colour
jnz next_colour_idx
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment