rendered paste body
Obj38_Shield:
move.b #0,$18(a0)
move.w ($FFFFD008).w,$08(a0) ; copy Sonic's position
move.w ($FFFFD00C).w,$0C(a0) ; copy Sonic's position
move.b ($FFFFD022).w,$22(a0) ; copy Sonic's flags
clr.l d2
move.b ($FFFFFE2C),d2 ; get shield type
lsl.b #1,d2 ; convert to address
move.l d2,d0 ; copy to d0 to use the address below also
add.l #Ani_Shields,d0 ; select shield's animation states
movea.l d0,a2
lea (Ani_Shields).l,a1
adda.w (a2),a1
jsr AnimateSprite
moveq #0,d1 ; start loading the shield DPLC
move.b $1A(a0),d1
cmp.b $30(a0),d1
beq.w Obj38_Shield_DPLC_Return
move.b d1,$30(a0)
add.w d1,d1
move.l d2,d6 ; copy to d6 to use the address below also
add.l #DPLC_Shields,d2 ; select shield's DPLC
movea.l d2,a1
lea (DPLC_Shields).l,a2
adda.w (a1),a2
adda.w (a2,d1.w),a2
move.w (a2)+,d5 ; fetch number of parts to load
subq.w #1,d5
bmi.w Obj38_Shield_DPLC_Return
move.w #$A820,d4 ; VRAM address
add.l #artunc_Shields,d6 ; select shield's uncompressed art
movea.l d6,a2
move.l #artunc_Shields,d6
add.w (a2),d6
Obj38_Shield_DPLC_Loop:
moveq #0,d1
move.w (a2)+,d1 ; fetch next item in the DPLC
move.w d1,d3 ; grab number of tiles to load
lsr.w #8,d3 ; -> $00XX
andi.w #$F0,d3 ; -> $00X0
add.w #$10,d3 ; +1 tile
andi.w #$FFF,d1 ; grab offset
lsl.l #5,d1 ; require $20 bytes per tile
add.l d6,d1 ; d1 = address to art in ROM
move.w d4,d2 ; d2 = address to load to in VRAM
add.w d3,d4 ; d3 = $10 * number of tiles
add.w d3,d4 ; increment for the next iteration
jsr DMA_68KtoVRAM
dbf d5,Obj38_Shield_DPLC_Loop
Obj38_Shield_DPLC_Return:
jmp (DisplaySprite).l