Thomas E. Doyle 5222 Big Bow Road Madison Wl 53711

5 Minutes or 5 Hours?

sorting techniques compared

n an attempt to help justify from this electronic marvel. Ithe purchase of a floppy-disk Nothing happened. Time Required to Sort N Items (seconds) system, I decided to put the Taking advantage of the N Ripple Modified Bubble S-M to some practical pause and the presence of a use. It seems that not everyone captive audience, I discussed 50 61 43 33 9 considers piloting the Enter- the advantages of adding a 100 245 173 130 21 prise and destroying Klingons disk to the wonderful com- 150 552 390 290 36 as a useful function worthy of puter. At the end of my rather 300 - 1224 85 another kilobuck investment. lengthy discussion there was Number of Swaps of Entries Using the system to keep track still nothing on the printer. As of household expenses seemed time wore on, I began to con- N Ripple Modified Bubble S-M to be a good place to start. The sider the possibilities: hard- 50 1225 1225 1225 105 Do-AII program by Randy Miller ware problems, software prob- 100 4950 4950 4950 260 {Kilobaud, August 1977) provid- lems or simply another exam- 150 11175 11175 11175 425 ed an ideal program. ple of Murphy's Law. I felt there 300 44850 1000 After the program was load- must be something wrong. Number of Entry Comparisons ed, a list of about a hundred After all, the Enterprise could items was entered for my move across the entire galaxy N Ripple Modified Bubble S-M demonstration of the practical in only seconds, so alphabetiz- 50 2450 1225 1225 263 advantages of a home com- ing this list could not take that 100 9900 4950 4950 668 puter. Everyone gathered for long. Trying to remain cool, I 150 22350 11175 11175 1187 the show, and the program was suggested that we leave the 300 44850 2812 - run. A command was given to computer and come back when sort the list of data alphabeti- it was done. Table 1. cally. Everyone stared at the Much to my suprise, thirty printer waiting for the output minutes later the sorting was 5 REM --- RIPPLE SORT --- 5 REM --- MODIFIED RIPPLE SORT 6 REM --- SET UP ARRAY --- 6 REM SET UP ARRAY —- 10 Nil 50 10 Nil 50 20 DIM D(N) 20 DIM D(N) 50 30 JiN A0 FOR 1:1 TO N 40 FOR 1:1 TO N 50 D(I)ij 50 D(I) 60 :J-1 60 J=J-1 70 NEXT 70 NEXT 80 PRINT "*" 80 PRINT "*" 90 REM --- START OF SORT --- 90 REM START OF SORT 100 M:N 100 M:N 105 Cr0 110 C:0 110 FOR Irl TO M-1 112 M:M-1 120 CMrCM+1 11 5 IF M:0 THEN 300 130 IF D(I)

Program B. complete. The printout re- are shown in Table 1. The vealed that the list had been results of this test revealed two 5 REM BIBBLE SORT --- sorted exactly as requested. things: The bubble sort was a 6 REM SET UP ARRAY --- What could have caused the little faster than the others, and 10 N:150 delay? Perhaps my 8080 v\/as sorting takes a lot of time. Sort- 20 DIM DCN) slow. The benchmark programs ing a simple table of 100 30 J:N 40 FOR 1:1 TO N in the basic timing com- numbers took almost three 50 D( I) :J parisons article {Kilobaud, minutes. No wonder the Do-AII 60 J:J-1 June 1977) were run and re- program took so long. 70 NEXT vealed that my computer ran a None of the common sorting 80 PRINT "*" little faster than the one used methods described in Mr. 90 REM --- START OF SORT --- for the article. Rerko's article would speed up 130 M:N Since the program ran prop- a sorting program significantly. 110 FOR 1:1 TO M-1 erly and the computer was up The solution to the problem, if 120 FOR J:I + 1 TO M to speed, the solution to the any, would lie in an uncommon 125 CM:CM+1 130 problem must be in the sorting sorting routine. An article by IF D(I)<:D(J) THEN 170 135 SW:SW+1 technique used in the program. John P. Grillo (Creative Com- 1 40 T:D(I):D(I):D(J): D(J):T An article on sorting routines puting, November 1976) dis- 170 NEXT J by Andrew J. Rerko (Kilobaud, cusses a technique called the 180 NEXT I April 1977) was consulted and Shell-Metzner Sort. This 300 REM --- PRI NT RESULTS --- some test programs (Programs method offered significant 310 PRI NT "SWI TCHES :" ;SW A, B and C) were run using the speed advantages when sort- 320 PRI NT " COMPARISONS :" ;C M Ripple, Modified Ripple and ing large amounts of data. A 330 PRI NT "SIZE -" ; N Bubble routines described in flowchart of the Shell-Metzner OK the article. Sort is shown in Fig. I.The arti- The test programs consisted cle stated that a projected sort Program C. of setting up an array of N of 10,000,000 items would take numbers in reverse order and 93 years using a bubble sort. using each of the sorting Using the S-M technique, sort- routines to sort them. The pro- ing the same data would re- quire only 2.5 days. But would it gram execution times as well gram was run using the S-M eight times faster than the bub- help when sorting small as number of comparisons and method and is shown in Pro- ble sort and over 15 times faster amounts of data? the number of element switch- gram D. When sorting 150 than a ripple sort. The bubble es were recorded. The results The benchmark sorting pro- items, the S-M sort was over sort required over 20 minutes to sort 300 items. The S-M method only one or two as other sorting 8080 system with a 2 MHz clock required only 85 seconds to methods. Following the exam- and zero wait states. Mits 8K sort the same list. The speed ple benchmark program, it BASIC (Version 3.2) was used. advantage of the S-M sort in- should be possible to use the Variable CM was used to total creases dramatically with the S-M technique in other sorting the number of comparisons be- size of the list, but it seemed to programs. tween table entries. The vari- speed sorts of even small lists. able SW was used to total the The next step was to incor- Notes on Programs number of switches between porate the S-M sort technique All programs were run on an table entries.! into the Do-AII program and try it out. A random list of 100 en- tries was prepared and sorted by the standard program. Al- most 45 minutes were required LIST 4050 to sort this list. The Do-AII pro- gram was then modified to use 4050 MrP the S-M sort. Sorting the same 4055 M:INT(M/2) list of 100 entries now required 4060 IF M:0 THEN 1 1 40 less than nine minutes. To 4065 J:| t :(P-1 ) -M modify the Do-AII program, 4070 l3j remove lines 4050-4115, 4075 L=I+M 4150-4280, 9220-9340 and 4080 IF N( T,I) <:N( T,L) THEN 4105 replace with the new lines 408 5 GOSUB 9210 4090 I:I-M shown in Progam E. 409 5 IF I<1 THEN 4105 The only disadvantage I have 4100 GOTO 407 5 found with the S-M technique 4105 JrJ-H so far is that it does require 41 10 IF J>K THEN 4055 slightly more code, and it uses 41 15 GOTO 4070 Fig. 1. Shell-Metzner Sort. five index variables rather than BR EAK OK LIST 41 50

41 50 MrP 5 REM --- SHELL METZNER SORT 4160 M:INT(n/2) 6 REM --- SET UP ARRAY —- 4170 IF Mr0 THEN 1 1 40 10 N:300 4180 J:1 : K:(P-I ) -M 20 DIM D(N) 4190 I:J 30 J:N 4200 L:I+M 40 FOR 1:1 TO N 4210 IF A$( T,I) <:A$( T, L) THEN 42 60 50 D(I)=J 4220 GOSUB 9210 60 J:J-l 4230 I:I-M 70 NEXT 42 40 IF I<1 THEN 42 60 S0 PRINT 42 50 GOTO 42 00 90 REW START OF SORT 42 60 J:J+1 120 M:N 4270 IF J>K THEN 41 60 • 110 MrINT(M/2) 42 8 0 GOTO 4190 120 IF M:0 THEN 300 BR EAK 130 J:1 : K:N-M OK »1 40 I r J LIST 922 0 • 150 L:I + M 1 55 CMrCM+1 9220 XI :N( 1 ,L) 160 IF D(I)K THEfJ 112 9300 N(1,1):X1 230 GOTO 1 40 9310 N(2,1):X2 •300 REM PRINT RESULTS --- 9320 A$(l ,n :B1 $ 310 PRINT "SWITCHF^ r" :5W 9330 A$(2,I)3B2$ 320 PRINT "COMPARISONS r" ;C M 9340 RETURN 330 PRINT "SIZE ;N BR EAK OK OK

Program D. Program E. MINATURE SOLID STATE COMPUTALKER 202 VIDEO CAMERA KIT FEATURING A . . 100 x 100 BIT SELF SCANNING CHARGED COUPLED DEVICE

THIS UNIQUE UPDATED CAMERA KIT FEATURES THE FAIRCHILD CCD 202C IMAGE SENSOR

® o o : FEATURES AMPLIFIER • Sensitive to infra red as well as visible light • May be used m a vacuum, under water and high altitude COMPUTALKIR sYNTHESIZfR • May be used m a magnetic environment because there is no high voltage • All components mounted on parallel 3H" x 6'/?' single sided boards • Total weight under 1 lb. S-100 BUS t ADVANTAGES CSR 1 • IN THE FUTURE SYNTHESIS-BY-RULE WE WILL SUPPLY A SOFTWARE COMPUTER VIDEO INTERFACE CARD • All clock voltages operate at 6V reguirmg no adjustments • Higher video output signal SPEAK "KAAMPYUTAOLKER' • We supply the power board, so only a 5V 1 Amp power source is needed • The circuitry has been simplified for MODEL CT-1 SYNTHESIZER 395.00 easier assembly • Two level TTL output is supplied for ^^ _ _ CSR1 SOFTWARE SYSTEM 35.00 interfacing

DEMONSTRATION CASSETTE 2.95 We supply all semiconductors, boards, data sheets. $7500 to assemble CALIF RESIDENTS ADD 6% SALES TAX diagrams, resistors, capacitors, and 8MM lens. and lesi-add $2 00 Sorry we do not supply the case, batteries and 5V supply postage & handling

WRITE FOR INFORMATIVE LITERATURE COMPUTALKER CONSULTANTS SOLID STATE SALES P.O. BOX 1951, DEPT. K, SANTA MONICA, CA 90406 •S> V C36 >

PHA8700 KIMSI

Answer For... Student HoU^ist The KIM to S-100 bus Manufacturer Interface/Motherboard I I in • Combines the power o( the 6502 with theflexibility o f 8700Processor: BSOSMPU. Wearfrec-ActiveKeytxwixl". the S-100 bus Micro-Diagnostic?' Extensive documentation. FiillySocketed. • Attaches to any unmodified KIM • Complete interface logic and fully buffered motherboard Piebug Monitor: Relative address calculator. Pointer High-low. in one unit User Subroutines. Back-step key. • On board regulation of power for KIM Cassette Interface: Load & Dump by nie Tape motton • Eight slots of S-100 compatibility for additional RAM. control, Positiveindicatkwti of operatkjn. Video and I/O boards. PROM Programmers. Speech Applkatkxis systems from S90 (lOunit quantity) processors. . . Development systems from $149 (single unit) • Includes all parts, sockets for ICs. one 100 pin connector. and full Assembly/Operating documentation TELL ME MORE I t,, je^ for myselt that the 8700 The Answer. { ) PleftBe send documentation • Kit $125. Assembled $165 and price lists. $10 em;loBed. name: • All units shipped from stock ( ) I doD't need documentation please send price Usts, address: FORETHOUGHT PRODUCTS ( ) Please send FDEE CATALOG. P.O. Box 8066-H city: lip:. Coburg, OR 97401 F8 ElECntONKS KPT.2-1 . 1020 W. Wlltblrl tM. • OklahMna Clli. OK 73116 14091 M3-g626 K Do-lt-Yourself Time-sharing

it's easier than you think

Mike Kop time-sharing on my system. It sharing is because a com- stop what it is doing and jump 3060 Marshall Ave. turns out to be simpler than you puter's input/output (I/O) to another program (often Cincinnati OH 45220 might think. devices are much slower than known as a service routine). In this article, I will attempt the processor. If a terminal is Sometimes it is possible to to explain exactly why one outputting characters at 30 mask off an interrupt. If this would want to set up time- cps, there is sufficient time be- happens, then the interrupt is sharing and how it is done (for tween characters for other ignored (or held pending until an M6800 system). I'll also try to work. Thus, with time-sharing, some later time). hen I first learned to pro- explain some other program- literally two, three or more Let's look briefly at the inter- Wgram I was taught how to ming considerations. times as much work can be ac- rupt mechanisms on the SWTP sign on to a computer system complished than by a single system (which uses MIKBUG). using a teletypewriter, type in a What is Time-sharing? user. There is a line marked IRQ (for program and obtain the results Time-sharing is accom- Most of the reasons given for interrupt request). If this line is at the terminal almost im- plished by switching rapidly be- using time-sharing would also temporarily gounded and the mediately. Other users around tween many users. That means apply to a microcomputer mask bit is a zero, an interrupt me, each working on his own each user is allowed, in turn, a system (perhaps on a smaller will occur. The system will then program, were using similar short duration of central pro- scale). One possible argument jump to the address contained type terminals. It appeared that cessing unit (CPU) or micropro- against its use in microproces- in storage locations $A000 and each user had the entire com- cessing unit (MPU) time. This is sors would be that they're too $A001. One thing about the puter to himself! This amazed called a time slice. For exam- slow. However, for programs M6800 is that and perplexed me. How could a ple, if the time slice were 50 that do a lot of input and output when interrupted it stores computer run all the terminals milliseconds, then each user and use little processor time everything (i.e., the condition and keep track of every- would use the processor for 50 (most games and business- code, B, A, X and program body—all at the same time? I milliseconds. If the switching is type programs fall into this counter registers) on the stack. conceded that the system was fast enough, the computer op- category), I see no reason why This means that little effort is too complex to analyze (or eration from each user's point time-sharing cannot be im- required to remember where perhaps it was sheer magic). of view will appear continuous. plemented. each program is when it was Eventually I began to under- stopped. With other proces- stand what went on by fighting Why Time-sharing? Using Interrupts sors, you would typically have my way through books on The computer in a large Proper use of interrupts to store all registers away, operating systems. I hope that system may cost several comes first in implementing which may take many instruc- future computer users will be million dollars. Obviously, buy- time-sharing. The ideas tions. One danger of this is that spared a similar experience. ing one computer for each user presented here are essentially if another interrupt occurs Last year, I purchased an is extremely impractical. Shar- the same, whether you have a before all registers are stored M6800 system from SWTP. ing the computer among many small or large system. away, some register contents After programming on it for a users is a more effective way to An interrupt is basically a may be lost. The M6800 proces- while, I decided to investigate utilize the system. hardware mechanism that sor saves everything in one swoop. the possibility of implementing Another reason for time- makes the microprocessor Incidentally, you may, if gram A, you may time-share up propriate address. (that is, resume execution of desired, use the nonmaskable to 15 different programs. The purpose of clearing the the same program) as is nor- Interrupt NMI instead of IRQ. The part of the program that condition code in the stack for mally done. Instead, we go to The interrupt address would actually does the time-sharing each program is that when the the next program. This occurs then be stored at locations (the service routine) is RTI instruction is executed, the because the stack pointer has $A006 and $A007. I prefer, statements 69 to 83. State- interrupt mask bit will not been changed. however, to use an interrupt ments 1 to 64 merely initialize become set (which would lock You will also observe that in that is maskable. various parameters. The in- up the system). For example, if the service routine, I purposely itialization routine basically the stack pointer were at $0F00, store data where instructions Software works thus—initially each pro- we would clear address $0F01 are. This is a trick I use to make Program A actually imple- gram is assigned a stack point- and store the starting address the service routine execute ments time-sharing. The com- er. The stack-pointer address- at address $0F06. An RTI in- quickly, although in general ments should aid you in under- es differ by 16 bytes. That is, struction would then load the this is not good practice. I do standing how the program program 1 has a stack-pointer condition-code register with have another version of the ser- works. It starts at address value of END-I-16, program 2 $00 and the program counter vice routine that does not do BEGIN. Also, some hardware has a value of END-(-32, etc. with the number at address this; however, it is slightly must be set up so that an IRQ These values are stored at ad- $0F06. Initially, we don't care longer. interrupt is generated at dresses STACK1, STACK2, etc. what the other register con- For a simple demonstration regular intervals (this is ex- The initialization routine also tents are. of time-sharing, Program B may plained later). Each time an in- clears the condition-code regis- The service routine performs be used. This program terrupt is generated, one pro- ter and stores the starting ad- a very simple function. It stops assumes that you have a serial gram is stopped and the next dress of each program at the the current program from ex- interface port (which uses an one in line is started. For exam- appropriate position in each ecuting and runs the next pro- ACIA) at the correct baud rate ple, if program 1 is currently ex- stack. When the RTI instruction gram in line; it accomplishes at address $8008. You will also ecuting and we are time- is executed, the processor this by storing away the current have to have a terminal plugged sharing three programs, then fetches all registers (program stack pointer and loading the in at this address. We will call four interrupts will result in pro- counter included in the fetch) next one. When the RTI instruc- this terminal 2. Terminal 1 will gram 2 being executed (1 then 2 from the stack and starts (or tion is executed, we do not be at the control interface. If then 3 then 1 then 2). With Pro- resumes) a program at the ap- return exactly where we left off you run the Program B starting

Program A. Time-share program.

STMT ADDR CODE STATEMENT 1 OEOO ORG SOEOO 2 OEOO STRING EQU $E07E 3 OEOO 1N2HEX EQU $E055 4 OEOO INHEX EQU SEOAA 5 OEOO CR EQU SOD 6 OEOO LF EQU SOA 7 OEOO EOT EQU $04 8 OEOO CE 0E92 BEGIN LDX #SERVCE 9 0E03 FF AOOO STX SAOOO INITIALIZE INTERRUPT REQUEST POINTER 10 0E06 CE 0E61 LDX #MES1 11 0E09 BD E07E JSR STRING PRINT '#PROGRAMS = ' 12 OEOC ED EOAA JSR INHEX GET NUMBER OF PROGRAMS TO BE TIME SHARED 13 OEOF B7 0EB2 STA A NUMBER 14 0E12 16 TAB 15 0E13 CE 0EB3 LDX #STACK1 16 0E16 FF 0E5D STX TEMPO 17 0E19 CE OEEl LDX #END-l- 16 X-REG NOW POINTS TO THE BEGINNING 18 OEIC FF 0E5F STX TEMP OF THE STACK AREA 19 OEIF FE 0E5D A1 LDX TEMPO LOAD ADDRESS OF STACK 1 20 0E22 FF 0E2E STX STO-l- 1 21 0E25 08 INX 22 0E26 08 INX 23 0E27 FF 0E5D STX TEMPO STORE ADDRESS OF STACK I + 1 24 0E2A FE 0E5F LDX TEMP 25 0E2D FF FFFF STO STX SFFFF INITIALIZE STACK I 26 0E30 6F 01 CLR i.x CLEAR CONDITION CODE REGISTER I 27 OE32 86 06 LDA A #6 28 0E34 8D 22 BSR ADD 29 0E36 FF 0E4A STX ST-l- 1 THE X-REG NOW POINTS TO THE ADDRESS WHERE THE 30 0E39 86 OA LDA A #10 STARTING ADDRESS OF PROGRAM 1 STARTS 31 0E3B 8D IB BSR ADD 32 0E3D FF 0E5F STX TEMP THE ADDRESS OF THE NEXT STACK WILL BE 16 33 0E40 CE OE73 LDX #MES2 BYTES AWAY FROM THE CURRENT STACK 34 0E43 BD E07E JSR STRING PRING 'START = ' 35 0E46 BD 0E7C JSR INPUTX INPUT STARTING ADDRESS 36 0E49 FF FFFF ST STX SFFFF INITIALIZE PROGRAM COUNTER 1 37 0E4C 5A DEC B 38 0E4D 26 DO BNE A1 39 0E4F 86 01 LDA A #1 BEGIN RUNNING PROGRAM#l 40 0E51 B7 OEBl STA A STATUS 41 0E54 BE 0EB3 LDS STACK1 42 OE57 3B RTI 43 0E58 08 ADD INX THIS SUBROUTINE INCREASES THE X-REG 44 0E59 4A DEC A BY THE VALUE IN THE A-REG 45 0E5A 26 FC BNE ADD 46 0E5C 39 RTS 47 0E5D TEMPO RMB 2 48 0E5F TEMP RMB 2 49 0E61 ODOA MESl FCB CR.LF 50 0E63 2350 FCC /#PROGRAMS(l-F)?/ 524F 4752 414D 5328 312D 4629 3F 51 0E72 04 FCB EOT 52 0E73 ODOA MES2 FCB CR.LF 53 0E75 5354 FCC /START = / 4152 543D 54 0E7B 04 FCB EOT 55 0E7C 36 INPUTX PSH A SUBROUTINE TO INPUT THE X-REG 56 0E7D 37 PSH B 57 0E7E BD E055 JSR IN2HEX 58 0E81 B7 0E9O STA A DATA 59 0E84 BD E055 JSR 1N2HEX 60 0E87 B7 0E91 STA A DATA +1 61 0E8A FE 0E90 LDX DATA 62 0E8D 33 PUL B 63 0E8E 32 PUL A 64 0E8F 39 RTS 65 0E90 DATA RMB 2 66 « 67 •THE PURPOSE OF THIS SERVICE ROUTINE IS TO 68 •STOP PROGRAM I AND BEGIN RUNNING PROGRAM 1+ 1 69 0E92 CE OEBl SERVICE LDX /ifSTACKl-2 70 0E95 B6 OEBl LDA A STATUS DETERMINE THE PROGRAM CURRENTLY EXECUTING 71 0E98 48 ASL A 72 0E99 B7 0E9D STA A STl + 1 73 0E9C AF 00 STl STS X SAVE THE STACK POINTER AT THE APPROPRIATE 74 0E9E 47 ASR A ADDRESS(STACK1,STACK2,. . ..STACKF) 75 0E9F 4C INC A BEGIN TO EXECUTE THE NEXT PROGRAM 76 OEAO B1 0EB2 CMP A NUMBER CHECK FOR WRAP AROUND 77 0EA3 2F 02 BLE L3 78 0EA5 86 01 LDA A #1 IF WRAP AROUND EXISTS EXECUTE PROGRAM#l 79 0EA7 B7 OEBl L3 STA A STATUS INDICATE THAT THE NEXT PROGRAM IS EXECUTING 80 OEAA 48 ASL A 81 OEAB B7 OEAF STA A ST2+ 1 82 OEAE AE 00 ST2 LDS X LOAD THE APPROPRIATE STACK POINTER 83 OEBO 3B RTI BEGIN ACTUAL EXECUTION 84 OEBl STATUS RMB 1 CURRENT PROGRAM IN EXECUTION(l TO F) 85 0EB2 NUMBER RMB 1 TOTAL NUMBER OR PROGRAMS TO BE TIME SHARED 86 0EB3 STACK 1 RMB 2 STACK POINTER FOR PROGRAM#l 87 0EB5 STACK2 RMB 2 STACK POINTER FOR PROGRAM#2 88 0EB7 STACK3 RMB 2 . . .ETC . . . 89 0EB9 STACK4 RMB 2 90 OEBB STACK5 RMB 2 91 OEBD STACK6 RMB 2 92 OEBF STACK7 RMB 2 93 OECl STACKS RMB 2 94 0EC3 STACK9 RMB 2 95 0EC5 STACKA RMB 2 96 0EC7 STACKB RMB 2 97 0EC9 STACKC RMB 2 98 OECB STACKD RMB 2 99 OECD STACKE RMB 2 100 OECF STACK* F RMB 2 Iin ViI 102 OEDl END EQU • 103 • 104 A048 ORG $A048 105 A048 OEOO FDB BEGIN

SYMBOL VALUE DEFN REFERENCES STRING E07E 2 11 34 at address $0000, a series of returning to a high state. This is IN2HEX E055 3 57 59 zeros should be printed out on because the IRQ line must INHEX EOAA 4 12 CR OOOD 5 49 52 terminal 2. Starting at address return to its high state before LF OOOA 6 49 52 $0008 will result In a printout of the service routine has com- EOT 0004 7 51 54 all ones. pleted its job. If this is not done, BEGIN OEOO 8 105 We will now time-sfiare botfi then another interrupt will oc- A1 OEIF 19 38 STO 0E2D 25 20 parts of this program. For this cur immediately after the ser- ST 0E49 36 29 vice is completed, causing part, first press the reset but- ADD OE58 43 28 31 45 ton. This will set the mask bit to some programs to be skipped TEMPO 0E5D 47 16 19 23 a one. Now set the interrupt in execution. A pulse duration TEMP 0E5F 48 18 24 32 rate to a very slow value, say of 50 microseconds works quite MESl 0E61 49 10 MES2 OE73 52 33 once every ten seconds if well. An interrupt will not occur INPUTX 0E7C 55 35 inside the service routine possible. (We'll discuss the DATA 0E90 65 58 60 61 hardware to accomplish this in because the mask bit will be set SERVCE 0E92 69 8 a moment.) Now run Program A, at that time. If, however, you STl 0E9C 73 72 starting at address BEGIN decide to use NMI instead, your L3 0EA7 79 77 SI'2 OEAE 82 81 ($0E00). You will then be re- pulse must be much narrower STATUS OEBl 84 40 70 79 quired to type In the number of (e.g., 10 microseconds). Other- NUMBER 0EB2 85 13 76 programs you want (this is a wise, the service routine may STACK 1 0EB3 86 15 41 69 single hex number from 1 to F) keep interrupting itself, which STACK2 0EB5 87 to time-share, followed by their can lead to difficulties! STACK3 0EB7 88 STACK4 0EB9 89 respective starting addresses. If you have a signal generator STACKS OEBB 90 The data is entered as follows: that can generate a pulse, so STACK6 OEBD 91 STACK? OEBF 92 much the better. I also under- #PROGRAMS(l-F)?2 STACK8 OECl 93 START = 0000 stand that SWTP now has STACK9 0EC3 94 START = 0008 available an interrupt timer STACKA 0EC5 95 board. In place of these alter- STACKB 0EC7 96 After having done the above, natives, you may use the circuit STACKC 0EC9 97 you should see the printout at STACKD OECB 98 shown in Fig. 1. There are no terminal 2 alternate between STACKE OECD 99 doubt other circuits that will strings of zeros and strings of STACKF OECF 100 work as well. Resistors R1 and END OEDl 102 17 ones. If you slowly increase the interrupt rate you will notice that the respective strings become shorter and shorter. STMT ADDR CODE STATEMENT If you do not have a second 1 0000 8D OE PRGRMl BSR SETUP terminal, you may unplug the 2 0002 86 30 LOOPl LDA A #'0 terminal from the control inter- 3 0004 8D 18 BSR OUTPUT face In each of the above steps 4 0006 20 FA BRA LOOPl and plug it into the other port 5 0008 8D 06 PRGRM2 BSR SETUP after having typed a G. Be very 6 OOOA 86 31 LOOP2 LDA A n 7 OOOC 8D 10 BSR OUTPUT careful when doing this; you 8 OOOE 20 FA BRA LOOP2 should avoid the practice in 9 0010 FE OOlC SETUP LDX ACIA general. 10 0013 86 13 LDA A #$13 Perhaps you have wondered 11 0015 A7 00 STA A 0,X 12 0017 86 11 LDA A #$11 why I used another I/O port and 13 0019 A7 00 STA A o,x not MIKBUG directly. f>/IIKBUG 14 OOIB 39 RTS outputs a character by soft- 15 OOlC 8008 ACIA FDB $8008 ware, bit by bit. If you were to in- 16 OOIE DE IC OUTPUT LDX ACIA terrupt the output routine, the 17 0020 C6 02 T1 LDA B #$02 18 0022 E4 00 AND B 0,X output bits would not appear at 19 0024 27 FA BEQ T1 the proper time. That is, you 20 0026 A7 01 STA A 1,X cannot output part of a charac- 21 0028 39 RTS ter now and the other part later. This problem does not occur with an ACIA because a SYMBOL VALUE DEFN REFERENCES character is output by a single PRGMl 1 0000 1 store instruction. LOOPl 0002 2 4 PRGRM2 0008 5 Hardware LOOP2 OOOA 6 8 As stated previously, inter- SETUP 0010 9 1 5 ACIA OOlC 15 9 16 rupts must be generated at OUTPUT 001E 16 3 7 regular intervals. An interrupt T1 0020 17 19 should be generated by a pulse that grounds the IRQ line for a Program B. Test program. very short duration before MONOSTABLE needs his own area to store his return from the subroutine. program). You will immediately notice But wait a minute! You can- that from user 1 's point of view, not take any subroutine and ex- the value of the A register has 'P lOOpF pect it to work on a time-shared been changed from $01 to $02 basis. As a matter of fact, most upon leaving the subroutine. subroutines would not work at This was not intended. So, we all. A subroutine that is reen- have here an example of a • TO IRQ LINE trant is needed. A reentrant subroutine that works for one subroutine is defined as one user, but falls apart for two. that may be employed by many Now, let us write the same TT CD4001 1 1/4 CO users at the same time (i.e., on subroutine in a different way, a time-shared BASIC). Let's go CI* 00001 TO lOO^P R3, C2 DETERMINE PULSE WIOTH as shown in Program D. This Rl.Cl DETERMINE FREQUENCY over some examples of reen- subroutine turns out to be reen- trant and non-reentrant trant. We'll assume the same Fig. 1. Interrupt-oscillator circuit. subroutines. sequence of events as in the Let's say we wanted to write previous example. User 1 will CI may be changed to vary the percent of the processing time a subroutine that would add the save $01 by pushing it onto its interrupt rate. actually performs useful work. contents of the A register to own stack. When user 2 enters The question of how often we Therefore, we should try to that of the B register and store the subroutine, it saves $02 on generate an interrupt now choose an optimal interrupt the result in the B register. It is its own stack. The crucial point arises. Suppose we were to rate. I find that 100 interrupts also desired that the A register here is that each program has generate an interrupt once per second works well. You not be modified when we return its own stack. Consequently, every ten seconds. If each user should experiment to deter- from this subroutine. The sub- $01 and $02 are stored in dif- were printing out data, the mine what works best for you. routine in Program C will ac- ferent locations. When each printing would be done in You could also determine the complish this for a single user program executes the PUL A in- spurts. Another problem would optimal rate mathematically; and will prove to be non- struction, it does so with be that a user might type In this would require that you ex- reentrant. respect to its own stack. This data while another program amine matters in more detail. Suppose two users call this means that the proper values was being run, resulting in in- routine at about the same time, are restored. Two or more users put being lost. If we increased Programming Considerations and the values of the A register can therefore use this sub- the interrupt rate fast enough, Suppose you are time-shar- for both users are $01 and $02, routine at the same time! the output would appear ing two or more programs at the respectively, upon entry into Another example of reen- smooth and continuous. Also it same time. If these programs the subroutine. User 1 enters trant programming can be would be impossible for a per- are in different segments of the subroutine and executes found in the Motorola M6800 son to type so fast that some memory, there are no problems. the first three instructions Programming Manual. For ex- data might be lost. So, it would Often, however, it is desirable before an interrupt occurs. ample, on pages 10-12 a reen- seem that the faster we gener- that programs be able to share Location TEMP will then con- trant 16-bit multiplication sub- ate interrupts, the better. the same subroutines; this is tain a value of $01. routine is depicted. The key The problem, however, is that necessary for large programs. Let us now assume that after technique here is that every- the service routine takes a fixed For example, BASIC might the interrupt, program 2 enters thing is first pushed onto the amount of time to perform its take up approximately 8K the subroutine and is inter- stack. The TSX (Transfer Stack duties. As we increase the rate bytes. If each of four users had rupted after three instructions Pointer to Index) is then ex- of interrupting, the percentage his own copy of BASIC, we have been executed. Location ecuted. All instructions that of time the microprocessor is in would need at least 32K! If all TEMP now has a value of $02. follow are executed in the in- the service routine increases. It four users could use one copy After the interrupt, user 1 will dexed mode. This is equivalent is possible to generate inter- of BASIC at the same time we resume execution and execute to the work area being in the rupts so fast that 99 percent of would need only 8K, resulting in statement 4, a load instruction. stack. Nowhere in the program the time is spent in the service a tremendous saving in mem- The A register will now contain is there a label designating a routine, meaning that only one ory (of course, each user still a value of $02. We will then storage location.

STMT ADDR CODE STATEMENT 1 0000 B7 0009 ADD STA A TEMP SAVE A-REGISTER 2 0003 IB ABA 3 0004 16 TAB 4 0005 86 0009 LDA A TEMP RESTORE A-REGISTER 5 0008 39 RTS 6 0009 TEMP RMB 1

SYMBOL VALUE DEFN REFERENCES ADD 0000 1 TEMP 0009 6 1 4

Program C. A non-reentrant subroutine. STMT ADDR CODE STATEMENT 1 0000 36 ADD PSH A SAVE A-REGISTER 2 0001 IB ABA 3 0002 16 TAB 4 0003 32 PUL A RESTORE A-REGISTER 5 0004 39 RTS

SYMBOL VALUE DEFN REFERENCES ADD 0000 1

Program D. A reentrant subroutine.

In general, writing reentrant You must be careful, though, out the stack of another pro- ters that are stored in the stack subroutines may be easy or dif- that the stack pointer does not gram! This problem can be will destroy some numbers in ficult, depending on the type of change too much from its initial solved, however, by initially the list. Jumping to a subrou- instruction set available. For value. At the start of execution, separating the stack pointers tine or doing PSHES and example, if the M6800 micro- the stack pointers of all pro- by more than 16. PULLS modify the stack pointer processor had a PSH X instruc- grams initially differ by 16. This Since the time-sharing but are not harmful because tion, the task of reentrant pro- will change slightly throughout routine uses the stack pointer the stack pointer is changed in gramming would be greatly the course of execution. For ex- for its own bookkeeping, you a way that won't change valid simplified. Other processors ample, if we were in program 1, must be careful what you do data in the stack. have defects of their own. an interrupt might occur after with the stack pointer. A com- Perhaps in the future someone we had jumped to a subroutine. mon technique is to use the Remarks will design a stack-oriented This would cause the stack stack pointer to point to a list of In this article, I have tried to microprocessor. Reentrant pro- pointer to differ by 2 from its ini- numbers. This will not work if point out some of the essential gramming may then become a tial value. If we nested sub- the stack pointer is pointing to, points that must be understood trivial task. Incidentally, stack routines too deeply, say 8 or 9, say, the middle of a list of in order to implement time- processors have other advan- we could change the stack numbers. It won't work be- sharing. I hope I've taken some tages than the one given. pointer so much that we'd wipe cause on interrupt, the regis- of the mystery out of it.l

Here's how theG3mputer Workshop works for you. Our clients get the whole thing- So even if your needs are minimal total systems engineering. We can right now, we can be a big help. help you with evaluation and deve - Then as your needs grow, you'l opment of requirements for data ^now where to come. processing and associated harc- The Computer Workshop ware, or give you management Here are some of the firms we represent: Alpha Microsystems assistance in developing systems. Compucolor Corp. The Digital Group We'll develop and design computer International Data Systems, Inc. Lear Seigler systems, and we'll design, organize North Star Nev4ech Computer Systems and manage special training pro- Sanyo Electronic, Inc. Southwest Technical Products Corp. grams for your staff. Vector Graphics

Here's where to find US: offices: BALTIMORE 4005 Seven Mile Lane. Baltimore, Md. 21208 (301) 486-5350/PITTSBURGH Robar Building, 4170 Wm. Penn Highway, Murraysville, Pa. 15660 (412) 327-0455/WASHINGT0N, D.C. AREA 1776 Plaza, 1776 E. Jefferson Street, RockvllTe, Md. 20852 (301) 468-0455/N0RTHERN VIRGINIA 5240 Port Royal Road, Suite 203, Springfield. Va. 22151 (703)321-9047/ KANSAS CITY 6 East Street, Parkville, Mo. 64152 (816) 741-5055 recorder was not designed to input audio (data or otherwise) via its AUX or MIC jack, and an instant later feed audio out through the EAR jack—with all jacks tied to a common exter- nal ground. Many recorders do not even have a common inter- nal ground for these jacks and the REM motor control jack. Cassette Recorder Those that do usually have a relatively high-resistance ground. When this shaky ground system is tied to the Disaster: computer's common ground by way of three separate shielded cables (DATA-in, DATA-out and REMOTE motor control), the ground loops created can com- pletely destroy the reliability of Ground Loops the recording system.

A Way Around this Hummer The standard way out of this ground-loop problem is to unplug either the DATA-in or DATA-out plug from the record- the problem, and a solution er, whichever is not in use. It usually works but is inconve- nient, particularly for the half- way serious computer user who values his time. Fortunately, there are a couple of simple and inexpensive solutions (un- til more suitable recorders hit the market at the right price). Photo 1 shows a simple cable adapter made from stan- Dave Waterman dard parts. It consists of a mini- 834 Oak Lee Ln. plug, minijack and a short (the Alpine CA 92001 shorter the better) piece of un- shielded wire. This wire is Dave Lien soldered only to the "hot" 8662 Dent Dr. (center) connectors of both Photo 1. Cable adapter made from standard parts. San Diego CA 92119 plug and jack. This ungrounding adapter is Inserted between the computer he ordinary household cas- and the recorder in the EAR line Tsette recorder was not or the AUX line, as shown in designed with anything as ex- Photo 2. Given the choice, It is otic as digital data recording in better to use an unbroken mind. Computer experimenters shield to the AUX jack to assure pressed the recorder into this a good-quality recording. A role. All things considered, the properly recorded tape can device works well. However, always be reloaded, but a bad two problems immediately tape cannot. Keep power sup- arise—-low-level ground loops, plies and other possible which can badly degrade the sources of interference away system's reliability, and the from this unshielded adapter. It lack of a convenient means of works well. overriding the computer's con- The second ground-looping trol of the drive motor. We'll ad- solution is a variation on the dress the problems separately. same theme, but it also solves the annoying problem of lack of Photo 2. The ungrounding adapter is inserted between the com- Why the Ho Hum convenient motor control. Two puter and the recorder in the EAR or AUX lines. The standard cassette jacks, one miniature (to match MINIATURE PLUG MINIATUREN "TO EAR OR AUX JACK 11

JUMPER WIRE

SUBMINtATURE (1 V- . 5UBMINIATURE JACK U PLUG TO REM SPST \ I NO > I IMINIBOX

Fig. 1. the EAR plug) and one submini- similar SPST switch with nor- ature (to match the REM motor mally open contacts, as shown plug), are mounted In a small in Fig. 1. Unshielded jumper plastic case. The one shown In wires are then connected from Photo 3 was used to hold a the switch to the submlniature burglar-alarm panic switch. A REM Jack-in-the-box (sorry shielded cable Is run from the about that!). Paralleling the EAR jack in the box to the EAR REM line with the push-button plug for the recorder. Note In switch allows us to turn on the Fig. 1 that the shielded part of motor. the cable Is not attached to We can always turn the re- tC.3 break the ground loop. Another corder off with its normal STOP shielded cable Is run from the button. This arrangement REM jack to the REM plug for allows us to turn the motor on the recorder, but its ground in- for purposes of rewinding tape, Photo 3. Small case with mounted jacks. tegrity is maintained. advancing a cassette past the Similar switch boxes are leader or going fast forward to computer system. It should nuisance problems work well, equipped with an SPST normal- find a certain spot on the tape. work as well with any other. are inexpensive and require no ly closed switch. If this is the Photo 4 shows this handy special tools or skill. Give them case with the one you select, auxiliary control box installed Success a try, and see how much more replace the switch with a with a Radio Shack TRS-80 Both of these solutions to you enjoy your computer.• Glen Charnock 864 Palomar Way Oxnard CA 93030 A Different Search Technique don't just try it—benchmark it

ood things can come in table; then initialize the loop in- the table. This time, however, Gsmall packages. This pro- dex and begin looping through only search for a match and in- gramming trick is so simple it crement the loop index within can easily retrofit to existing the loop. You don't need to test programs; yet, it can substan- tor the end of the table ... if tially reduce the time needed to you haven't found a match by search a table. then, you will on the last table The traditional method of entry because you've already searching a table is shown in moved the search argument in- Fig. 1. First, a loop index is ini- to this last entry. Thus, you tialized. Then a loop is execut- save one comparison for each ed, comparing the table ele- table entry searched (see Fig. 2). ment with the search argument Depending on the language and incrementing the loop in- and the way the computer im- dex until either a match is plements subscripts, this trick found or the table is exhausted. can save as much as half the When the loop is exited, the the time needed for the search. loop index points either to the That's pretty good for such a location of the matching table small change! element or, if no match was I learned this programming found, to the last table element trick from the advertising plus one. brochure of Software Consult- The new method dimensions ing Services of Allentown PA. one extra place at the end of Further details may be found in the table for a "dummy" value. The Art of Computer Program- To search the table, first move ming, Vol. 3, "Sorting and the search value into this dum- Fig. 1. Traditional table-search- Searching," by Donald E. Fig. 2. A different search tech- my location at the end of the ing method. Knuth.H nique.

inc INTERNATIONAL DATA SYSTEMS, INC. 11 J^m prepaid Shipping added lo COD 400 North Washington Street. Suite 200. Falls Church. Virginia 22046 U.S.A. Mmitnun order $1000 Master Charge accepted Telephone (703) 536-7373 BIG SAVINGS ON PRIME COMPONENTS DUE TO MANUFACTURERS LARGE QUANTITY DISCOUNTS.

LOW POWER SHOTTKEY 74LS174 125 BAUD RATE GENERATOR 74LS175 1.25 74LS00 22 74LS192 2.45 MCI 4411 990 74LS02 24 74LS193 2.45 74LS04 24 74LS08 28 TTL 600MHz PRESCALER 74LS11 35 74LS13 69 7400 15 11C90 19 00 74LS30 26 7406 29 74LS32 ,34 74121 .35 74LS74 49 74150 .85 PRIME INTEL 74LS85 1 99 74LS90 89 SHOTTKEY 8085 CPU 29 00 74LS92 89 8251 USART 10 50 74LS125 .63 74S00 40 8212 PIO 4.00 74LS126 63 74S30 40 8155 29 00 74LS151 .95 74S132 1.10 8253 PIT 74LS155 1 25 748196 3.80 8255 PPI 2200 NO A P DIP Jumpers for Faster & Easier connections.

AP DIP Jumpers are the low cost high quality solution to bussing between PC boards, mother boards, backplanes and more. Available In 14, 16, 24 and 40 pin single-ended or double-ended assemblies. In standard lengths of 6, 12, 18. 24 and 36 Inches. Each assembly has molded-on strain relief and llne-by-line probeabllity. Contact material Is non corrosive alloy 770. Dielectric Is 94 V-O rated, and cable is stranded rainbow.

Order from your A P distributor today. Our distributor list is growing daily. For the name of the distributor nearest :v yo u call Toil-Free 800-321-9668.

Send for our complete AP catalog The Faster & Easier Book. y Faster and Easier is what we're all about.

AP PRODUCTS INCORPORATED Box 110 • 72 Corwin Drive, Painesville OH 44077 T (216)354-2101 TWX:8ia425-2250 A22

The NewMicro Executive \l It handles big jobs at a price that makes sense to small without extensive accounting for special use, such as in businesses. backgrounds.) medical, dental and insur- Finally there's a computer What's more, Micro ance offices. system that can run your of- Executive II includes the It also has o word process- fice without eating up your best programs system to be ing system that provides you profits. For less than $15,000 found on any micro computer. with a full range of editing and (or a just-as- Besides a complete editorial services, including reasonable leas- business legal documents and ing arrange- contracts, catalogues, letters ment), you tL to your customer. can put Micro Executive 11 to Doesn't it make sense? work handling Accounts Poyable and Receivable, Payroll, Inventory and GDmputer Financial Reporting. (And it system—with ^ can be operated by people Workshop programs offering Microcomputer BusinessSystems

Offices BALTIMORE 4005 Seven Mile Lone. Baltimore. Md. 21208 (301) 486-5350 KANSAS CITY 6 East Street. Porkville. Mo. 64152(816} 741-5055 ' PITTSBURGH Robor Building. 4170 Wm. Penn Highway. Murraysville. Pa. 15660 (412) 327-0455 WASHINGTON, D.C AREA 1776 Plaza. 1776 E. JeffersonStreet.Rockville.Md. 20852 (301} 468-0455/NORTHERN VIRGINIA 5240 Port Royal Road. Suite 203. Springfield. Va. 22151 (703) 321-9047 Kilobaud classified advertisements are intended for use by those individuals desiring to buy, sell, or trade used computer equipment or software. No commercial ads are accepted. Two sizes of ads are available. The $5 box allows five lines of about 22 characters each, including spaces and punctuation. The $10 box provides ten lines of type — again, each line is about 22 characters. Minimize capital letters, as they use twice the space of small characters. Payment is required in advance v/ith ad copy. We Ccinnot bill, or accept credit. Oversize ads are not accepted. Each subscriber is limited to two (2) identical ads in any given issue. Advertising text and payment must reach us 60 days in advance of publication. For example, advertising copy for the March issue CmC'sADA. (mailed in February) must be in our hands on January 1. The publisher reserves the right to refuse a questionable or not applicable advertisement. Mail advertisements to: KILOBAUD comes complete with instruc- needed. Numerous combinations CLASSIFIED, Kilobaud, Peterborough, NH 03458. Do not include tions, is assembled and tested and of line length, line spacing and any other material with your ad, as it may be delayed. measures 3 x 3'/: x I inches. KIM page spacing allow for any form is isolated from the RS-232 device to be handled. Pages may be by optoisolators. numbered as well as titled. Slock Market, Commodity Time Series TRS-80 Sort: in BASIC I, 4K min. Sorts recs analysis programs. Exchange with others in memory on 1 or 2 numcric fields in asc. or ADA sells for $24.50 with Minimum system hardware who have worked in this area on computers. desc. seq. Input from tape, k.b. or both. drilled, plated-through solder requirements: (Stock system Bob Lemeer, PO Box 29. Brooklyn NY Output to tape or video. Can be subroutine. 11230. $10 on tape w/doc. To: Software, Box 6153, pads for all connections, or for —other versions available by Syracuse NY 13217. $29.50 with barrier strips and special order) SOL-20/SOLOS PET Owners: Perfect your system before screw terminals. (or equivalent: system w/ VDM-1 trying Las Vegas. Blackjack, baccarat, rou- PET Software: Game and demo programs lette, craps. Full LV casino rules & options written in BASIC for 4K PET. Includes CONNECTICUT microCOM- and CUTS cassette), 8K of mem- give maximum reality. Full screcn graphics. blackjack, children's math, biorhythm and PUTER, 150 Pocono Road, ory starting at location 0000, All on I cassette. $25. CMS. 431 Monte 15 others. On cassette, ready to load and Brookfield, CT 06804. Printer (TTY, Selectric, etc.). Vista, Dallas TX 75223. run. plus written descrip. $15.95. R. Schmidt, 14 Tinker Rd.. Nashua NH 03060. Video Display Monitor, Cassette Augat w/w boards, 24-16 pin cap. or any recorder. comb, of other sizes. 36 dual w/w edge conn. PET users need info? Getting started with S8, no ICs, S9 w/lCs S10 w/ICs & edge conn, your PET workbook. $4. Workbook has This Is the Electric Pencil The Electric Pencil is available ppd. in U.S. R. Savilonis. 334 Columbia St. helpful info, sample programs, exerciscs and from stock at: Interactive Com- Cambridge MA 02141. (617) 492-2095 5-7 fundamental features of PET BASIC. Send puters, 7646 1/2 Dashwood, PM EST. SASE for details. D. Smith. Box 921, Los The Electric Pencil is a charac- Alamos NM 87544. Houston TX 77036. HP-97 prog/printing calc. Top-of-line. ter-oriented word-processing sys- Orig. $750, asking $475. P. Davis (201) Heathkit H9 video terminal assembled, tem. This means that text is en- 885-1220 (days). $400. Kilobaud issues 1 to 15. $25. Byte tered as a continuous string of issues 3 (Nov 75) to 16 (Dec 76) in binder. characters and manipulated as Sophisticated 2-player football simulation $35. Byte Jan 77 to date. $15. First money Microprocessor Protection on cassette for Radio Shack TRS-80 Level I order. T. Halldorson. 44 Ctr. Grove Rd., such, allowing the user freedom BASIC. Uses graphics to draw field, move Apt D-13. Randolph NJ 07801. and ease in the movement and ball, etc. $12. Dr. S. Haner. Box 17222. Tampa FL 33682. handling of text. Since lines are Lightning and heavy-duty elec- Use Kilobaud Classified not delineated, any number of trical equipment often create characters, words, lines or para- power-line surges and transients. graphs may be inserted or deleted These can cause extensive dam- anywhere in the text. The typing age to valuable NEW of carriage returns as well as word and peripherals. hyphenation is not required since Electronic Specialists announc- each line of text is formatted Contest: Froiujcts es a line-cord transient sup- automatically. Whenever text is pressor that will absorb repeated inserted or deleted, existing text is power surges to protect delicate Another month has gone (from page 15) pushed down or pulled up in a equipment. by, and the votes have been wraparound fashion. Everything Available in 2-prong plug/ counted. The article vi^inner passage. Kinged pieces are iden- appears on the video display socket ($11.50) or 3-prong plug/ for the v\/intry nnonth of Febru- tified on the display and messages screen as it occurs, which socket ($14.50), these units are ary is Dr. Mark Boyd, author of appear at the right of the board eliminates any guesswork. also available with integral "Interfacing Tips" on page 72. relating to each move. When text is printed, The Elec- power-line hash filtering. Choice-of-a-book-from-the- Included with Video Checkers tric Pencil automatically inserts Electronic Specialists, Box is a 9-page instruction book. The carriage returns where they are 122, Natick MA 01760. Book Nook winner is Larry game's author has invited pur- Nelson of Marion IN. chasers of the cassette to add en- To both Mark and Larry, we hancements to the program. offer congratulations and Therefore, an entire program list- best wishes. ing is included. And to all of our readers who are responding enthusi- astically with their votes, we RS-232 ADApter for KIM also offer congratulations,

best wishes and good Connecting an RS-232 ter- reading. minal to KIM is easy with ADA. Keep voting! This ADApter converts KIM's 20-mA current-loop port to an RS-232 port. ADA does not af- fect the baud rate and uses stan- dard power supplies. The unit Electronic Specialisls' transient suppressor. WHY YOU VIDEO SHOULD TERMINAL Nov^. a comptett'lv seH-contained v.deo tetm.nal card foi lets than S150 00 Rftiuirw only an ASCII Kpytioa'd and TV iPi lo become a cofTHHete mteraclive terminal fof connection to vouf comouieti ienal 10 port Two units availatiJe. common h-aturei ate imitle 5V iupply. ciyMal controlled sync and Ijaud raitis MAKE A (to 9600 baudi, crutiouter an<) keytXJard OI>er,tted cursor contrni (Mr ity error antl control, prjvwr on mitrali/atron. torywrd MWCes. Ime ft.e<), rev Irne (eetlt. home, return cursor, anst clear lo end of ime Povyer rettuiremenis ate 5V at 900m.), ouitiut stti IV p |» virleo and serial TTL leyel data CORPORATE Features: TH3216 TH6416 Display 32 characters 64 characters by 16 lines by 16 lines CONTRIBU- 2 pages scrolling Characters Upper case ASCII Upper/lower case optional TION TO Baud Rates 300-9600 110-9600 Controls Read to/from Scroll up or memory down THE AD Price (kit) SI 49.95 SI 89.95 COUNCIL Above prices include ail IC sockets OPTIONS:

The Advertising Council is the biggest Power supply (mounts on board) S14.95 advertiser in the world. Last year, with Video/RF Modulator, VD-1 6.95 the cooperation of all media, the Coun- Lower case option (TH6416 only) 10.00 SIJEEfVlEPy Assembled, tested units, add 60.00 cil placed almost six hundred million TH 6416 shown ahovf dollars of public service advertising. Yet its total operating expense budget Frequency Counter MINI-KITS was only $914,683, which makes its FM WIRELESS MIKE KIT $79.95 kit Tfjmm.t ut) to 300 to any ^ W advertising programs one of America's iiKiio S^Tisitiw rnikv imiut tf greatest bargains... for every $1 cash (JUMCS »f«' FM 1 S2.95 Co«n1#» h«8 f^ort COu'iI»»» Miltnq SPECIFICATIONS $600 of advertising. Vy t»<« tn* M^aso'ing n «*»» a* TONE DEC