![]() |
Forum Index : Microcontroller and PC projects : PicoMiteVGA: Multicolour Fonts?
Author | Message | ||||
Hawk![]() Senior Member ![]() Joined: 15/07/2021 Location: AustraliaPosts: 150 |
Following on from my last question regarding details for defining new fonts, is it possible to define multicolour fonts? In 320x240 mode, is the font data interpreted as two bits of font data per pixel? Thanks, Mike |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4068 |
I don't think so. When you output text so long as you follow the tile/etc rules it'll acquire the current colours you've set. John |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10379 |
Yes |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1270 |
the Font (like gui Bitmap) uses one Bit /Pixel so you will not get more than 2 Colors per Char (Foreground and background color) using TEXT or PRINT Command. The Only way I see, is load a Picture of the Multicolor-Font to the Frame Buffer and write a little Sub that places a String on the Screen via Sprite Read/ Sprite Write. Edited 2023-03-09 20:42 by Martin H. 'no comment |
||||
Hawk![]() Senior Member ![]() Joined: 15/07/2021 Location: AustraliaPosts: 150 |
Sorry, I should have clarified this question a bit further...in 320x240 mode, does the graphics engine interpret the two bits of data per pixel as colour information? I grew up with an Atari 8-bit, and am accustomed to getting more colour as the horizontal resolution decreased. I was wondering whether this is the same for the PicMiteVGA? From reading other responses, it is more like the ZX Spectrum, allowing any foreground/background colour from a palette of 16 fixed colours for a whole charater. I'm OK having limitations, I am just trying to determine what limitations I am working to. |
||||
Hawk![]() Senior Member ![]() Joined: 15/07/2021 Location: AustraliaPosts: 150 |
In 320x240 mode, is the font data interpreted as two bits of font data per pixel? Thanks, Mike the Font (like gui Bitmap) uses one Bit /Pixel so you will not get more than 2 Colors per Char (Foreground and background color) using TEXT or PRINT Command. The Only way I see, is load a Picture of the Multicolor-Font to the Frame Buffer and write a little Sub that places a String on the Screen via Sprite Read/ Sprite Write. I like this idea. Is the Framebuffer the only place to load a bitmap? Can it just sit in arbitary memory? |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1270 |
Multicolor Font... Little Demo (Ugly but it is just for Demonstration) 'demo MODE 2 Dim integer f,n,cl,col FRAMEBUFFER create FRAMEBUFFER write f 'first build an Multicolor Font Page in Framebuffer CLS :Font 1 cl=1 For f=32 To 127:Print Chr$(f);:Next For f=0 To 36 col=&HFF*(CL And 1)+&HFF00*((CL And 2)=2)+&HFF0000*((CL And 4)=4) For n=0 To 319 If Pixel(n,f) Then Pixel n,f,col Next n Inc cl:cl=cl And 7 Next f coltext 0,120,"Print a Text in Multicolor" '--------------------------- Sub coltext x,y,c$ Local integer f,sx,sy For f= 1 To Len(c$) 'calc source coordinates sy=0 sx=8*(Asc(Mid$(c$,f,1))-32) Do If sx>=320 Then Inc sx,-320:Inc sy,12 Loop Until sx<320 FRAMEBUFFER write f Sprite read #1,sx,sy,8,8 FRAMEBUFFER write n Sprite write #1,x,y 'calc dest. coordinates Inc x,8:If x>319 Then x=0:Inc y,12 Next End Sub of course you can also load a prepared image of your multicolor font into the framebuffer Edited 2023-03-10 17:53 by Martin H. 'no comment |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 8043 |
There is no such thing as arbitrary memory on the PicoMite. Every last byte is either used or reserved for something. :) Just a thought... Would this be possible? If the font character data is small enough, they could be poked into strings as we know where they are and how long. A string could then be copied to the framebuffer (not PRINTed) as required. Strings can be written as files so characters could be stored and loaded as required. Edited 2023-03-10 18:28 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1270 |
That makes me curious... How do I copy a string to the memory area of the screen or framebuffer? 'no comment |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 8043 |
I don't know yet. :) You can PEEK it character by character, of course. The zeroeth character of the string is its length. I'm *assuming* that the frame buffer is some sort of linear map that could be POKEable. It's just an idea. Could the string data be a sprite? Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1270 |
You can PEEK it character by character, of course. The zeroeth character of the string is its length. I'm *assuming* that the frame buffer is some sort of linear map that could be POKEable. It's just an idea. Could the string data be a sprite? so far so good with VARADDR var$ - I get the address of the String, 1st Byte is the lenght String. But sadly, I have no address for Screen (n) or Framebuffer(f) or the memory area in which the sprites are stored to POKE or move anything to. ![]() I was hoping I just missed it and you would have the answer Edited 2023-03-10 20:33 by Martin H. 'no comment |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 8043 |
Oh well, it was something to think about. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Martin H.![]() Guru ![]() Joined: 04/06/2022 Location: GermanyPosts: 1270 |
I found an error in my listing. 'demo MODE 2 Dim integer f,n,cl,col FRAMEBUFFER create FRAMEBUFFER write f 'first build an Multicolor Font Page in Framebuffer CLS :Font 1 cl=1 For f=32 To 127:Print Chr$(f);:Next For f=0 To 36 col=&HFF*(CL And 1)+&HFF00*((CL And 2)=2)+&HFF0000*((CL And 4)=4) For n=0 To 319 If Pixel(n,f) Then Pixel n,f,col Next n Inc cl:cl=cl And 7 Next f FRAMEBUFFER write n CLS &H004000 coltext 0,120,"Print a Text in Multicolor" '--------------------------- Sub coltext x,y,c$ Local integer f,sx,sy For f= 1 To Len(c$) 'calc source coordinates sy=0 sx=8*(Asc(Mid$(c$,f,1))-32) Do If sx>=320 Then Inc sx,-320:Inc sy,12 Loop Until sx<320 FRAMEBUFFER write f Sprite read #1,sx,sy,8,12 FRAMEBUFFER write n Sprite write #1,x,y 'calc next dest. coordinates Inc x,8:If x>319 Then x=0:Inc y,12 Next End Sub Since the font is 8x12 Pixel, it has to be Sprite read #1,sx,sy,8,12 not Sprite read #1,sx,sy,8,8 Edited 2023-03-12 00:51 by Martin H. 'no comment |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |