Start of big refactor

This commit is contained in:
alpine9000
2016-04-15 09:53:05 +10:00
parent 8e896e1017
commit c016c4779b
2 changed files with 22 additions and 16 deletions
+19 -14
View File
@@ -42,26 +42,16 @@ Entry:
Reset:
move.l #0,foregroundScrollX ; x pos (d1)
move.l #0,fg_shift ; shift counter (d2)
move.l #15,fg_shift ; shift counter (d2)
move.l #0,fg_tileIndex ; tile index (d3)
move.l #0,backgroundScrollX
move.l #0,bg_shift ; shift counter (d2)
move.l #0,bg_tileIndex ; tile index (d3)
move.l #BACKGROUND_UPDATE_COUNT,d6 (Frame count)
jsr BlueFill
move.l #0,frameCount
move.l #-1,frameCount
MainLoop:
move.l frameCount,d6
bsr RenderNextForegroundFrame
bsr RenderNextBackgroundFrame
jsr WaitVerticalBlank
bsr.s HoriScrollPlayfield
jsr SwitchBuffers ; takes bitplane pointer offset in d0
andi.b #BACKGROUND_UPDATE_COUNT,d6
bne .skipBackgroundUpdates
;; ---- Background updates ----------------------------------------
@@ -85,6 +75,17 @@ MainLoop:
add.l #1,frameCount
move.l frameCount,d6
bsr RenderNextForegroundFrame
bsr RenderNextBackgroundFrame
jsr WaitVerticalBlank
bsr.s HoriScrollPlayfield
jsr SwitchBuffers ; takes bitplane pointer offset in d0
bra MainLoop
HoriScrollPlayfield:
@@ -146,7 +147,8 @@ RenderForegroundTile:
move.l foregroundOffscreen,a0
add.l d0,a0
lea tilemap,a1
add.l #BITPLANE_WIDTH_BYTES-8,a0 ; dest
;; add.l #BITPLANE_WIDTH_BYTES-8,a0 ; dest
add.l #(BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*SCREEN_HEIGHT/4)+BITPLANE_WIDTH_BYTES-8,a0
add.w (a2),a1 ; source tile
move.l fg_shift,d2
cmp.l #8,d2
@@ -159,8 +161,11 @@ ClearForegroundTile
lea tilemap,a1
add.w #11520,a1 ; source tile
move.l fg_shift,d2
cmp.l #8,d2
bge .skip
sub.l #32,a0
jsr BlitTile
jsr BlitTile
.skip:
rts
+3 -2
View File
@@ -14,7 +14,7 @@ SwitchBuffers:
move.l a0,a1
lea copperListBpl1Ptr,a0
jsr PokeBitplanePointers
btst #FOREGROUND_DELAY_BIT,d6 ; only swap the background buffer every second frame
beq .skipBackgroundSwap
move.l backgroundScrollX,d0
@@ -24,7 +24,8 @@ SwitchBuffers:
move.l a0,backgroundOnscreen
move.l a0,a1
lea copperListBpl2Ptr,a0
jsr PokeBitplanePointers
jsr PokeBitplanePointers
.skipBackgroundSwap:
;; movem.l (sp)+,d0/a0-a1
rts