More small optimisations

This commit is contained in:
alpine9000
2016-03-27 20:03:27 +11:00
parent 0ba8f57061
commit 3c14f4094d
+18 -27
View File
@@ -53,20 +53,13 @@ DrawChar8:
add.w #1,d5 ; while we have a weird font image, '!' starts on second line
move.l d6,a1 ; #font
mulu.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH*FONT_HEIGHT,d5
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
btst #0,d2 ; blitter does words only, so we need to know if its an odd or even character
beq .even ; then shift it into position with the blitter shift
.odd: ; this check is repeated in .blitChar8 so should be refactored
moveq #1,d3
bra .c1
.even:
moveq #0,d3
.c1:
add.w d2,a1 ; add offset into font
if MASKED_FONT==1
@@ -74,24 +67,24 @@ DrawChar8:
endif
.blitChar8:
;; kills a4,d2,d4
;; kills a4,d2,d4,d5
;; d0 - xpos
;; d1 - ypos bytes
;; d3 - odd character = 1, even character = 0
;; d2.0 - odd character = 1, even character = 0
;; a4 - display
;; a1 - object
;; a2 - mask
move.l d0,d4
move.l d0,d2
move.l d0,d5
lsr.w #3,d4 ; d4 = XPOS_BYTES
WaitBlitter
btst #0,d3
btst #0,d2
beq .evenChar
.oddChar
subq #8,d2
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
@@ -100,29 +93,27 @@ 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 d2
lsl.w #8,d2 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
lsl.w #4,d2 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
;; this shift will give us the bits to shift (bits 0-3) in bits (12-15) of d5
lsl.w #8,d5 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
lsl.w #4,d5 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
move.w d2,BLTCON1(A6)
move.w d5,BLTCON1(A6)
if MASKED_FONT==1
ori.w #BLIT_SRCA|BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d2
ori.w #BLIT_SRCA|BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d5
move.l a2,BLTAPTH(a6) ; mask bitplane
else
ori.w #BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d2
ori.w #BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d5
endif
move.l a1,BLTBPTH(a6) ; source bitplane
move.w d2,BLTCON0(A6)
move.w d5,BLTCON0(a6) ; set minterm, dma channel and shift
move.l a4,d2 ; d2 = dest bitplane address
add.l d4,d2 ; d2 = += XPOS_BYTES
add.l d1,d2 ; d2 = += YPOS_BYTES
add.l d4,a4 ; dest += XPOS_BYTES
add.l d1,a4 ; dest += YPOS_BYTES
move.l d2,BLTCPTH(a6) ; background top left corner
move.l d2,BLTDPTH(a6) ; destination top left corner
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