No more bg_shift

This commit is contained in:
alpine9000
2016-04-15 10:51:46 +10:00
parent abd268f18c
commit 57535fee32
3 changed files with 11 additions and 18 deletions
+3
View File
@@ -3,6 +3,9 @@ FOREGROUND_DELAY_BIT equ 0
FOREGROUND_SCROLL_SHIFT_CONVERT equ 1
FOREGROUND_SCROLL_PIXELS equ 2
BACKGROUND_SCROLL_SHIFT_CONVERT equ 1
BACKGROUND_SCROLL_PIXELS equ 2
SCREEN_WIDTH equ 320
SCREEN_HEIGHT equ 256
+7 -18
View File
@@ -43,8 +43,7 @@ Entry:
Reset:
move.l #-FOREGROUND_SCROLL_PIXELS,foregroundScrollX ; x pos (d1)
move.l #0,fg_tileIndex ; tile index (d3)
move.l #0,backgroundScrollX
move.l #0,bg_shift ; shift counter (d2)
move.l #-BACKGROUND_SCROLL_PIXELS,backgroundScrollX
move.l #0,bg_tileIndex ; tile index (d3)
jsr BlueFill
move.l #-1,frameCount
@@ -77,9 +76,8 @@ Update:
bne .skipBackgroundUpdates
;; ---- Background updates ----------------------------------------
.backgroundUpdates:
add.l #1,backgroundScrollX
add.l #FOREGROUND_SCROLL_PIXELS,backgroundScrollX
add.l #2,bg_tileIndex ; increment tile index by a word
bsr UpdateBackgroundShiftCounter
.skipBackgroundUpdates:
btst #FOREGROUND_DELAY_BIT,d6
@@ -107,7 +105,7 @@ HoriScrollPlayfield:
;; movem.l d0-d6,-(sp)
move.l backgroundScrollX,d0
lsr.l #BACKGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels
move.w d0,d2
lsr.w #3,d0 ; bytes to scroll
and.w #$F,d2 ; pixels = 0xf - (hpos - (hpos_bytes*8))
@@ -188,27 +186,20 @@ ClearForegroundTile
RenderBackgroundTile:
;; a2 - map
move.l backgroundScrollX,d0
lsr.w #BACKGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels
lsr.w #3,d0 ; bytes to scroll
move.l backgroundOffscreen,a0
add.l d0,a0
lea backgroundTilemap,a1
add.l #BITPLANE_WIDTH_BYTES-2,a0 ; dest
add.w (a2),a1 ; source tile
move.l bg_shift,d2
move.l backgroundScrollX,d2
lsr.b #BACKGROUND_SCROLL_SHIFT_CONVERT,d2 ; convert to pixels
andi.w #$f,d2 ; find the shift component
jsr BlitTile
rts
UpdateBackgroundShiftCounter:
cmp.l #15,bg_shift
bne .s1
move.l #0,bg_shift
bra .s2
.s1:
add.l #1,bg_shift
.s2:
rts
Level3InterruptHandler:
movem.l d0-a6,-(sp)
@@ -280,8 +271,6 @@ foregroundScrollX:
dc.l 0
fg_tileIndex:
dc.l 0
bg_shift:
dc.l 0
backgroundScrollX:
dc.l 0
bg_tileIndex:
+1
View File
@@ -17,6 +17,7 @@ SwitchBuffers:
;; background is not double buffered
move.l backgroundScrollX,d0
lsr.l #BACKGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels
lsr.l #3,d0 ; bytes to scroll
move.l backgroundOnscreen,a1
lea copperListBpl2Ptr,a0