BBC Basic: Inserting a control character without occupying space in Mode 7

211 Views Asked by At

I'm using mode 7 ("Teletext mode") on my Beeb. I'd like to print a string of unbroken characters with an coloured text control character in the middle, as-per this mock-up:

Example string of coloured teletext characters

However, I can't work how this can be done. The control character needs to occupy space in the output:

PRINT CHR$129;"STACK"CHR$132;"OVERFLOW"

Output with the unwanted space

I read up on held graphics mode, but this only seems to allow me to repeat the last used graphics symbol, instead of inserting a space when I print a control character. When I do try this with text I just get an additional space for the held graphics character:

PRINT CHR$129;"STACK"CHR$158;CHR$132;"OVERFLOW"

enter image description here

Is this possible? Can I print a control character without getting a visible space?

Or perhaps there is a way to insert a control character followed by a backspace, to claim back the occupied space but retain the control code effect?

3

There are 3 best solutions below

0
On BEST ANSWER

It is not possible to treat the text characters as graphics characters when using the 'held graphics' character. A good example of using 'held graphics' can be found here: http://www.riscos.com/support/developers/bbcbasic/part2/teletext.html

You also cannot use the backspace character to go back one space as each control code takes up one space on the screen.

6
On

This is from memory, I recall that CHR$(8) moves the cursor one place to the left.

Put that just before the "O":

PRINT CHR$(129);"STACK";CHR$(132);CHR$(8);"OVERFLOW"

Sadly my BBC Model B is, I believe, in my parents' attic, so I can't test this.

0
On

OK so this is a bit of a fudge; but it was an answer to my problem so I will share it here for all those BBC Micro / Teletext developers struggling with the same problem...

My challenge was to avoid a noticeable space between the two coloured words. Control characters must exist in the text and occupy a character (either as a space or a copy of the last used block graphic).

Therefore, by inserting a space between every character I was able to make the text appear as one word (albeit with slightly excessive letter spacing):

PRINT CHR$129;"S T A C K"CHR$132;"O V E R F L O W"

Workaround with spacing

This had the desired effect for me - it may not for some others. The only other route I could see available was to render the whole text in block graphics, which would occupy significantly more screen space than the approach I settled for.