Geekboy

Untitled

Oct 28th, 2011
128
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.  push de
  5.  Dec sp \ pop HL  ; Get Angle/counter into HL
  6.  ld a,l
  7.  push hl \ inc sp ; restore sp we dont need to write values back in this portion of the routine
  8.  and %00001111    ; mask out un-needed information
  9.  add a,192-8        ;This is added for varience of the angle
  10.  ld h,$82
  11.  ld l,a           ; get pointer on sin/cos table
  12.  ld a,(hl)
  13.  pop de           ; Load D with Y and E with X
  14.  rlc d
  15.  rlc d            ; shift xpos to be our 6.2FP variable
  16.  rlc e
  17.  rlc e            ; Shift ypos to be our 6.2FP cariable
  18.  or a
  19.  RRA \ RRA \ RRA
  20.  RRA \ RRA \ RRA \ rra \ rra ; Shift sine value down to 000000SS (subject to change)
  21.  
  22.  neg
  23.  add a,e
  24.  rrca \ rrca      ; shift back into SSYYYYYY
  25.  ld d,e          ; Merge for new Y pos and save back into D
  26.  
  27.  ld a,l
  28.  add a,64
  29.  ld l,a          ; Add 64 to get Cos value
  30.  cp 193
  31.  ld a,(hl)
  32.  jp nc,+_        ;if x is Pos Skip the neg
  33.  neg             ; If X was in the -x rage neg itb2
  34. _:
  35.  or a
  36.  RRA \ RRA \ RRA
  37.  RRA \ RRA \ RRA \ rra \ rra ; Rotate Cos value to 00000cc
  38.  add a,d
  39.  rrca \ rrca     ; shift back into SSXXXXXX
  40.  ld d,a
  41.  
  42.  push de         ; save onto table
  43.  pop de
  44.  
  45.  jp PBTMainMoveRet
Advertisement
Add Comment
Please, Sign In to add comment