BBC MODEs 8-14 J.G.Harston, 70 Camm Street, SHEFFIELD, S6 3TR. 20-Jul-1992 Updated 15-May-1993 There have been many programs written to give extra MODEs on the BBC, but they have usually given extra colours, but at the price of losing character resolution. The usual example is a ten character, 16 colour mode. What I wanted was extra colours, without losing character resolution. The program here gives an approximation to MODEs 8, 9 and 11 on RISC OS, that is 80x32 characters with 4 colours, 40x32 characters with 16 colours and 80x25 characters with 4 colours. This is done by redefining the character set to be only four pixels wide and modifying the VDU driver information so it thinks they are twice as wide. This allows you to effectively create a copy of the standard screen modes, but with twice the colour depth in each mode. Type in the listings, check them and save them. When MkFont is run, it will create a file ThinSet containing the thin characters. After saving the file, you could modify it with a character editor. Running Mode/src creates the *MODE command. To use it, you normally do: MODE x:*MODE x eg MODE 8:*MODE 8 Doing this, BASIC checks that there is enough memory for the screen mode, and then *MODE selects it. As each extended screen mode is a modified duplicate of the lower numbered screen mode they take the same amount of memory so the checking by BASIC works. After selecting MODE 0 to 7 to select a normal mode, you should use another *MODE command to reset the characters. For instance, to select MODE 4, do: MODE 4:*MODE 4 If you just do MODE x, then the characters will remain thin, and will look odd. If the character set was not exploded, then the current language is re-entered to take into account the change in PAGE. If the character set was exploded, and BASIC is the current language, and there is no Tube (ie, I can legally play with BASIC's workspace), then BASIC's HIMEM variable is changed. The program SWMode/src creates a sideways ROM/RAM image which intercepts WRCHV and provides MODEs 8-14 directly. Just do MODE x as normal. When running on a BBC B which has an unexploded character set, MODEs 8-14 are unavailable, as the characters need to be redefined. The character set is exploded with *FX20,6. On the Master series, MODEs 8-14 are always available. As an extra feature, on selecting MODE 7, the screen is shifted left one character. This makes it look more centred then the usual setting, especially with coloured backgrounds. MODE list Standard MODEs Extended MODEs MODE 0 80x32 chars 2 colours MODE 8 80x32 chars 4 colours MODE 1 40x32 chars 4 colours MODE 9 40x32 chars 16 colours MODE 2 20x32 chars 16 colours MODE 10 20x32 chars 16 colours* MODE 3 80x25 chars 2 colours MODE 11 80x25 chars 4 colours MODE 4 40x32 chars 4 colours MODE 12 40x32 chars 16 colours MODE 5 20x32 chars 2 colours MODE 13 20x32 chars 4 colours MODE 6 40x25 chars 2 colours MODE 14 40x25 chars 4 colours MODE 7 40x25 chars teletext MODE 15 40x25 teletext *MODE 10 would normally be 20x32 characters in 256 colours, but 256 colours is not possible with the BBC video hardware, so it drops back to MODE 2 to give the same character aspect ratio. How it works In MODE 1, 16 bytes of screen memory are used to store each character, two columns of eight. In MODE 2, 32 bytes are used, four columns of eight. Location &34F in the VDU workspace holds the number of bytes a single character occupies in the current screen mode. Changing it to half its value makes the VDU driver advance only half the distance for each character printed. This, coupled with redefining the characters so that they occupy only the lefthand four pixels of the character cell doubles the number of characters displayed on a line. Location &30A is the righthand text column, and this is doubled to give the correct window edge. OSBYTE 154 is called to change the width of the displayed cursor to half its normal size. MODEs 8-11 are functionally the same as those on RISC OS systems (except for MODE 10). MODEs 12 and 13 are effectively small-memory versions of MODEs 1 and 2. With the sideways ROM version, an intercept is placed at &380-&3A7 to check the characters set to OSWRCH. This is the CFS BPUT workspace, and so is normally unused as long as you do not BPUT to a tape file. When a character 22 that is not part of a VDU queue is sent, the ROM is called. The byte at &380 is used to hold some flags: b7 = MODE pending b6 = current MODE is a thin MODE b5-b0 if non-zero, on Break the SWMode ROM disables itself. The program works on DFS, ADFS, HADFS and NFS, and B/B+/M/C.