64-COL

Published in Dragon User December 1987.

64 Columns

Paul Harrison does an upgrade on the Dragon screen display

64-COL is a program which attempts to cure one thing which makes the Dragon inferior to many home computers of its class — the screen display. The table below lists several problems that Dragon Data created when they decided to use the Motorola board on which the Dragon was based too closely:

Had Dragon Data changed the poor quality 6847 video display chip to (for example) the 6845 (as used in the BBC micro and the IBM Colour Graphics Adapter), the Dragon would have been capable of a great many other things — 16 colours, flashing colours, 80 column text, 640x256 resolution, etc. All this seems ridiculous in a micro with probably the best graphics facilities out of all the home micros today.

Unfortunately, it is difficult to connect another VDG to your Dragon. However, if you use a few tricks involving the low quality of the standard television set, and the expandability of the system software-wise due to the useful vectors provided by Microsoft, you can get 64 column text on the computer, allowing an amazing three times the amount of data on the screen at any time! Because the program to do this is stored in RAM, you can redefine text as well, and … wait for it … you can (at last) have lowercase on the Dragon!

This is exactly what my program does. The screen mode it uses is PMODE-4 so you can mix hi-res graphics and text on the screen at the same time. The character size is 4x7, allowing 64 columns of 27 lines to be used. Unlike some other text utilities, facilities like a visible cursor are provided, when you are typing in text or while a program is running (this feature is possible to turn off). There are control codes for inverse text, for non destructive backspace and forward space, to make the screen scroll without effecting the cursor position, and the usual Dragon control for delete and the carriage-return/line feed sequence.

The table below summerises the effects of the controol codes:
0No operation (NULL)
1Non-destructive backspace (BS)
2Non-destructive forward-space (HT)
3No operation
4Scroll (does not effect cursor position)
5Enable cursor
6Disable cursor
7No operation
8Delete (DEL)
9No operation
10No operation
11No operation
12Clear screen (FF)
13Carriage return/line feed (CR/LF)
14Home cursor
15Inverse off (use white on black characters) These also effect the scroll and form-feed colour.
16Inverse on (use black on white characters)

Facilities have been provided for machine code programmers to increase the number of codes provided. There is a vector at the end of the program (location 31108) which can be patched, either by over writing it to by placing a jump at the location to a subroutine of your own. At this point, 'A' holds the current character (below 20 only) and any control characters that need to be interpreted, will have. Note though that you can still check for these characters, your routines being executed after the ones in the 64-Col program itself.

As a rough guide to the whereabouts of spare memory, you can write your routine in the space between 31108 and #7BFF without any problems.

The Character Set

There are 128 displayable character altogether-lying from #20 (space) to #9F. Characters above £9F are stored in the ROM and print out as rubbish. Characters are stored as 8 bytes (although only the first 7 bytes are displayed). As each line of each character has only 4 bits, the characters have two forms — one, which is printed for every odd column, uses the top 4 bits of each byte, and one for every even column, which uses the lower 4 bits of the bytes that make up the character. This turned out to be the easiest way of doing it, and a programmer could easily find ways of taking advantage of this.

The characters between #80 (£128) and free for you to redefine. You can redefine the others as well, but you may get some funny results if you do (can you imagine a listing where all the Es are printed as space invaders ???!?). You can calculate the position of the first byte of a character by using the equation 8*c+&H7B00, where 'c' is the ASCII code of the character to be changed.

An easy way of redefining characters is by using listing 3. This runs using 64-Col and allows you to define characters using a grid, and a cursor that can move around the grid changing individual bits. The computer will display the codes that make up the character at the side of each line of the character, so that when you have finished, you can write them down and use them in another program.

To demonstrate how this is done, you could use the following subroutine to define character 130 as a box.

1000 LET CHARACTER=8*130+&H7B00
1010 LET A="F9999F":REM THE CODES THAT MAKE UP THE CHARACTER
1020 FOR N=1 TO 7
1030 X$="&H"+STRING$(MID$(A$,N,1),2)
1040 POKE CHARACTER+1,VAL(X$)
1050 NEXT N
1060 RETURN

Typing in the program

Listing 1 is the only listing you have to type in. Listing 2 is a very useful character designed (see above).

After you have typed in routine 1, CSAVE the program to tape, and then RUN it. You are bound to have made some typing mistakes, even I, mega-brilliant as I am, do that sort of thing. The computer will tell you where any mistakes have been made, and stop. You can then edit the appropriate line, and correct it. Once the program has all the typing mistakes out of it, it will set itself up for white on black text, with a cursor. The computer will clear the screen, and print the entire ASCII range (#20 to #7F).

The following BASIC instructions have no effect:

The equivalent of the instruction PRINT AT x,y; is PRINT CHR$(14);STRING$(y,13);STRING$(x,2);

It is not a good idea to use graphics if the cursor has been switched on as it expects the screen to be te same as when it left it, and if you draw lines through the cursor, lines will appear/disappear where the cursor was beforehand.

I have not decided to produce a program that is compatible with most standard Dragon programs, as it would be difficult, if not impossible for them to make full use of the new screen size. Any programs not designed to run on this system will therefore be unlikely to work.