diff --git a/028.bs/assets/background.png b/028.bs/assets/background.png
index 63d42ed..1888aec 100644
Binary files a/028.bs/assets/background.png and b/028.bs/assets/background.png differ
diff --git a/028.bs/background.tmx b/028.bs/background.tmx
index 764a531..52a1463 100644
--- a/028.bs/background.tmx
+++ b/028.bs/background.tmx
@@ -5,7 +5,7 @@
- eJztmsluAjEMhqdSObTqLnU5dN9EC+//fDUqlkbpZCa2/9gZyuETIAGO4zXOLLuuWyp5IV4Nv4/miDg2/P6UOCPOiYsG9JHodgCU5b0Piy3sf/y5ljytfl/Et0Huevt6OPG9nC2tdrkkrgTfT9d5TdwQt8Qd0B6IvCPVzbK3kn0YsvWUrPvkM8cD+18/PhZgato55Rn8f5Z1nwDkPxCPxJNQt6nczXbP1QCPfC3ZW+0+aO3IvvtGvHe4+Pjsvf/o/adVvzFq2tKy7jQnefmdhFwN8MhnNX3CKqtWfOTqh8aXSvGqTQjmslaE7+ZsiqirKdZzXgr77qr77dGj4yPalnPyuz1/ydXBqXNnjuj6oYl3zTxkDZDbKhpdvPUv6SenfDhihsn7FBUf1tlHCUN13EMukrG+U6MLSv/SOEP0k9YZZg72/bF92oX+qhbSXCutb3O+2ymNs5b7yY3v585C0f3VHEDk2rHeoVZeRKHt3S20cp8aER+WGdWe/4E1J6Hmg+y7rfVX2vjfhdjzuBvhmlBjxtoCqH6u1f6qpfsB77s8lO7SdVt6Gq89inr+Kqp+5M6yHue50nOxd6yidJeu29LTlMqy1neELSR5oNX6oUUyOyo9F6Nj1fo8a6l9W35uY2hPeF/G8pZGTjpfGMsDaX2Krh+7gPeZJ/ruBvm8+hCR87y0PuV8Fx0bG34AHDOqDg==
+ eJztmmdrAzEMhg/ag2vpho4P3Ys0zf//fVXoGYJ7XtJryXfNh4ckZMjasp1V13UrJsMI9/vWHBHHgu+fEmfEOXHRgD4luvVAWdp26EeGEfe6ljyufm59XLmb8fEwwx41/HJJXBV83l/nNXFD3BJ3QH9I7crRTWLbEjtM+Tol6957HcuPHkxNP/s8g39Psu4TgPwH4pF4KtTtIPG+83uoB2jU6xLbcu3A9aOL3TfivcPlx+fO84+d35TqF6OmLyXr9muSVtyVEOoBGvWsZkxIZdXKj1D/4MRSLlq9CcFc1oqI3ZBPEX3VR7rP83Gx+939zujW+WHtyznF3Z6/hPpgat8Zwrp/cPI9NVNPsQHIbRWOLtr658yTqRh+IV6NbGuVH9Kzjxym+riGXCSxuZOjC0r/3DxDzJNfxLqCbV3sx+y0hPmqFqW1trS/WdRFFLl51vI8uY390F7Ier6aA4haG5sdatVFFNzZXUIr96kW+SE5o9rzP5DWJNT5oIvd1uYrbv4vIfc07kZcT6hxxtoCqHmu1fmqpfsB7bs8lO6l65bMNFo2svr/lVX/CO1lNfZzufti7VxF6V66bslMkytL2t8RviipA632Dy4lZ0e5+2J0rnLubzj+bfl/G1M2GcbnsbrFkeOfL8TqgN+frPvHEtDe81jf3UjzO4XleZ7fn0Kxi86NLT+BOKjL
diff --git a/028.bs/blit.s b/028.bs/blit.s
index 50ceead..2c01068 100644
--- a/028.bs/blit.s
+++ b/028.bs/blit.s
@@ -5,7 +5,6 @@
xdef BlitBackgroundTile
xref BlueFill
xref SimpleBlit
-
;; A(mask) B(bob) C(bg) D(dest)
;; - - - -
@@ -103,28 +102,54 @@ _BlitScroll:
BlitTile:
- ;; a0 - dest bitplane pointer
- ;; a1 - source tile pointer
- ;; d2 - y tile index
+ ;; a0.l - dest bitplane pointer
+ ;; a1.l - source tile pointer
+ ;; d2.w - y tile index
+
+
+ movem.l d2/a0/a2,-(sp)
+
+ if 0
+ mulu.w #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16,d2
+ adda.w d2,a0
+ endif
+ lea blitTileMuluTable(pc),a2
+ add.w d2,d2
+ adda.w 0(a2,d2.w),a0
WaitBlitter
- movem.l d2/a0,-(sp)
move.w #0,BLTCON1(a6) ;
move.w #BC0F_SRCA|BC0F_DEST|$f0,BLTCON0(a6)
-
move.w #TILEMAP_WIDTH_BYTES-2,BLTAMOD(a6)
move.w #BITPLANE_WIDTH_BYTES-2,BLTDMOD(a6) ;
-
- mulu.w #BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16,d2
- add.l d2,a0
move.l a1,BLTAPTH(a6) ; source
move.l a0,BLTDPTH(a6) ; dest
move.w #$ffff,BLTAFWM(a6)
move.w #$ffff,BLTALWM(a6)
move.w #(16*SCREEN_BIT_DEPTH)<<6|(1),BLTSIZE(a6) ;rectangle size, starts blit
- movem.l (sp)+,d2/a0
+ movem.l (sp)+,d2/a0/a2
rts
+
+blitTileMuluTable:
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*0
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*1
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*2
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*3
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*4
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*5
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*6
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*7
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*8
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*9
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*10
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*11
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*12
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*13
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*14
+ dc.w BITPLANE_WIDTH_BYTES*SCREEN_BIT_DEPTH*16*15
+
+
BlitBackgroundTile:
;; a0 - dest bitplane pointer
;; a1 - source tile pointer
diff --git a/028.bs/blittext.s b/028.bs/blittext.s
index 8efaf66..beb6a55 100644
--- a/028.bs/blittext.s
+++ b/028.bs/blittext.s
@@ -16,11 +16,11 @@ DrawText8:
;; a1 - text
;; d0 - xpos
;; d1 - ypos
- movem.l d0-d6/a0-a4,-(sp)
+ movem.l d0-d4/a1-a4,-(sp)
WaitBlitter
;; blitter config that is shared for every character
- move.w #BC0F_SRCB|BC0F_SRCC|BC0F_DEST|BLIT_LF_MINTERM,d6 ; BLTCON0 value
+ move.w #BC0F_SRCB|BC0F_SRCC|BC0F_DEST|BLIT_LF_MINTERM,d4 ; BLTCON0 value
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
@@ -29,61 +29,43 @@ DrawText8:
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.w #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT,d3 ; bytes per font line
+ ;; 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-d6/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
-
- 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
- mulu.w d3,d5 ; d5 *= #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT
- add.w d5,a1 ; add y offset in lines to font address
- add.w d2,a1 ; add offset into font
-
-.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
+ sub.w #' ',d2 ; index = char - ' '
+ move.w d2,d3
+
+
+ andi.w #$1f,d2 ; char index in line (char index - start of line index)
+ adda.w d2,a1 ; add offset into font
+
+ add.w #1<<5,d3 ; while we have a weird font image, ' ' starts on second line
+ ;; lsr.w #5,d3 ; char / 32 = fontmap line
+ ;; lsl.w #5,d3 ; d3 *= #FONTMAP_WIDTH_BYTES*_SCREEN_BIT_DEPTH*FONT_HEIGHT
+ andi.w #$e0,d3
+ lsl.w #5,d3
+ adda.w d3,a1 ; add y offset in lines to font address
+
+ move.w d0,d3 ; xpos
+ lsr.w #3,d3 ; d3 = xpos bytes
+ adda.w d3,a4 ; dest += XPOS_BYTES
+ adda.w d1,a4 ; dest += YPOS_BYTES
+
+ move.l d0,d3 ; xpos
+
WaitBlitter
btst #0,d2 ; check if odd or even char
beq .evenChar ;
.oddChar
- subq #8,d5 ; offset the x position for the odd character
+ subq #8,d3 ; 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
@@ -91,21 +73,37 @@ DrawChar8:
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
+
+ ;; this shift will give us the bits to shift (bits 0-3) in bits (12-15) of d3
+ swap d3 ; d3 << 12
+ lsr.l #4,d3 ;
+
+ move.w d3,BLTCON1(A6) ; set the shift bits 12-15, bits 00-11 cleared
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
+ or.w d4,d3 ; d3 = BLTCON0 value
+ move.w d3,BLTCON0(a6) ; set minterm, dma channel and shift
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
+ move.w #(FONT_HEIGHT*_SCREEN_BIT_DEPTH)<<6|(BLIT_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit
+
+ add.l #FONT_WIDTH,d0 ; increment the x position
+ bra .loop
+.done:
+ movem.l (sp)+,d0-d4/a1-a4
rts
+DrawChar8:
+ ;; kills d2,d3,a1,a2,a4
+ ;; d0 - xpos
+ ;; d1 - ypos bytes
+ ;; d2* - char
+ ;; d4 - bltcon0 value
+ ;; a4* - bitplane
+ ;; a5 - #font
+
+ rts
font:
incbin "out/font8x8.bin"
+
diff --git a/028.bs/bob.i b/028.bs/bob.i
index 669c462..72dbb92 100644
--- a/028.bs/bob.i
+++ b/028.bs/bob.i
@@ -45,5 +45,5 @@ BALOON_BOB: macro
endm
CLOUD_BOB: macro
- BLITTER_OBJECT \1,320,\2,\3,24,18
+ BLITTER_OBJECT \1,320,\2,\3,0,16
endm
diff --git a/028.bs/bob.s b/028.bs/bob.s
index c25cabc..5798330 100644
--- a/028.bs/bob.s
+++ b/028.bs/bob.s
@@ -13,19 +13,42 @@
;; BLITTER_OBJECT
;; index,startX,y,dx,mapLine,blitHeight
bob:
- BALOON_BOB 0,15,24
+ CLOUD_BOB 0,15,8
endBob:
- BALOON_BOB 1,150,32
- CLOUD_BOB 2,64,8
- CLOUD_BOB 3,170,12
+ CLOUD_BOB 1,96,10
+ CLOUD_BOB 2,170,12
+ BALOON_BOB 3,15,24
dc.l 0
+
ResetBobs:
+ move.w #2,bobsEnabled ; disables bob movement
bsr RestoreBobBackgrounds
+ bsr RenderBob
eor.l #4,bobBufferOffset
+ move.l backgroundOffscreen,a0
+ move.l backgroundOnscreen,backgroundOffscreen
+ move.l a0,backgroundOnscreen
bsr RestoreBobBackgrounds
+ bsr RenderBob
eor.l #4,bobBufferOffset
+ move.l backgroundOffscreen,a0
+ move.l backgroundOnscreen,backgroundOffscreen
+ move.l a0,backgroundOnscreen
move.w #0,bobsEnabled
+ lea bob,a5
+.loop:
+ cmp.l #0,(a5)
+ beq .done
+ lea BOB_LAST_DEST_ADDRESS(a5),a1
+ move.l #0,(a1)
+ adda.l bobBufferOffset,a1
+ move.l #0,(a1)
+ move.l #320<