message panel

This commit is contained in:
alpine9000
2016-04-19 16:37:20 +10:00
parent ec2e0d6874
commit 3fd945009a
7 changed files with 314 additions and 19 deletions
+10 -2
View File
@@ -11,11 +11,12 @@ BASE_ADDRESS=4000
NUM_COLORS=8
BOOTBLOCK_ASM=alpine_bootblock.s
OBJS=out/init.o out/utils.o out/image.o out/blit.o out/joystick.o out/pig.o out/items.o
OBJS=out/init.o out/utils.o out/image.o out/blit.o out/joystick.o out/pig.o out/items.o out/blittext.o
IMAGES=foreground.png \
background.png \
panel.png \
mpanel.png \
sprite_pig_up.png \
sprite_pig_down.png \
sprite_pig_left.png \
@@ -29,7 +30,8 @@ IMAGES=foreground.png \
sprite_coin3.png \
sprite_coin4.png \
sprite_coin6.png \
sprite_coin7.png
sprite_coin7.png \
font8x8.png
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
@@ -55,12 +57,18 @@ out/background.bin: assets/tilemap.png
out/panel.bin: assets/panel.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/panel --use-palette=assets/panel.pal
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/sprite_pig_%.bin: assets/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
out/sprite_coin%.bin: assets/sprite_coin%.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_coin$* --palette-offset 20 --use-palette=assets/coin.pal
out/font%.bin: assets/font%.png
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/font$* --colors=16 --use-palette assets/mpanel.pal --full-color-palette-file --output-mask --transparent-color=0,0,0 --output-png
out/fade.s: assets/bottom_section.pal out/fade
./out/fade assets/bottom_section.pal bottom > out/fade.s
+16
View File
@@ -0,0 +1,16 @@
032 241 006 255
121 240 007 255
021 158 003 255
011 085 001 255
027 053 026 255
255 255 255 255
000 000 000 000
000 000 000 255
000 000 000 255
000 000 000 255
000 000 000 255
000 000 000 255
000 000 000 255
000 000 000 255
000 000 000 255
000 000 000 255
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

+13 -8
View File
@@ -7,7 +7,12 @@ BLIT_LF_MINTERM equ $ca ; cookie cut
BLIT_WIDTH_WORDS equ 1 ; blit 2 words to allow shifting
BLIT_WIDTH_BYTES equ BLIT_WIDTH_WORDS*2
FONTMAP_WIDTH_BYTES equ 32
_SCREEN_BIT_DEPTH equ 4
_BITPLANE_WIDTH_BYTES equ 320/8
MASKED_FONT equ 1
FONT_WIDTH equ 8
FONT_HEIGHT equ 8
if MASKED_FONT==1
BLTCON0_VALUE equ BC0F_SRCA|BC0F_SRCB|BC0F_SRCC|BC0F_DEST|BLIT_LF_MINTERM
else
@@ -20,7 +25,7 @@ BlitChar8:
;; d1 - ypos
;; d2 - char
movem.l d0-d3/a0-a2,-(sp)
mulu.w #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH,d1 ; ypos bytes
mulu.w #_BITPLANE_WIDTH_BYTES*_SCREEN_BIT_DEPTH,d1 ; ypos bytes
lea font(pc),a1 ; font pointer
sub.w #'!',d2 ; index = char - '!'
@@ -28,9 +33,9 @@ BlitChar8:
lsr.w #5,d3 ; char / 32 = fontmap line
andi.w #$1f,d2 ; char index in line (char index - start of line index)
add.l #1,d3 ; while we have a weird font image, '!' starts on second line
mulu.w #FONTMAP_WIDTH_BYTES*SCREEN_BIT_DEPTH*FONT_HEIGHT,d3 ; d3 *= #FONTMAP_WIDTH_BYTES*SCREEN_BIT_DEPTH*FONT_HEIGHT
mulu.w #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT,d3 ; d3 *= #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT
add.l #(FONT_HEIGHT*SCREEN_BIT_DEPTH*FONTMAP_WIDTH_BYTES)-FONTMAP_WIDTH_BYTES+0,a1 ; last word - descending mode
add.l #(FONT_HEIGHT*_SCREEN_BIT_DEPTH*FONTMAP_WIDTH_BYTES)-FONTMAP_WIDTH_BYTES+0,a1 ; last word - descending mode
add.w d3,a1 ; add y offset in lines to font address
add.w d2,a1 ; add offset into font
@@ -38,7 +43,7 @@ BlitChar8:
add.l d0,a0 ; dest += XPOS_BYTES
add.l d1,a0 ; dest += YPOS_BYTES
add.l #(FONT_HEIGHT*SCREEN_BIT_DEPTH*BITPLANE_WIDTH_BYTES)-BITPLANE_WIDTH_BYTES+0,a0 ; last word - descending mode
add.l #(FONT_HEIGHT*_SCREEN_BIT_DEPTH*_BITPLANE_WIDTH_BYTES)-_BITPLANE_WIDTH_BYTES+0,a0 ; last word - descending mode
WaitBlitter
@@ -46,8 +51,8 @@ BlitChar8:
move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTAMOD(a6) ; A modulo (only used for masked version)
endif
move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTBMOD(a6) ; B modulo
move.w #BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTCMOD(a6) ; C modulo
move.w #BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTDMOD(a6) ; D modulo
move.w #_BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTCMOD(a6) ; C modulo
move.w #_BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTDMOD(a6) ; D modulo
move.w #$ffff,BLTAFWM(a6) ; don't mask first word
@@ -76,7 +81,7 @@ BlitChar8:
move.l a0,BLTCPTH(a6) ; background top left corner
move.l a0,BLTDPTH(a6) ; destination top left corner
move.w #(FONT_HEIGHT*SCREEN_BIT_DEPTH)<<6|(BLIT_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit
move.w #(FONT_HEIGHT*_SCREEN_BIT_DEPTH)<<6|(BLIT_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit
movem.l (sp)+,d0-d3/a0-a2
rts
+155
View File
@@ -0,0 +1,155 @@
include "includes.i"
xdef DrawText8
BLIT_LF_MINTERM equ $ca ; cookie cut
BLIT_WIDTH_WORDS equ 2 ; blit 2 words to allow shifting
BLIT_WIDTH_BYTES equ 4
FONT_HEIGHT equ 8
FONT_WIDTH equ 8
FONTMAP_WIDTH_BYTES equ 32
_SCREEN_BIT_DEPTH equ 4
_BITPLANE_WIDTH_BYTES equ 320/8
MASKED_FONT equ 1
DrawText8:
;; a0 - bitplane
;; a1 - text
;; d0 - xpos
;; d1 - ypos
movem.l d0-d7/a0-a4,-(sp)
WaitBlitter
;; blitter config that is shared for every character
if MASKED_FONT==1
move.w #BC0F_SRCA|BC0F_SRCB|BC0F_SRCC|BC0F_DEST|BLIT_LF_MINTERM,d6 ; BLTCON0 value (masked version)
move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTAMOD(a6) ; A modulo (only used for masked version)
else
move.w #BC0F_SRCB|BC0F_SRCC|BC0F_DEST|BLIT_LF_MINTERM,d6 ; BLTCON0 value
endif
move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTBMOD(a6) ; B modulo
move.w #_BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTCMOD(a6) ; C modulo
move.w #_BITPLANE_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTDMOD(a6) ; D modulo
mulu.w #_BITPLANE_WIDTH_BYTES*_SCREEN_BIT_DEPTH,d1 ; ypos bytes
move.w #$0000,BLTALWM(a6) ; mask out extra word used for shifting
move.w #$ffff,BLTADAT(a6) ; preload source mask so only BLTA?WM mask is used
move.l a1,a3 ; character pointer
move.l #font,a5 ; font pointer
move.l #fontMask,d7 ; font mask pointer
move.w #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT,d3 ; bytes per font line
.loop:
clr.l d2
move.b (a3)+,d2 ; get next character
cmp.b #0,d2 ; 0 terminates the string
beq .done
move.l a0,a4 ; bitplane pointer
bsr DrawChar8 ; draw it
add.l #FONT_WIDTH,d0 ; increment the x position
bra .loop
.done:
movem.l (sp)+,d0-d7/a0-a4
rts
DrawChar8:
;; kills d2,d4,d5,a1,a2,a4
;; d0 - xpos
;; d1 - ypos bytes
;; d2* - char
;; d3 - bytes per font line
;; d6 - bltcon0 value
;; a4* - bitplane
;; a5 - #font
;; d7 - #fontMask
sub.w #' ',d2 ; index = char - '!'
move.w d2,d5
lsr.w #5,d5 ; char / 32 = fontmap line
andi.w #$1f,d2 ; char index in line (char index - start of line index)
add.l #1,d5 ; while we have a weird font image, '!' starts on second line
move.l a5,a1 ; #font
if 1
mulu.w d3,d5 ; d5 *= #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT
else
move.w d5,d3
lsl.w #7,d3 ; d5 *= FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH
move.w d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
add.l d3,d5
endif
if MASKED_FONT==1
move.l d7,a2 ; #fontMask
add.w d5,a2 ; add y offset in lines to fontMask address
endif
add.w d5,a1 ; add y offset in lines to font address
add.w d2,a1 ; add offset into font
if MASKED_FONT==1
add.l d2,a2 ; add offset into mask
endif
.blitChar8:
;; kills a4,d2,d4,d5
;; d0 - xpos
;; d1 - ypos bytes
;; d2.0 - odd character = 1, even character = 0
;; d3 - bytes per font line
;; d6 - bltcon0 value
;; a4 - display
;; a1 - object
;; a2 - mask
move.l d0,d4 ; xpos
move.l d0,d5 ; xpos
lsr.w #3,d4 ; d4 = xpos bytes
WaitBlitter
btst #0,d2 ; check if odd or even char
beq .evenChar ;
.oddChar
subq #8,d5 ; offset the x position for the odd character
move.w #$00FF,BLTAFWM(a6) ; select the second (odd) character in the word
subq #1,a4 ; move the destination pointer left by one byte
bra .continue
.evenChar:
move.w #$FF00,BLTAFWM(a6) ; select the first character in the word
.continue:
;; this shift will give us the bits to shift (bits 0-3) in bits (12-15) of d5
swap d5 ; d5 << 12
lsr.l #4,d5 ;
move.w d5,BLTCON1(A6) ; set the shift bits 12-15, bits 00-11 cleared
if MASKED_FONT==1
move.l a2,BLTAPTH(a6) ; mask bitplane
endif
move.l a1,BLTBPTH(a6) ; source bitplane
or.w d6,d5 ; d5 = BLTCON0 value
move.w d5,BLTCON0(a6) ; set minterm, dma channel and shift
add.l d4,a4 ; dest += XPOS_BYTES
add.l d1,a4 ; dest += YPOS_BYTES
move.l a4,BLTCPTH(a6) ; background top left corner
move.l a4,BLTDPTH(a6) ; destination top left corner
move.w #(FONT_HEIGHT*_SCREEN_BIT_DEPTH)<<6|(BLIT_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit
rts
font:
incbin "out/font8x8.bin"
fontMask:
incbin "out/font8x8-mask.bin"
+106 -7
View File
@@ -2,7 +2,9 @@
xdef copperList
xdef copperListBpl1Ptr
xdef copperListBpl2Ptr
xdef copperListBpl1Ptr2
xdef copperListBpl2Ptr
xdef copperListBpl2Ptr2
xdef backgroundOnscreen
xdef backgroundOffscreen
xdef foregroundOnscreen
@@ -41,6 +43,9 @@ Entry:
lea panelCopperListBpl1Ptr,a0
lea panel,a1
jsr PokePanelBitplanePointers
lea mpanelCopperListBpl1Ptr,a0
lea mpanel,a1
jsr PokePanelBitplanePointers
jsr Init ; enable the playfield
jsr InstallSpriteColorPalette
@@ -50,6 +55,7 @@ Reset:
move.l #0,foregroundScrollX
move.l #0,backgroundScrollX
jsr BlueFill
jsr Message
move.l #-1,frameCount
MainLoop:
@@ -71,10 +77,11 @@ SetupBoardLoop:
.gotoGameLoop:
add.l #1,d6
jsr WaitVerticalBlank
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS+100,d6
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS+50,d6
bne .gotoGameLoop
move.w #0,moving
move.l #FOREGROUND_SCROLL_PIXELS,foregroundScrollPixels
move.w #$ffff,mpanelWaitLinePtr
FadeInLoop:
add.l #1,frameCount
@@ -168,6 +175,7 @@ HoriScrollPlayfield:
lsl.w #4,d5
or.w d5,d0
move.w d0,copperListScrollPtr
move.w d0,copperListScrollPtr2
rts
ResetAnimPattern:
@@ -344,6 +352,24 @@ Level3InterruptHandler:
rte
Message:
;; a0 - bitplane
;; a1 - text
;; d0 - xpos
;; d1 - ypos
lea mpanel,a0
lea message,a1
move.w #128,d0
move.w #11,d1
jsr DrawText8
rts
message:
dc.b "LETS PLAY!"
dc.b 0
align 4
copperList:
panelCopperListBpl1Ptr:
dc.w BPL1PTL,0
@@ -398,6 +424,66 @@ copperListBpl2Ptr:
playAreaCopperPalettePtr:
include "out/foreground-copper-list.s"
include "out/background-copper-list.s"
mpanelWaitLinePtr:
dc.w $9ad1
dc.w $fffe
mpanelCopperListBpl1Ptr:
dc.w BPL1PTL,0
dc.w BPL1PTH,0
dc.w BPL2PTL,0
dc.w BPL2PTH,0
dc.w BPL3PTL,0
dc.w BPL3PTH,0
dc.w BPL4PTL,0
dc.w BPL4PTH,0
dc.w BPLCON1,0
dc.w DDFSTRT,(RASTER_X_START/2-SCREEN_RES)
dc.w DDFSTOP,(RASTER_X_START/2-SCREEN_RES)+(8*((SCREEN_WIDTH/16)-1))
dc.w BPLCON0,(4<<12)|COLOR_ON ; 4 bit planes
dc.w BPL1MOD,SCREEN_WIDTH_BYTES*4-SCREEN_WIDTH_BYTES
dc.w BPL2MOD,SCREEN_WIDTH_BYTES*4-SCREEN_WIDTH_BYTES
mpanelCopperPalettePtr:
include "out/mpanel-copper-list.s"
dc.w $BAd1,$fffe
dc.w BPL1MOD,BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES-2
dc.w BPL2MOD,BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH-SCREEN_WIDTH_BYTES-2
dc.w BPLCON1
copperListScrollPtr2:
dc.w 0
copperListBpl1Ptr2:
;; this is where bitplanes are assigned to playfields
;; http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node0079.html
;; 3 bitplanes per playfield, playfield1 gets bitplanes 1,3,5
dc.w BPL1PTL,0
dc.w BPL1PTH,0
dc.w BPL3PTL,0
dc.w BPL3PTH,0
dc.w BPL5PTL,0
dc.w BPL5PTH,0
copperListBpl2Ptr2:
;; 3 bitplanes per playfield, playfield2 gets bitplanes 2,4,6
dc.w BPL2PTL,0
dc.w BPL2PTH,0
dc.w BPL4PTL,0
dc.w BPL4PTH,0
dc.w BPL6PTL,0
dc.w BPL6PTH,0
dc.w DDFSTRT,(RASTER_X_START/2-SCREEN_RES)-8 ; -8 for extra scrolling word
dc.w DDFSTOP,(RASTER_X_START/2-SCREEN_RES)+(8*((SCREEN_WIDTH/16)-1))
dc.w BPLCON0,(SCREEN_BIT_DEPTH*2<<12)|COLOR_ON|DBLPF
playAreaCopperPalettePtr2:
include "out/foreground-copper-list.s"
include "out/background-copper-list.s"
dc.l $fffffffe
InstallSpriteColorPalette:
@@ -407,25 +493,33 @@ InstallSpriteColorPalette:
InstallColorPalette:
lea playAreaCopperPalettePtr,a1
lea playAreaCopperPalettePtr2,a2
lea playAreaPalette,a0
add.l #2,a1
add.l #2,a2
move.l #15,d0
.loop:
move.w (a0),(a1)
move.w (a0),(a2)
add.l #2,a0
add.l #4,a1
add.l #4,a1
add.l #4,a2
dbra d0,.loop
rts
InstallGreyPalette:
lea playAreaCopperPalettePtr,a1
lea playAreaCopperPalettePtr2,a2
lea greyPalette,a0
add.l #2,a1
add.l #2,a2
move.l #15,d0
.loop:
move.w (a0),(a1)
move.w (a0),(a2)
add.l #2,a0
add.l #4,a1
add.l #4,a1
add.l #4,a2
dbra d0,.loop
InstallPanelGreyPalette:
@@ -442,17 +536,21 @@ InstallPanelGreyPalette:
InstallNextGreyPalette:
lea playAreaCopperPalettePtr,a1
lea playAreaCopperPalettePtr,a1
lea playAreaCopperPalettePtr2,a3
move.l fadePtr,a0
lea bottomFadeComplete,a2
cmp.l a2,a0
bge .done
add.l #2,a1
add.l #2,a3
move.l #15,d0
.loop:
move.w (a0),(a1)
move.w (a0),(a3)
add.l #2,a0
add.l #4,a1
add.l #4,a1
add.l #4,a3
dbra d0,.loop
move.l frameCount,d0
lsr.l #1,d0
@@ -494,9 +592,10 @@ foregroundTilemap:
incbin "out/foreground.bin"
backgroundTilemap:
incbin "out/background.bin"
panel:
incbin "out/panel.bin"
mpanel:
incbin "out/mpanel.bin"
map:
include "out/foreground-map.s"
dc.w $FFFF
+14 -2
View File
@@ -14,8 +14,13 @@ SwitchBuffers:
move.l a0,foregroundOnscreen
move.l a0,a1
lea copperListBpl1Ptr,a0
jsr PokeBitplanePointers
jsr PokeBitplanePointers
add.l #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(96-1),d0
lea copperListBpl1Ptr2,a0
jsr PokeBitplanePointers
;; background is not double buffered
move.l backgroundScrollX,d0
lsr.l #BACKGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels
@@ -24,13 +29,19 @@ SwitchBuffers:
lea copperListBpl2Ptr,a0
jsr PokeBitplanePointers
add.l #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*(96-48+16),d0
move.l backgroundOnscreen,a1
lea copperListBpl2Ptr2,a0
jsr PokeBitplanePointers
rts
PokeBitplanePointers:
; d0 = frame offset in bytes
; a0 = BPLP copper list address
; a1 = bitplanes pointer
;; movem.l d0-a6,-(sp)
;; movem.l d0-a6,-(sp)
movem.l d0/a1,-(sp)
add.l d0,a1 ; bitplane offset
moveq #SCREEN_BIT_DEPTH-1,d0
.bitplaneloop:
@@ -41,6 +52,7 @@ PokeBitplanePointers:
lea BITPLANE_WIDTH_BYTES(a1),a1
addq #8,a0
dbra d0,.bitplaneloop
movem.l (sp)+,d0/a1
;; movem.l (sp)+,d0-a6
rts