EUG PD


Big Letters

 
Published in EUG #45

What It Does

This program prints large letters on the screen. It works by making solid, 3D-looking letters out of the standard character set, copying the screen data into memory, and using machine code to plot the letters back on screen afterwards.

The Power Of Osword 10

The characters are made in the procedure PROCcreate. Only numbers and capital letters are used, specified in the string valid$, otherwise there wouldn't be enough memory. First of all, OSWORD 10 is called to get the character definition for each letter in valid$. The definition is altered to produce a double-height, 'thin' letter, re-defined as characters 128 and 129. They are then printed at the graphics cursor (VDU5) at different positions and in different colours, to produce a solid shape.

As it happens, we end up with a graphical shape that fits exactly into the character spaces (i.e. the same area as if one text character was printed below another). This is equivalent to 32 bytes of memory in Mode 5. So the 32 bytes are copied into memory; the character set begins at T%, set to &5300 in line 60. This allows enough room for all 37 characters (10 numbers, 26 letters plus a space) to sit below the Mode 5 screen.

PROCmess

The machine code uses a parameter block containing the X and Y co-ordinates of the text to be printed, followed by the text itself ending in a carriage return. This is all done in PROCmess(A%,X%,Y%), where X% and Y% point to the parameter block. The screen address is calculated with the help of a table in lines 690-760. Each letter of the message is compared with the characters in valid, using Y as an index (lines 800-850). If a match is made, Y is then used to find the data for the right letter to print. Finally, the letter data is written to the screen (in the same way a sprite would be printed). &270 is subtracted from scr to get the correct address for the next letter - this saves having to re-calculate the screen address each time.

Christopher Dewhurst, EUG #45

Chris Dewhurst