Simplifying char blit

This commit is contained in:
alpine9000
2016-04-01 16:35:02 +11:00
parent 64bfbef970
commit 2a5eaa1ea2
2 changed files with 12 additions and 15 deletions
+4 -9
View File
@@ -22,7 +22,6 @@ BlitChar8:
movem.l d0-d3/a0-a2,-(sp) 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 lea font(pc),a1 ; font pointer
lea fontMask,a2 ; font mask pointer
sub.w #'!',d2 ; index = char - '!' sub.w #'!',d2 ; index = char - '!'
move.w d2,d3 move.w d2,d3
@@ -31,16 +30,10 @@ BlitChar8:
add.l #1,d3 ; while we have a weird font image, '!' starts on second line 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
if MASKED_FONT==1
add.w d3,a2 ; add y offset in lines to fontMask address
add.l d2,a2 ; add offset into mask
endif
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 d3,a1 ; add y offset in lines to font address
add.w d2,a1 ; add offset into font add.w d2,a1 ; add offset into font
add.l #(FONT_HEIGHT*SCREEN_BIT_DEPTH*FONTMAP_WIDTH_BYTES)-FONTMAP_WIDTH_BYTES+0,a2 ; last word - descending mode
lsr.w #3,d0 ; d0 = xpos bytes lsr.w #3,d0 ; d0 = xpos bytes
add.l d0,a0 ; dest += XPOS_BYTES add.l d0,a0 ; dest += XPOS_BYTES
@@ -72,11 +65,13 @@ BlitChar8:
.continue: .continue:
move.l a1,BLTBPTH(a6) ; source bitplane
if MASKED_FONT==1 if MASKED_FONT==1
move.l a2,BLTAPTH(a6) ; mask bitplane add.l #fontMask-font,a1
move.l a1,BLTAPTH(a6) ; mask bitplane
endif endif
move.l a1,BLTBPTH(a6) ; source bitplane
move.l a0,BLTCPTH(a6) ; background top left corner move.l a0,BLTCPTH(a6) ; background top left corner
move.l a0,BLTDPTH(a6) ; destination top left corner move.l a0,BLTDPTH(a6) ; destination top left corner
+6 -4
View File
@@ -5,6 +5,8 @@
xdef offscreen xdef offscreen
xdef copperListBplPtr xdef copperListBplPtr
Y_POS equ 16
byteMap: byteMap:
dc.l Entry dc.l Entry
dc.l endCode-byteMap dc.l endCode-byteMap
@@ -43,8 +45,8 @@ MainLoop:
if 0 if 0
;; test ;; test
move.b #'B',d2 move.b #'B',d2
move.l #32,d0 ; xpos move.l #16,d0 ; xpos
move.l #100,d1 ; ypos move.l #0,d1 ; ypos
move.l onscreen,a0 move.l onscreen,a0
jsr BlitChar8 jsr BlitChar8
bra MainLoop bra MainLoop
@@ -62,14 +64,14 @@ MainLoop:
.moreText: .moreText:
move.b (a3)+,d2 move.b (a3)+,d2
move.l #BITPLANE_WIDTH-16,d0 ; xpos move.l #BITPLANE_WIDTH-16,d0 ; xpos
move.l #16,d1 ; ypos move.l #Y_POS,d1 ; ypos
move.l onscreen,a0 move.l onscreen,a0
jsr BlitChar8 jsr BlitChar8
move.l #0,shiftcounter move.l #0,shiftcounter
.shift: .shift:
move.l onscreen,a0 move.l onscreen,a0
move.l #FONT_HEIGHT,d1 move.l #FONT_HEIGHT,d1
move.l #16,d2 move.l #Y_POS,d2
jsr BlitScroll jsr BlitScroll
add.l #1,shiftcounter add.l #1,shiftcounter