www.jupiter-ace.co.uk

Previous Page > Listings Index > Character-Forming Exercises, Your Computer April, 1983


Character-Forming
Exercises For
Your Ace








Roger Liddiard`s program
will help convert
your deformed
character into
true descenders
of the
Ace

Character-Forming Exercises, Your Computer April, 1983, Vol 3, page 82
THE SPEED of Forth and being able to redefine standard graphic characters are Features of the Jupiter Ace which make it ideal for improved quality printing - either on screen or on paper- a parallel printer has been promised by Jupiter Carter.
The Jupiter Ace Handbook explains that the character set is contained in RAM addresses 11264 to 12287. These characters can be changed by writing new values into this RAM, but counter be read bank. again. The initial character set is created from the ROM when the computer is switched on. The raw data to generate the characters is contained in ROM bytes 7547 to 8187 which consist of an abbreviated set of ASCII characters 32 to 127. If you want to see this data, define the words DD and Change01 as follows:
: DO
  DUP 16 + DUP ROT 
  DO
   I C@ 256 + 2 BASE C!
   . DECIMA! 32 EMIT I . CR 
  LOOP ;

: CHANGE01
  11264 48 8 * + 8 0 
  DO
   DUP 128 SWAP C! 8 + 
   DUP 255 SWAP C! 7 - 
  LOOP
  1- 255 SWAP C! ;

Now enter

    CHANGE01 INVIS CLS 7547 DD

and enter further DD as required. The program displays the ROM data in succession - with an additional character on the left-hand side - and the byte. number at the right. The word Change01 has turned the character 0 into a black square and the character 1 into a white square, so that the ASCII characters are readily discernible.
If you look carefully at this section of ROM, you will see that the ASCII characters 32 to 62 copy seven bytes at a time. The top line of each character is a zero byte. ASCII characters 63 to 94 only use six bytes each with zero top and bottom, while 95 to 126 use seven as before. Finally character 127 uses all eight bytes.
When you have finished looking at the ROM, enter Abort to clear the data stack. The ROM data provides a very simple means of returning any character set you may have devised back into the original form. For example, we do not want us and is to look like black and white squares for the rest of their lives. The word Reset emulates the
action of the computer when it is first switched on, restoring to original any altered characters between 32 and 127.
Two utility words are needed - ROW which enters a single byte where ordered, and Block, which copies a prescribed block of data from the ROM.
: ROW
  OVER C! 1 + ;

: BLOCK 
  0 DO 
   OVER C@ ROW SWAP 
   1+ SWAP
  LOOP ;

: RESET
  7547 11520 31 0
  DO 0 ROW 7 BLOCK
  LOOP 32 0
  DO 0 ROW 6 BLOCK 0 ROW 
  LOOP 32 0
  DO 0 ROW 7 BLOCK 
  LOOP 8 BLOCK ABORT ;
 
Now Redefine DD and Change 01. This remove.. them from the dictionary and leaves just Row, Block and Reset Define another word Test to display all the characters on the screen:
: TEST	
  127 32
  DO I EMIT 
  LOOP 4 1 
  DO I EMIT 
  LOOP ;
You will notice that three graphic characters appear at the end - we will need to look at these later on; they will be changed into something more useful.
Examine the letters critically - several things detract from their appearance: the lines of writing are too close together; some lower case letters seem to be too short, not lining up with the top of the other letters; and the descennor, - the tails that are supposed to fall below the line - hardly descend at all.
To overcome crammed writing one simple remedy is to print a blank line between lines of type. At first this might appear to spare the lines our too far, but if the blank lines are used to on,, better descend,,, and we increase the size of the capitals, the spacing looks just right.
The word Capital increases the height of ASCII characters 63 to 94- it simply doubles

BEFORE AFTER
 
 
 
 

Character-Forming Exercises, Your Computer April, 1983, Vol 3, page 83
up on the top two lines of the characters:
: CAPITAL 
  7764 11766 32 0 
  DO 2 BLOCK SWAP 
   4 + SWAP 6+ 
  LOOP DROP DROP ;
  The offending lower-case letters are stretched in a similar manner to smooth out their tops:
: LCASE
  1 1 4 4 4 1 4 1 4 1 4 7977 12048 11 0 
  DO 3 PICK BLOCK 3 PICK - 
   SWAP ROT-7 + SWAP 8 + 
  LOOP DROP DROP ;
Now to put proper tails on your letters. The letters g, j, p, q and y are re-defined and their tails are drawn in graphic characters 1, 2 and 3. Yes, you only need three tails - those of g, j, and y are the same.
The word Descenders makes this trans- formation - of course the tails are lost until we double space the typing, but you can see them being formed in the last three characters of Test.
: DESCENDERS
  4 664 64 56 68 11272 
  DUP 24 0
  DO 0 ROW 
  LOOP DROP 3 0 
  DO 2 0
   DO SWAP ROW 
   LOOP 6 + 
  LOOP DROP
  8141 12237 8085 12173 8078 12165 
  8035 12117 8015 12093 5 0
  DO 3 BLOCK DROP DROP 
  LOOP ;

If your Jupiter Ace has no additional memory, you will soon be running out of space, but do not worry - once the new set of characters has been formed, we can dear the dictionary and start again with some new words. So Save what we have done so far, then enter
CAPITAL LCASE DESCENDERS FORGET 
RESET

which should clear out the dictionary - check it with VList. Now the Create. Start by entering two utilities:
 32 VARIABLE NN
 : PRINT ;

Then define the word DType. It is quite long but its effect is dramatic:
 
: DTYPE
  32 NN ! FIND DUP 6 + SWAP 5- @ 13 - 
  BEGIN
   DUP 32>
    IF
    ELSE DUP NN ! 
    THEN NN @ 0 >
  WHILE
   BEGIN
    INKEY DUP 80 =
     IF PRINT 
     THEN 
   UNTIL NN @ - SWAP DUP NN @ + 
   SWAP NN @
   TYPE SWAP 32 NN @- SPACES 32 0 
  DO 113 113 113 112 112 121 106 103 
   0 15388 @ 32 - C@ 8 0
   DO DUP 4 ROLL = ROT + SWAP 
  LOOP DROP DUP
   IF
   ELSE DROP 32 
  THEN EMIT 
 LOOP
 REPEAT DROP DROP ;

DType is used in conjunction with a word containing text. It starts on a new line so the text is best arranged in complete paragraphs. The first 32 letters are typed out, followed by a line of blanks and descenders. It then wait, for you to press any key before repeating the process with the next 32 letters. This control facility is very useful when you need to control the amount of text you wish to display, for example when a printer is used to copy a screen full of text, A dummy word Print has been included - if the letter P is pressed this subroutine is called up - it will be useful in the future. To use DType, define some text such as
P1 ." abcdefghijklmnop etc. " ;

preferably with more than one line of characters. Because DType uses the word Find, and calculates the length of text in P1, another word must appear in the dictionary after P1, otherwise the bytes in P1's header which define its length, will not be complete. So add a dummy word : P2 ; on the end.   Now enter
     INVIS CLS DTYPE P1

when the first line is complete, press any key and the next line will appear. The advantages of storing test in colon definitions are. that the length of text is not limited to 256 characters and full Edit facilities are available. In addition, memory space is not wasted in defining new words such as String. Successive paragraphs can be displayed by means of
     DTYPE P1 DTYPE P2 DTYPE P3 etc.

and paragraphs can be interspersed with additional blank lines by the use of CR as required. Your text can be Saved on tape in the normal manner.