Page 1 of 1

Swapping graphics and text colour in BBC BASIC

Posted: Thu Jan 17, 2013 8:15 pm
by Jochen
This is starting to drive me crazy. I know it is not possible to change the text colour directly by assigning r,g,b values. But memory tells me that in the distant past I used to assign an r,g,b colour to the graphics colour and then used a VDU call to swap this colour into text mode.

For the life of me I can't remember the number of this call. Can anybody remember?

Jochen

Re: Swapping graphics and text colour in BBC BASIC

Posted: Thu Jan 17, 2013 8:31 pm
by jojopi
HELP COLOUR

Re: Swapping graphics and text colour in BBC BASIC

Posted: Fri Jan 18, 2013 5:19 am
by DavidS

Code: Select all

DEF PROCTxtRGB(rc%,gc%,bc%)
  COLOUR 7,rc%,gc%,bc% 
  COLOUR 7
ENDPROC

Re: Swapping graphics and text colour in BBC BASIC

Posted: Fri Jan 18, 2013 9:16 am
by Jochen
DavidS wrote:

Code: Select all

DEF PROCTxtRGB(rc%,gc%,bc%)
  COLOUR 7,rc%,gc%,bc% 
  COLOUR 7
ENDPROC
The problem is that this won't work with me, only when I use GCOL. Hence the swap.

Jochen

Re: Swapping graphics and text colour in BBC BASIC

Posted: Fri Jan 18, 2013 2:29 pm
by DavidS
Are you running in a task window? Of cource if so I would like to know how you are using GCOL.
I will look up how to do it by either a SWI call or an OSByte/OSWord Call.

Re: Swapping graphics and text colour in BBC BASIC

Posted: Fri Jan 18, 2013 2:30 pm
by jojopi
DavidS wrote:COLOUR 7,rc%,gc%,bc%
COLOUR 7
This will only work in an indexed palette mode. Though I did wonder if it was the solution OP was misremembering.

Another possible hack is GCOL r,g,b:VDU 5. But that prints text at the graphics cursor, with a transparent background, and generally very slowly. And is the r,g,b form of GCOL really older than the r,g,b form of COLOUR?

I can find no evidence of a VDU to swap text and graphics colors. Indeed the modern practice seems to be to set colors with SWI not VDU.

For anyone unable to check HELP: the problem no longer exists. COLOUR r,g,b is fine.

Re: Swapping graphics and text colour in BBC BASIC

Posted: Fri Jan 18, 2013 2:42 pm
by DavidS
I am not inding anything after ust a quick look. I know that there is a way using a SWI call, though it may take a while looking through the RISC OS PRMs

Re: Swapping graphics and text colour in BBC BASIC

Posted: Fri Jan 18, 2013 2:59 pm
by Jochen
jojopi wrote:
DavidS wrote:COLOUR 7,rc%,gc%,bc%
COLOUR 7
This will only work in an indexed palette mode. Though I did wonder if it was the solution OP was misremembering.

Another possible hack is GCOL r,g,b:VDU 5. But that prints text at the graphics cursor, with a transparent background, and generally very slowly. And is the r,g,b form of GCOL really older than the r,g,b form of COLOUR?

I can find no evidence of a VDU to swap text and graphics colors. Indeed the modern practice seems to be to set colors with SWI not VDU.

For anyone unable to check HELP: the problem no longer exists. COLOUR r,g,b is fine.
You are quite right, COLOUR r,g,b seems to work for the current colour. The VDU code I talked about was published in the Acorn User some 20 or so years ago. Possibly the problem was worse under RiscOs 3.5. As I always wrote for the WIMP, text colours were generally not important. It's the Raspberry Pi and writing non wimp programs that gave me the problem. I was trying to store two colours and call them on alternate cycles of a program I'm writing that decodes the Frankfurt DCF atomic clock. With a small work-around it works fine now.

Thanks everyone who answered.

Jochen

Re: Swapping graphics and text colour in BBC BASIC

Posted: Sat Jan 19, 2013 4:20 pm
by DavidS
Ok, sorry about that. I mostely run at X1280 Y720 C256 F60, so palettized tricks work. I will have to rember to switch to X1920 Y1080 C16M F30 when testing my responce for graphics related questions.