; SPHERES EFFECT
;
; BY: OERG866, SIK

Spheres:
    moveq #0, d0
    
    
    move.w #$9001, (VDPControl)
    
    move.w #$0000, d0
    jsr CalcOffset
    
    lea (Spheres_BoardTiles), a0
    lea (VDPData), a1
    move.w #Spheres_BoardMap-Spheres_BoardTiles-1, d0
@WriteBoardTiles:
    move.w (a0)+, (a1)
    dbf d0, @WriteBoardTiles
    
    lea (RLEData), a1
    lea (Spheres_BoardMap), a0
    jsr RunLengthDecoding  
    
    
    move.l #$C000, d0
    jsr CalcOffset
    lea (RLEData), a0
    lea (VDPData), a1
    move.w #2048-1, d0
@WriteBoardMap:
    move.w (a0)+, (a1)
    dbf d0, @WriteBoardMap
    
    moveq #2, d0
    jsr CalcOffset_CRAM
    move.w #$EEE, (VDPDATA)
    move.w #0, (RAM_ScaleVanishingPoint)
    moveq #1, d0
    move.w d0, (RAM_ScaleValue)
    bsr.w ScaleInit
    move.l #223-1, d1
    moveq #1, d0
@Test:
    move.w d0, (RAM_ScaleValue)
    addq.w #1, d0
    WaitFrame
    dbf d1, @Test
    jmp *
Spheres_BoardTiles:
    incbin "./spheres/board.bin"
    even
Spheres_BoardMap:
    incbin "./spheres/boardmap.rle"
    even