mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-01-12 16:30:43 +00:00
Added non-masked version of text blitter
This commit is contained in:
@ -18,7 +18,9 @@ include ../shared/base.mk
|
||||
|
||||
|
||||
out/%.bin: ../assets/%.png
|
||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/$* --colors=16 --use-palette palette.pal --full-color-palette-file --output-mask --transparent-color=0,0,0
|
||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-grey-palette-asm --output-palette-asm --output-palette --output out/$* --colors=16 --use-palette palette.pal --full-color-palette-file --output-mask --transparent-color=0,0,0 --output-png
|
||||
|
||||
out/blittext.o: constants.i
|
||||
out/blit.o: constants.i
|
||||
out/main.o: $(IMAGEDATA) constants.i Makefile link.script.x palette.pal
|
||||
out/init.o: constants.i Makefile
|
||||
@ -1,8 +1,6 @@
|
||||
include "includes.i"
|
||||
xdef DrawText8
|
||||
|
||||
;; This will only work for 8 pixel wide fonts
|
||||
|
||||
BLIT_LF_MINTERM equ $ca ; cookie cut
|
||||
BLIT_WIDTH_WORDS equ 2 ; blit 2 words to allow shifting
|
||||
BLIT_WIDTH_BYTES equ 4
|
||||
@ -12,7 +10,7 @@ DrawText8:
|
||||
;; a1 - text
|
||||
;; d0 - xpos
|
||||
;; d1 - ypos
|
||||
movem.l d0-d5/a0-a2,-(sp)
|
||||
movem.l d0-d5/a0-a3,-(sp)
|
||||
jsr WaitBlitter
|
||||
;; blitter config that is shared for every character
|
||||
move.w #SCREEN_WIDTH_BYTES-BLIT_WIDTH_BYTES,BLTAMOD(a6) ; A modulo
|
||||
@ -20,17 +18,17 @@ DrawText8:
|
||||
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
|
||||
move.l a1,a5
|
||||
move.l a1,a3
|
||||
.loop:
|
||||
clr.l d2
|
||||
move.b (a5)+,d2 ; get next character
|
||||
move.b (a3)+,d2 ; get next character
|
||||
cmp.b #0,d2 ; 0 terminates the string
|
||||
beq .done
|
||||
bsr DrawChar8 ; draw it
|
||||
add.w #FONT_WIDTH,d0 ; increment the x position
|
||||
bra .loop
|
||||
.done:
|
||||
movem.l (sp)+,d0-d5/a0-a2
|
||||
movem.l (sp)+,d0-d5/a0-a3
|
||||
rts
|
||||
|
||||
DrawChar8:
|
||||
@ -50,9 +48,11 @@ DrawChar8:
|
||||
|
||||
add.w #1,d5 ; while we have a weird font image, '!' starts on second line
|
||||
lea font(pc),a1
|
||||
lea fontMask,a2
|
||||
mulu.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH*FONT_HEIGHT,d5
|
||||
add.w d5,a2
|
||||
if MASKED_FONT==1
|
||||
lea fontMask,a2
|
||||
add.w d5,a2
|
||||
endif
|
||||
add.w d5,a1
|
||||
|
||||
btst #0,d2 ; blitter does words only, so we need to know if its an odd or even character
|
||||
@ -64,14 +64,13 @@ DrawChar8:
|
||||
moveq #0,d3
|
||||
.c1
|
||||
|
||||
add.w d2,a1
|
||||
add.w d2,a2
|
||||
bsr BlitChar8
|
||||
movem.l (sp)+,a0
|
||||
rts
|
||||
|
||||
BlitChar8:
|
||||
;; kills a0,d2,d4
|
||||
add.w d2,a1 ; add offset into font
|
||||
if MASKED_FONT==1
|
||||
add.w d2,a2 ; add offset into mask
|
||||
endif
|
||||
|
||||
.blitChar8:
|
||||
;; kills a0,d2,d4
|
||||
;; d0 - xpos
|
||||
;; d1 - ypos bytes
|
||||
;; d3 - odd character = 1, even character = 0
|
||||
@ -79,9 +78,9 @@ BlitChar8:
|
||||
;; a1 - object
|
||||
;; a2 - mask
|
||||
|
||||
move.l d0,d4 ; d4 = XPOS
|
||||
move.l d0,d4
|
||||
move.l d0,d2
|
||||
lsr.w #3,d4 ; d4 = XPOS_BYTES
|
||||
lsr.w #3,d4 ; d4 = XPOS_BYTES
|
||||
|
||||
jsr WaitBlitter
|
||||
|
||||
@ -89,35 +88,41 @@ BlitChar8:
|
||||
beq .evenChar
|
||||
.oddChar
|
||||
sub.w #8,d2
|
||||
move.w #$00FF,BLTAFWM(a6) ; no mask for first word
|
||||
move.w #$0000,BLTALWM(a6) ; mask out last word
|
||||
move.w #$00FF,BLTAFWM(a6) ; select the second (odd) character in the word
|
||||
move.w #$0000,BLTALWM(a6) ;
|
||||
subq #1,a0
|
||||
bra .continue
|
||||
.evenChar:
|
||||
move.w #$ff00,BLTAFWM(a6) ; no mask for first word
|
||||
move.w #$0000,BLTALWM(a6) ; mask out last word
|
||||
move.w #$FF00,BLTAFWM(a6) ; select the first character in the word
|
||||
move.w #$0000,BLTALWM(a6)
|
||||
.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
|
||||
lsl.w #8,d2 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
|
||||
lsl.w #4,d2 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
|
||||
|
||||
move.w d2,BLTCON1(A6)
|
||||
|
||||
if MASKED_FONT==1
|
||||
ori.w #BLIT_SRCA|BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d2
|
||||
move.l a2,BLTAPTH(a6) ; mask bitplane
|
||||
else
|
||||
ori.w #BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d2
|
||||
move.w #$ffff,BLTADAT(a6) ; preload source mask so only BLTA?WM mask is used
|
||||
endif
|
||||
|
||||
move.l a1,BLTBPTH(a6) ; source bitplane
|
||||
move.w d2,BLTCON0(A6)
|
||||
|
||||
move.l a2,BLTAPTH(a6) ; mask bitplane
|
||||
move.l a1,BLTBPTH(a6) ; bob bitplane
|
||||
move.l a0,d2 ; d2 = dest bitplane address
|
||||
add.l d4,d2 ; d2 = += XPOS_BYTES
|
||||
add.l d1,d2 ; d2 = += YPOS_BYTES
|
||||
|
||||
move.l a0,d2 ; d2 = #bitplanes
|
||||
add.l d4,d2 ; d2 = #bitplanes+XPOS_BYTES
|
||||
add.l d1,d2 ; d2 = #bitplanes+XPOS_BYTES+(YPOS*SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH)
|
||||
|
||||
move.l d2,BLTCPTH(a6) ;background top left corner
|
||||
move.l d2,BLTDPTH(a6) ;destination top left corner
|
||||
move.l d2,BLTCPTH(a6) ; background top left corner
|
||||
move.l d2,BLTDPTH(a6) ; destination top left corner
|
||||
|
||||
move.w #(FONT_HEIGHT*SCREEN_BIT_DEPTH)<<6|(BLIT_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit
|
||||
movem.l (sp)+,a0
|
||||
rts
|
||||
|
||||
font:
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
MASKED_FONT equ 0
|
||||
|
||||
if MASKED_FONT==1
|
||||
BACKGROUND_COLOR equ 4
|
||||
else
|
||||
BACKGROUND_COLOR equ 3
|
||||
endif
|
||||
|
||||
FONT_WIDTH equ 8
|
||||
FONT_HEIGHT equ 10
|
||||
SCREEN_WIDTH equ 320
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
000 000 000 000
|
||||
000 000 000 255
|
||||
255 255 255 255
|
||||
255 000 000 255
|
||||
000 255 000 255
|
||||
000 000 255 255
|
||||
555 555 555 255
|
||||
055 255 055 255
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
@ -13,5 +13,5 @@
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
255 255 000 255
|
||||
255 000 000 255
|
||||
255 200 000 255
|
||||
|
||||
|
||||
@ -29,14 +29,14 @@ Entry:
|
||||
move.w #(DMAF_BLITTER|DMAF_SETCLR!DMAF_MASTER),DMACON(a6)
|
||||
|
||||
move.l onscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
move.w #SCREEN_HEIGHT,d1 ; height
|
||||
move.l #BACKGROUND_COLOR,d0
|
||||
move.w #SCREEN_HEIGHT,d1
|
||||
move.w #0,d2 ; ypos
|
||||
jsr BlitFillColor
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
move.w #SCREEN_HEIGHT,d1 ; height
|
||||
move.l #BACKGROUND_COLOR,d0
|
||||
move.w #SCREEN_HEIGHT,d1
|
||||
move.w #0,d2 ; ypos
|
||||
jsr BlitFillColor
|
||||
|
||||
@ -48,8 +48,8 @@ MainLoop:
|
||||
jsr InstallPalette
|
||||
|
||||
move.l offscreen,a0
|
||||
move.l #4,d0 ; color#
|
||||
move.w #FONT_HEIGHT,d1 ; height
|
||||
move.l #BACKGROUND_COLOR,d0
|
||||
move.w #FONT_HEIGHT,d1
|
||||
move.l ypos,d2 ; ypos
|
||||
jsr BlitFillColor
|
||||
|
||||
@ -68,7 +68,6 @@ MainLoop:
|
||||
move.l ypos2,d1
|
||||
jsr DrawText8
|
||||
|
||||
|
||||
jsr SwitchBuffers
|
||||
|
||||
cmp.l #SCREEN_WIDTH-((endText-text)*FONT_WIDTH),xpos
|
||||
|
||||
@ -13,6 +13,7 @@ DOYNAMITE68KDIR=../tools/external/doynamite68k
|
||||
DOYNAMITE68K=$(DOYNAMITE68KDIR)/out/lz
|
||||
A500_RUN_SCRIPT=~/Google\ Drive/Amiga/amiga500.sh
|
||||
A600_RUN_SCRIPT=~/Google\ Drive/Amiga/amiga600.sh
|
||||
A1200_RUN_SCRIPT=~/Google\ Drive/Amiga/amiga1200.sh
|
||||
|
||||
#VASM_ARGS=-phxass -Fhunk -quiet -spaces
|
||||
VASM_ARGS=-Fhunk -quiet -esc
|
||||
@ -71,6 +72,9 @@ test: all
|
||||
go: test
|
||||
$(RUN_SCRIPT)
|
||||
|
||||
aga: test
|
||||
$(A1200_RUN_SCRIPT)
|
||||
|
||||
list:
|
||||
m68k-amigaos-objdump -b binary --disassemble-all out/bootblock.bin -m m68k > out/bootblock.txt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user