From 3fd945009a8739ffff90ca322e7c8ad8ff5f4f2c Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Tue, 19 Apr 2016 16:37:20 +1000 Subject: [PATCH] message panel --- 028.game2/Makefile | 12 ++- 028.game2/assets/mpanel.pal | 16 ++++ 028.game2/assets/mpanel.png | Bin 0 -> 1614 bytes 028.game2/blitchar.s | 21 +++-- 028.game2/blittext.s | 155 ++++++++++++++++++++++++++++++++++++ 028.game2/game1.s | 113 ++++++++++++++++++++++++-- 028.game2/image.s | 16 +++- 7 files changed, 314 insertions(+), 19 deletions(-) create mode 100644 028.game2/assets/mpanel.pal create mode 100644 028.game2/assets/mpanel.png create mode 100644 028.game2/blittext.s diff --git a/028.game2/Makefile b/028.game2/Makefile index 2e1944f..db79c5b 100644 --- a/028.game2/Makefile +++ b/028.game2/Makefile @@ -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 diff --git a/028.game2/assets/mpanel.pal b/028.game2/assets/mpanel.pal new file mode 100644 index 0000000..5fc20f0 --- /dev/null +++ b/028.game2/assets/mpanel.pal @@ -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 diff --git a/028.game2/assets/mpanel.png b/028.game2/assets/mpanel.png new file mode 100644 index 0000000000000000000000000000000000000000..9d5b0624f9a7b6514d6e5e29854ef81f44520213 GIT binary patch literal 1614 zcmV-U2C?~xP)4Tx062|}Rb6NtRTMtEb7vzY&QokOg>Hg1+lHrgWS zWcKdPn90sKGrRqvPeo9CG3uKX#J{(IASm?@+di}}l?o-=)F3E6wD^Ni=!>T7nL9I? zX}YoAW$t|Qo$sD|?zw001?ah|SeB6#0T!CBEf+H4bBB+JJu8rehoBb*p;u8ID_yBf z0ya+zcePvJL&AGs+11_tpRKn>9TgyPA7ZoSs0)aX0r00)%XR^J`jH<$>RKN5V(7Oq zK*TS4xZz{h!*f1C3ECFkK$#7nA@pGN!$;%jYvwjAKwmYb0gKL(K8 z-kPtb5${A?tlI~wzMrJ6wTdBr=Y%%%EaEMQ&o}4FQ^DA)s*}Z>!FI&AHCpoWI|RUq zx?7s@$8!5^Q=anY%X@i5{QA6kNcMelpE>R6eCYFpmMsVTrI(b06~u#xf1yS} z_UGdMvD``!0~u->P=lA4?YN`hilQ|3tHka)7T{2CGqw zjZfMwx$5irQN_*|e4l)UHmiYuz74Yp1t^#>hrJ3-SOXDcC_o0^7T9R1gAN8V6s;5) zieI5-7aQlmJn}lUna#nz!j%5V$X|o`xX!dHWQRV27P1=rj;t2bW$~+pTw@bIek?Zv zKPDL<64`^#UNTAck#RBsB6*5DP4<%UA_FqU$I>2EH_cM;u)Q~SI+rg`Rn{L_AC5qq~L$#SMj%U z$6Cz0vP{G5Y*=%5RT^yu;}-DInZ=349rJPVM6C3K^oO)8y(fJr{l>k`ead~!ea?NsT>_Ci%bnxC;Vy6=b6>{xYV#Ue-+LB$ z7`JEXmTRm^AtP)R9u{)KHsMiWGV&)32xCG~*nyU<>-!d;FP=Re4r3qYr~6#KE>;1F z`>_J_P5xC?ROxV(DIHdCO*p$HRQI@7^PwV@Pvuf+5K}u-6REM(K@W$s zrgorh0{i?O)v0c>QtHxU-hBdD(>iYJ4b2sIOVX2K8m~4gmYVA5h^QEb$V`rCQ-|7Z zS{nuL-t>?3n=-o(6I(7vocj#GzCZEo`!3>+v;dYIfPu#&ZWzzX2i^rZ^Mu;6+rb@? zNPG+6)c5T6zxpzGe*M(x+{AON=PiJ>H#?ob-|uwRK0yDg0B4PV0id6JRZw95ZvX%R z{7FPXRCodH-7!uBF%SjNHAGOPp{2{65Cuo!M5(wF9c?HmQP4(m3N$<2YQghp61=ez zKaal>#fsbE^X@z)e=p~jT%D$4OS@0{^UDfI{a8O)eXN}yyZOn#-oC@vuz$L}v@aED ze{uTriwa2nSU+=J{N?<(i3(R60RjXn2nfImvuun62!sLxFl5n4fItNS0a#&{jgbI> zP(T2NEE)+As36d6gRu=EEA;+N|I%ZYzTxYS*WWg%UJKFf*7ei&&-q5ahxf~ zhmY(1=#KvUqPpm9>c{%&wGiE|ogY2|N9x)L5GWxa0831>K@uPk2?)SQMH>MEB?JUu ziD@=S0t6xf0T`)hBS4^pfB-Bp%?3$;KqMdlBNc4~2$T@mt-a62J}>*cvX!L%>=VuE zW9|I#4lvVqjR1k61q9&G(`#@92xI~RFw=330D++e1mMuqYj6YzWC8*(({YUefuRKi z;Ly`+a0Ccs0s=78ag6|hp#|FO=|25M(5-*4(DSF$}6EVww$- z0D(wA07fd>2oNYCU>l5W6ltL^eZ$u~^_>F!|KGRz=i4y&ZF_F=55I6)(=M<>2LJ#7 M07*qoM6N<$f_kV0AOHXW literal 0 HcmV?d00001 diff --git a/028.game2/blitchar.s b/028.game2/blitchar.s index 2e2ac7f..e77343f 100644 --- a/028.game2/blitchar.s +++ b/028.game2/blitchar.s @@ -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 diff --git a/028.game2/blittext.s b/028.game2/blittext.s new file mode 100644 index 0000000..fa8886d --- /dev/null +++ b/028.game2/blittext.s @@ -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" diff --git a/028.game2/game1.s b/028.game2/game1.s index 00ea36b..e7c1090 100644 --- a/028.game2/game1.s +++ b/028.game2/game1.s @@ -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 diff --git a/028.game2/image.s b/028.game2/image.s index 5760918..fdf3d80 100644 --- a/028.game2/image.s +++ b/028.game2/image.s @@ -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