Geekboy

Untitled

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