The objective of this task is to display a numeric font that is 8×8 bits onto the bitmap. By storing font using dcb directive, we place the 64 bit data into a region of memory and load that memory to display a number between 0 and 99.

Creating Font to Display an 8×8 bit Digit
five:
dcb 00,01,01,01,01,01,01,00
dcb 00,01,00,00,00,00,00,00
dcb 00,01,00,00,00,00,00,00
dcb 00,01,01,01,01,01,00,00
dcb 00,00,00,00,00,00,01,00
dcb 00,00,00,00,00,00,01,00
dcb 00,01,00,00,00,00,01,00
dcb 00,00,01,01,01,01,00,00
DCB is a directive that can be used to store bits of data. Since the objective is to store an 8×8 digit font on bit map, the directive holds a total of 64bits. These bits take up a region of memory and can stored to use later on in the code when needed.
In order to store the directive into a memory location, we could need to first select a pointer to a low byte and a pointer to high byte. Once the pointers are created, we would store the digit value into the low byte and by using asl to shift the byte 6 times, this would provide us with a 64 byte memory location to store our 64 bit data.
Obtaining the Memory Location of Directive
lda #$05 ;digit to be stored in low byte
sta $20
lda #$00 ;high byte
sta $21
asl $20
asl $20
asl $20
asl $20
asl $20
asl $20
clc
adc #<five
sta $20
rol $21
rol $21
rol $21
rol $21
rol $21
rol $21
lda $21
adc #>five
sta $21
The reason we have the snippet of code above is to store the directive into a region of memory. Since each directive takes up 64 bits of memory and a page has 255 bits, by shifting left 6 times, we are able to obtain the memory location where our dcb is stored. Line 1 of the code provides us with the value #$05 stored into memory location $20. Line 3 stores a value of #$00 into memory location $21. With these 4 lines, we declared a low byte and a high byte for calculating where our DCB is located in memory. Line 4 to 14 are Arithmetic Shift Left (asl) of the low byte which give us a bit location, in hex format, where the directive is stored and line 16 to 25 are Rotate Left (rol), which will provide us with the page number the directive is stored in. You might end up with a memory location of $07a3 where the directive for number five is stored.
Drawing the 8×8 bit Font onto the Bitmap
setup:
lda #$0d ; create a pointer at $10
sta $10 ; which points to where
lda #$03 ; the graphic should be drawn
sta $11
lda #$00 ; number of rows we've drawn
sta $12 ; is stored in $12
ldx #$00 ; index for data
ldy #$00 ; index for screen column
draw:
lda $07a3,x
sta ($10),y
inx
iny
cpy #WIDTH
bne draw
inc $12 ; increment row counter
lda #HEIGHT ; are we done yet?
cmp $12
beq done ; ...exit if we height and width have been reached
lda $10 ; load pointer
clc
adc #$20 ; add 32 to drop one row
sta $10
lda $11 ; carry to high byte if needed
adc #$00
sta $11
ldy #$00
beq draw
Using the snippet to obtain the directive needed to display 5 on the bitmap, we now use the bit and page location to draw the number 5 using a digit font. Line 13 loads the memory location we found using asl and rol.