Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IBlendRBG:
- ; blend color c and a
- ; destroy b and e
- ld b, a
- and c
- and ICOLOR_LOW_BIT
- ld e, a
- ld a, b
- and ~ICOLOR_LOW_BIT
- ld b, a
- ld a, c
- and ~ICOLOR_LOW_BIT
- add a, b
- rra
- add a, e
- ret
- ILitRBG:
- ; lit a color (c) by factor (a)
- ; destroy bc, hl
- ld b, a
- ld a, c
- and IGREEN_BITS
- ld l, a
- ld h, b
- mlt hl
- add hl, hl
- add hl, hl
- ld a, h
- tst a, %11111000
- jr z, $+4
- ld h, IGREEN_BITS
- ld a, c
- and IBLUE_BITS
- ld l, a
- ld a, h
- ld h, b
- mlt hl
- add hl, hl
- add hl, hl
- ld l, a
- ld a, h
- tst a, %11100000
- jr z, $+4
- ld a, IBLUE_BITS
- and IBLUE_BITS
- or l
- ld h, b
- ld b, a
- ld a, c
- and IRED_BITS
- ld l, a
- mlt hl
- ld a, h
- tst a, %11000000
- jr z, $+4
- ld h, IRED_BITS>>2
- add hl, hl
- add hl, hl
- ld a, h
- and IRED_BITS
- or b
- ret
- ILerpRBG:
- ; 452 TStates
- push hl
- ld b, (hl)
- ; b,c,e
- ld e, a
- ld a, b
- and IGREEN_BITS
- ld h, a
- ld a, c
- and IGREEN_BITS
- sub h
- jr nc, $+4
- cpl
- inc a
- ld h, a
- ld l, e
- ; convert flag
- sbc a, a
- or a, a
- ; c=nz, nc=z
- mlt hl
- add hl, hl
- add hl, hl
- ld a, h
- jr z, $+4
- neg
- ld h, a
- ld a, b
- and IGREEN_BITS
- add a, h
- ld d, a
- ; 138
- ld a, b
- and IBLUE_BITS
- ld h, a
- ld a, c
- and IBLUE_BITS
- sub h
- jr nc, $+4
- cpl
- inc a
- ld h, a
- ld l, e
- mlt hl
- rl h ; push down carry flag
- add hl, hl
- ld a, h
- and IBLUE_BITS
- bit 1, h
- jr z, $+4
- neg
- ld h, a
- ld a, b
- and IBLUE_BITS
- add a, h
- or d
- ld d, a
- ; 280
- ld a, b
- and IRED_BITS
- ld h, a
- ld a, c
- and IRED_BITS
- sub h
- jr nc, $+4
- cpl
- inc a ; neg, put different flag output
- ld h, a
- ld l, e
- mlt hl
- rl h ; push down carry flag
- ld a, h
- and IRED_BITS>>1
- bit 0, h
- jr z, $+4
- neg
- ld h, a
- ld a, b
- rra
- and IRED_BITS>>1
- add a, h
- sla a
- or d
- pop hl
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement