Refactored slideshow example

This commit is contained in:
alpine9000 2016-03-24 16:12:29 +11:00
parent 0019f4af27
commit 8a99dfafdf
35 changed files with 415 additions and 408 deletions

View File

@ -5,16 +5,16 @@ INTERLACE=1
HAM_MODE=1
USERSTACK_ADDRESS=7fffc # userstack used by bootblock
BASE_ADDRESS=10000 # if you change this you must also change link.script
BASE_ADDRESS=800 # if you change this you must also change link.script.x
BOOTBLOCK_ASM=alpine_bootblock.s
OBJS=out/init.o out/utils.o out/trackloader.o out/image.o out/blitter.o
OBJS=out/init.o out/utils.o out/trackloader.o out/image.o out/blitter.o out/module.o out/disk.o out/data.o
ifeq ($(INTERLACE),0)
NOINTERLACE_EXTRA=mr8.png
NOINTERLACE_EXTRA=image8.png
endif
IMAGES=mr.png mr2.png mr3.png mr4.png mr6.png mr9.png mr10.png $(NOINTERLACE_EXTRA)
IMAGES=image1.png image2.png image3.png image4.png image5.png image6.png image7.png $(NOINTERLACE_EXTRA)
P61MODULE=out/P61.breath_of_life.lz
@ -30,6 +30,8 @@ IMAGECON_ARGS=--colors 32 --quantize
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
endif
SHRUNKDATA=$(IMAGEDATA:.bin=.lz)
SIZEDIMAGEDATA=$(addprefix out/, $(IMAGES:.png=.sized.png))
@ -40,11 +42,12 @@ FLAGS=--height=256
endif
#SYMBOL_INFO=-M
LINK_COMMANDLINE=vlink -T link.script -brawbin1 $< $(OBJS) $(SYMBOL_INFO) -o $@
#LINK_COMMANDLINE=vlink -T link.script.x -brawbin1 $< $(OBJS) $(SYMBOL_INFO) -osec=out/main && cat out/main.load out/main.photo > out/main.bin
LINK_COMMANDLINE=vlink -T link.script.x -brawbin1 $< $(OBJS) $(SYMBOL_INFO) -o out/main.bin
include ../shared/base.mk
out/%.sized.png: ../assets/%.png
out/%.sized.png: assets/%.png
$(RESIZE) --width=320 $(FLAGS) --blur=0.75 --input=$< --output=$@
out/%.bin: out/%.sized.png
@ -59,5 +62,5 @@ out/%.lz: ../assets/%.mod
out/%-ham.bin: out/%.sized.png
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-palette-asm --output-palette $(DITHER) --output out/$*
out/main.o: $(P61MODULE) $(SIZEDIMAGEDATA) $(IMAGEDATA) $(SHRUNKDATA) constants.i Makefile link.script
out/main.o: $(P61MODULE) $(SIZEDIMAGEDATA) $(IMAGEDATA) $(SHRUNKDATA) constants.i Makefile link.script.x
out/init.o: constants.i Makefile

View File

@ -240,7 +240,8 @@ MotorOff:
LoadTrak: ;loadtrack+decode.a0=dst,d0=secoffs,d1=secsleft
MOVE.W D0,-(SP)
MOVE.W D1,-(SP)
lea (MFMbuf).w,a1
;; lea (MFMbuf).w,a1
lea (MFMbuf),a1
move.w #2,$9c-2(a6) ;Clr Req
move.l a1,$20-2(a6)
move.w #$8210,$96-2(a6) ;DskEna
@ -335,7 +336,8 @@ BootE:
cnop 0,1024
;MFMbuf is placed here after bootblock end, $3c0.w or so when copied.
MFMbuf equ LoaderVars+(BootE-CopyStart)
MFMbuf equ $E0000
;; MFMbuf equ LoaderVars+(BootE-CopyStart)
MFMbufE equ MFMbuf+MFMlen ;lowest free address. $372e for a full bootblock.
mainStart:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

Before

Width:  |  Height:  |  Size: 708 KiB

After

Width:  |  Height:  |  Size: 708 KiB

152
023.slideshow/data.s Normal file
View File

@ -0,0 +1,152 @@
include "includes.i"
xdef imageLookupTable
xdef compressedModule
xdef endCompressedModule
InstallColorPalette:
include "out/image1-palette.s"
rts
InstallColorPalette2:
include "out/image2-palette.s"
rts
InstallColorPalette3:
include "out/image3-palette.s"
rts
InstallColorPalette4:
include "out/image4-palette.s"
rts
InstallColorPalette5:
include "out/image5-palette.s"
rts
InstallColorPalette6:
include "out/image6-palette.s"
rts
InstallColorPalette7:
include "out/image7-palette.s"
rts
if INTERLACE==0
InstallColorPalette8:
include "out/image8-palette.s"
rts
endif; INTERLACE==0
imageLookupTable: ; configure slideshow here
dc.l InstallColorPalette ; palette installation routine
dc.l imageData1 ; compressed image data
dc.l endImageData1-imageData1 ; compressed image data size
dc.l InstallColorPalette2
dc.l imageData2
dc.l endImageData2-imageData2
dc.l InstallColorPalette3
dc.l imageData3
dc.l endImageData3-imageData3
dc.l InstallColorPalette4
dc.l imageData4
dc.l endImageData4-imageData4
dc.l InstallColorPalette5
dc.l imageData5
dc.l endImageData5-imageData5
dc.l InstallColorPalette6
dc.l imageData6
dc.l endImageData6-imageData6
dc.l InstallColorPalette7
dc.l imageData7
dc.l endImageData7-imageData7
if INTERLACE==0
dc.l InstallColorPalette8
dc.l imageData8
dc.l endImageData8-imageData8
endif; INTERLACE==0
dc.l 0 ; terminate list
section .noload ; data in this section will not be loaded by the bootloader
cnop 0,512 ; each image must be aligned to a sector boundary
imageData1: ; because I am too lazy to read non aligned data
if HAM_MODE==1
incbin "out/image1-ham.lz"
else
incbin "out/image1.lz"
endif
endImageData1:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData2: ; because I am too lazy to read non aligned data
if HAM_MODE==1
incbin "out/image2-ham.lz"
else
incbin "out/image2.lz"
endif
endImageData2:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData3:
if HAM_MODE==1
incbin "out/image3-ham.lz"
else
incbin "out/image3.lz"
endif
endImageData3:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData4:
if HAM_MODE==1
incbin "out/image4-ham.lz"
else
incbin "out/image4.lz"
endif
endImageData4:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData5:
if HAM_MODE==1
incbin "out/image5-ham.lz"
else
incbin "out/image5.lz"
endif
endImageData5:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData6:
if HAM_MODE==1
incbin "out/image6-ham.lz"
else
incbin "out/image6.lz"
endif
endImageData6:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData7:
if HAM_MODE==1
incbin "out/image7-ham.lz"
else
incbin "out/image7.lz"
endif
endImageData7:
if INTERLACE==0
cnop 0,512 ; each image must be aligned to a sector boundary
imageData8:
if HAM_MODE==1
incbin "out/image8-ham.lz"
else
incbin "out/image8.lz"
endif
endImageData8:
endif; INTERLACE==0
cnop 0,512
compressedModule:
incbin "out/P61.breath_of_life.lz"
endCompressedModule:

27
023.slideshow/disk.s Normal file
View File

@ -0,0 +1,27 @@
xdef LoadDiskData
LoadDiskData:
;; a0 - destination address
;; a1 - start address
;; d0 - size
movem.l d0-a6,-(sp)
lea $dff002,a6 ; LoadMFMB uses this custom base addr
move.l d0,d1
move.l a1,d0
move.l #startCode,d2
sub.l d2,d0 ; offset from start of this module
lsr.l #6,d0 ; bytes -> sectors
lsr.l #3,d0
add.l #2,d0 ; offset for bootblock
add.l #512,d1
lsr.l #6,d1 ; bytes -> sectors
lsr.l #3,d1
neg.w d1
jsr LoadMFMB ; load the data!
movem.l (sp)+,d0-a6
rts

View File

@ -1,7 +1,6 @@
include "includes.i"
xdef LoadNextImage
xdef LoadModule
xdef SetupImage
LoadNextImage:
@ -26,29 +25,28 @@ LoadImage:
;; d0 - size
;; a1 - start address
;; a2 - InstallColorPalette(X) address
move.l bitplanesp3,a0 ; load compressed data into bitplanes3
bsr DoLoadImage ; load data from disk
lea bitplanes3,a0
bsr LoadDiskData ; load data from disk
move.l nextbitplane,a1 ; decompress into offscreen bitplanesp(1/2)
move.l (a1),a1
;a0 = Input buffer to be decompressed. Must be 16-bit aligned!
;a1 = Output buffer. Points to the end of the data at exit
;; a0 = Input buffer to be decompressed. Must be 16-bit aligned!
;; a1 = Output buffer. Points to the end of the data at exit
jsr Depack
jsr WaitVerticalBlank ; avoid tearing when we show the new image
jsr (a2) ; install new color palette
bsr SetupImage ; display new image
;; toggle offscreen bitplane
cmp.l #bitplanesp1,nextbitplane
beq .setbitplanesp2
.setbitplanesp1:
move.l #bitplanesp1,nextbitplane
cmp.l #bitplanes1,nextbitplane
beq .setbitplanes2
.setbitplanes1:
move.l #bitplanes1,nextbitplane
bra .done
.setbitplanesp2:
move.l #bitplanesp2,nextbitplane
.setbitplanes2:
move.l #bitplanes2,nextbitplane
.done:
rts
@ -69,199 +67,9 @@ SetupImage:
movem.l (sp)+,d0-a6
rts
DoLoadImage:
;; a0 - destination address
;; a1 - start address
;; d0 - size
movem.l d0-a6,-(sp)
lea $dff002,a6 ; LoadMFMB uses this custom base addr
move.l d0,d1
move.l a1,d0
move.l #startCode,d2
sub.l d2,d0 ; offset from start of this module
lsr.l #6,d0 ; bytes -> sectors
lsr.l #3,d0
add.l #2,d0 ; offset for bootblock
add.l #512,d1
lsr.l #6,d1 ; bytes -> sectors
lsr.l #3,d1
neg.w d1
jsr LoadMFMB ; load the data!
movem.l (sp)+,d0-a6
rts
imageLookupTable: ; configure slideshow here
dc.l InstallColorPalette ; palette installation routine
dc.l imageData1 ; compressed image data
dc.l endImageData1-imageData1 ; compressed image data size
dc.l InstallColorPalette2
dc.l imageData2
dc.l endImageData2-imageData2
dc.l InstallColorPalette3
dc.l imageData3
dc.l endImageData3-imageData3
dc.l InstallColorPalette4
dc.l imageData4
dc.l endImageData4-imageData4
dc.l InstallColorPalette5
dc.l imageData5
dc.l endImageData5-imageData5
dc.l InstallColorPalette6
dc.l imageData6
dc.l endImageData6-imageData6
dc.l InstallColorPalette7
dc.l imageData7
dc.l endImageData7-imageData7
if INTERLACE==0
dc.l InstallColorPalette8
dc.l imageData8
dc.l endImageData8-imageData8
endif; INTERLACE==0
dc.l 0 ; terminate list
imageIndex:
dc.l 0
nextbitplane:
dc.l bitplanesp1
LoadModule:
;; a0 - destination address
;; a1 - start address
;; d0 - size
movem.l d0-a6,-(sp)
lea endCode,a0
lea compressedModule,a1
move.l #endCompressedModule,d0
sub.l #compressedModule,d0
jsr DoLoadImage
;a0 = input buffer to be decompressed. Must be 16-bit aligned!
;a1 = output buffer. Points to the end of the data at exit
lea endCode,a0
lea Module1,a1
move.l (a1),a1
jsr Depack
dc.l bitplanes1
movem.l (sp)+,d0-a6
rts
InstallColorPalette:
include "out/mr-palette.s"
rts
InstallColorPalette2:
include "out/mr2-palette.s"
rts
InstallColorPalette3:
include "out/mr3-palette.s"
rts
InstallColorPalette4:
include "out/mr4-palette.s"
rts
InstallColorPalette5:
include "out/mr9-palette.s"
rts
InstallColorPalette6:
include "out/mr6-palette.s"
rts
InstallColorPalette7:
include "out/mr10-palette.s"
rts
if INTERLACE==0
InstallColorPalette8:
include "out/mr8-palette.s"
rts
endif; INTERLACE==0
section .photo ; data in this section will not be loaded by the bootloader
cnop 0,512 ; each image must be aligned to a sector boundary
imageData1: ; because I am too lazy to read non aligned data
if HAM_MODE==1
incbin "out/mr-ham.lz"
else
incbin "out/mr.lz"
endif
endImageData1:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData2: ; because I am too lazy to read non aligned data
if HAM_MODE==1
incbin "out/mr2-ham.lz"
else
incbin "out/mr2.lz"
endif
endImageData2:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData3:
if HAM_MODE==1
incbin "out/mr3-ham.lz"
else
incbin "out/mr3.lz"
endif
endImageData3:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData4:
if HAM_MODE==1
incbin "out/mr4-ham.lz"
else
incbin "out/mr4.lz"
endif
endImageData4:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData5:
if HAM_MODE==1
incbin "out/mr9-ham.lz"
else
incbin "out/mr9.lz"
endif
endImageData5:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData6:
if HAM_MODE==1
incbin "out/mr6-ham.lz"
else
incbin "out/mr6.lz"
endif
endImageData6:
cnop 0,512 ; each image must be aligned to a sector boundary
imageData7:
if HAM_MODE==1
incbin "out/mr10-ham.lz"
else
incbin "out/mr10.lz"
endif
endImageData7:
if INTERLACE==0
cnop 0,512 ; each image must be aligned to a sector boundary
imageData8:
if HAM_MODE==1
incbin "out/mr8-ham.lz"
else
incbin "out/mr8.lz"
endif
endImageData8:
endif; INTERLACE==0
cnop 0,512
compressedModule:
incbin "out/P61.breath_of_life.lz"
endCompressedModule:

View File

@ -40,7 +40,7 @@ HAMBIT equ 0
lea copperList,a0
move.l a0,COP1LC(a6)
move.w COPJMP1(a6),d0
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
;; move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
movem.l (sp)+,d0-a6
rts

View File

@ -1,24 +0,0 @@
MEMORY
{
ram: org = 0x10000, len = 0x100000
}
SECTIONS
{
load : {
startCode = .;
*(.text)
*(.bss)
*(.data)
*(CODE)
*(DATA)
endCode = .;
} > ram
photo ALIGN(512) : {
startData = .;
*(.photo)
endData = .;
} > ram
}

View File

@ -0,0 +1,28 @@
MEMORY
{
disk: org = 0x800, len = 0xDB800
ram: org = 0x00000, len = 0x80000
}
SECTIONS
{
load : {
startCode = .;
*(.text)
*(.data)
*(CODE)
*(DATA)
endCode = .;
} > disk
noload ALIGN(512) : {
startData = .;
*(.noload)
endData = .;
} > disk
bss (NOLOAD) : {
. = endCode;
*(.bss)
} > ram;
}

21
023.slideshow/module.s Normal file
View File

@ -0,0 +1,21 @@
xdef LoadModule
LoadModule:
movem.l d0-a6,-(sp)
lea bitplanes1,a0
lea compressedModule,a1
move.l #endCompressedModule,d0
sub.l #compressedModule,d0
;; a0 - destination address
;; a1 - start address
;; d0 - size
jsr LoadDiskData
;; a0 - input buffer to be decompressed. Must be 16-bit aligned!
;; a1 - output buffer. Points to the end of the data at exit
lea bitplanes1,a0
lea Module,a1
jsr Depack
movem.l (sp)+,d0-a6
rts

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -0,0 +1,16 @@
210
fed
b76
fff
ecb
321
744
c98
fdc
c53
dba
965
b87
ffe
533
da9

View File

@ -1,17 +0,0 @@
111
9ac
244
cef
28a
744
122
3ce
267
cbd
978
422
b8c
def
133
19c

View File

@ -1,17 +0,0 @@
000
fff
757
a23
99a
355
ccc
788
258
222
eee
666
abb
444
555
777

View File

@ -1,16 +0,0 @@
011
865
222
c97
543
ecb
b75
344
689
432
754
111
233
da8
fed
455

View File

@ -1,17 +0,0 @@
111
9ac
244
cef
28a
744
122
3ce
267
cbd
978
422
b8c
def
133
19c

View File

@ -1,17 +0,0 @@
000
da8
532
ffe
211
865
922
dcb
e63
544
322
988
fd5
511
111
edd

View File

@ -1,17 +0,0 @@
000
dcd
833
fff
a02
877
134
ba9
555
701
112
d02
def
058
ec9
333

View File

@ -1,17 +0,0 @@
000
aad
734
cef
67a
d58
211
722
346
ace
fef
933
e8b
79c
d27
568

View File

@ -1,16 +0,0 @@
100
a86
522
dc9
744
311
eeb
cb8
965
633
b97
200
854
411
eda
422

View File

@ -2,23 +2,22 @@
include "P6112-Options.i"
xdef PokeBitplanePointers
xdef Level3InterruptHandler
xdef copperList
xdef copperListAlternate
xdef bitplanesp1
xdef bitplanesp2
xdef bitplanesp3
xdef Module1
xdef bitplanes1
xdef bitplanes2
xdef bitplanes3
xdef Module
byteMap:
dc.l Entry
dc.l endCode-byteMap
Entry:
move.l userstack,a7
lea userstack,a7
lea CUSTOM,a6
move #$7ff,DMACON(a6) ; disable all dma
;; move #$7ff,DMACON(a6) ; disable all dma
move #$7fff,INTENA(a6) ; disable all interrupts
move.w d0,COLOR00(a6) ; black screen
@ -28,23 +27,23 @@ Entry:
move.l a3,LVL3_INT_VECTOR
;; initialise P61
lea Module1,a0
move.l (a0),a0
lea Module,a0
sub.l a1,a1
sub.l a2,a2
moveq #0,d0
jsr P61_Init
move.w #(INTF_SETCLR|INTF_VERTB|INTF_INTEN),INTENA(a6)
move.l bitplanesp2,a0 ; setup an empty bitplane
move.l #IMAGESIZE,d0
jsr ClearMemory ; clear it
jsr WaitBlitter ; make sure it's clear
move.l a0,a1
bsr SetupImage ; select it
lea bitplanes2,a0
move.l #IMAGESIZE/4,d0
.clear:
move.l #0,(a0)+
dbra d0,.clear
lea bitplanes2,a1
bsr SetupImage ; select it
jsr WaitVerticalBlank
jsr Init ; enable the playfield
move.l #50*10,d0
@ -82,9 +81,6 @@ Level3InterruptHandler:
.verticalBlank:
move.w #INTF_VERTB,INTREQ(a6) ; clear interrupt bit
movem.l d0-a6,-(sp)
;; jsr P61_Music ; and call the playroutine manually.
movem.l (sp)+,d0-a6
if INTERLACE==1
btst #VPOSRLOFBIT,VPOSR(a6)
@ -166,19 +162,19 @@ copperList:
dc.w BPL6PTL,0
dc.w BPL6PTH,0
dc.l $fffffffe
;; Module1:
;; incbin "../assets/P61.sowhat-intro" ;usecode $9410
align 4
bitplanesp1:
dc.l endCode
bitplanesp2:
dc.l endCode+(512)+IMAGESIZE
bitplanesp3:
dc.l endCode+(512*2)+(2*IMAGESIZE)
userstack:
dc.l endCode+(512*3)+(3*IMAGESIZE)+$1000
Module1:
dc.l endCode+(512*3)+(3*IMAGESIZE)+$1000+4
section .bss
bitplanes1:
ds.b IMAGESIZE+512
bitplanes2:
ds.b IMAGESIZE+(512*2)
bitplanes3:
ds.b IMAGESIZE+(512*3)
startUserstack:
ds.b $1000
userstack:
endUserstack:
Module:

Binary file not shown.