mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2025-11-21 06:41:32 +00:00
Tilemap scroll
This commit is contained in:
@ -11,9 +11,13 @@ NUM_COLORS=16
|
||||
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=tilemap.png
|
||||
TILEMAPDATA=$(addprefix out/, $(TILEMAPS:.png=.bin))
|
||||
|
||||
VASM_EXTRA_ARGS=-DNUM_COLORS=$(NUM_COLORS)
|
||||
|
||||
#SYMBOL_INFO=-M
|
||||
@ -22,12 +26,19 @@ 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
|
||||
#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: %.png
|
||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --quantize --colors $(NUM_COLORS) --output-bitplanes --output-palette-asm --output-grey-palette --output-palette $(DITHER) --output out/$*
|
||||
|
||||
out/main-map.s: map.tmx
|
||||
../tools/mapgen/out/mapgen --depth=4 --input=map.tmx
|
||||
mv main-map.s out
|
||||
|
||||
out/blit.o: constants.i macros.i
|
||||
out/main.o: $(IMAGEDATA) constants.i macros.i Makefile link.script.x palette.pal
|
||||
out/main.o: out/main-map.s $(TILEMAPDATA) $(IMAGEDATA) constants.i macros.i Makefile link.script.x palette.pal
|
||||
out/init.o: constants.i Makefile
|
||||
@ -101,7 +101,7 @@ BlitScroll:
|
||||
|
||||
BlitTile:
|
||||
;; a0 - dest bitplane pointer
|
||||
;; a1 - source bitplane pointer
|
||||
;; a1 - source tile pointer
|
||||
;; d2 - y tile index
|
||||
|
||||
WaitBlitter
|
||||
@ -109,12 +109,12 @@ BlitTile:
|
||||
move.w #0,BLTCON1(a6) ;
|
||||
move.w #BC0F_SRCA|BC0F_DEST|$f0,BLTCON0(a6)
|
||||
|
||||
move.w #BITPLANE_WIDTH_BYTES-2,BLTAMOD(a6)
|
||||
move.w #TILEMAP_WIDTH_BYTES-2,BLTAMOD(a6)
|
||||
move.w #BITPLANE_WIDTH_BYTES-2,BLTDMOD(a6) ;
|
||||
|
||||
mulu.w #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16,d2
|
||||
add.l d2,a0
|
||||
add.l d2,a1
|
||||
;; add.l d2,a1
|
||||
move.l a1,BLTAPTH(a6) ; source
|
||||
move.l a0,BLTDPTH(a6) ; dest
|
||||
move.w #$ffff,BLTAFWM(a6)
|
||||
|
||||
@ -5,6 +5,9 @@ SCREEN_WIDTH_WORDS equ SCREEN_WIDTH_BYTES/2
|
||||
BITPLANE_WIDTH equ 352
|
||||
BITPLANE_WIDTH_BYTES equ BITPLANE_WIDTH/8
|
||||
BITPLANE_WIDTH_WORDS equ BITPLANE_WIDTH_BYTES/2
|
||||
TILEMAP_WIDTH equ 256
|
||||
TILEMAP_WIDTH_BYTES equ TILEMAP_WIDTH/8
|
||||
TILEMAP_WIDTH_WORDS equ TILEMAP_WIDTH_BYTES/2
|
||||
|
||||
if NUM_COLORS==64
|
||||
SCREEN_BIT_DEPTH equ 6
|
||||
|
||||
11
026.tile_hscroll/map.tmx
Normal file
11
026.tile_hscroll/map.tmx
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.0" orientation="orthogonal" renderorder="left-up" width="100" height="16" tilewidth="16" tileheight="16" nextobjectid="1">
|
||||
<tileset firstgid="1" name="test" tilewidth="16" tileheight="16" tilecount="256" columns="16">
|
||||
<image source="Projects/amiga/amiga_examples/026.tile_hscroll/tilemap.png" width="256" height="256"/>
|
||||
</tileset>
|
||||
<layer name="main" width="100" height="16" visible="0">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJzt2FOQXEEUxvGObdvWxk42djKxk4lt27Zt27ZtY2NzY+Ofyu2azkVetpJUpfrhV9Ona6q/U/fcnofxFkJ4a37iD/4RAAERCIERBEERDMERAiERCqERBmGN70l/qkevv/g8/nVWOIRHBEREJERGFERFNERHDMRELMRGHMQVv84jHuIjARIiERIjCZIiGZIjBVIiFVIjjVGb97x+83x0lv256jzSIh3SIwMyIhMyIwuyIhuyIwdyIhdyG7V5T/boMj6bo4Wx1ln256rzyIO8yIf8KICCKITCKIKiKIbiKIGSKGXU5j2XwY1u6I4e6KmzbLNcpnmURhmURTmURwVURCVURhVURTVURw3UNGrznlvpeRiGYwRG6izbLLdpHrVQG3VQF/VQHw3QEI3QGE3QFM2E5662NNVyLXuehumYgZk6yzFLnUcrtEYbtEU7tEcHdEQndEYXdBXWu6rWci17XoblWIGVOssxS51HL/RGH/RFP/THAAzEIAzGEAwV1ruq1nIte96G7diBnTrLMUudxyiMxhiMxTiMxwRMxCRMxhRMFda7qtZyLXs+huM4gZM6yzFLnccszMYczMU8zMcCLMQiLMYSLBXWu6rWci17vmrwET9/Y3WWfZY6j1VYjTVYi3VYjw3YiE3YjC3YKqx3Va3lWvbso/Tsq7Mcs9R57MJu7MFe7MN+HMBBHMJhHMFRYb2rai3X8v2R/Uo6yz5LnccpnMYZnMU5nMcFXMQlXMYV4Xk3ruE6bgjPu6LumfuV/tcsXz9mqfO4iVu4jTu4i3u4jwd4iEd4jCd4imd4bvRht+dEZ9mfq87jBV7iFV7jDd7iHd7jAz7iEz7jC77iG3780Wy359S3zrI/V53HdxA4QSI=
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
@ -1,20 +0,0 @@
|
||||
idnt "test.c"
|
||||
opt 0
|
||||
opt NQLPSMRBT
|
||||
section "CODE",code
|
||||
public _blah
|
||||
cnop 0,4
|
||||
_blah
|
||||
movem.l l2,-(a7)
|
||||
moveq #0,d0
|
||||
move.w (6+l4,a7),d0
|
||||
move.l #320,-(a7)
|
||||
move.l d0,-(a7)
|
||||
public __lmods
|
||||
jsr __lmods
|
||||
addq.w #8,a7
|
||||
l1
|
||||
l2 reg
|
||||
l4 equ 0
|
||||
rts
|
||||
; stacksize=8
|
||||
@ -1,4 +0,0 @@
|
||||
int blah(unsigned short x)
|
||||
{
|
||||
return x % 320;
|
||||
}
|
||||
@ -30,6 +30,7 @@ Entry:
|
||||
|
||||
move.l #0,d1 ; x pos
|
||||
move.l #0,d2 ; shift counter
|
||||
move.l #0,d3
|
||||
MainLoop:
|
||||
jsr WaitVerticalBlank
|
||||
move.l d1,d0 ; x position in pixels
|
||||
@ -37,20 +38,25 @@ MainLoop:
|
||||
jsr SwitchBuffers ; takes bitplane pointer offset in d0
|
||||
add.l #1,d1
|
||||
.backfill:
|
||||
move.l onscreen,a1
|
||||
add.l d0,a1
|
||||
;; sub.l #2,a1
|
||||
move.l a1,a0
|
||||
move.l onscreen,a0
|
||||
add.l d0,a0
|
||||
add.l #BITPLANE_WIDTH_BYTES-2,a0 ; dest
|
||||
lea tilemap,a1
|
||||
lea map,a2
|
||||
add.l d3,a2
|
||||
add.w (a2),a1 ; source tile
|
||||
jsr BlitTile
|
||||
move.l offscreen,a1
|
||||
add.l d0,a1
|
||||
;; sub.l #2,a1
|
||||
move.l a1,a0
|
||||
add.l #BITPLANE_WIDTH_BYTES-2,a0
|
||||
|
||||
move.l offscreen,a0
|
||||
add.l d0,a0
|
||||
add.l #BITPLANE_WIDTH_BYTES-2,a0 ; dest
|
||||
lea tilemap,a1
|
||||
lea map,a2
|
||||
add.l d3,a2
|
||||
add.w (a2),a1 ; source tile
|
||||
jsr BlitTile
|
||||
|
||||
|
||||
add.l #2,d3
|
||||
|
||||
cmp.l #15,d2
|
||||
bne .s1
|
||||
move.l #0,d2
|
||||
@ -99,24 +105,27 @@ copperListBplPtr:
|
||||
dc.l $fffffffe
|
||||
|
||||
InstallPalette:
|
||||
include "out/gigi_full-palette.s"
|
||||
include "out/tilemap-palette.s"
|
||||
rts
|
||||
|
||||
GreyPalette:
|
||||
include "out/gigi_full-grey.s"
|
||||
rts
|
||||
onscreen:
|
||||
dc.l bitplanes1
|
||||
offscreen:
|
||||
dc.l bitplanes2
|
||||
|
||||
tilemap:
|
||||
incbin "out/tilemap.bin"
|
||||
|
||||
bitplanes1:
|
||||
incbin "out/gigi_full.bin"
|
||||
ds.b IMAGESIZE
|
||||
ds.b BITPLANE_WIDTH_BYTES*20
|
||||
bitplanes2:
|
||||
incbin "out/gigi_full.bin"
|
||||
ds.b IMAGESIZE
|
||||
ds.b BITPLANE_WIDTH_BYTES*20
|
||||
|
||||
map:
|
||||
include "out/main-map.s"
|
||||
|
||||
section .bss
|
||||
startUserstack:
|
||||
ds.b $1000 ; size of stack
|
||||
|
||||
BIN
026.tile_hscroll/tilemap.png
Normal file
BIN
026.tile_hscroll/tilemap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
Reference in New Issue
Block a user