Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- calculatePalette:
- ; Get the current line
- ld b, 0
- ld a, [rLY]
- ld c, a
- ; Get sin(Ly/PI) or SinLyPiTable[b] if you want to see it as an array.
- ld hl, SinLyPiTable
- add hl, bc
- ld d, [hl]
- ; Multiply by 2 or 4
- ld a, [wScale]
- ld b, a
- and a
- ld a, d
- jr z, _noScale
- _multiply:
- add a, a
- dec b
- jr nz, _multiply
- jr _noDownScale
- _noScale:
- ; Scale back down ( / 8)
- and %11111000
- rrca
- rrca
- rrca
- _noDownScale:
- ; Use the result to change the palette
- and %00000011
- cpl
- ldh [< rBGP], a
- ret
Advertisement
Add Comment
Please, Sign In to add comment