Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:18 02 Sep 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMiteVGA: Multicolour Fonts?

Author Message
Hawk

Senior Member

Joined: 15/07/2021
Location: Australia
Posts: 150
Posted: 12:25am 09 Mar 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 4068
Posted: 07:45am 09 Mar 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 10379
Posted: 07:59am 09 Mar 2023
Copy link to clipboard 
Print this post

  Quote  In 320x240 mode, is the font data interpreted as two bits of font data per pixel?


Yes
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1270
Posted: 10:31am 09 Mar 2023
Copy link to clipboard 
Print this post

  Hawk said  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

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: Australia
Posts: 150
Posted: 11:15pm 09 Mar 2023
Copy link to clipboard 
Print this post

  matherp said  
  Quote  In 320x240 mode, is the font data interpreted as two bits of font data per pixel?


Yes


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: Australia
Posts: 150
Posted: 11:18pm 09 Mar 2023
Copy link to clipboard 
Print this post

  Martin H. said  
  Hawk said  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

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: Germany
Posts: 1270
Posted: 07:37am 10 Mar 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 8043
Posted: 08:27am 10 Mar 2023
Copy link to clipboard 
Print this post

  Hawk said  I like this idea. Is the Framebuffer the only place to load a bitmap?  Can it just sit in arbitary memory?

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: Germany
Posts: 1270
Posted: 09:27am 10 Mar 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  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.


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 Kingdom
Posts: 8043
Posted: 09:35am 10 Mar 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 1270
Posted: 10:30am 10 Mar 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  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?


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 Kingdom
Posts: 8043
Posted: 10:38am 10 Mar 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 1270
Posted: 10:58am 10 Mar 2023
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025