1

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?

seanhodges
  • 17,426
  • 15
  • 71
  • 93

3 Answers3

2

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.

Tim Street
  • 36
  • 5
1

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.

seanhodges
  • 17,426
  • 15
  • 71
  • 93
0

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.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483
  • Thanks! It didn't quite work as I hoped, but at least I was able to rule out the backspace idea. The CHR$(8) did indeed move the cursor to the left (well remembered!), but the "O" then printed over the control code and caused the remaining text to print in red. – seanhodges Jul 29 '16 at 15:39
  • Can you not move the cursor *several* places to the left, change the colour, then move it back to the right? That I think is CHR$(9)? – Bathsheba Jul 29 '16 at 15:42
  • Also, I'm sure some of the VDU modes (4?) allowed you to superimpose characters. Could you not do that? – Bathsheba Jul 29 '16 at 15:46
  • I gave it a go; but it looks like this might be a limitation of mode 7. You can't seem to superimpose characters or overwrite a control character without cancelling it. I tried redefining character 132 but that's not allowed in mode 7 either. – seanhodges Jul 29 '16 at 18:55
  • Hum. What about my suggestion on moving the cursor back a few paces, or does the colour control have to be immediately to the left of the printed character? – Bathsheba Jul 29 '16 at 19:32
  • It does seem that way. I even tried printing the first word in red, then re-positioning the cursor and printing the second word in blue, but if the original control character is changed then I lose the colour. Thinking I should either leave the space or draw the whole thing in sixels... – seanhodges Jul 29 '16 at 22:21