MediaWiki:Sitenotice:
2024-03-02: The wiki ran out of disk space, so things were not working. This has been resolved by adding another 5GB of quota ;-) Thanks to Tim Lindner for reporting the issues.
2020-05-17: If a page gives you an error about some revision not being found, just EDIT the page and the old page should appear in the editor. If it does, just SAVE that and the page should be restored. OS-9 Al (talk) 12:22, 17 May 2020 (CDT)
Undercolor/840102/Cross Talk
Home Articles Companies Publications Hardware People Software Timeline ... Emulators Internet Resources
(Don't see something listed? Click "edit" and add it! Together we can build this database. When making a new info page, refer to this InfoBox Template for guidelines.)
UnderColor, Volume 1, Number 2, December 25, 1984
- Title: Cross Talk
- Author: William Barden, Jr.
- Synopsis: RS232 revealed.
- Page Scans: Link
Article
I'm up to my ears in computers! I mean it- I have more computers than I want. I have Radio Shack Models I, II, III, IV, three Color Computers, two MC—10s, an IBM PC and PCjr, a Sanyo MBC-550, a Commodore VIC—2O and 64, and Timex/Sinclair TS2068s, TS1500s, and TS1000s, not to mention several other vintage systems. Do you know what most of these systems have in common? No, not MicroSoft Basic. Guess again. No, not the microprocessor. I'm sorry, your time is up... let's see what's behind curtain number three...
Most computer systems I own have RS-232C ports! RS- 232C ports are a standard way to let a computer talk to the outside world — other computer systems, line printers, plotters, modems, and other kinds of peripheral equipment and devices.
The Color Computer uses its RS—232C port to connect to printers, modems, and other devices. In this article we'll look at how you can use this port so your Color Computer can communicate with other devices. And we'll bypass the ROM software so we're removed from its constraints.
RS-232C? An RS-232C interface is a standard way to connect electronic devices. The standard defines both the electronic and physical aspects of the connection. One of the nicest things about an RS-232C interface is that devices such as computers and computer equipment can be connected over fairly long distances, say, thousands of feet, and still transfer data without errors.
RS-232C is often called serial communication, and devices that use RS-232C are called serial devices. This is so because data is transferred as a string of bits (rather than all bits in parallel as a byte) in RS-232C communication.
The RS-232C standard defines the format of the serial data, which looks like Figure 1. A byte of data is converted to a string of eight bits with a leading start bit and a trailing stop bit or bits.
In the example in Figure 1, the eight-bit byte has been changed into a ten-bit stream of bits, with the eight data bits in the middle of the stream. The ten bit times are all the same length, so the total time will always be the same.
How are the bits sent? The easiest way is to transmit over two wires. Imagine a switch and battery at location A and a buzzer at location B, as shown in Figure 2. You're at location A, and you want to signal a Radio Shack store A manager at location B. By prearrangement, the switch is closed and the buzzer sounds continuously. When you
want to start transmission, you'll open the switch for one second. As soon as the store manager hears the buzzer stop, he will start counting seconds, using a Realistic 101 Timer. By prearrangement he knows that each bit time
will be one second so that it'll take ten seconds to receive the entire ten bits. As soon as he detects the silent period, he'll wait 1.5 seconds, putting him in the middle of the second bit time. He’ll then note whether the buzzer is on or off, recording a one if the buzzer is on, and a zero if it isn't.
The manager will then wait another second; he will be in the middle of the third bit time allotment. He'll again record one or zero, depending on whether the buzzer is sounding. He'll do this for eight data bits. At the end of the eight bits (nine elapsed seconds), you'll send a continuous buzz for one second, and then leave the switch set so that the buzzer continues to sound.
The Radio Shack store manager will now take the eight data bits and arrange them as an eight-bit byte, placing the first bit received as the least significant. Looking up the byte in a table of ASCII characters, he’ll convert the eight-bit value into a text character.
The process can be repeated for as many characters as you'd like to send. Each character will take ten seconds — one start bit of zero (no buzzer), eight data bits (buzz or no buzz), and one stop bit (buzz). The time in-between characters could be zero seconds, if you're sending along message, or it might be minutes or hours, if you don’t have any more text to send. The silent start bit (no buzz) alerts the manager that data is coming.
The process of passing data over these two wires is exactly analogous to RS-232C asynchronous communication. There may be varying times between characters, but once the start bit comes in, the receiving end counts time to get to the middle of each bit time, being as precise as possible about the timing.
RS-232C communication works in the same fashion, except that timing is much more rapid. Instead of one second for each bit time, there's only thousandths of a second for the bit times: from about 100 to 9600 bits or
more can be sent each second.
TWO WAY TRANSMISSION. If you want to be able to signal the Radio Shack store manager, and also to receive data from him, you could just add another wire to the two wires you're using to make a three—wire system
instead of two (Figure 3). You'd now have two buzzers, one at each end, and two sets of switches and batteries. The "common" wire would be the so-called ground wire. You could actually signal each other at the same time, except that it might be confusing.
The first system (the ability to send data in one direction only) is called simplex. The second system (the ability to send data in both directions) is called duplex. If the Radio Shack store manager and you are easily confused and can't receive while the other is transmitting, the duplex operation is called half duplex- transmission can only be performed in one direction at a time. If you both are very coordinated, the operation is called full duplex — you can both send and receive data simultaneously.
MORE CHARACTERISTICS. A number of different formats are used in RS-232C. We’ve been talking about ten bits. Often, though, one start bit, seven data bits, and two stop bits are used. Here again, there are ten total bits, but only seven data bits. This format is often used for ASCII, or character data, as ASCII codes use only seven bits to represent the alphabet, digits, or special characters.
Other formats might use as few as five data bits. The most frequently used format in computers, though, is one start bit of zero, seven or eight data bits, and one or two stop bits of one.
Another bit is sometimes thrown in as well. A parity bit is occasionally used to check on the data. The parity bit is the last data bit sent, and is set to a one or zero to make the total number of one bits in the data even or odd. We won't be using a parity bit in the cases we're talking about. No parity is often used in communications systems because there are other data checks. One frequently-used check is to send out a character and then have the receiving sytem echo back the same character, so the sending system can compare the character received with the one sent. This system is often used in full duplex systems, where you press a key to send a character without displaying the character on the screen. The receiving system sends back the character received which is displayed on the screen. The process is so rapid that it appears you typed the character and it was simultaneously displayed on the screen; it actually came from the other terminal!
The RS-232C standard uses a number of different data rates expressed as bauds. A baud is a unit of information transmission speed which is not necessarily equal to bits per second. Bauds commonly used on the Color Computer and other systems are 300, 600, 1200, and 2400 baud. In 300 baud transmission, there are ten bit times per character or byte, so that 30 characters per second can be sent. In 600 baud, 60 characters per second can be sent. In 1200 and 2400 baud, 120 and 240 characters or bytes per second can be sent.
To find the length of a bit time, divide one by the baud. A baud of 600, for example, has a bit time of 1/600, or 1.666 milliseconds (thousandths of a second). The total length for ten bits is 16.66 milliseconds.
MORE SIGNALS. We discussed a three-wire system earlier. One wire is ground, or common. Two other wires transmit data from one end of the system to the other. On one end, one wire is called TD for transmit data and the other wire is called RD for receive data. On the other end, the names and connections are reversed.
There are many other signals present in RS-232C systems, however. Many are necessary for modem use. Modems are devices that take serial data and change it into audio tones so that data can be transmitted over telephone lines. One signal commonly used is CD, or Carrier Detect. This signal indicates to the computer that the modem is receiving the carrier tone of the sending device. In fact, this carrier is actually the stop condition of the TD line, the continuous buzzing in our earlier example. Another signal is RTS, or Request To Send. This signals the other end of the RS-232C connection that data is ready for transmission. CTS, or Clear To Send, informs the computer that it is all right to start transmission.
There are 22 signals in the RS-232C specification, representing various conditions and states. The 22 signals are connected via a 25-pin connector called a DB-25 connector, shown in Figure 4. The DB-25 connector can be seen on modems and other serial devices, and is used on the Radio Shack Model I, II, III, IV, Model 100, and other computer systems. The Color Computer, however, doesn't
use a 25-pin connector. It uses a four-pin DIN connector, shown in Figure 5.
Though the complete set of RS-232C signals are useful, the most important of the signals are still ground, TD, and RD. The Color Computer RS-232C throws in CD for modem applications.
Using these four signals it's possible to connect to a modem, transfer data to a serial printer, or connect to another computer system.
HOW OURS DIFFERS. The connector used on the Color Computer isn't the only difference between the Color Computer and other computer system RS-232C interfaces. The biggest difference is that the Color Computer RS-232C signaling is accomplished primarily by software, rather than hardware, as on other systems.
Systems such as the Radio Shack Model IV have built-in hardware that handles the task of reading in the serial bit stream and converting it to a parallel byte, or sending out data after conversion from a parallel byte. This operation goes on independently from other operations in the system. About all a program must do is write a byte to be transmitted to the RS-232C hardware, or read in a received byte.
In the Color Computer a program must convert parallel bytes to serial bit streams, add start and stop bits, and then send the bit streams out over the TD line, or, alternately, read the RD line, strip off the start and stop bits, and assemble the received byte.
HOW RS-232C WORKS. It's important to know how the Color Computer hardware implements RS-232C communications so you can use the hardware in your own data communications applications. If you’re not a hardware type, please bear with me: I'll make it as painless as possible.
The Color Computer has a number of devices called PIAs, Peripheral Interface Adapters. You can envisage the PIAs as memory locations; they are addressed in the same manner as other memory locations in the Color Computer. The addresses of the PIAs, however, are in the $FFXX area of the memory map of the Color Computer. There are PIAs to control sound, cassette I/O, read the key board, and other operations.
PIAs are unlike memory locations in that each bit of the PIAs is a signal line routed to various Color Computer functions. Once that bit in the PIA is set it remains set until new data is stored in the PIA. Alternately, a PIA bit might be an input bit that comes from a signal line. The on/off condition of the signal line can be determined by reading the PIA location; In digital engineering terms, the PIAs are latches that read and store binary data routed to or from signal lines.
Two PIA addresses handle RS-232C data. The PIA addressed by address value $FF22 holds the current state of the RD line in bit seven (the most significant bit). Whenever you PEEK at location $FF22, bit seven represents the zero or one state of the RD line. By properly timing the PIA reading, you can position the read in the middle of the bit time and decode incoming RS-232C data.
The PIA addressed by address value $FF20 controls the TD line. Putting a one bit into bit one of that PIA address using a POKE or other means will output a one bit on the TD line. The one bit will stay there until a new output to the PIA arrives. By properly timing the output to PIA $FF20, you can create an RS-232C stream of TD bits.
A third bit is used to read the state of the CD line from the Color Computer RS-232C connector. This PIA works somewhat differently than the other PIA lines, as it controls an interrupt input. We won’t talk about this bit, as we can do most everything we want with the RD, TD, and ground lines.
This is probably a good time to mention that actual signal levels found on the DIN connector for RS-232C signals are not what you would expect. Outputting a one bit on the TD line, for example, actually results in a -12 Vdc level. Outputting a zero bit results in a +12 Vdc level. This is compatible with the RS-232C specification. Be aware of this fact if you will be measuring signal levels with a voltmeter or oscilloscope. (Editor's Note: The Color Computer 2 does not have + or -12 volts available from its power supply, so it uses + and -5 volts on its RS-232C data lines. This works quite well over the usual—room sized—distances between computer and printer or modem.)
RS-232C AND BASIC. Unfortunately, RS-232C and Basic are not very compatible! The reason is speed — Basic is simply too slow to keep up with the speed of RS-232C data. Consider the 600 baud used for LLISTing Basic programs, for example. We said earlier that 600 baud was about 1.666 milliseconds per bit time. That represents 600 possible changes per second. A Basic loop such as:
100 FOR I=1 TO 6000
110 NEXT I
takes a little under nine seconds, or about 666 counts per second. If more processing is added, it’s obvious that Basic can't keep up with 600 baud.
To do anything with the Color Computer RS-232C, then, we're forced to use assembly language. You won’t have to actually do anything in assembly language, however. I've done all the hard work, and you can reap the benefits! For the sake of you assembly language buffs, however, I'll explain what's happening in the program I’ve prepared. Also, you'll need to know the general way the program works to be able to use it from Basic.
THE PROGRAM. The RS-232C program (Listing 1) consists of two parts, an output character part and an input character part. The output character portion will send out a single byte over the TD line to another computer system or serial device, such as a printer. The input character portion will read in from one to many bytes from the RD line and store the received bytes in a specified memory area. The input character portion will end when a specified number of bytes have been received or when a key is pressed on the Color Computer keyboard.
Both routines will work at bauds of 300, 600, 1200, or 2400. I regularly use 2400 baud in my computer room to transfer data between the Color Computer and my Model III, and I experience virtually no errors. You should be able to use 2400 bauds over moderately long distances (a few hundred feet) without problems.
Any number of data bits can be used with the program, in addition to any number of stop bits. There is no parity bit provision, so you'll have to verify the data with a checksum or other means.
Both programs use a common parameter block to define the speed and parameters of the RS-232C transmission, as shown in Figure 6. Location $3F00 (16128) holds the number of data bits. Location $3F01 (16129) holds the number of stop bits. Location $3F02 holds the baud in encoded form. Location $3F03 (16130) holds the character to be transmitted or the last character received. Locations $3F04,5 (16132, 16133) hold the starting memory address for storage of received data and locations $3F06,7 (16134, 16135) hold the ending address for received data.
To use the output character routine, POKE the number of data bits, the number of stop bits and the baud (0=300, 1= 600, 2 = 1200, and 3 =2400) into the proper locations. You need only do this once. Then POKE the character to be transmitted into location $3F03 and call location $3F18 (16132) with a USR call. After the character has been transmitted the USR function will return to the Basic program.
To use the input character routine, set up the same parameters (or use the existing parameters) except for the baud. The baud codes are 4 - 7 for bauds of 300, 600, 1200, and 2400. POKE the starting and ending addresses of the data block to be used as a buffer. You may use the text screen addresses of $400 (4,0) and $5FF (5,255) if you want the data to appear on the screen as it's received. Then call location $3F43 (16195) with a USR call. You'll return after the last memory location has been filled or when you press any key on the keyboard.
SAMPLE BASIC DRIVER. Program Listing 2 is a sample Basic driver program that lets you use your Color Computer as a dumb terminal. The first portion of this program is the machine code of the assembly language program as data values. Regardless of your Basic code, use statements 110 through 260 to move the code to the $3F00 area. If you have a Color Computer with Extended Basic, use the program as is. If you do not have Extended Color Basic, change the four lines as shown in the listing.
Next month — applications!
Listings
PROGRAM LISTING 1 RS-232C Assembly Language Program 16K Extended Color Basic 3F00 00100 ORG $3F00 00110 * RS-232-C OUTPUT CHARACTER 3F00 07 00120 NOBITS FCB ; 7 #DATA BITS 3F01 02 00130 NOSTOP FCB ; 2 #STOP BITS 00140 * XMIT BAUD RATE: 0=300 1=600 2=1200 3=2400 00150 * RCV BAUD RATE ; 4=300 5=600 6=1200 7=2400 3F02 00 00160 BAUDR FCB 0 ; BAUD RATE 3F03 00 00170 CHAR FCB 0 ; IN OR OUT CHAR 3F04 3F03 00180 MEMS FDB CHAR ; MEMORY START 3F06 3F03 00190 MEME FDB CHAR ; MEMORY END 3F08 016E 00200 BAUDTB FDB 366 ; 300 BAUD TRANSMIT 3F0A 0080 00210 FDB 176 ; 600 3F0C 0050 00220 FDB 80 ; 1200 3F0E 0020 00230 FDB 32 ; 2400 3F10 015A 00240 FDB 346 ; 300 BAUD RECEIVE 3F12 0080 00250 FDB 176 ; 600 3F14 0050 00260 FDB 80 ; 1200 3F16 001E 00270 FDB 30 ; 2400 3F18 1A 50 00280 RSOUT ORCC #$50 ; RESET FIRQ, IRQ 3F1A B6 3F03 00290 LDA CHAR ; GET CHARACTER 3F1D F6 3F00 00300 LDB NOBITS ; GET # DATA BITS 3F20 49 00310 ROLA ; ALIGN FOR OUTPUT 3F21 34 03 00320 PSHS A,CC ; SAVE CHARACTER 3F23 4F 00330 CLRA ; 0 BIT IN BIT POSITION 1 3F24 8D 17 00340 BSR OUTPUT ; OUTPUT BIT POSITION 1 3F26 35 03 00350 PULS A,CC ; RESTORE CHARACTER 3F28 34 03 00360 LOOP1 PSHS A,CC ; SAVE CHARACTER 3F2A 8D 11 00370 BSR OUTPUT ; OUTPUT AND DELAY 3F2C 35 03 00380 PULS A,CC ; RESTORE CHARACTER 3F2E 46 00390 RORA ; ALIGN NEXT BIT 3F2F 5A 00400 DECB ; DECREMENT # OF BITS 3F30 26 F6 00410 BNE LOOP1 ; LOOP IF NOT DONE 3F32 F6 3F01 00420 LDB NOSTOP ; GET 3 OF STOP BITS 3F35 86 02 00430 LOOP2 LDA I2 ; 1 BIT=STOP 3F37 8D 04 00440 BSR OUTPUT ; OUTPUT STOP BIT 3F39 5A 00450 DECB ; DECREMENT # OF STOP BITS 3F3A 26 F9 00460 BNE LOOP2 ; GO IF NOT DONE 3F3C 39 00470 RTS ; RETURN 00480 * OUTPUT SUBROUTINE 3F3D B7 FF20 00490 OUTPUT STA SFF20 ; OUTPUT BIT POSITION 1 3F40 8D 58 00500 BSR DELAY ; DELAY ONE BIT TIME 3F42 39 00510 RTS 00520 * RS-232-C INPUT CHARACTER 3F43 1A 50 00530 RSIN ORCC #$50 ; RESET FIRO, IRQ 3F45 10BE 3F04 00540 LOOP9 LDY MEMS ; INITIALIZE BUFFER START 3F49 F6 3F00 00550 LOOP11 LDB NOBITS ; GET 4 DATA BITS 3F4C 8D 3F 00560 LOOP11 BSR INPUT ; GET INPUT BIT 3F4E 81 80 00570 CMPA 4580 ; TEST MS BIT 3F50 25 0C 00580 BLO LOOP15 ; GO IF 0 3F52 4F 00590 CLRA ; FOR KEYBOARD 3F53 B7 FF02 00600 STA $FF02 ; OUTPUT TO KB 3F56 B6 FF00 00610 LDA $FF00 ; READ ALL ROWS 3F59 43 00620 COMA ; KEYPRESS=1 3F5A 26 30 00630 BNE LOOP50 ; GO IF KEYPRESS 3F5C 20 EE 00640 BRA LOOP11 ; CONTINUE INPUT IF NOT 3F5E 8D 41 00650 LOOP15 BSR DELAYH ; HALF BIT DELAY 3F60 8D 38 00660 BSR DELAY ; TOTAL= 1 1/2 BIT TIMES 3F62 4F 00670 CLRA ; INITIALIZE CHAR 3P63 8D 28 00680 LOOP21 BSR INPUT ; GET INPUT BIT 3F65 8D 33 00690 BSR DELAY ; DELAY BIT TIME 3F67 5A 00700 DECB ; DECREMENT COUNT 3F68 26 F9 00710 BNE LOOP21 ; GO IF NOT ALL BITS 3F6A C6 08 00720 LDB 48 ; FINAGLE 3F6C F0 3F00 00730 SUBB NOBITS ; FIND BITS TO SHIFT 3F6F 27 04 00740 BEO LOOP25 ; GO IF NONE TO SHIFT 3F7l 44 00750 LOOP24 LSRA ; ALIGN TO RIGHT 3F72 5A 00760 DECB ; DECREMENT COUNT 3F73 26 FC 00770 BNE LOOP24 ; CONTINUE 3F75 F6 3F01 00780 LOOP25 LDB NOSTOP ; GET O STOP BITS 3F78 8D 20 00790 LOOP31 BSR DELAY ; DELAY ONE BIT TIME 3F7A 5A 00800 DECB ; DECREMENT 4 OF STOP BITS 3F7B 26 FB 00810 BNE LOOP31 ; GO IF NOT DONE 3F7D B7 3F03 00820 STA CHAR ; STORE CHARACTER 3F80 A7 A4 00830 STA ,Y ; STORE IN MEMORY PROGRAM LISTING 1 (CONT.) 3F82 10BC 3F06 00840 CMPY MEME : COMPARE TO END 3F86 27 04 00850 BEQ LOOP50 ; GO IF AT END 3F88 31 21 00860 LEAY 1,Y : BUMP POINTER 3F8A 20 BD 00870 BRA LOOP10 ; CONTINUE 3F8C 39 00880 LOOP50 RTS ; RETURN TO CALLING 3F8D 44 00890 INPUT LSRA : ALIGN A 3FBE 34 02 00900 PSHS A ; SAVE IN STACK 3F90 B6 FF22 00910 LDA $PP22 : GET RS-232C DATA INPUT 3F93 46 00920 RORA : ALIGN TO BIT 7 3F94 46 00930 RORA 3F95 84 80 00940 ANDA #$80 ; MASK OUT REST 3F97 AA E0 00950 ORA ,S+ ; MERGE IN REMAINDER OP CHAF 3F99 39 00960 RTS 3F9A 8D 0C 00970 DELAY BSR GETCNT : GET DELAY COUNT 3F9C 30 1F 00980 LOOP41 LEAX -1,X ; DECREMENT DELAY COUNT 3F9E 26 FC 00990 BNE LOOP41 ; GO IF NOT DONE 3FA0 39 01000 RTS ; RETURN 3FA1 8D 05 01010 DELAYH BSR GETCNT ; GET DELAY COUNT 3FA3 30 1E 01020 LOOP51 LEAX -2,X : DECREMENT 3FA5 26 FC 01030 BNE LOOP51 ; GO IF NOT DONE 3FA7 39 01040 RTS ; RETURN 3FA8 34 06 01050 GETCNT PSHS D : SAVE A,B 3FAA B6 3F02 01060 LDA BAUDR : GET BAUD RATE 3FAD C6 02 01070 LDB #2 3FAF 3D 01080 MUL : D NOW 2 TIMES INDEX 3FB0 C3 3F08 01090 ADDD #BAUDTB ; POINT TO DELAY COUNT 3FB3 1F 01 01100 TFR D,X : DELAY COUNT NOW IN X 3FB5 AE 84 01110 LDX ,X ; GET ACTUAL COUNT 3FB7 35 06 01120 PULS D ; RESTORE A,B 3FB9 39 01130 RTS 0000 01140 END 00000 TOTAL ERRORS BAUDR 3F02 LOOP11 3F4C LOOP51 3FA3 BAUDTB 3F08 LOOP15 3FSE L00P9 3F45 CHAR 3F03 LOOP2 3F35 MEME 3F06 DELAY 3F9A LOOP21 3F63 MEMS 3F04 DELAYH 3FA1 LOOP24 3F71 NOBITS 3F00 GETCNT 3FA8 LOOP25 3F75 NOSTOP 3F01 INPUT 3F8D LOOP31 3F78 OUTPUT 3F3D LOOP1 3F28 LOOP41 3F9C RSIN 3F43 LOOP10 3F49 LOOP50 3F8C RSOUT 3F18 PROGRAM LISTING 2 BASIC DRIVER 16K Extended Color Basic 100 REM TERMINAL PROGRAM 110 CLEAR 100,16127 120 DATA 7,2,0,0,63,3,63,3,1,110,0,176,0,80,0,32 130 DATA 1,90,0,176,0,80,0,30,26,80,182,63,3,246,63,0 140 DATA 73,52,3,79,141,23,53,3,52,3,141,17,53,3,70,90 150 DATA 38,246,246,63,1,134,2,141,4,90,38,249,57,183,255,32 160 DATA 141,88,57,26,80,16,190,63,4,246,63,0,141,63,129,128 170 DATA 37,12,79,183,255,2,182,255,0,67,38,48,32,238,141,65 180 DATA 141,56,79,141,40,141,51,90,38,249,198,8,240,63,0,39 190 DATA 4,68,90,38,252,246,63,1,141,32,90,38,251,183,63,3 200 DATA 167,164,16,188,63,6,39,4,49,33,32,189,57,68,52,2 210 DATA 182,255,34,70,70,132,128,170,224,57,141,12,48,31,38,252 220 DATA 57,141,5,48,30,38,252,57,52,6,182,63,2,198,2,61 230 DATA 195,63,8,31,1,174,132,53,6,57,15308 240 CK=0:FOR I = 16128 TO 16313 250 READ A: POKE I, A: CK=CK+A 260 NEXT I: READ A: IF CK<>A THEN PRINT " DATA INCORRECT, PLEASE CHECK": STOP 270 POKE 16132,4: POKE 16133,0 280 POKE 16134,5: POKE 16135,255 290 POKE 16130,4 300 DEFUSR0 = 16195 'POKE 275,63: POKE 276,67 in Standard BASIC 310 A = USR0(0) 'A = USR(0) in Standard BASIC 320 A$ = INKEY$: IF A$ = "" THEN 320 330 PRINT AS$ 340 POKE 16131, ASC(A$) 350 POKE 16130, 0 360 DEFUSR0 = 16152 'POKE 275,63: POKE 276,24 in Standard BASIC 370 A = USR0(0) 'A = USR(0) in Standard BASIC 380 GOTO 290