[Coco] Basic 09 text display question.

L. Curtis Boyle curtisboyle at sasktel.net
Wed Jul 24 11:02:32 EDT 2019


That is a little more complicated; there is no display code (or gfx2 function) for that. For that, you have to do a GetStat system call, which will need the following code:

TYPE registers=cc,a,b,dp:BYTE;x,y,u:INTEGER
DIM regs:registers
DIM curpalette(16):BYTE

(* Standard output path we are using
regs.a=1
(* SS.Palet GetStat call #
regs.b=$91
(* Point to place to hold all 16 current palette register settings
regs.x=ADDR(curpalette)
RUN syscall($8d,regs)

At this point curpallette(1) contains the current color in palette 0, curpallette(2) has color 1, etc. up to curpalette(16) has color 15.
As Wayne Campbell mentioned before, if you do a BASE 0 at the beginning of your program, than arrays will be 0 to n-1 (vs. the default 1 to n), so you could then use curpalette(0) for palette 0. But be aware that all arrays in your program become base 0 if you do that).

L. Curtis Boyle
curtisboyle at sasktel.net



> On Jul 24, 2019, at 7:28 AM, coco at jechar.ca wrote:
> 
> Thanks for the reply I am trying out some test programs to get a better
> understanding of all this.
> 
> One question I have.
> 
> If you want to set a pallete regester number one to say color 7
> you would use the command RUN GFX2("PALETTE",1,7) ie
> RUN GFX2("PALETTE",palette_register,color_value).
> 
> But what if you want to know what palette number one is how do
> you check to see what color it is ? ie how would you implement
> a function like.
> 
>  color_value=THE_FUNCTION(palette_register)
> 
> 
>  So for example:
>  RUN GFX2("PALETTE",1,7)
>  X=THE_FUNCTION(1)
>  PRINT X
> 
>  would print 7.
> 
> Charlie
> 
> On 2019-07-23 12:57, L. Curtis Boyle wrote:
>> 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