Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Calculates the average of the BGR565 (or RGB565) colors in DE and HL into HL.
- ; I: DE=color1, HL=color2
- ; O: A=color1&$FF&~((1<<5)+1), BC=color1&color2&(((1<<6)+1<<5)+1),
- ; DE=color1&~(((1<<6)+1<<5)+1), HL=average(color1,color2)
- ; FO: SZP(L), C=0
- ; CC: 125
- AverageBGR565:
- ld a,d
- and h
- and 1<<(6+5-8)
- ld b,a
- ld a,e
- and l
- and (1<<5)+1
- ld c,a
- res (6+5)&7,d
- ld a,e
- and ~((1<<5)+1)
- ld e,a
- res (6+5)&7,h
- res 5,l
- add hl,de
- rr h
- rr l
- add hl,bc
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement