Skip to content

Instantly share code, notes, and snippets.

@mateoconlechuga
Last active December 16, 2016 05:56
Show Gist options
  • Save mateoconlechuga/99082fccfa10224b9adf76a00bd51ce6 to your computer and use it in GitHub Desktop.
Save mateoconlechuga/99082fccfa10224b9adf76a00bd51ce6 to your computer and use it in GitHub Desktop.
_lighten:
pop de
pop bc
pop hl
push hl
push bc
push de
ld a,b
cpl
ld b,a
ld a,c
cpl
call +_
ld a,l
cpl
ld l,a
ld a,h
cpl
ld h,a
ret
_darken:
pop de
pop bc
pop hl
push hl
push bc
push de
ld a,c
_:
ld c,l
ld iyl,a
ld de,128
and a,31
ld l,a
ld h,c
mlt hl
add hl,de
push hl ; h = blue color
ld a,b
rrca
rrca
and a,31
ld l,a
ld h,c
mlt hl
add hl,de
push hl ; h = red color
ld a,iyl
rrca
rrca
rrca
rrca
and a,14
ld l,a
ld a,b
and a,3
rlca
rlca
rlca
rlca
or a,l
ld l,a
ld a,h
rlca
and a,1
or a,l
ld l,a
ld h,c
mlt hl
add hl,de ; h = green color
ld a,h
and a,1
rrca
ld d,a
ld a,h
rrca
rrca
rrca
rrca
ld l,a
and a,3
or a,d
ld d,a
ld a,l
and a,224
ld e,a ; green store complete
pop af ; a = red color
rlca
rlca
or a,d
ld h,a ; high byte complete
pop af ; a = blue color
or a,e
ld l,a ; hl complete
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment