Geekboy

Untitled

Oct 29th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PutEnemyExplosion:  ;A=(FF[big] to FF-7[small]) count; E=Y D=X
  2. ;we're not going to bother with clipping as of yet
  3.  cpl
  4.  srl a   ;expand the explosion for a bit longer
  5.  add a,a
  6.  add a,a
  7.  add a,a ;x8 for sprite size
  8.  ld hl,PutEnemyExplosionSpriteTable
  9.  add a,L
  10.  ld L,a
  11.  jr nc,_
  12.  inc h
  13. _:
  14.  push hl
  15.   ld a,e    ;y position
  16.   add a,a   ;x2 within range
  17.   add a,a   ;x4 still within range, but not the next.
  18.   ld h,0
  19.   ld b,h
  20.   ld L,a
  21.   add hl,hl ;x8 Now we're cooking with propane
  22.   ld a,d    ;x position
  23.   and 7     ;get 3 low bits for sprite rotation logic
  24.   cpl
  25.   add a,9   ;and inverse this thinger
  26.   ld c,a
  27.   ld ix,PutEnemyExplosionShifter
  28.   add ix,bc
  29.   ld a,d
  30.   and 7
  31.   add a,$08 ;getting spritemask position from LUTable.z80
  32.   ld e,a    ;putting to address LSB to complete later. We kinda still need D.
  33.   ld a,d
  34.   and %00111000
  35.   rrca
  36.   rrca
  37.   rrca
  38.   add a,L
  39.   ld L,a     ;not crossing any 256 byte boundaries, are we?
  40.   set 7,h    ;completing the screen address
  41.   ld d,$40   ;completing address to sprite mask above
  42.   ld a,(de)
  43.   ld b,a   ;mask (left side AND)
  44.   cpl      ;invert it
  45.   ld c,a   ;mask (right side AND)
  46.  pop de
  47.  ld (itemp2),sp
  48.  ld sp,7   ;and now we're cooking with dragon fire~!
  49.  ld a,8
  50. PutEnemyExplosionLoop: ;DE=spriteLocation, HL=screenbuf
  51.  ex af,af'
  52. ld a,(de)
  53. jp (ix)
  54. PutEnemyExplosionShifter:
  55. rrca
  56. rrca
  57. rrca
  58. rrca
  59. rrca
  60. rrca
  61. rrca
  62. rrca
  63. ld (itemp3),a   ;I don't have a better way of doing this yet.
  64.  and c
  65.  or (hl)
  66.  ld (hl),a
  67.  inc hl
  68.  ld a,(itemp3)
  69.  and b
  70.  or (hl)
  71.  ld (hl),a
  72.  add hl,sp
  73.  inc de
  74.  ex af,af'
  75. dec a
  76. jr nz,PutEnemyExplosionLoop
  77. ld sp,(itemp2)
  78. ret
Advertisement
Add Comment
Please, Sign In to add comment