Text work in progress

This commit is contained in:
alpine9000 2016-03-26 18:24:14 +11:00
parent 2ed5ac364b
commit 23672eef5c
4 changed files with 86 additions and 31 deletions

View File

@ -19,7 +19,7 @@ include ../shared/base.mk
out/%.bin: ../assets/%.png
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-palette-asm --output-palette --output out/$* --colors=16 --use-palette palette.pal --output-mask
$(IMAGECON) --input $< $(IMAGECON_ARGS) --output-bitplanes --output-palette-asm --output-palette --output out/$* --colors=16 --use-palette palette.pal --full-color-palette-file --output-mask --transparent-color=0,0,0
out/main.o: $(IMAGEDATA) constants.i Makefile link.script.x palette.pal
out/init.o: constants.i Makefile

View File

@ -1,5 +1,5 @@
include "includes.i"
xdef blitObject64
xdef DrawText
;; BLTCON? configuration
;; http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node011C.html
@ -26,7 +26,7 @@ BLIT_SRCA equ $800
BLIT_ASHIFTSHIFT equ 12 ;Bit index of ASH? bits
BLIT_BOB_WIDTH equ 32 ; Must blit extra word to allow shifting
BLIT_BOB_HEIGHT equ 12
BLIT_BOB_HEIGHT equ 10
BLIT_BOB_WIDTH_BYTES equ BLIT_BOB_WIDTH/8
BLIT_BOB_WIDTH_WORDS equ BLIT_BOB_WIDTH/16
@ -40,23 +40,34 @@ blitWait:
;; blitobject
;; d0 - xpos
;; d1 - ypos
;; d3 - odd character
;; a0 - display
;; a1 - object
;; a2 - mask
blitObject64:
blitText:
movem.l d0-a6,-(sp)
bsr blitWait
;; d0 = XPOS
;; d1 = YPOS
;; d3 = odd character
;; d4 = XPOS_BYTES
move.w d0,d4 ; d4 = XPOS
lsr.w #3,d4 ; d4 = XPOS_BYTES
if 1
cmp.b #1,d3
bne .evenChar
.oddChar
sub.w #8,d0
endif
move.w #$00FF,BLTAFWM(a6) ; no mask for first word
move.w #$0000,BLTALWM(a6) ; mask out last word
sub.l #1,a0
bra .continue
.evenChar:
move.w #$ff00,BLTAFWM(a6) ; no mask for first word
move.w #$0000,BLTALWM(a6) ; mask out last word
.continue:
;; this shift will give us the bits to shift (bits 0-3) in bits (12-15) of d0
lsl.w #8,d0 ; BLIT_SOURCE_SHIFT<<BLIT_ASHIFTSHIFT
@ -66,14 +77,6 @@ blitObject64:
ori.w #BLIT_SRCA|BLIT_SRCB|BLIT_SRCC|BLIT_DEST|BLIT_LF_MINTERM,d0
move.w d0,BLTCON0(A6)
if 1
move.w #$00FF,BLTAFWM(a6) ; no mask for first word
move.w #$0000,BLTALWM(a6) ; mask out last word
else
move.w #$ff00,BLTAFWM(a6) ; no mask for first word
move.w #$0000,BLTALWM(a6) ; mask out last word
endif
move.w #SCREEN_WIDTH_BYTES-BLIT_BOB_WIDTH_BYTES,BLTAMOD(a6) ;A modulo
move.w #SCREEN_WIDTH_BYTES-BLIT_BOB_WIDTH_BYTES,BLTBMOD(a6) ;B modulo
@ -97,3 +100,64 @@ blitObject64:
move.w #(BLIT_BOB_HEIGHT*SCREEN_BIT_DEPTH)<<6|(BLIT_BOB_WIDTH_WORDS),BLTSIZE(a6) ;rectangle size, starts blit
movem.l (sp)+,d0-a6
rts
DrawText:
;; a0 - bitplane
;; a1 - text
;; d0 - xpos
;; d1 - ypos
.loop:
clr.l d2
move.b (a1)+,d2
cmp.b #0,d2
beq .done
jsr DrawChar
add.l #8,d0
bra .loop
.done:
rts
DrawChar:
;; d0 - xpos
;; d1 - ypos
;; d2 - char
;; a0 - bitplane
movem.l d0-a6,-(sp)
move.l #'!',d4 ; fontmap offset
sub.l d4,d2 ; index = char - '!'
move.l d2,d5
lsr.l #5,d5 ; fontmap y offset
move.l d5,d4
lsl.l #5,d4 ; start of line
sub.l d4,d2 ;
add.l #1,d5 ; temp marker first line xx
lea font,a1
lea fontMask,a2
mulu.w #SCREEN_WIDTH_BYTES*SCREEN_BIT_DEPTH*BLIT_BOB_HEIGHT,d5
add.l d5,a2
add.l d5,a1
btst.l #0,d2
beq .even
.odd:
move.b #1,d3
bra .c1
.even:
move.b #0,d3
.c1
add.l d2,a1
add.l d2,a2
jsr blitText
movem.l (sp)+,d0-a6
rts
font:
incbin "out/font.bin"
fontMask:
incbin "out/font-mask.bin"

View File

@ -2,13 +2,10 @@
xdef PokeBitplanePointers
xdef copperList
xdef copperListAlternate
xdef bitplanes1
xdef bitplanes2
xdef bitplanes3
xdef Module
xdef copperListBplPtr
xdef copperListAlternateBplPtr
byteMap:
dc.l Entry
@ -59,19 +56,19 @@ Entry:
;; a2 - mask
;; add.l #1,xpos
move.l #4,xpos
move.b #0,d3
move.l #0,xpos
move.l xpos,d0
move.l #50,d1
lea bitplanes1,a0
if 1
sub.l #2,a0
endif
lea font,a1
lea fontMask,a2
jsr blitObject64
lea text,a1
jsr DrawText
bra .mainLoop
text:
dc.b "My first text on an Amiga!"
dc.b 0
align 4
xpos:
dc.l 0
Level3InterruptHandler:
@ -119,12 +116,6 @@ copperListBplPtr:
InstallPalette:
include "out/font-palette.s"
rts
font:
incbin "out/font.bin"
fontMask:
incbin "out/font-mask.bin"
section .bss
bitplanes1:
ds.b IMAGESIZE+(512)

BIN
assets/font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB