From e428d2211f33d0e8c3ae004d7cc8642c0150fe5f Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Tue, 10 May 2016 19:30:38 +1000 Subject: [PATCH] don't be quite as wasteful with ram --- 028.bs/Makefile | 17 ++++++++++++++- 028.bs/background.s | 12 +++++----- 028.bs/constants.i | 6 ++--- 028.bs/game1.s | 52 +++++++++++++++++++++++++++++++++++--------- 028.bs/link.script.x | 1 + 028.bs/splash.s | 8 ++++++- shared/base.mk | 1 + 7 files changed, 77 insertions(+), 20 deletions(-) diff --git a/028.bs/Makefile b/028.bs/Makefile index cfce4af..fa6a5f1 100644 --- a/028.bs/Makefile +++ b/028.bs/Makefile @@ -17,6 +17,7 @@ IMAGES=foreground.png \ background.png \ panel.png \ mpanel.png \ + mpanelOrig.png \ sprite_pig-0.png \ sprite_pig-1.png \ sprite_pig-2.png \ @@ -71,7 +72,6 @@ IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin)) VASM_EXTRA_ARGS=-DTIMING_TEST=0 -DSFX=1 -#SYMBOL_INFO=-M LINKER_OPTIONS=-T link.script.x include ../shared/base.mk @@ -109,6 +109,10 @@ out/panel.bin: assets/panel.png out/mpanel.bin: assets/mpanel.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 16 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output-grey-palette --output out/mpanel --use-palette=assets/mpanel.pal +out/mpanelOrig.bin: out/mpanelOrig.png + $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 16 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output-grey-palette --output out/mpanelOrig --use-palette=assets/mpanel.pal + + out/sprite_pig-%.bin: out/sprite_pig-%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_pig-$* --palette-offset 16 --use-palette=assets/pig.pal @@ -135,27 +139,38 @@ out/sprite_arrow%.bin: out/sprite_arrow%.png $(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_arrow$* --palette-offset 24 --use-palette=assets/arrow.pal +.SECONDARY: out/sprite_pig%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_pig --width=16 --height=16 --rows=1 --cols=8 --dx=16 --dy=16 --x=192 --y=112 +out/mpanelOrig.png: assets/mpanel.png + ../tools/croppa/out/croppa --input=assets/mpanel.png --output=out/mpanelOrig.png --width=320 --height=16 --rows=1 --cols=1 --dx=0 --dy=0 --x=0 --y=8 + +.SECONDARY: out/sprite_robot%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_robot --width=16 --height=16 --rows=1 --cols=8 --dx=16 --dy=16 --x=192 --y=176 +.SECONDARY: out/sprite_tank%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_tank --width=16 --height=16 --rows=1 --cols=8 --dx=16 --dy=16 --x=192 --y=208 +.SECONDARY: out/sprite_fallingPig%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_fallingPig --width=16 --height=16 --rows=1 --cols=5 --dx=16 --dy=16 --x=192 --y=128 +.SECONDARY: out/sprite_fallingRobot%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_fallingRobot --width=16 --height=16 --rows=1 --cols=5 --dx=16 --dy=16 --x=192 --y=192 +.SECONDARY: out/sprite_fallingTank%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_fallingTank --width=16 --height=16 --rows=1 --cols=5 --dx=16 --dy=16 --x=192 --y=224 +.SECONDARY: out/sprite_coin%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_coin --width=16 --height=15 --rows=1 --cols=4 --dx=16 --dy=16 --x=192 --y=144 +.SECONDARY: out/sprite_arrow%.png: assets/assets.png ../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_arrow --width=16 --height=15 --rows=1 --cols=4 --dx=16 --dy=16 --x=192 --y=160 diff --git a/028.bs/background.s b/028.bs/background.s index c507966..4ae1564 100644 --- a/028.bs/background.s +++ b/028.bs/background.s @@ -39,10 +39,10 @@ RenderBackgroundTile: jsr BlitTile cmp.l #backgroundBitplanes1,backgroundOffscreen bne .offsetSub - add.l #IMAGESIZE*2,a0 + add.l #backgroundBitplanes2-backgroundBitplanes1,a0 bra .doBlit .offsetSub: - sub.l #IMAGESIZE*2,a0 + sub.l #backgroundBitplanes2-backgroundBitplanes1,a0 .doBlit: jsr BlitTile rts @@ -64,7 +64,7 @@ RenderNextBackgroundFrame: backgroundScrollX: dc.l 0 backgroundTilemap: - incbin "out/background.bin" + incbin "out/background.bin" backgroundMap: include "out/background-map.s" dc.w $FFFF @@ -75,9 +75,11 @@ backgroundOffscreen: section .bss backgroundBitplanes1: - ds.b IMAGESIZE*2 + ds.b IMAGESIZE + ds.b LINESIZE*10 backgroundBitplanes2: - ds.b IMAGESIZE*2 + ds.b IMAGESIZE + ds.b LINESIZE*10 \ No newline at end of file diff --git a/028.bs/constants.i b/028.bs/constants.i index 2925489..a1ccb39 100644 --- a/028.bs/constants.i +++ b/028.bs/constants.i @@ -21,7 +21,7 @@ PLAYER_CHECK_MISS_PIXELS equ 10 PLAYER_FAST_PAUSE_PIXELS equ 4 ; number of pixel waits between jumps PLAYER_FAST_CHECK_MISS_PIXELS equ 2 - +SPLASH_USE_FOREGROUND equ 0 PATHWAY_FADE_TIMER_COUNT equ 100 @@ -88,5 +88,5 @@ RASTER_X_START equ $81 ; hard coded coordinates from hardware manual RASTER_Y_START equ $2c RASTER_X_STOP equ RASTER_X_START+SCREEN_WIDTH RASTER_Y_STOP equ RASTER_Y_START+256 -SCROLL_EXTRA equ 0 -IMAGESIZE equ BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(SCREEN_HEIGHT+SCROLL_EXTRA) \ No newline at end of file +IMAGESIZE equ BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(SCREEN_HEIGHT) +LINESIZE equ BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH \ No newline at end of file diff --git a/028.bs/game1.s b/028.bs/game1.s index bee6824..690d477 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -24,6 +24,7 @@ xdef foregroundOnscreen xdef foregroundOffscreen xdef foregroundScrollX + xdef foregroundBitplanes1 xdef foregroundMapPtr xdef pathwayMapPtr @@ -51,6 +52,9 @@ Entry: jsr StartMusic jsr ShowSplash + if SPLASH_USE_FOREGROUND=1 + jsr InstallBlackPalette + endif jsr BlueFill ;; d0 - fg bitplane pointer offset @@ -872,9 +876,10 @@ Message: ;; d1 - ypos move.w d0,d1 - move.w #(32*4)<<6|(320/16),d0 + move.w #(32*4)<<6|(8),d0 lea mpanelOrig,a0 lea mpanel,a2 + add.l #(40*4*8),a2 jsr SimpleBlit lea mpanel,a0 @@ -1274,10 +1279,34 @@ InstallFlagsGreyPalette: add.l #4,a2 dbra d0,.loop - rts - - + rts + if SPLASH_USE_FOREGROUND=1 +InstallBlackPalette: + move.w #$000,COLOR00(a6) + move.w #$000,COLOR01(a6) + move.w #$000,COLOR02(a6) + move.w #$000,COLOR03(a6) + move.w #$000,COLOR04(a6) + move.w #$000,COLOR05(a6) + move.w #$000,COLOR06(a6) + move.w #$000,COLOR07(a6) + move.w #$000,COLOR08(a6) + move.w #$000,COLOR09(a6) + move.w #$000,COLOR10(a6) + move.w #$000,COLOR11(a6) + move.w #$000,COLOR12(a6) + move.w #$000,COLOR13(a6) + move.w #$000,COLOR14(a6) + move.w #$000,COLOR15(a6) + move.w #$000,COLOR16(a6) + move.w #$000,COLOR17(a6) + move.w #$000,COLOR18(a6) + move.w #$000,COLOR19(a6) + move.w #$000,COLOR20(a6) + rts + endif + InstallTilePalette: move.l tileFade,tileFadePtr lea playAreaCopperPalettePtr2,a1 @@ -1400,7 +1429,7 @@ InstallPaletteB: foregroundOnscreen: dc.l foregroundBitplanes1 foregroundOffscreen: - dc.l foregroundBitplanes2 + dc.l foregroundBitplanes1+IMAGESIZE foregroundTilemap: incbin "out/foreground.bin" panel: @@ -1408,7 +1437,7 @@ panel: mpanel: incbin "out/mpanel.bin" mpanelOrig: - incbin "out/mpanel.bin" + incbin "out/mpanelOrig.bin" level1ForegroundMap: include "out/foreground-map.s" dc.w $FFFF @@ -1598,11 +1627,14 @@ nextPaletteInstaller: panelFade: include "out/panelFade.s" - section .bss + foregroundBitplanes1: - ds.b IMAGESIZE -foregroundBitplanes2: - ds.b IMAGESIZE + if SPLASH_USE_FOREGROUND=1 + incbin "out/splash.bin" + endif +.endSplash + ds.b (IMAGESIZE*2)-(.endSplash-foregroundBitplanes1) + section .bss startUserstack: ds.b $1000 ; size of stack userstack: diff --git a/028.bs/link.script.x b/028.bs/link.script.x index 4933239..a657cbc 100644 --- a/028.bs/link.script.x +++ b/028.bs/link.script.x @@ -24,5 +24,6 @@ SECTIONS bss (NOLOAD) : { . = endCode; *(.bss) + endRam = .; } > ram; } \ No newline at end of file diff --git a/028.bs/splash.s b/028.bs/splash.s index 8e3af11..c441c74 100644 --- a/028.bs/splash.s +++ b/028.bs/splash.s @@ -20,7 +20,11 @@ ShowSplash: move.w #SPLASH_SCREEN_WIDTH_BYTES*SPLASH_COLOR_DEPTH-SPLASH_SCREEN_WIDTH_BYTES,BPL2MOD(a6) ;; poke bitplane pointers + if SPLASH_USE_FOREGROUND=1 + lea foregroundBitplanes1,a1 + else lea splash(pc),a1 + endif lea splashCopperListBplPtr(pc),a2 moveq #SPLASH_COLOR_DEPTH-1,d0 .bitplaneloop: @@ -68,5 +72,7 @@ splashCopperListBplPtr: dc.w BPL6PTH,0 dc.l $fffffffe + if SPLASH_USE_FOREGROUND=0 splash: - incbin "out/splash.bin" + incbin "out/splash.bin" + endif \ No newline at end of file diff --git a/shared/base.mk b/shared/base.mk index 47ad010..c9cbd45 100644 --- a/shared/base.mk +++ b/shared/base.mk @@ -131,6 +131,7 @@ ALL_DEPENDS=$(ALL_OBJS:.o=.d) out/main.bin: out/main.o $(OBJS) vlink $(LINKER_OPTIONS) -brawbin1 $< $(OBJS) -o $@ @vlink $(LINKER_OPTIONS) -brawbin1 $< $(OBJS) -M -o /tmp/main.bin | grep ", value " | cut -d " " -f3,7 | cut -d "," -f1 > ~/Projects/amiga/debugger.syms + @echo "RAM USAGE:" $$((16#`cat ~/Projects/amiga/debugger.syms | grep endRam | sed 's/0x//' | sed 's/endRam: //'`)) bytes out/shrunk.bin: $(SHRINKLER_EXE) out/main.bin