Geekboy

Untitled

Oct 27th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PBMoveANG:
  2. ;Moves the bullet in the directoin given via an angle
  3. ;Stored in the LSB of the counter
  4. Dec sp \ pop HL  ; Get Angle/counter into HL
  5. ld a,l
  6. push hl \ inc sp ; restore sp we dont need to write values back in this portion of the routine
  7. and %00001111    ; mask out un-needed information
  8. add a,184        ;This is added for varience of the angle
  9. ld h,$82
  10. ld l,a           ; get pointer on sin/cos table
  11. ld a,(hl)
  12. pop de           ; Load D with Y and E with X
  13. rlc d
  14. rlc d            ; shift Ypos to be our 6.2FP variable
  15. rlc e
  16. rlc e
  17. RRA \ RRA \ RRA
  18. RRA \ RRA \ RRA  ; Shift sine value down to 000000SS (subject to change)
  19.  
  20. add a,d
  21. rrca \ rrca      ; shift back into SSYYYYYY
  22. ld d,a           ; Merge for new Y pos and save back into D
  23.  
  24. ld a,l
  25. add a,64
  26. ld l,a          ; Add 64 to get Cos value
  27.  
  28. ld a,(hl)
  29. cp 193
  30. jp nc,+_        ;if x is Pos Skip the neg
  31. neg             ; If X was in the -x rage neg it
  32. _:
  33. RRA \ RRA \ RRA
  34. RRA \ RRA \ RRA ; Rotate Cos value to 00000cc
  35. add a,e
  36. rrca \ rrca     ; shift back into SSXXXXXX
  37. ld e,a
  38.  
  39. push de         ; save onto table
Advertisement
Add Comment
Please, Sign In to add comment