Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cos88:
- ld de,40h
- add hl,de
- sin88:
- ;This computes sin(2pi*x/256), where
- ;x=H.L is an 8.8 fixed point number
- ;Output is H.L
- ;when l>=128, just negate the output.
- ld a,l
- add a,a
- push af
- jp p,$+5
- neg
- cp 124
- ld hl,256
- jr nc,+_
- rrca
- sbc hl,hl
- ld l,a
- ex de,hl
- ld hl,sinLUT
- add hl,de
- ld e,(hl)
- ex de,hl
- _:
- pop af
- ret nc
- ex de,hl
- or a
- sbc hl,hl
- sbc hl,de
- ret
- sinLUT:
- .db 0,6,13,19,25,31,38,44,50,56,62,68,74,80,86,92
- .db 98,104,109,115,121,126,132,137,142,147,152,157,162,167,172,177
- .db 181,185,190,194,198,202,206,209,213,216,220,223,226,229,231,234
- .db 237,239,241,243,245,247,248,250,251,252,253,254,255,255
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement