8-Bit Software Online Conversion

Creating user friendly programs (2) ----------------------------------- by Steven Flintham ------------------ The screen layout (2) --------------------- This article is, as promised, about creating a good mode 7 screen display. Mode 7 is one of the best features of the BBC series machines, but it can be a little tricky to get to grips with. I don't intend to cover the basic elements like using control codes to change colour - anyone who doesn't know that can find it all in the user guide. There are several styles of mode 7 layout which I've found useful in the past. The first is the "title at the top" style, which is illustrated by the program "TitlTop". It is generally very straightforward, but PROCtitle is worth a mention as you can use this in your own programs. It takes three parameters - the string to centre and the foreground and background colours for the heading (the colour numbers are the same as those in mode 2). It then displays the string in double height surrounded by a box in the chosen colours. Note that the box is centred correctly - allowance has been made for the extra space taken by the control codes. This is particularly important on the title, as the highlighted spaces at the side of the text (which are taken up by control codes) are balanced by the insertion of extra spaces at the right. The second point to note is the automatic listing performed to demonstrate the use of the text window to avoid problems with scrolling in this display style. The listing is done by inserting the keyword LIST followed by RETURN into the keyboard buffer (PROClist_program), which is then obeyed when the program ends. (Incidentally, if you feel like an unrelated challenge, try writing a program which produces an EXACT copy of itself on screen without using this technique!) Note that the screen window leaves one blank line at both the top and bottom - if you adjust the size to remove this, the display looks a lot worst during the listing stage. The copyright message at the bottom is one way of adding a "sub-title" - this could just as well have been placed under the title. This is a good point to mention colour clashes, as the title bar is one situation where they can occur. Some colours become hard to read when placed together - yellow on green for instance. The program "ColClsh" shows all the possible combinations of colours together so that you can see the best ones available. I find that yellow on red or yellow on blue tends to look best. The only point of note in the program is line 510 - the complex looking condition is simply to use code 156 instead of 157 when back% is 0, because otherwise the background becomes white. Instead of just placing the text "on the screen" under the heading, you can group it in boxes. The program "Boxes" illustrates this - PROCbox is the new procedure which you may wish to add to your library. It takes the parameters: box title, border colour, title colour, main text colour, bottom left x, bottom left y, top right x, top right y and window. The box title is a string which will appear in the small box at the top left of the main box. The border colour is the colour of the bar around the box, and the title colour is the colour in which the box title string will be displayed. The main text colour is the colour which will be used by default within the box. The bottom left and top right coordinates are the same as in a text window, and define the extent of the box. Finally, the window parameters will automatically set up a text window within the box if set to TRUE. Note that although the display produced by the program gives the impression that the heading is off-centre, this is caused because there is one extra space at the left of the box due to the control code. The makes the heading look incorrectly positioned relative to the box - you may wish to make the heading routine print the text one space to the right to overcome this. Finally for this article, I'd like to point out a "problem" with the teletext chip. It concerns the combination of single and double height text within the same line. You might, for example, want to use a heading like: Program Title Version 1.00 Program Title (C) SGF ^ this represents double height! Unfortunately, you can't do this because of the way in which double height works. You have to put the single height text on the top line: Version 1.00 Program Title (C) SGF Program Title The program "TelProb" illustrates the problem and shows what happens if you try the first style. The next article in this series will feature the "monochrome 3D" style mentioned in my article in issue 21, as nine members from the sixteen whose questionnaire results were available had either monochrome monitors or TV's. The seven members with colour monitors will be able to view the effect by connecting a TV, adding a circuit board between the computer and monitor (!) - see the June 1987 edition of The Micro User if you're interested (you do so at your own risk!) or printing the screens out on a monochrome printer.