|
The following article was printed in September 1991 of the magazine „8000 PLUS".
|
A BASIC program to design up to 10 new characters for the PCW
|
|
DESIGNER.BAS by Tom Pearce
Have you ever, as a BASIC programmer, fumed and fretted at the lack of a CP/M 'tick' character, or at the monotony of the supplied set of box borders?
Or as a game writer, have you got fed up with using an arrow instead of a real alien in your own version of space invaders?
Fret no more.
This program from Tom Pearce will allow you to redefine up to ten CP/M characters, and what is more, you can then save those characters to disc as part of a ten line program which you can use to redefine those characters whenever necessary — you can even use it as part of another BASIC program!
When you RUN "DESIGNER", you will be presented with a screen with a white 'patch' in the middle of it.
This is your grid.
A PCW screen character is made up of a series of very small points of light, each known as a pixel.
There are 64 pixels in each character, arranged in an 8x8 pattern.
Each pixel is either on or off.
and it is the arrangement of the 'on' pixels that you see on screen.
The grid that this program gives you (press any key to get into it) is also 8x8, although on a much larger scale.
It allows you to build up your pattern of dots quickly and easily.
Move around the grid with the arrow keys, and set a pixel using the space bar.
If you make a mistake, by the way, the space bar will also turn a set pixel off.
When the pattern is ready, press E.
You will be asked if the pattern is correct.
Answer Y.
Now you will have to decide where to store your characters in memory.
The program stores the new characters in sequential ASCII character positions in memory, overwriting the characters which were already there.
So if you want to use certain characters from the CP/M set, make sure that you don't start somewhere where your required character is going to be overwritten!
If in doubt, check in the ASCII pages of your manual (page 113ff of the CP/M for the 8000 series, and page 547 for the 9512); also bear in mind that the program will only store in the range from 200 to 255.
If your program runs beyond character 255, it will not work!
Also, make sure that you remember which character is stored where — you will need to know that when you come to use them in other programs!
Having decided where the characters are to go, you are now asked whether to save the program to disc.
If you have more characters still to design, give the answer N, and define the next character.
You will not be asked where it is to be put in memory — the computer will automatically overwrite the next character in memory.
|
|
The upper of these screen shots is the main screen of 'Designer' — where you create the characters, and the lower shot is part of a rather madcap game which uses the characters which have been created
|
Eventually you will want to save the program to disc.
At this point answer Y to the question.
You will then be asked to give a name for the program on disc.
Any name will do, but it is a good idea to give it the extension '.BAS', so that the computer will know in future that it is a BASIC program.
Finally, you will be shown the characters that you have just defined, and will be asked if you want to continue.
The answer is probably no.
Make sure that the program has been saved to disc by typing LOAD " followed by the name of your new program.
When the 'Ok' prompt appears, type LIST and 8 lines of program (numbered 1 to 8) will appear on the screen.
If you have defined more than 5 characters (here is a small change to make to the new program at this point — type EDIT 7 [RETURN|, and delete the last character of the line, which is a comma.
Then SAVE the program back to disc, using the same name as before.
Now, to make sure that your new program is running, turn your machine off and reboot it.
When you have BASIC installed, put the disc with your new character program on it into the drive, and type RUN " followed by the name of this new program.
You should see your characters appear on the screen, one after the other.
Using them in a program is quite simple.
You cannot access most of these characters directly from the keyboard.
Instead, you will have to use the PRINT CHR$()" function, putting the ASCII code for your character inside the brackets.
This is why you need to know the number of each character that you nave redefined with 'Designer'.
You can include the program as part of another program by using BASIC's MERGE command — if your new graphics definition is called "GRAPHICS.BAS", just type MERGE "GRAPHICS.BAS" while editing the other program.
LISTing will then reveal that the "GRAPHICS" program has become lines 1 to 8 of the new program.
At this point you will need to do a little more editing.
Change line 6 as follows:
delete the final word 'END', and remove the command "PRINT CHR$(char)".
Experiment will show that there is much that you can do with this program.
Try defining 'sprites' of four characters which fit together to make a block.
If you feel that for a particular program the ten new characters are not enough, try running the program again, with a different set of storage positions, and then merge both those programs into your main program
(although don't forget to renumber the lines of the second program, and don't overwrite anything in the main program!).
|
|
|
These two data lines are the machine code necessary for redesigning the screen characters.
They are also used in the program which is written to disc later.
|
|
|
|
Line 150 is a typical 'housekeeping' line - defining the screen clearing and character positioning functions
|
|
|
|
The previous lines deal with the display and input of the character as it is being created.
The funny character in the middle of line 310 can be typed from the PCW keyboard using [EXTRA] U.
It will appear as an 'up arrow'
|
|
|
|
The 'information bar' at the top of the screen is drawn up in these lines.
You can see how 'iv$', defined in line 170 comes into its own in lines 330-350, and reverses the screen display.
'nv$' puts it back to normal
|
|
|
|
This is the clever bit - where the new program is written to disc.
Line 400 creates the new file, 410 writes to it, and 420 to 500 provide the text for the program.
Because it uses all the correct words, BASIC will be able to understand it
|
| [BASIC listing] and [assembler listing] |
HTML customization by
Werner Cirsovius
February 2015
© 8000 PLUS