AmigaExamples/024.simple_text
alpine9000 ffc5f1f93d Got build working on newer OSX, included missing ADFs 2019-06-11 13:58:03 +10:00
..
bin Got build working on newer OSX, included missing ADFs 2019-06-11 13:58:03 +10:00
Makefile Optimisations 2016-03-30 19:18:15 +11:00
README.md Update README.md 2016-04-04 10:48:25 +10:00
alpine_bootblock.s
blit.s Cleanup 2016-04-04 13:50:40 +10:00
blittext.s Right side ok 2016-03-31 10:04:47 +11:00
constants.i Cleanup 2016-04-04 13:50:40 +10:00
cpu.s
image.s Added left and right buffers for over scroll 2016-03-31 10:53:44 +11:00
includes.i Tried writing a vasm macro 2016-03-27 16:54:33 +11:00
init.s Added left and right buffers for over scroll 2016-03-31 10:53:44 +11:00
link.script.x
macros.i Tried writing a vasm macro 2016-03-27 16:54:33 +11:00
palette.pal
screenshot.png Added screenshot 2016-04-04 10:47:05 +10:00
simple_text.s Cleanup 2016-04-04 13:50:40 +10:00
utils.s Tried writing a vasm macro 2016-03-27 16:54:33 +11:00

README.md

simple text

In this example I try to render a bitmaped font using the blitter. This is almost certainly not the optimal way to achieve the goal, so don't use this as an example of how to render text, it's more an example of how to use the blitter.

Firstly I created a simple bitmapped font file using dpaint:

font

Once again, this is not the optimal way to organise a font file. Just the way I did it :-)

The only complication is bliting an 8 bit font is that the blitter operates only on 16 bit words, so we must mask the correct 8 bits worth of character data.

        beq     .evenChar                               ;
.oddChar
        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                                   ; move the destination pointer left by one byte
        bra     .continue
.evenChar:
        move.w  #$FF00,BLTAFWM(a6)                      ; select the first character in the word
.continue:

We use the blitter shift register to allow pixel positioning of the text, so when we need to render the second character in a word, we offset the X position by 8 bits and also move the destination pointer.

There are two operating modes that can be configured in constants.i

non masked mode

 MASKED_FONT             equ 0

In this mode, the font is blitted with the font file background included. This mode is interesting because we still use a cookie cut logic function $ca however instread of enabling the DMA A source channel, we pre-load the A data register with all 1s so that the A channel can be used to mask out 8 bits of the 16 bit blit.

   move.w  #$ffff,BLTADAT(a6) ;  ; preload source mask so only BLTA?WM mask is used

masked mode

 MASKED_FONT             equ 1

In this mode, the font is blitted using a cookie cut function so the font is blitted over the destination background. Ee use the A DMA channel as the mask and point it at a mask bitplane. We still need to use the A channel first word mask for masking out the unwanted character as we blit a whole word:

This routine should be able to handle any number of bitplanes, althought it not run at 50 fps with more than 16 colors.

See the Makefile

   NUM_COLORS=16

Lastly, we switch the palette to greyscale after all the work has been done so we can see how long things are taking.

screenshot

Screenshot

try it