MODE 8 and 9 J.G.Harston, 70 Camm Street, SHEFFIELD, S6 3TR. 20/7/92. 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 loosing character resolution. The usual example is a ten character, 16 colour mode. What I wanted was extra colours, without loosing character resolution. The program here gives an approximation to MODEs 8 and 9 on the Archimedes, that is 80x32 characters with 4 colours and 40x32 characters with 16 colours. This is done by redefining the character set to be only four pixels wide and modifying either mode 1 or 2 so that the VDU driver thinks they are twice as wide. Type in the listings, check them and save them. When MkChar is run, it will create a file ThnChrs containing the thin characters. After saving the file, you could modify it with a character editor, eg my DefChar program available from various PD Libraries. Running S/Mode creates the *MODE command. To use it, you normally do: MODE x:*MODE x eg MODE 8:*MODE 8 Doing this, Basic checks there is enough memory for the screen mode, and then *MODE selects it. After selecting mode 8 or 9, 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 S/SWMode creates a sideways rom/ram image which intercepts the WRCHV and provides MODEs 8 and 9 directly. Just do MODE x as normal. When running on a BBC B which has an unexploded character set, MODEs 8 and 9 are unavailable, as the characters need to be redefined. The character set is exploded with *FX20,6. On the Master series, MODEs 8 and 9 are always available. As an extra feature, on selecting MODE 7, the screen is shifted left one character. This makes it look more central then the usual setting, especially with coloured backgrounds. How it works The program works as follows. 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. With the sideways rom version, an intercept is placed at &380 to check the characters set to OSWRCH. &380 to &3DF is the CFS workspace, and so is normally unused. When a character 22 that is not part of a VDU queue is sent, the rom is called. This flags for the following character to be intercepted as well which then is used to select what mode to create. MODE 8 (four colours, 80 columns) is based on MODE 1 (four colours, 40 columns). MODE 9 (16 colours, 40 columns) is based on MODE 2 (16 colours, 20 columns). It is not possible to create MODE 10 (256 colours, 20 columns), as there isn't a base mode with 256 colours that can be used. However, doing MODE 10 gives MODE 2 with looks the same, 20 columns, but only has 16 colours. It is almost possible to create MODE 11 (four colours, 80 columns, 25 lines). In effect, this is MODE 1 with only 25 lines, a 16k screen map with four colours. However, I've found it difficult to create this passively, it needs routines to be permanently hooked into the workings of the VDU driver to scroll correctly. Maybe some other time... It is not possible to create another higher-numbered MODEs, as then you would be in the realms of two-pixel wide characters or less. The program works on DFS, ADFS, HADFS and NFS, and B/B+/M/C.