mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-09-12 03:52:12 +00:00
Refactor ready for adding compression
This commit is contained in:
@@ -24,6 +24,7 @@ IMAGECON_ARGS=--colors 32 --quantize
|
||||
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
|
||||
endif
|
||||
|
||||
SHRUNKDATA=$(IMAGEDATA:.bin=.bin.sz)
|
||||
SIZEDIMAGEDATA=$(addprefix out/, $(IMAGES:.png=.sized.png))
|
||||
|
||||
ifeq ($(INTERLACE),1)
|
||||
@@ -42,8 +43,12 @@ out/%.sized.png: ../assets/%.png
|
||||
out/%.bin: out/%.sized.png
|
||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-palette-asm --output-palette $(DITHER) --output out/$*
|
||||
|
||||
out/%.bin.sz: out/%.bin
|
||||
$(SHRINKLEREXE) -d $< $@
|
||||
|
||||
|
||||
out/%-ham.bin: out/%.sized.png
|
||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-palette-asm --output-palette $(DITHER) --output out/$* --use-palette=palettes/$*.pal
|
||||
|
||||
out/main.o: $(SIZEDIMAGEDATA) $(IMAGEDATA) constants.i Makefile link.script
|
||||
out/main.o: $(SIZEDIMAGEDATA) $(IMAGEDATA) $(SHRUNKDATA) constants.i Makefile link.script
|
||||
out/init.o: constants.i Makefile
|
||||
@@ -11,3 +11,4 @@ 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
|
||||
IMAGESIZE equ SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH*SCREEN_HEIGHT
|
||||
+142
-19
@@ -1,6 +1,8 @@
|
||||
include "includes.i"
|
||||
|
||||
xref LoadNextImage
|
||||
|
||||
|
||||
|
||||
LoadNextImage:
|
||||
movem.l d0-a6,-(sp)
|
||||
@@ -11,34 +13,78 @@ LoadNextImage:
|
||||
move.l #0,imageIndex
|
||||
lea imageLookupTable,a1
|
||||
.showImage
|
||||
move.l a1,a2
|
||||
move.l (a1),a1 ; address of InsallColorPalette(X)
|
||||
move.l 4(a2),a2 ; address of LoadImage(X)
|
||||
jsr (a2)
|
||||
add.l #8,imageIndex
|
||||
move.l a1,a3
|
||||
move.l (a1),a2 ; address of InsallColorPalette(X)
|
||||
move.l 4(a3),a1 ; address of compressed image on disk
|
||||
move.l 8(a3),d0 ; size of compressed image
|
||||
move.l 12(a3),a3 ; address of LoadImage(X)
|
||||
jsr (a3)
|
||||
add.l #16,imageIndex
|
||||
movem.l (sp)+,d0-a6
|
||||
rts
|
||||
|
||||
Callback:
|
||||
;; d0 = Number of bytes decompressed so far
|
||||
;; a0 = Callback argument
|
||||
move.l a6,-(sp)
|
||||
lea CUSTOM,a6
|
||||
move.w d0,COLOR00(a6) ; Set wild background colors as we decompress
|
||||
move.l (sp)+,a6
|
||||
rts
|
||||
|
||||
LoadImage1:
|
||||
;; d0 - size
|
||||
;; a1 - start address
|
||||
lea InstallColorPalette,a0
|
||||
move.l imageSize,d0
|
||||
;; a2 - InstallColorPalette(X) address
|
||||
if 0
|
||||
move.l bitplanesp3,a0 ; Load compressed data into bitplanes3
|
||||
endif
|
||||
|
||||
move.l bitplanesp1,a0
|
||||
bsr DoLoadImage
|
||||
jsr InstallColorPalette
|
||||
lea bitplanes,a1
|
||||
bsr SetupImage
|
||||
rts
|
||||
|
||||
if 0
|
||||
;; Decompress
|
||||
; a0 = compressed data
|
||||
; a1 = decompressed data destination
|
||||
move.l bitplanesp1,a1
|
||||
; a2 = progress callback, can be zero if no callback is desired.
|
||||
lea Callback(pc),a2
|
||||
bsr ShrinklerDecompress ; -> decompress!
|
||||
endif
|
||||
|
||||
LoadImage2:
|
||||
;; a1 - start address
|
||||
lea InstallColorPalette2,a0
|
||||
move.l imageSize,d0
|
||||
bsr DoLoadImage
|
||||
jsr InstallColorPalette2
|
||||
lea bitplanes2,a1
|
||||
jsr (a2)
|
||||
move.l bitplanesp1,a1
|
||||
bsr SetupImage
|
||||
rts
|
||||
|
||||
LoadImage2:
|
||||
;; d0 - size
|
||||
;; a1 - start address
|
||||
;; a2 - InstallColorPalette(X) address
|
||||
if 0
|
||||
move.l bitplanesp3,a0 ; Load compressed data into bitplanes3
|
||||
endif
|
||||
|
||||
move.l bitplanesp2,a0
|
||||
bsr DoLoadImage
|
||||
|
||||
if 0
|
||||
;; Decompress
|
||||
; a0 = compressed data
|
||||
; a1 = decompressed data destination
|
||||
move.l bitplanesp2,a1
|
||||
; a2 = progress callback, can be zero if no callback is desired.
|
||||
lea Callback(pc),a2
|
||||
bsr ShrinklerDecompress ; -> decompress!
|
||||
endif
|
||||
|
||||
jsr (a2)
|
||||
move.l bitplanesp2,a1
|
||||
bsr SetupImage
|
||||
rts
|
||||
|
||||
|
||||
SetupImage:
|
||||
;; a1 - bitplanes address
|
||||
movem.l d0-a6,-(sp)
|
||||
@@ -83,19 +129,96 @@ DoLoadImage:
|
||||
|
||||
imageLookupTable:
|
||||
dc.l InstallColorPalette
|
||||
dc.l imageData1
|
||||
dc.l endImageData1-imageData1
|
||||
dc.l LoadImage2
|
||||
|
||||
dc.l InstallColorPalette2
|
||||
dc.l imageData2
|
||||
dc.l endImageData2-imageData2
|
||||
dc.l LoadImage1
|
||||
|
||||
dc.l InstallColorPalette3
|
||||
dc.l imageData3
|
||||
dc.l endImageData3-imageData3
|
||||
dc.l LoadImage2
|
||||
|
||||
dc.l InstallColorPalette4
|
||||
dc.l imageData4
|
||||
dc.l endImageData4-imageData4
|
||||
dc.l LoadImage1
|
||||
|
||||
dc.l InstallColorPalette5
|
||||
dc.l imageData5
|
||||
dc.l endImageData5-imageData5
|
||||
dc.l LoadImage2
|
||||
|
||||
dc.l InstallColorPalette6
|
||||
dc.l imageData6
|
||||
dc.l endImageData6-imageData6
|
||||
dc.l LoadImage1
|
||||
dc.l 0
|
||||
|
||||
imageIndex:
|
||||
dc.l 0
|
||||
|
||||
|
||||
|
||||
include "../tools/external/shrinkler/ShrinklerDecompress.S"
|
||||
|
||||
|
||||
|
||||
section .photo
|
||||
|
||||
cnop 0,512
|
||||
imageData1:
|
||||
if HAM_MODE==1
|
||||
incbin "out/mr-ham.bin"
|
||||
else
|
||||
incbin "out/mr.bin"
|
||||
endif
|
||||
endImageData1:
|
||||
|
||||
cnop 0,512
|
||||
imageData2:
|
||||
if HAM_MODE==1
|
||||
incbin "out/catwoman-ham.bin"
|
||||
else
|
||||
incbin "out/catwoman.bin"
|
||||
endif
|
||||
endImageData2:
|
||||
|
||||
cnop 0,512
|
||||
imageData3:
|
||||
if HAM_MODE==1
|
||||
incbin "out/batgirl-ham.bin"
|
||||
else
|
||||
incbin "out/batgirl.bin"
|
||||
endif
|
||||
endImageData3:
|
||||
|
||||
cnop 0,512
|
||||
imageData4:
|
||||
if HAM_MODE==1
|
||||
incbin "out/kb-ham.bin"
|
||||
else
|
||||
incbin "out/kb.bin"
|
||||
endif
|
||||
endImageData4:
|
||||
|
||||
cnop 0,512
|
||||
imageData5:
|
||||
if HAM_MODE==1
|
||||
incbin "out/fe-ham.bin"
|
||||
else
|
||||
incbin "out/fe.bin"
|
||||
endif
|
||||
endImageData5:
|
||||
|
||||
cnop 0,512
|
||||
imageData6:
|
||||
if HAM_MODE==1
|
||||
incbin "out/ww-ham.bin"
|
||||
else
|
||||
incbin "out/ww.bin"
|
||||
endif
|
||||
endImageData6:
|
||||
+16
-59
@@ -5,15 +5,16 @@
|
||||
xref Level3InterruptHandler
|
||||
xref copperList
|
||||
xref copperListAlternate
|
||||
xref imageSize
|
||||
xref bitplanes
|
||||
xref bitplanes2
|
||||
xref InstallColorPalette
|
||||
xref InstallColorPalette2
|
||||
xref InstallColorPalette3
|
||||
xref InstallColorPalette4
|
||||
xref InstallColorPalette5
|
||||
xref InstallColorPalette6
|
||||
xref bitplanesp1
|
||||
xref bitplanesp2
|
||||
xref bitplanesp3
|
||||
|
||||
|
||||
byteMap:
|
||||
dc.l Entry
|
||||
@@ -126,76 +127,32 @@ copperList:
|
||||
dc.w BPL6PTH,0
|
||||
dc.l $fffffffe
|
||||
|
||||
imageSize:
|
||||
dc.l endbitplanes-InstallColorPalette
|
||||
|
||||
section .photo
|
||||
InstallColorPalette:
|
||||
include "out/mr-palette.s"
|
||||
rts
|
||||
bitplanes:
|
||||
if HAM_MODE==1
|
||||
incbin "out/mr-ham.bin"
|
||||
else
|
||||
incbin "out/mr.bin"
|
||||
endif
|
||||
endbitplanes:
|
||||
|
||||
|
||||
cnop 0,512
|
||||
rts
|
||||
InstallColorPalette2:
|
||||
include "out/catwoman-palette.s"
|
||||
rts
|
||||
bitplanes2:
|
||||
if HAM_MODE==1
|
||||
incbin "out/catwoman-ham.bin"
|
||||
else
|
||||
incbin "out/catwoman.bin"
|
||||
endif
|
||||
endbitplanes2:
|
||||
|
||||
|
||||
cnop 0,512
|
||||
InstallColorPalette3:
|
||||
include "out/batgirl-palette.s"
|
||||
rts
|
||||
if HAM_MODE==1
|
||||
incbin "out/batgirl-ham.bin"
|
||||
else
|
||||
incbin "out/batgirl.bin"
|
||||
endif
|
||||
endbitplanes3:
|
||||
|
||||
|
||||
cnop 0,512
|
||||
InstallColorPalette4:
|
||||
include "out/kb-palette.s"
|
||||
rts
|
||||
if HAM_MODE==1
|
||||
incbin "out/kb-ham.bin"
|
||||
else
|
||||
incbin "out/kb.bin"
|
||||
endif
|
||||
endbitplanes4:
|
||||
|
||||
cnop 0,512
|
||||
InstallColorPalette5:
|
||||
include "out/fe-palette.s"
|
||||
rts
|
||||
if HAM_MODE==1
|
||||
incbin "out/fe-ham.bin"
|
||||
else
|
||||
incbin "out/fe.bin"
|
||||
endif
|
||||
endbitplanes5:
|
||||
|
||||
cnop 0,512
|
||||
InstallColorPalette6:
|
||||
include "out/ww-palette.s"
|
||||
rts
|
||||
if HAM_MODE==1
|
||||
incbin "out/ww-ham.bin"
|
||||
else
|
||||
incbin "out/ww.bin"
|
||||
endif
|
||||
endbitplanes6:
|
||||
|
||||
align 4
|
||||
|
||||
|
||||
bitplanesp1:
|
||||
dc.l endCode
|
||||
bitplanesp2:
|
||||
dc.l endCode+(512)+IMAGESIZE
|
||||
bitplanesp3:
|
||||
dc.l endCode+(512*2)+(2*IMAGESIZE)
|
||||
|
||||
Reference in New Issue
Block a user