Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PBMoveANG:
- ;Moves the bullet in the directoin given via an angle
- ;Stored in the LSB of the counter
- push de
- Dec sp \ pop HL ; Get Angle/counter into HL
- ld a,l
- push hl \ inc sp ; restore sp we dont need to write values back in this portion of the routine
- and %00001111 ; mask out un-needed information
- add a,192-8 ;This is added for varience of the angle
- ld h,$82
- ld l,a ; get pointer on sin/cos table
- ld a,(hl)
- pop de ; Load D with Y and E with X
- rlc d
- rlc d ; shift xpos to be our 6.2FP variable
- rlc e
- rlc e ; Shift ypos to be our 6.2FP cariable
- or a
- RRA \ RRA \ RRA
- RRA \ RRA \ RRA \ rra \ rra ; Shift sine value down to 000000SS (subject to change)
- neg
- add a,e
- rrca \ rrca ; shift back into SSYYYYYY
- ld d,e ; Merge for new Y pos and save back into D
- ld a,l
- add a,64
- ld l,a ; Add 64 to get Cos value
- cp 193
- ld a,(hl)
- jp nc,+_ ;if x is Pos Skip the neg
- neg ; If X was in the -x rage neg itb2
- _:
- or a
- RRA \ RRA \ RRA
- RRA \ RRA \ RRA \ rra \ rra ; Rotate Cos value to 00000cc
- add a,d
- rrca \ rrca ; shift back into SSXXXXXX
- ld d,a
- push de ; save onto table
- pop de
- jp PBTMainMoveRet
Advertisement
Add Comment
Please, Sign In to add comment