|★ APPLICATIONS ★ DIVERS ★ CHARACTER EXPANSION ★|
|Rsx - Character Expansion|Popular Computing Weekly)||Applications Divers|
An advantage of the Amstrad's bit mapped display is that text can be mixed with graphics in any of the three display modes. However, It would often be useful to be able to alter the size of the text characters displayed, for use in title screens, menus, and other displays. This Is the facility that this program gives you. via two new commands.
Type in, save and run the Basic Loader program, taking care with the Data statements. If you haven't made any mistakes entering the code you will get a message informing you that the new commands have successfully been loaded Now type in the short demonstration program, to get an idea of what the commands can do. This demo program simply displays the letters 'PCW' in all possible sizes in all three modes.
The two new RSX commands are called |CSIZE and |DISPLAY, the syntax of them is as follows:
Where xmag is the horizontal magnification factor, and ymag is the vertical magnification factor. So to get triple height, double width characters you would type |CSIZE,2.3. Note the T before the command name, this tells Basic that the command is an external RSX command ('|' is obtained using Shift @). Also note that there is a comma immediately after the command name. Xmag and ymag must be in the range 1 to 7. Obviously. using |CSIZE,1,1 would give characters of the normal size.
Once you have set the size of characters, a string is printed using the DISPLAY command. So if X$ is a string containing the message to be printed, the syntax of the command is:
The is necessary before the string variable name to pass the string descriptor (containing the length and start address of the string) to the machine code routine. The string is displayed from the current cursor position, so you can use the normal LOCATE command to position the text. The characters are printed with their top left hand corners at the cursor position. Take care not to cause the screen to scroll within a DISPLAY command, ie. do not try to print the expanded characters too low down the screen, otherwise each section of the expanded character will be printed on a separate line.
There are no restriction on the use of the new commands, they can operate in all modes, and the characters in the string can be user-defined if you wish - using the normal SYMBOL command. The character size set by |CSIZE is with respect to the normal character size for the current screen mode. So CS/ZE2,1 will give mode 1 size characters in mode 2, and mode 0 size characters in mode 1 The characters are displayed in the current pen and paper colours. One point to note is that the program uses character number 255 -chr$(255) - internally, so this must always be a user-definable code, codes 0-254 can be ROM based. Also there is no point in trying to use CHR$(255) in your own programs as the routine redefines it to display the expanded characters.
The assembly language listing is included to show how the program actually operates, and this is fully commented. The main routine is called PRTCH: this prints an expanded character at the current cursor position. The routine first copies the matrix for the required character from ROM or Ram into its own workspace, next it expands it vertically by the current value of MULTY(set by |CSIZE). Finally, it expands each byte horizontally and defines chr$(255) as part of the expanded character - this is then printed using the normal ROM print routine. This process of defining chr$(255) and printing it goes on until the whole of an expanded character has been built up and printed. Once a character has been printed, the cursor position is updated to be ready for the next character So successive DISPLAY commands, without using LOCATE between them will cause each string to be printed one after another Note that control codes cannot be used within a DISPLAY string.
The CSIZE routine forces the xmag and ymag parameters to lie in the range 0-7 by an AND 7 command, and then ignores the result if it is zero. Bigger sizes could have been used with only a little more memory, but characters seven times their normal size should be big enough for anyone!