[Coco] Basic 09 text display question.
L. Curtis Boyle
curtisboyle at sasktel.net
Tue Jul 23 12:57:43 EDT 2019
There are a couple of ways. The easiest to read and follow would be to use RUN gfx2(“color”,foreground#,background#). You can also do with defining a couple of 3 byte arrays for foreground color and background color escape code sequences, and the do a PUT #1,arrayname). The latter would be slightly faster and take less memory, but not as obvious to what it does.
You are correct in type 8 being 320 wide, 16 color. You can have the height as anywheres from 8 to 200 (in steps of 8), depending on what you created the window with.
The default colors duplicates 8 colors twice (so palettes 0 and 8 are the same, 1 and 9 are the same, etc. - you can define your own with the palette command, both via gfx2 and PUT arrays like I mentioned above). The default colors for Coco 3 text and graphics modes are:
0&8 - white
1&9 - blue
2&10 - black
3&11 - green
4&12 - red
5&13 - yellow
6&14 - magenta
7&15 - cyan
So, as one example from what you requested, to print the word RED on a black background:
Method 1:
RUN gfx2(“color”,4,2)
PRINT “RED”
Method 2
DIM fcolor(3),bcolor(3):BYTE
fcolor(1)=$1b
fcolor(2)=$32
fcolor(3)=4
bcolor(1)=$1b
bcolor(2)=$33
bcolor(3)=2
PUT #1,fcolor
PUT #1,bcolor
PRINT “RED”
The first method is the easiest - but it will take some memory to load the GFX2 package, and then have the GFX2 parser go through the things you passed to it. The 2nd method does not require any external programs, and is faster, but harder to set up. (Once you have it set up, though, to change the foreground color to something else, you only have to do:
fcolor(3)=[color#]
PUT #1,fcolor
(same with background, just change bcolor(3) instead, and PUT #1,bcolor)
L. Curtis Boyle
curtisboyle at sasktel.net
> On Jul 23, 2019, at 9:35 AM, coco at jechar.ca wrote:
>
>
> I was trying to figure out how I would have a basic09 program print to the screen.
>
> RED(in red)GREEN(in green)BLUE(in blue)HIGHLIGHTED(in Black text on Yellow Background) all
> on a Black background.
>
> Also is there a record somewhere of which numbers display what color when building a PALLET.
>
> In my case I am working with a type 8 screen which I believe is 192x320(16color) and a 6x8
> font witch provides 53 characters per line.
>
> Charlie.
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list