Quick propeller font questions
Dr_Acula
Posts: 5,484
I'm trying to work out how the propeller font gets read.
I believe this object uses the internal font http://obex.parallax.com/objects/67/
Reading through the code, I can't seem to see where the font gets read. Ascii bytes get moved to a screen buffer, and longs get moved out to the display, and somewhere in there the ascii byte must be translated to font pixels.
I gather the font is stored in internal rom so the code that reads this may only be one or two lines using a jump table based on the ascii value which I suspect is why it is hard to spot.
Another pair of eyes would be most appreciated here!
I believe this object uses the internal font http://obex.parallax.com/objects/67/
Reading through the code, I can't seem to see where the font gets read. Ascii bytes get moved to a screen buffer, and longs get moved out to the display, and somewhere in there the ascii byte must be translated to font pixels.
I gather the font is stored in internal rom so the code that reads this may only be one or two lines using a jump table based on the ascii value which I suspect is why it is hard to spot.
Another pair of eyes would be most appreciated here!
Comments
Yes there is something clever going on there.
Hmm - screen is a word array rows*cols so that is 40x13*2 bytes. Is that enough to contain the bitmap for the font though? (16 longs per char). Or does that line above now contain an "address" to the bitmap in rom?
I'm working on a little bit of spin code to get the font bitmap out of rom and into an array so I can manipulate the bits (maybe resize the font by averaging the bits etc).
Addit: Do'h *hits head*
It probably is something simple like
and then (reading p32 of the manual) - undo the interleaving.
Part of the word is left-shifted by 6 in the TV.spin source.
*edit* BTW. The characters are encoded in ascii, so reading them is real easy. RomAddress+ (character * 32 The propeller tool has a handy font reference.
I think most drivers use 4 color mode, but back-ground and 2 other colors are the same,
you would not have to un-interleave the fonts by using this trick.
But in my VGA font test I do un-interleave the font, the source code is in description.
Font test:
http://youtu.be/dtahz8WwBm0
Smooth scroller:
http://youtu.be/dZZMfN2loAg
($200+(high 7-bits of c)) << 5 = the address of the character pair.
(color << 1 + (low bit of c)) << 10 = the word portion that selects color for the tile. Color selection is used to choose the high-bit of each pair of bits in the word, or the low bit.
Yes this is for the ILI9325 display. At the moment you need to read a font off the SD card in order to display anything. But you can't print a message like "SD card not found" because you need the font first. So even a simple display (320/16 = 20 chars wide) using the propeller font will be very helpful for startup debugging.
In a way, super fast speed is not so important so Spin will be fine. One you can print a message on the screen saying the SD card has been found, and that it is loading a font, then you can use that loaded font to display things faster using existing pasm.
So it is mainly just to display whether i) an SD card has been found and ii) whether certain essential files like icons and fonts have been found on that SD card.
Thanks ++ to everyone who contributed here - this is much appreciated.
Sorry. Can someone else finish it?
クロネコさん、ありがとう。