Classic Computer Magazine Archive COMPUTE! ISSUE 19 / DECEMBER 1981 / PAGE 154

Typing Foreign Language Text With The Commodore Printer

Zoltan Szepesi
Pittsburgh, PA

Most languages, unlike English, use different kinds of marks or accents above some of the vowels or even above or below some consonants. The French has the "accent aigu" (´), "accent grave" and the "accent circonflexe" (ˆ) placed in many words above vowels e, a, o, u and they have also the "cédille" placed below C (as ç) in some words. English typewriters and printers generally do not have the facility for printing these orthographic signs. However, with the CBM series 2022 and 2023 printers one can create special characters, thereby printing any of the wanted letters.

We could create the complete special character (letter + accent) for each vowel. However, for 4 vowels and 3 accents we would need 4×3 = 12 special characters. It is simpler to program only the 3 accents and, any time one needs the accent on the vowel, one goes to a subroutine to print the accent in the proper position. After the accent is printed, one has a carriage return without line feed, and the standard characters are printed after a line was typed.

At first, I made a program according to this plan. However, as each accent needs a full printer head scan, the printing time was slowed down very much if the number of accents in a line were great. Therefore, I modified the program so that the accents are printed after the full line has been printed, and any number of accents of one kind is printed in one printer head movement. This improved the speed to a practically acceptable level.

This paper and program will not handle the printing of special symbols below the letters as the cédille in French. This problem is the same as printing descenders on letters g, j, q, p, y. According to the same principles as described above for the accents, one can create these special characters. However, the printing can be done only with the tractor feed printer (2022 series). A paper and program on this problem will be published elsewhere.

In writing this program, I started with the "TYPEWRITER 1.5" program of Warren D. Swan published in THE PAPER (pages 11–15, Vol. II, Issue 10, January 1980), modified for the new CBM/PET (ROM 3) and the new printer ROM (4). It is a very simple, but powerful, mini-word-processor.

Listing 1 is the accent printing program. There, first we have to design the special character strings A$(I), where I = 0 TO 2. They are defined in statement 240, using the DATA in statements 150 to 170 for the three above mentioned French accents. (See instructions in the Printer User manual or in Swan's article). Second, one has to decide which keys to sacrifice for calling the subroutine for the special accents. We used the "and" key (&) for the accent aigu (´) as specified in statement 410, the "shift and" for accent grave — statement 420 — and the "shift apostrophe" key for accent circonflexe (ˆ) — statement 430. For the printing of the accents in the proper place, the strings S$(I) are created, one for each accent type. For tape recording and reprinting the text from tape the string T$ is created.

Swan gives the instructions for how to use the original program. I will tell you shortly what to do and how to do it in the modified program.

For Input one can choose:

  1. The keyboard (device #0)
  2. The tape recorder (device #1 or #2)

For Output:

  1. Tapes 1 or 2.
  2. Screen (device #3)
  3. Printer (device #4)

For the tape files you can give a file title. If you do not need a title just press two apostrophes ("").

When using the DEL command in or after an enhanced text, the following rule has to be applied:

Within the enhanced text the correction can be made the normal way, if the SHIFT - (key was not yet pressed.

If you want to go back to the enhanced characters after an exit from them, use the DEL until you delete the exit character. Here press the enhanced command (SHIFT-BACKSLASH) and continue with DEL. Do not again use the SHIFT-BACKSLASH when you type the corrected text, but use the SHIFT-( key when you want to continue with standard characters.

Boldface characters can be printed also on the full line by printing the same text on the same line two times. For achieving this, do the following:

KEY ASCII Statement No. Function
CLR 147 320 Sets the paging mode to the printer.
HOME 19 330 Sends a cursor-home character to the output device only.
DEL 20 340 Deletes the last character.
SHIFT BACKSLASH 220 350 Enhanced print
SHIFT ( 168 360 Unenhanced print for stopping enhanced
INST 148 370 Deletes entire line
BACKSLASH 92 380 TAB for next 8 spaces
SHIFT # 163 400 Prints programmable character defined previously.
RETURN 13 310 Brings the printer to the print subroutine.
SHIFT RETURN 141
& 38 410 Accent aigu
SHIFT & 166 420 Accent grave
SHIFT APOSTROPHE 167 430 Accent circonflexe
CURSOR LEFT 157 390 Program goes to the special command mode, where one can ask:
  1. A programmable character
  2. Change the # of lines/inch
  3. End the program.
Table 1. List of operations for the TYPEWRITER ACCENT program.

After the line you want to print bold face, do not press RETURN, but use SHIFT-RETURN. For the next line press SHIFT-BACKSLASH and RETURN.

If the language you want to print has other accents than the ones given in this program, just construct their forms according to the instructions of the printer and substitute the resulting six numbers into the data statements 150-170. E.g.: the German text needs only the "Umlaut," which could be printed by the following data:

0,0,64,0,64,0

Since more accents are not used in the German, the other 2 accents can be deleted in the program. Since there will be just a single A$ and S$, statements 240, 270, 280, 500, 510, 2090, 2510 could be modified accordingly and statements 160, 170, 420, 430, 1110, 1120, 1220, 1230 could be deleted.

In the Hungarian, beside the accent grave the Umlaut, one needs an accent similar to the quotation mark. The following data would define this:

0, 32, 64, 32, 64, 0

In several other languages one uses a wave-shaped accent. The previous Hungarian accent could be acceptable for this accent too.

Copyright registration of this program is being requested. You can use this program for your personal use, or you can have it on tape by sending $3.00 to my address: 2611 Saybrook Drive, Pittsburgh, PA 15235.