COMPUTE II ISSUE 1 / APRIL/MAY 1980 / PAGE 25PROGRAM TRANSFERS (PET TO KIM)
Joseph A Dilts
Assoc. Prof, of Chemistry
Univ. of North Carolina
Harvey B. Herman
Prof. of Chemistry
Univ. of North Carolina
In a recent 6502 User Notes editorial (Issue #14, P. 27) you propose a method to transfer BASIC programs from PET to KIM. Your editorial prompted us to document our method for your readers, as we have been doing this for almost a year now.
There are several possible methods to communicate between computers. One way, memory to memory transfer using parallel ports, has already been published (“KIM-1 Talks to PET”, PET User Notes, Vol. 1 #5, p 6). However, as you point out, tokens for various Micros of BASICs differ. Consequently, a simple transfer will not work for BASIC programs.
Another way, the way we picked, is to send an ASCII version of the program from the IEEE port of the PET to the serial interface of the KIM. This method requires both an IEEE/RS232 serial adapter and a RS232/KIM adapter. We used an IEEE adapter manufactured by Connecticut Microcomputer (PET ADA 1200 $170 assembled) which one of us (J.A.D.) uses with a word processing program (CMC). We constructed a modified version of the RS232/KIM adapter published in your journal (Issue #4, p 6) to complete the connection from PET to KIM.
It is very important to set the slide switches on the PET ADA 1200 properly. One combination that works for more than one application is:
1 parity bit 2 stop bits (10010 in switches 1-5) 7 characters even parity
The baud rate of the KIM serial line can be set with a serial terminal and the reset/rubout sequence or with the KIM keyboard (change locations $17F2/$17F3, see 6502 User Notes. Issue #6, p 11 for typical values.) We worked with a 300 baud terminal and the IEEE/RS232 interface set at 300 baud.
The first method we tried was similar to the suggestion in your editorial. KIM BASIC was brought up as always using the terminal. A NEW command was given, the terminal was carefully disconnected from KIM and the PET/adapter substituted (pin 2 on the KIM to pin 3 on the PET/adapter). A PET program which we wished to transfer to KIM was loaded and listed to the IEEE bus using the following sequence (on the PET).
OPEN 6, 6 CMD 6 LIST PRINT #6 CLOSE 6
The terminal was reconnected and the program listed on KIM. To our horror we found this method generally only transferred the first program line as apparently a delay or hand shaking is necessary after the first carriage return. One of us (HBH) uses an X-off/X-on sequence to properly load paper tapes on KIM thereby circumventing the same problem. We could not use this method here and we did not see an easy way to modify the PET ADA 1200 adapter for handshaking.
We tried another approach; one that eventually worked well. Since we saw the problem as necessitating a delay after carriage return, perhaps software, rather than hardware, could accomplish this. A BASIC program was written which could read an ASCII file from tape and send each character to the IEEE bus individually. The program adds a proper delay after the carriage return character is sent and gives KIM BASIC enough time to digest each line.
It is easy to make any PET BASIC program into a file on cassette tape after it is loaded.
OPEN 1, 1, 1 CMD 1 LIST PRINT #1 CLOSE 1
The PET program, GET, (shown in the figure) which reads the file is loaded next. (Line 45 is incomplete, see below for reason, and needs GOSUB 60 after the colon). The KIM terminal is disconnected and PET connected to KIM. GET is executed on the PET and causes the program file, made previously, to be sent character for character over the IEEE bus to KIM, inserting delays when necessary. KIM's terminal is reconnected and if the PET program happens to be directly compatable with KIM's BASIC, it can be run immediately without modification.
Some minor problems may arise:
Even though we recognized that problems exist we have successively moved very long PET programs (close to 8K) and made them operate on KIM. As a short, possibly bad, example we transferred the GET program itself to KIM and listed it on a KIM operated teletype (110 baud). This program cannot execute on KIM because of software and hardware differences. It also illustrates the line length buffer limitation (line 45). As long as users are aware of the potential trouble spots they should have no difficulty.
We have also used the PET ADA 1200 adapter in other applications. The adapter was originally designed to directly drive a printer off the IEEE bus. When the terminal is not in proximity to the PET but is near a telephone and modem it is possible to make listings over phone lines. We have used the Pennywhistle 103 Modem to transmit PET programs and output on a high channel frequency, to terminals whose modem is receiving on the same frequency. A simple list to the IEEE bus (with CMD) or data output of the bus is all that's required. If the terminal also requires an extra delay after carriage return more bits per character (9) could suffice or the GET program used. The remote device could also be a computer. However, we have not tried this. The best part of the remote printing operation is to watch the faces of the folks in the computer room when they spy a strange (to them) dialect of BASIC printing on their terminal.
10 OPEN1,1,0 15 OPEN6,6 17 FORI=1 to 500:NEXTI 18 PRINT#6,CHR$(15) 20 GET #1,C$ 30 IF (ST) AND 64 THEN 500 40 IF ASC(C$)=13 THEN PRINT L$:PRINT#6,L$:L$="":FOR I=1TO500:NEXTI:GOTO20 45 L$=L$+C$:IF LEN(L$)=71 THEN PRINTL$:PRINT#6,L$:L$= "":FORI=1 TO 500:NEXT: 50 GOTO20 60 GET#1,C$:IF (ST) AND 64 THEN 500 70 IF ASC(C$)=13 THEN RETURN 80 GOTO60 500 CLOSE 1 OK