mirror of
https://github.com/alpine9000/amiga_examples
synced 2025-12-08 14:59:01 +00:00
Small optimisations
This commit is contained in:
@@ -9,7 +9,7 @@ BASE_ADDRESS=4000
|
||||
BOOTBLOCK_ASM=alpine_bootblock.s
|
||||
OBJS=out/init.o out/utils.o out/image.o out/blittext.o out/cpu.o out/blit.o
|
||||
|
||||
IMAGES=font.png
|
||||
IMAGES=font8x10.png
|
||||
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
|
||||
VASM_EXTRA_ARGS=
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
BLIT_LF_MINTERM equ $ca ; cookie cut
|
||||
BLIT_WIDTH_WORDS equ 2 ; blit 2 words to allow shifting
|
||||
BLIT_WIDTH_BYTES equ 4
|
||||
FONTMAP_WIDTH_BYTES equ 32
|
||||
|
||||
DrawText8:
|
||||
;; a0 - bitplane
|
||||
@@ -16,11 +17,11 @@ DrawText8:
|
||||
;; blitter config that is shared for every character
|
||||
if MASKED_FONT==1
|
||||
move.w #BLIT_SRCA|BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d6 ; BLTCON0 value (masked version)
|
||||
move.w #SCREEN_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTAMOD(a6) ; A modulo (only used for masked version)
|
||||
move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTAMOD(a6) ; A modulo (only used for masked version)
|
||||
else
|
||||
move.w #BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d6 ; BLTCON0 value
|
||||
endif
|
||||
move.w #SCREEN_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTBMOD(a6) ; B modulo
|
||||
move.w #FONTMAP_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTBMOD(a6) ; B modulo
|
||||
move.w #SCREEN_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTCMOD(a6) ; C modulo
|
||||
move.w #SCREEN_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTDMOD(a6) ; D modulo
|
||||
mulu.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH,d1 ; ypos bytes
|
||||
@@ -29,7 +30,7 @@ DrawText8:
|
||||
move.l a1,a3 ; character pointer
|
||||
move.l #font,a5 ; font pointer
|
||||
move.l #fontMask,d7 ; font mask pointer
|
||||
move.w #SCREEN_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
|
||||
@@ -37,7 +38,7 @@ DrawText8:
|
||||
beq .done
|
||||
move.l a0,a4 ; bitplane pointer
|
||||
bsr DrawChar8 ; draw it
|
||||
add.w #FONT_WIDTH,d0 ; increment the x position
|
||||
add.l #FONT_WIDTH,d0 ; increment the x position
|
||||
bra .loop
|
||||
.done:
|
||||
movem.l (sp)+,d0-d7/a0-a4
|
||||
@@ -60,10 +61,25 @@ DrawChar8:
|
||||
lsr.w #5,d5 ; char / 32 = fontmap line
|
||||
andi.w #$1f,d2 ; char index in line (char index - start of line index)
|
||||
|
||||
add.w #1,d5 ; while we have a weird font image, '!' starts on second line
|
||||
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 *= #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH*FONT_HEIGHT
|
||||
if 0
|
||||
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
|
||||
@@ -74,7 +90,7 @@ DrawChar8:
|
||||
|
||||
add.w d2,a1 ; add offset into font
|
||||
if MASKED_FONT==1
|
||||
add.w d2,a2 ; add offset into mask
|
||||
add.l d2,a2 ; add offset into mask
|
||||
endif
|
||||
|
||||
.blitChar8:
|
||||
@@ -129,6 +145,6 @@ DrawChar8:
|
||||
rts
|
||||
|
||||
font:
|
||||
incbin "out/font.bin"
|
||||
incbin "out/font8x10.bin"
|
||||
fontMask:
|
||||
incbin "out/font-mask.bin"
|
||||
incbin "out/font8x10-mask.bin"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
MASKED_FONT equ 0
|
||||
MASKED_FONT equ 1
|
||||
|
||||
if MASKED_FONT==1
|
||||
BACKGROUND_COLOR equ 4
|
||||
|
||||
@@ -28,17 +28,17 @@ Entry:
|
||||
|
||||
move.l onscreen,a0
|
||||
move.l #BACKGROUND_COLOR,d0
|
||||
move.w #SCREEN_HEIGHT,d1
|
||||
move.w #SCREEN_HEIGHT,d1
|
||||
move.w #0,d2 ; ypos
|
||||
jsr BlitFillColor
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l #BACKGROUND_COLOR,d0
|
||||
move.w #SCREEN_HEIGHT,d1
|
||||
move.w #0,d2 ; ypos
|
||||
move.w #0,d2 ; ypos
|
||||
jsr BlitFillColor
|
||||
|
||||
WaitBlitter
|
||||
WaitBlitter
|
||||
jsr Init ; enable the playfield
|
||||
|
||||
MainLoop:
|
||||
@@ -47,12 +47,16 @@ MainLoop:
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l #BACKGROUND_COLOR,d0
|
||||
move.w #FONT_HEIGHT,d1
|
||||
move.w #FONT_HEIGHT,d1
|
||||
move.l ypos,d2 ; ypos
|
||||
jsr BlitFillColor
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l ypos2,d2
|
||||
move.l offscreen,a0
|
||||
move.l ypos2,d2
|
||||
jsr BlitFillColor
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l ypos3,d2
|
||||
jsr BlitFillColor
|
||||
|
||||
move.l direction,d0
|
||||
@@ -66,6 +70,9 @@ MainLoop:
|
||||
move.l ypos2,d1
|
||||
jsr DrawText8
|
||||
|
||||
move.l ypos3,d1
|
||||
jsr DrawText8
|
||||
|
||||
jsr SwitchBuffers
|
||||
|
||||
cmp.l #SCREEN_WIDTH-1-((endText-text)*FONT_WIDTH),xpos
|
||||
@@ -96,6 +103,8 @@ ypos:
|
||||
dc.l 1
|
||||
ypos2:
|
||||
dc.l SCREEN_HEIGHT-FONT_HEIGHT-1
|
||||
ypos3:
|
||||
dc.l (SCREEN_HEIGHT-FONT_HEIGHT-1)/2
|
||||
direction:
|
||||
dc.l 2
|
||||
|
||||
@@ -138,11 +147,11 @@ copperListBplPtr:
|
||||
dc.l $fffffffe
|
||||
|
||||
InstallPalette:
|
||||
include "out/font-palette.s"
|
||||
include "out/font8x10-palette.s"
|
||||
rts
|
||||
|
||||
GreyPalette:
|
||||
include "out/font-grey.s"
|
||||
include "out/font8x10-grey.s"
|
||||
rts
|
||||
onscreen:
|
||||
dc.l bitplanes1
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Reference in New Issue
Block a user