mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-09-13 08:43:55 +00:00
Test dual scroll
This commit is contained in:
+7
-7
@@ -11,9 +11,9 @@ NUM_COLORS=8
|
||||
BOOTBLOCK_ASM=alpine_bootblock.s
|
||||
OBJS=out/init.o out/utils.o out/image.o out/blit.o out/scroll.o
|
||||
|
||||
#IMAGES=gigi_full.png
|
||||
#IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
|
||||
#SIZEDIMAGEDATA=$(addprefix out/, $(IMAGES:.png=.sized.png))
|
||||
IMAGES=gigi_full.png
|
||||
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
|
||||
SIZEDIMAGEDATA=$(addprefix out/, $(IMAGES:.png=.sized.png))
|
||||
|
||||
TILEMAPS=2222.png background_tiles.png
|
||||
TILEMAPDATA=$(addprefix out/, $(TILEMAPS:.png=.bin))
|
||||
@@ -26,11 +26,11 @@ LINKER_OPTIONS=-T link.script.x
|
||||
include ../shared/base.mk
|
||||
|
||||
|
||||
#out/%.sized.png: ../assets/%.png
|
||||
# $(RESIZE) --width=352 --height=256 --blur=0.75 --input=$< --output=$@
|
||||
out/%.sized.png: ../assets/%.png
|
||||
$(RESIZE) --width=352 --height=256 --blur=0.75 --input=$< --output=$@
|
||||
|
||||
#out/%.bin: out/%.sized.png
|
||||
# $(IMAGECON) --input $< $(IMAGECON_ARGS) --quantize --colors $(NUM_COLORS) --output-bitplanes --output-palette-asm --output-grey-palette --output-palette $(DITHER) --output out/$*
|
||||
out/%.bin: out/%.sized.png
|
||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --quantize --colors $(NUM_COLORS) --output-bitplanes --output-palette-asm --output-grey-palette --output-palette $(DITHER) --output out/$*
|
||||
|
||||
out/%.bin: assets/%.png
|
||||
$(IMAGECON) --use-palette=assets/fg.pal --input $< $(IMAGECON_ARGS) --quantize --colors $(NUM_COLORS) --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-grey-palette --output-palette $(DITHER) --output-png --output out/$*
|
||||
|
||||
+2
-2
@@ -106,7 +106,7 @@ BlitTile:
|
||||
;; d2 - y tile index
|
||||
|
||||
WaitBlitter
|
||||
movem.l d2,-(sp)
|
||||
movem.l d0-a6,-(sp)
|
||||
move.w #0,BLTCON1(a6) ;
|
||||
move.w #BC0F_SRCA|BC0F_DEST|$f0,BLTCON0(a6)
|
||||
|
||||
@@ -121,7 +121,7 @@ BlitTile:
|
||||
move.w #$ffff,BLTAFWM(a6)
|
||||
move.w #$ffff,BLTALWM(a6)
|
||||
move.w #(16*SCREEN_BIT_DEPTH)<<6|(1),BLTSIZE(a6) ;rectangle size, starts blit
|
||||
movem.l (sp)+,d2
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
|
||||
|
||||
|
||||
+5
-3
@@ -1,10 +1,11 @@
|
||||
include "includes.i"
|
||||
|
||||
xdef SwitchBuffers
|
||||
|
||||
|
||||
SwitchBuffers:
|
||||
;; offscreen - bitplane address
|
||||
;; d0 - bitplane pointer offset
|
||||
;; d0 - fg bitplane pointer offset
|
||||
;; d1 - bg bitplane pointer offset
|
||||
movem.l d0/a0-a1,-(sp)
|
||||
move.l offscreen,a0
|
||||
move.l onscreen,offscreen
|
||||
@@ -14,8 +15,9 @@ SwitchBuffers:
|
||||
jsr PokeBitplanePointers
|
||||
|
||||
|
||||
lea backgroundTiles,a1
|
||||
lea bg_bitplanes,a1
|
||||
lea copperListBpl2Ptr,a0
|
||||
move.l d1,d0
|
||||
jsr PokeBitplanePointers
|
||||
movem.l (sp)+,d0/a0-a1
|
||||
rts
|
||||
|
||||
+30
-18
@@ -3,28 +3,40 @@
|
||||
xdef HoriScrollPlayfield
|
||||
|
||||
HoriScrollPlayfield:
|
||||
;; d0 - x position in pixels
|
||||
;; d0 - fg x position in pixels
|
||||
;; d1 - bg x position in pixels
|
||||
;; out:
|
||||
;; d0 - bitplane pointer increment in bytes
|
||||
movem.l d1-a6,-(sp)
|
||||
move.l d0,d1
|
||||
;; d0 - fg bitplane pointer increment in bytes
|
||||
;; d1 - bg bitplane pointer increment in bytes
|
||||
movem.l d2-a6,-(sp)
|
||||
|
||||
move.l d0,d3
|
||||
move.l d1,d0
|
||||
|
||||
move.l d1,d2
|
||||
lsr.l #3,d0 ; bytes to scroll
|
||||
move.l d0,d4 ; save bitplane pointer increment (bytes) for return value
|
||||
and.l #$F,d2 ; pixels = 0xf - (hpos - (hpos_bytes*8))
|
||||
move.l #$F,d0
|
||||
sub.l d2,d0 ; bits to delay
|
||||
move.l d0,d5 ; d5 == bg bits to delay
|
||||
|
||||
move.l d3,d0
|
||||
move.l d0,d2
|
||||
lsr.l #3,d0 ; bytes to scroll
|
||||
move.l d0,d3 ; save bitplane pointer increment (bytes) for return value
|
||||
and.l #$F,d1 ; pixels = 0xf - (hpos - (hpos_bytes*8))
|
||||
and.l #$F,d2 ; pixels = 0xf - (hpos - (hpos_bytes*8))
|
||||
move.l #$F,d0
|
||||
sub.l d1,d0 ; bits to delay
|
||||
bsr SetupHoriScrollBitDelay
|
||||
move.l d3,d0 ; retstore d0 for return value
|
||||
movem.l (sp)+,d1-a6
|
||||
sub.l d2,d0 ; bits to delay
|
||||
|
||||
lsl.w #4,d5
|
||||
or.w d5,d0
|
||||
|
||||
move.w d0,BPLCON1(a6)
|
||||
|
||||
move.l d3,d0 ; restore d0 for return value
|
||||
move.l d4,d1 ; restore d1 for return value
|
||||
movem.l (sp)+,d2-a6
|
||||
rts
|
||||
|
||||
SetupHoriScrollBitDelay:
|
||||
;; d0 = number of bits to scroll
|
||||
movem.l d0/d1,-(sp)
|
||||
move.w d0,d1
|
||||
;; lsl.w #4,d1
|
||||
;; or.w d1,d0
|
||||
move.w d0,BPLCON1(a6)
|
||||
movem.l (sp)+,d0/d1
|
||||
rts
|
||||
|
||||
+63
-16
@@ -6,6 +6,7 @@
|
||||
xdef copperListBpl1Ptr
|
||||
xdef copperListBpl2Ptr
|
||||
xdef backgroundTiles
|
||||
xdef bg_bitplanes
|
||||
|
||||
byteMap:
|
||||
dc.l Entry
|
||||
@@ -23,6 +24,10 @@ Entry:
|
||||
lea Level3InterruptHandler,a3
|
||||
move.l a3,LVL3_INT_VECTOR
|
||||
|
||||
;; d0 - fg bitplane pointer offset
|
||||
;; d1 - bg bitplane pointer offset
|
||||
move.l #0,d0
|
||||
move.l #1,d1
|
||||
jsr SwitchBuffers
|
||||
|
||||
move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
|
||||
@@ -31,36 +36,42 @@ Entry:
|
||||
jsr Init ; enable the playfield
|
||||
|
||||
Reset:
|
||||
move.l #0,d1 ; x pos
|
||||
move.l #0,d2 ; shift counter
|
||||
move.l #0,d3 ; tile index
|
||||
|
||||
move.l #0,fg_xpos ; x pos (d1)
|
||||
move.l #0,fg_shift ; shift counter (d2)
|
||||
move.l #0,fg_tileIndex ; tile index (d3)
|
||||
move.l #0,bg_xpos
|
||||
|
||||
jsr BlueFill
|
||||
|
||||
MainLoop:
|
||||
jsr WaitVerticalBlank
|
||||
MainLoop:
|
||||
add.l #1,fg_xpos
|
||||
jsr WaitVerticalBlank
|
||||
|
||||
jsr WaitVerticalBlank
|
||||
bsr RenderNextFrame
|
||||
jsr UpdateShiftCounter
|
||||
add.l #1,d1
|
||||
jsr UpdateBackgroundXpos
|
||||
|
||||
;; d0 - fg bitplane pointer offset
|
||||
;; d1 - bg bitplane pointer offset
|
||||
|
||||
jsr SwitchBuffers ; takes bitplane pointer offset in d0
|
||||
bra MainLoop
|
||||
|
||||
RenderNextFrame:
|
||||
move.l d1,d0 ; x position in pixels
|
||||
move.l fg_xpos,d0 ; fg x position in pixels
|
||||
move.l bg_xpos,d1 ; bg x position in pixels
|
||||
lea map,a2
|
||||
add.l d3,a2
|
||||
add.l fg_tileIndex,a2
|
||||
cmp.w #0,20(a2)
|
||||
bne .skip
|
||||
bra Reset
|
||||
.skip:
|
||||
jsr HoriScrollPlayfield ; returns bitplane pointer offset in d0
|
||||
jsr HoriScrollPlayfield ; returns fg bitplane pointer offset in d0
|
||||
move.l onscreen,a0
|
||||
bsr RenderTile
|
||||
move.l offscreen,a0
|
||||
bsr RenderTile
|
||||
add.l #2,d3 ; increment tile index
|
||||
add.l #2,fg_tileIndex ; increment tile index
|
||||
rts
|
||||
|
||||
RenderTile:
|
||||
@@ -70,18 +81,30 @@ RenderTile:
|
||||
lea tilemap,a1
|
||||
add.l #BITPLANE_WIDTH_BYTES-2,a0 ; dest
|
||||
add.w (a2),a1 ; source tile
|
||||
move.l fg_shift,d2
|
||||
jsr BlitTile
|
||||
rts
|
||||
|
||||
UpdateShiftCounter:
|
||||
cmp.l #15,d2
|
||||
bne .s1
|
||||
move.l #0,d2
|
||||
cmp.l #15,fg_shift
|
||||
bne .s1
|
||||
move.l #0,fg_shift
|
||||
bra .s2
|
||||
.s1:
|
||||
add.l #1,d2
|
||||
add.l #1,fg_shift
|
||||
.s2:
|
||||
rts
|
||||
|
||||
UpdateBackgroundXpos:
|
||||
cmp.l #1,bg_delay
|
||||
bne .s1
|
||||
move.l #0,bg_delay
|
||||
add.l #1,bg_xpos
|
||||
bra .s2
|
||||
.s1:
|
||||
add.l #1,bg_delay
|
||||
.s2:
|
||||
rts
|
||||
|
||||
Level3InterruptHandler:
|
||||
movem.l d0-a6,-(sp)
|
||||
@@ -162,6 +185,9 @@ bitplanes1:
|
||||
bitplanes2:
|
||||
ds.b IMAGESIZE
|
||||
ds.b BITPLANE_WIDTH_BYTES*20
|
||||
|
||||
bg_bitplanes:
|
||||
incbin "out/gigi_full.bin"
|
||||
|
||||
map:
|
||||
include "out/main-map.s"
|
||||
@@ -170,7 +196,28 @@ map:
|
||||
backgroundTiles:
|
||||
include "out/background_tiles.bin"
|
||||
|
||||
|
||||
fg_shift:
|
||||
dc.l 0
|
||||
fg_xpos:
|
||||
dc.l 0
|
||||
fg_tileIndex:
|
||||
dc.l 0
|
||||
|
||||
bg_shift:
|
||||
dc.l 0
|
||||
bg_xpos:
|
||||
dc.l 0
|
||||
bg_tileIndex:
|
||||
dc.l 0
|
||||
|
||||
bg_delay:
|
||||
dc.l 0
|
||||
|
||||
section .bss
|
||||
|
||||
|
||||
|
||||
startUserstack:
|
||||
ds.b $1000 ; size of stack
|
||||
userstack:
|
||||
|
||||
Reference in New Issue
Block a user