Complete RTTY for the Timex

See all articles from QZX v3 n1
Author(s): Thomas R. Strohl (KA1VW)
Publication: QZX
Pub Details: QZX v3 n1 (Volume 3, Issue 1)
Date: December 1984
Pages: 5-11

This article presents the hardware and software that I have developed to use with my Timex TS-1000 computer. The software runs on a 2k byte unexpanded system, and listings are available for both Baudot and ASCII operation from the ARRL. [1]

Functions of the System

The hardware interface is based on the Z80A SIO serial input/output device. The SIO contains a dual channel USART, with control registers, handshake control lines, and data buffers for each channel. The device has features that make it quite suitable for amateur use, but its full capabilities are far beyond the necessities of amateur RTTY. In asynchronous operation it automatically adds start, stop, and parity bits (if parity is enabled). It is programmable with respect to stop bits per character, parity, bits per character, and data clock rates (1, 16, 32, or 64 times the data baud rate). Thus, the device can be programmed for ASCII as well as Baudot with any combination of stop and parity bits in use by amateurs. It also allows additional protection against spurious signals generated by faster data clock rates.

Since the Z80A SIO is part of the Z80 family, it is easy to use with the Z80A CPU — the heart of the TS-1000. Many of the pins of the SIO connect directly to the CPU bus. All inputs and outputs are TTL compatible with the necessary pull-up resistors self contained. It requires a single 5-V dc regulated power supply that can be derived from the TS-1000 9-V supply. In the circuit presented here, the address decoding is simple and straight forward.

There are actually four versions of the Z80A SIO designated /0, /1, /2, and /9. Internally they are similar, but the main difference among them is that the /9 is a single channel version. Each channel has 3 read registers and 7 write registers. The read registers provide information about the data passing through the device such as buffer overflow, framing errors, and parity errors. In the asynchronous mode, read register 0 is polled to determine when a received character is available when receiving or if the transmit buffer is empty when transmitting. Only write registers 3, 4 and 5 need be programmed for asynchronous operation in the polling mode. Complete information about the Z80A SIO can be found in the “Z80 SIO Technical Manual.” [2]

The price of the SIO depends on the supplier. Prices range from $12.50 to $25 for the /0 version used here. It pays to search for the best price and I have included pin functions for all the versions should you want to make a substitute. My unit was built at a cost of $25 using breadboard construction and the lowest-priced SIO.

Review of the Circuits

Fig. 1 shows the minimum circuit required for RTTY operation. It will interface any TTL compatible terminal unit to the TS-1000, and permits operation at one speed only, in excess of 300 baud. Fig. 2 shows modifications for multiple baud rates and software TR switching.

Address decoding is performed by U1, U2, and U3. This scheme was adapted from that of J. J. Carr. [3] When address bits 0, 1, and 6 are high and bits 2, 4, 5, and 7 are low, then all eight inputs to U1 will be high. This causes the output of U1 to go low.

If this should happen when an input/output instruction is being performed by the CPU, the input/output request (IORQ) line also goes low. The two low inputs to the NOR gate (U3) cause its output to go high. This output is inverted and serves as both the chip enable (CE) and IORQ for the SIO. Note that bit A3 can be either high or low. The result is that a single channel of the SIO has two port addresses, 67 and 75. Port 67 is used to pass character data between the computer and the terminal unit. Port 75 is used to pass programming information to the SIO and for passing buffer information to the computer.

As may be apparent, the wiring of the address lines and U2 determine the interface addresses. If you wish to use port addresses other than 67 and 75, be sure the ones selected are not being used by the Sinclair Logic chip. The system will crash if you try to write to an address that is already in use. If you try to read from such an address, a value other than 255 will be returned.

All data lines, M1, RD, ground, and the CPU clock are connnected directly to the CPU bus. Power is supplied from a 7805 5-V regulator connected to the 9-V pin of the bus. The edge connector I used was made by cutting a larger connector purchased from Radio Shack (0.1 inch spacing). A prototyping board, marked edge connector, and expansion board (necessary if you want to attach a printer or RAM pack) are available. [4] If you cut your own, it is a good idea to fit it with a key for the slot to be sure the connections line up properly.

The data clock is built using a 555 timer IC. The clock pulses do not need to be perfectly symmetric and after two years of use I have not found any frequency drift in the one I am using. The clock rate should be adjusted with R5 to run at 16 times the data rate (720 Hz for 60 WPM Baudot).

Fig. 1 -- Timer circuit values are for 45-baud (60 WPM) operation.
Fig. 1 — Timer circuit values are for 45-baud (60 WPM) operation.
Fig. 2A -- The clock circuit for selecting two different baud rates. This circuit may be expanded to provide for any number of clock frequencies. Fig. 2B -- Circuit to provide software TR switching. Software required is listed on page 9. The 470-ohm resistor may need to be changed to ensure relay activation.
Fig. 2A — The clock circuit for selecting two different baud rates. This circuit may be expanded to provide for any number of clock frequencies. Fig. 2B — Circuit to provide software TR switching. Software required is listed on page 9. The 470-ohm resistor may need to be changed to ensure relay activation.

The Baudot Program

Space requirements will not allow an explanation of how the machine language programs work. I present only the details of how to use them, some customizing that can be done, and the program listings themselves. If you are interested in how it works, I have added comments to the listing to help you understand it. Let’s first look at how the Baudot program is operated once it’s on tape.

The program is loaded using the name “Baudot.” After loading, it starts to run automatically in the receive mode. The upper ten lines of the display show the received text, printed on line ten and scrolled automatically. The software searches for and scrolls on a received space after 21 characters have been printed on the line. This almost completely eliminates half words at the end of the line. If no space is received, scrolling takes place after printing 32 characters on the line. Line 11 is blank and separates the received text from the transmit buffer text.

The next ten lines display the contents of the transmit buffer. As you type on the keyboard, the typed text appears across the bottom line and scrolls up as the line is filled. When the buffer is full, text is not accepted from the keyboard or from the string load routine. Once nine full lines have been typed, the buffer cannot be written to until the whole top line has been sent. As each character is transmitted, its appearance in the buffer is changed from black to white to white on black. This allows you to keep track of what is being sent and how much room is available in the buffer.

To change from receive to transmit, press shift-S (as if to type the keyword LPRINT). You may continue to type into the buffer, space allowing, while characters are being sent. Pressing shift-D (SLOW) will cause transmission of the buffer to cease and return to the receive mode. When the transmit mode is again selected, transmission from the buffer will resume where it left off. There is no way to delete characters from the buffer to prevent transmission of erroneous characters except to re-start the program.

Once you have a copy of the Baudot listing, take a look at page 3. Addresses 16640 through 16703 contain the TS-1000/Baudot conversion table. The code column contains the TS-1000 print code for a character. The op column shows the corresponding Baudot character sent or received (encoded in the last five bits of the address). The comment column indicates if the character in Baudot is not contained in TS-1000 and what to type as an equivalent. Some of the equivalents are inverse characters. If you include the TR switching option, you will not be able to send these characters because the software necessary for switching will replace the software for getting into and out of “inverse.” Inverse is entered and exited by pressing shift-ENTER (FUNCTION). For example, to send the bell signal, type shift-ENTER, shift-B, and shift-ENTER. When the bell signal is received, a normal asterisk is printed.

The automatic sending of the figs and ltrs signals has not been included so you must be sure to type < before any series of numbers or punctuation and > afterwards. To send the text

SO 73 NICK. KL7KA DE KA1VW SK

type

SO <73> NICK <.> KL<7>KA DE KA<1>VW SK.

Additional Features

There are three additional features to point out. The first situation occurs when you are in the receive mode; the figs signal is sometimes received, but for various reasons the following ltrs signal is not received. In this case the system can get hung up printing all sorts of unnecessary numbers and punctuation. Pressing ENTER at any time while in the receive mode sets the system to ltrs. In fact, you can hold the key down and prevent the system from printing any figs. If you do this, any numbers received are printed as their letter equivalent (5 will be T, 7 will be U, ? will be B, and so on).

The carriage return and line feed signals are automatically sent after each set of 63 characters. If you include these signals in the transmitted text, they will not force a reset of the counter and will be included in the count. Changing the count requirement or defeating this function is explained in the next section.

As mentioned before, there is a special string, A$, that can be defined explicitly (without a line number). Once defined, it can be loaded into the transmit buffer by pressing shift-A (STOP). If you did not define A$ before saving the program, you may stop the program by typing shift-A. This will cause the error message 2/10, indicating that the string in line 10 of the BASIC program is undefined. If you have already defined A$ and want to change it, type shift-A and then press the space (BREAK) key. IMPORTANT: Whenever you stop the program you must type POKE 16595,205 before you do anything else.

Once you’ve stopped the program and have completed the necessary pokeing, define A$ explicitly. One example is LET A$=” CQ CQ CQ CQ CQ DE KA<1>VW “. A$ may be up to 120 characters long in a 2k RAM system. Type GOTO 2 to re-enter the program. One additional comment, by pressing shift-A you will load A$ into the transmit buffer and change the mode to transmit regardless of what mode you were in. (A special note to users who select the software TR option: Pressing shift-A does everything I have described above, but it will not activate the TR relay. The only way to activate the relay is to press shift-S or shift-D.)

System Operation

Before you type in the machine language code, decide how you want the system to work with respect to the following adjustable conditions. Do you want to use your Timex printer that is limited for use at 45 baud only? If not, you will want to delete the calls to the printer routine that cause irritating screen flicker. This is done by typing in 0’s (NOP – no operation) for the code at the following addresses

16542  16543  16544
16609  16610  16611
16863  16864  16865  16866
16899  16900  16901
17037  17038  17039

As a reminder that you are not going to use the printer, (NOP) will appear at these locations in the comment column.

Do you want to change the automatic carriage return line feed transmission operation? If so, address 17086 contains one more than the number of characters sent between carriage return and line feed signals. If you want to defeat the automatic operation, load code 201 at location 17087. The carriage return or line feed signal is now sent only when included in the typed text. This is very handy for message formatting.

When the line feed signal is received, do you want the display system to ingore it, print a space, or scroll the line? This is controlled by the codes shown at 16843.

The feature that checks for a space after printing 21 characters on the received line may be changed. You may prefer to print a full 32 character line and not care about parts of words at the end of a line. The value that controls when the search begins is located at 16874. If you want a full 32 character line, put 32 into this location.

There is one other area of customizing you may want to experiment with once you’ve got the system running. There are two timing loops for controlling the rate at which the keyboard is scanned for characters. If you are a fast typist, you may want to lower these values to prevent missing characters. If you are slow at removing your finger from the keys you may need to increase the values to prevent unwanted multiple letters. This means that characters are auto-repeating if you hold the key down. The locations of the time constants are 16578 (receive) and 16712 (transmit). The values included in the listing are for typing at about 45 wpm (comfortable for the author).

The machine language routine is 620 bytes long. It is written to be located starting at address 16514, the first byte in a remark statement that is the first line of a BASIC program. Therefore, you will need to make a REM statement, line one, that has 620 characters in it. I have seen several schemes for making long REM statements but the only reliable method I know of is to type it in directly. This is a long process (in FAST mode), so once you have it, put it on tape. The ASCII program needs 630 bytes so you may want to use it again, and there is always the chance that the system will crash while typing in the code. Once you’ve got the REM statement, type in the following BASIC program.

FAST
1 REM LLL1111111---620 characters
2 FOR N=16514 TO 17131
3 SCROLL
4 PRINT N,
5 INPUT I
6 POKE N,I
7 PRINT PEEK N
8 NEXT N

Run this program. As each address appears at the bottom of the display, type in the corresponding code from the Baudot listing. If you make an error, you can stop by pressing shift-A (STOP), explicitly assigning the address of the error to N, then type GOTO 3. The correct code can be reentered from where the error occured and not from the beginning.

After all of the code has been entered, change the following lines.

4 PRINT N, PEEK N
5 NEXT N
6 STOP
SLOW

Run it again. As each address and its code appear, check it against the listing. If an error is discovered note the address. After checking, poke any addresses with the correct code as necessary.

Once you are sure the code is correct save what you have temporarily. Then enter the following changes.

FAST
2 FOR N=0 TO 21
3 PRINT AT N,31;" "
4 NEXT N
5 SLOW
6 LET A=USR 16514
7 LET A=USR 16517
8 FAST
9 POKE 16595,201
10 FOR N=1 TO LEN A$
11 POKE 17118, CODE A$(N)
12 LET A=USR 17111
13 NEXT N
14 POKE 16595,205
15 SLOW
16 LET A=USR 16592
17 GOTO 8
18 SAVE "BAUDOT"
19 GOTO 2

Turn on your tape recorder. When you’re ready to save the program, type GOTO 18. The program saves itself and comes out of the save routine running in receive. If you don’t have the serial interface attached, it may crash or get hung in a loop. This is not critical because you’ve got the program on tape and this should not happen with the interface attached.

If you want to save a particular A$ with the program, type it in without a line number, but before you type GOTO 18. The A$ will be saved on tape with the rest of the program. Remember that the maximum length of A$ is 120 characters in a 2k byte RAM system.

If you now have more than 2k RAM and you want to have a longer string that’s fine. Be sure, however, there is enough room in the buffer to load the whole string thought. I suggest that you keep it under 256 characters. Another way is to define more than one string. You can define 25 strings, B$ through Z$, and call them up by number using the BASIC routine that follows. Use the same lines for lines 2 through 8 as shown above.

9 GOTO 12
10 LET A$=B$
11 GOTO 21
12 INPUT Z
13 GOTO Z*10
18 SAVE "BAUDOT"
19 GOTO 2
20 LET A$=C$
21 POKE 16595,201
22 FOR N=1 TO LEN A$
23 POKE 17118, CODE A$(N)
24 LET A=USR 17111
25 NEXT N
26 POKE 16595,205
27 SLOW
28 LET A=USR 16592
29 GOTO 8
30 LET A$=D$
31 GOTO 21
40 LET A$=E$
41 GOTO 21
50 LET A$=F$
51 GOTO 21 ...and so on.

This continues for as many strings as you have room for up to Z$. You can define various strings explicitly for RY’s, CQ’s, brag, ID, or whatever. When you press shift-A an inverse L prompt appears at the bottom of the screen. Enter the number corresponding to the string number that you want to send (1 sends B$, 2 sends C$, 3 sends D$, you get the idea). Be careful that there is enough room in the transmit buffer to hold all of the string.

The ASCII Program

Since the operation of the ASCII software is similar to that of the Baudot software, I will only describe the significant differences. The major difference is that no provision is made to include the use of the printer. The printer control routine written in the BASIC ROM will not operate fast enough to print over 60 WPM. The summary of key functions for the Baudot program apply to the ASCII program as well except that pressing the ENTER key has no effect. This is so because there is no equivalent to figs and ltrs in ASCII. It is tested for in the machine language program and can be used at some time for future features.

The character code conversion table is on pages three and four of the ASCII listing. The Timex character code 136 is used for characters not printed on reception nor capable of being transmitted. These are mostly control characters. If you want or need to include any of these ASCII characters, you will have to swap codes with another character, thereby losing the ability to send that character. Note that graphics characters and keywords codes cannot be used and that lower case ASCII characters are printed as inverse characters.

The characters are sent as seven bits plus parity set to mark and two stop bits. This is compatible with almost all Amateur Radio ASCII communications. No parity checking is done on the received code and only the least significant seven bits are used for character conversion.

The customizing locations are as follows. Automatic carriage return and line feed transmission options are at 17098 and 17099, the line feed interpret options are at 16857, the character count for the scroll on space routine is at 16896, and the time constants for the keyboard scan are at 16566 and 16625.

The machine language routine will require a 630 byte remark statement for line one of the BASIC program. This is ten bytes longer than the Baudot program required. The single string (A$) BASIC program is

1 REM 111111--- 630 bytes --- 1111
2 FOR N=0 TO 21
3 PRINT AT N,31;" "
4 NEXT N
5 SLOW
6 LET A=USR 16514
7 LET A=USR 16517
8 FAST
9 POKE 16583,201
10 POKE 16625,0
11 FOR N=1 TO LEN a$
12 POKE 17130, CODE A$(N)
13 LET A=USR 17123
14 NEXT N
15 POKE 16625,3
16 POKE 16583,205
17 SLOW
18 LET A=USR 16580
19 GOTO 8
20 SAVE "ASCII"
21 GOTO 2

Very Important: Whenever you stop the program be sure to POKE 16583,205 and POKE 16625,3 before restarting the program.

Summary of Key Functions

ENTER causes received characters to print in ltrs mode.

shift-ENTER causes entry to or exit from printing inverse characters in the transmit buffer.

shift-A causes the predefined string to load into the transmit buffer.

shift-S changes to transmit buffer.

shift-D changes to receive.

To stop program run press shift-A and then press the space (BREAK) key while the string is loading.

References

[1] Listings for both the ASCII and Baudot operation of this program are available for $1 and a business-sized s.a.s.e. Write to QEX, Technical Dept., 225 Main St., Newington, CT 06111.

[2] “Z80 SIO Technical Manual,” SGS-ATES Semiconductor Corporation, 240 Bear Hill Rd., Waltham, MA 02154

[3] Carr, Joseph J.,”Z80 Users Manual,” Reston Publishing Company, Reston, VA

[4] Zebra Systems, Inc., 78-06 Jamaica Ave., Woodhaven, NY 11421

Code Changes for TR Switching

Note that this eliminates the “inverse” mode.

  ELE     CODE   OP (Comment)

                 BAUDOT LISTING

16 538     32    JR NZ 21
   539     21
   540     62    LD A, 118
   541    118
   542    205    CALL (2129)   (NOP)
   543     81                  (NOP)
   544      8                  (NOP)
   545     62    LD A, 5
   546      5
   547    211    OUT (75), A
   548     75
   549     62    LD A, 136
   550    136
   551    211    OUT (75), A
   552     75
   553     24    JR 37
   554     37
16 604     32    JR NZ 22
   605     22
   606     62    LD A, 118
   607    118
   608    205    CALL (2129)   (NOP)
   609     81                  (NOP)
   610      8                  (NOP)
   611     62    LD A, 5
   612      5
   613    211    OUT (75), A
   614     75
   615     62    LD A, 8
   616      8
   617    211    OUT (75), A
   618     75
   619     24    JR 212
   620    212

                 ASCII LISTING

16 533     32    JR NZ 14
   534     14
   535     62    LD A, 5
   536      5
   537    211    OUT (75), A
   538     75
   539     62    LD A, 232
   540    232
   541    211    OUT (75), A
   542     75
   543     24    JR 35
   544     35
16 592     32    JR NZ 14
   593     14
   594     62    LD A, 5
   595      5
   596    211    OUT (75), A
   597     75
   598     62    LD A, 104
   599    104
   600    211    OUT (75), A
   601     75
   602     24    JR 217
   603    217

TABLE 1: Z80A SIO/0 PIN FUNCTIONS

PIN FUNCTION                     PIN FUNCTION
 1. DATA 1                       21. RESET
 2. DATA 3                       22. DATA CARRIER DETECT (B)
 3. DATA 5                       23. CLEAR TO SEND (B)
 4. DATA 7                       24. REQUEST TO SEND (B)
 5. INTERRUPT CPU                25. DATA TERMINAL READY (B)
 6. INT. ENABLE IN               26. TRANSMIT DATA (B)
    (DAISY CHAIN)                27. TRANSMIT & RECEIVE
 7. INT. ENABLE OUT                  DATA CLOCK (B)
    (DAISY CHAIN)                28. RECEIVE DATA (B)
 8. M1 FROM CPU                  29. EXT. SYNCH (B)
 9. Vcc (+5 VDC)                 30. WAIT/READY (B)
10. WAIT/READY (A)               31. GROUND
11. EXT. SYNCH (A)               32. RD FROM CPU
12. RECEIVE DATA (A)             33. COMMAND/DATA SELECT
13. RECEIVE DATA CLOCK (A)       34. CHANNEL SELECT (A/B)
14. TRANSMIT DATA CLOCK (A)      35. CHIP ENABLE
15. TRANSMIT DATA (A)            36. IORQ FROM CPU
16. DATA TERMINAL READY (A)      37. DATA 6
17. REQUEST TO SEND (A)          38. DATA 4
18. CLEAR TO SEND (A)            39. DATA 2
19. DATA CARRIER DETECT (A)      40. DATA 0
20. CPU CLOCK

/1 version: 25 is TRANSMIT DATA (B); 26 is TRANSMIT
            DATA CLOCK (B); 27 is RECEIVE DATA CLOCK (B);
            DATA TERMINAL READY (B) is not available.
/2 version: 27 is TRANSMIT DATA CLOCK (B); 28 is RE-
            CEIVE DATA CLOCK (B); 29 is RECEIVE DATA (B);
            EXT. SYNCH (B) is not available.
/9 version: single channel only (A); pins 22 through
            30 must be left unconnected.

QEX September 1984