|★ APPLICATIONS ★ CREATION GRAPHIQUE ★ Memories are made of this|Popular Computing Weekly) ★|
|Memories are made of this||Applications Creation Graphique|
Find out how characters are stored in memory with this m/c program by R G Bennett
Although this program could perhaps be classed as a novelty program, there are features which could be of academic interest to some readers. Appendix III of the Amstrad handbook shows pictures depicting those characters with ASCII codes from 32 to 255 decimal, and shows them on an 8x8 grid. This grid is called the character matrix, and is stored in lower Rom as the 8 bytes represented by the 8 rows, or lines, of the matrix. Each byte is a number between 0 and 255 decimal, which is stored as the binary bit pattern which represents that number. The convention is that when a bit is ‘one' it is said to be set, and when the bit is ‘zero' it is reset.
You can see quite clearly from Appendix ID that it is the pattern of set bits in each byte which make up the whole character.
When you have the program up and running you are requested to press a key, with or without Shift You could even press the Enter key at this stage if you wished. The character represented by the keypress is then shown on the screen in a much enlarged form, followed by the binary, hexadecimal, and decimal representation of each byte of the matrix. You should have no difficulty in matching up the binary pattern on the screen with the pictures in Appendix HI.
After seeing the result of your first keypress, a second one will take you back to the start of the program, but pressing Enter here will stop the program.
Regarding the actual program, in order to gain access to a character matrix, the lower Rom has to be 'turned on' first, and turned back off again when the matrix has been found. When printing the enlarged character each of the 8 bits of the byte are checked in turn. If the bit is set then a solid square is printed, and if reset, a space is printed. Thus the solid squares pick out the shape of the character. The same method is used to print the binary representation of the character, but this time a 'one' replaces the solid square, and a zero is printed in place of the space.
The following routines are called from within the program, with the addresses given in hexadecimal:
The only control code used in the program was in the Text, this was control code 31 which is the same as a Print At instruction. This is followed by a number for the column, and then the line number to printed to. Most of the control codes are ideal for embedding m message printing loops.
Once you have successfully generated the code by the Basic program, the actual machine code can be saved by Save '‘name",B,30000,290,30000. It can then be loaded back later on by either Memory 29999: Load "name", or Memory 29999: Run ".
Popular Computing Weekly