Writing machine code software is something that cannot be accomplished easily overnight. For quite some time, I have been writing a bulletin board program for the TS-1000. This means first of all, I have to find out how the MODEM works. Since ANCHOR AUTOMATION (the manufacturers of the TS2050) and Westrige would not provide any help, I could not begin to write this program for that MODEM. BYTE-BACK provided a complete source code for their software which included the information needed to input and output data.
The BYTE BACK MODEM doesn’t use the Z-80 in/out ports (and I don’t understand why), but instead uses logic gates that activate the 8251 USART, used to send and receive data. The 8251 is the heart of this MODEM. This chip catches the data from the data bus, serializes it and inserts the appropriate start/stop bits, parity, etc. If you aren’t familiar with how MODEMs work, that alright. Just remember it has an input side to get the data, a clock to determine its transmission speed, a serial output of the tones necessary for decoding at the other end. But more than anything, the 8251 USART can send and receive at the same time.
Before using the USART, it must be initialized. This process merely informs the chip what parameters you want. This is where knowing the command ‘format’ comes in. The data you put on the data bus for setting parameters looks like this:
BIT 7 0 0 1 1 BIT 6 0 1 0 1 / number of stop bits BIT 5 0 1 0 1 -- PARITY BIT 4 0 1 0 1 -- PARITY ENABLE BIT 3 0 0 1 1 BIT 2 0 1 0 1 / CHARACTER LENGTH BIT 1 0 0 1 1 BIT 0 0 1 0 1 / BAUD RATE
NUMBER OF STOP BITS:


Each bit of our 8 bit bus has been defined so you can select your own parameters. The Byte Back MODEM operates at 250 baud, which is 1/16th of the clock speed. Data bits 1 and 0 will have to be 1 and 0 respectfully. With 7 bit words, bit 3 and 2 are 1 and 0, respectfully. Likewise, setting to even parity would be 1 and 1 for bits 5 and 4. Lastly, for 1 stop bit, bits 7 and 6 would be 0 and 1. Now, for 7 bit words, 1 stop bit, even parity, 250 baud, our data byte would be:
0 1 1 1 1 0 1 0 binary value
1 2 2 decimal
The Byte Back uses address 16383 for status, thus you can POKE 16383,122 to set your parameters. Before doing this, establish a USART reset by POKE 16383,64. This is the order in which the chip operates, RESET, then COMMAND. Afterwards POKE 16383,22 to recondition the 8251 error flags and enables. At this point, you can send or receive data via address 16382. This is the ‘data’ address with the BYTE BACK (this MODEM only uses 16382 and 16383).
How do you know if a character has been received, or if the 8251 is ready to transmit? After a RESET and COMMAND, address 16383 will provide a status. You can find out the communication status by knowing the bits for this mode:
BIT 1 READY TO TRANSMIT WHEN 1 (HIGH) BIT 2 CHARACTER RECEIVED WHEN 1 (HIGH)
In BASIC you cannot check these bits easily, so, maybe you would prefer a machine code routine to do this.
LD A, (16383) 58 | LD A, (16383) 58
255 | 255
63 | 63
AND 1 230 | AND 2 230
1 | 2
JR Z,-7 40 | JR Z -7 40
249 | 249
RET 201 | RET 201
wait until ready | wait for a received
to transmit | character
In machine code, ANDing has the same effect as a typical logic gate where you AND logic 1 with a bit.

ANDing bit 1 will produce a high on the output only when the bit is high (logic 1). In this manner, we can test individual bits of an entire byte.
Let’s say the routine to wait for a received character began at 16514. And let’s say you were talking directly with another TIMEX MODEM and needed no ASCII conversion. That is, A TS-1000 with a BYTE BACK MODEM IN ORIGINATE, and the host TS-1000 with a a BYTE BACK IN ANSWER mode. You could communicate directly with a simple program:
5 RAND USR 16514
10 PRINT CHR$ PEEK 16382
15 GOTO 5
Here the host would wait for a new received character. When one is received, it gets printed onto the screen.
The originate computer’s program may have the “wait until ready” machine code at address 16525. His program would go something like this:
5 IF INKEY$=""THEN GOTO 5
10 LET A$=INKEY$
15 RAND USR 16525
20 POKE 16382, CODE A$
Those of you keeping up with me may already be thinking of upload/download through BASIC. I suppose you could move RAMTOP down, download a program in this fashion above RAMTOP. But, I’m not sure how to recover it without losing the stackpointer, variables, screen, etc. It would be tricky, but you could try. TO SEND the entire program you could have a program like this:
5 LET A=PEEK 16404+256*PEEK 16405
10 FOR N=16509 TOA
15 RAND USR 16525
20 POKE 16382, PEEK N
25 NEXT N
Very simply, this would send all data in the BASIC area of RAM to the host. I have not tried these routines in BASIC, but have connected the TS-2068 and TS-2050 directly to the TS-1000 and BYTE BACK MODEM with successful transfer of data. The MODEM works at 250 baud and there is no reason one could not develop communication software in BASIC. Clever programmers might try experimenting.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.