From: gvg@lvld.hp.com (Greg Goebel) Newsgroups: comp.sys.hp.misc Subject: Re: ? transfer data from HP85 to DOS or UNIX Date: 3 Mar 1994 16:32:17 GMT Organization: Hewlett-Packard Co., Loveland, CO Lines: 1029 Message-ID: <2l53eh$bfj@hplvec.lvld.hp.com> References: <1670@xsoft.uucp> NNTP-Posting-Host: hpislgg1.lvld.hp.com X-Newsreader: TIN [version 1.2 PL1.4] from: Greg Goebel / HP VXD / Loveland CO / gvg@hpislsup.lvld.hp.com to: Michael Gehret date: thu 03 mar 94 0900 I tried mailing this but my mailer can't find you, so I will have to post. > How can I transfer data from an ancient HP85 computer with > 5,25" double floppy drive to DOS or UNIX? > > Replies are welcome via news or email to xsoft.uucp!mg. > > Michael Gehret > X/software > Marktstrasse 8, D-87730 Groenenbach, Germany > voice (+49) 8334 1411, fax (+49) 8334 6245 Here is everything I know about moving to DOS. Is also roughly applicable to UNIX for serial transfers. [<>] gregards -- gvg Transferring Series-80 Programs & Data To DOS [1] Introduction * HP's Series-80 controllers were very popular in their time, and there are a lot of customers who are still getting good use out of them; but progress marches on, and many of those users are upgrading to newer machines, usually PC-based controllers -- and confronting the problem: how can I get my old S80 data and program files over to my PC? There are a number of different ways to do this, depending on the hardware configuration of the two systems; but all require obtaining additional hardware or software, unless you are lucky enough to have the precise configuration needed to get the job done. The first and simplest option is to get a copy of HP's E2080A LIFUTIL program and copy the S80 files direct from floppy disk to the PC -- S80 disks are LIF- formatted, although they use nonstandard file types. However, this assumes that you have comparable disk drives on both the S80 and PC -- that is, 3.5-inch or 5.25-inch floppy drives on both machines. In the case of the HP-85, the most popular of the S80s, it didn't HAVE a disk drive in its standard configuration -- just a 256 KB tape drive -- so that isn't always a practical approach. But most HP-85s were equipped with an HP-IB card; and it is possible as an alternative to obtain an HP-IB interface for a PC (the HP 82335 or its predecessor, the HP 82990) and transfer data and programs across over HP-IB. Another alternative would be to transfer files using RS-232 communications. This document discusses these three alternatives in detail. [%%] [2] Transferring Files Using LIFUTIL * HP's E2080A LIFUTIL is a simple but capable program that allows conversion of LIF files onto DOS systems; you can run LIFUTIL on your PC, stick a LIF or S80 floppy disk on your PC drive, and copy the files across using a number of conversion options. However, there is a catch: while LIFUTIL can convert S80 DATA files into DOS text files (the data items in S80 DATA files are "tagged", so LIFUTIL can determine their data types and convert them appropriately), it cannot convert S80 PROG files into anything a PC can make sense out of -- and so PROG files must be converted to DATA files containing a program listing before they can be transferred. Fortunately, it is simple -- through use of the S80 GET/SAVE binary -- to convert an S80 program to an ASCII listing in a DATA file. Transferring S80 To DOS 2 * Transferring the DATA file is extremely simple: store the file on a floppy disk, take the disk out of your s80 drive and plug into into your PC, then run LIFUTIL; specify the drive (say, "A:"), the filename, then, last but not least, specify the conversion type: DOS text (ASCII, HP-UX, S80 DATA, Pascal TEXT) The file will be copied over as a DOS text file you can read in an editor. * Getting an S80 PROG file across is simple if you have an S80 GET/SAVE binary in some form. Normally, when an S80 program is typed into the machine, it is "parsed" into "byte-codes" or "tokens". These tokens are simple codes that can be quickly interpreted by the machine when it executes the program. When you STORE a program, the resulting PROG-type file is full of these tokens. Tokenized programs are efficient, but they have a drawback: they can't be understood by any machine except one of the type that the program was written on. If you want to port a program to another type of machine, you have to obtain an ASCII listing for it. This is done with the SAVE statement; it takes a tokenized program and dumps an ASCII listing of the program into a data file. (The complementary GET statement takes the ASCII listing of a program in a data file and loads it into the S80 as a tokenized program.) GET/SAVE is a nice feature, but it is only standard on the HP-85B and the HP-86B. The GET/SAVE binary for the HP-86A/87 is available in the HP-86/87 EDISC ROM, on the HP-86/87 Advanced Programming ROM, or on the HP-86/87 demo disk. GET/SAVE binaries for both the HP-85 and the HP-86/87 are provided with the DataComm software package; the two binaries can also be purchased from a third party: SOLVE & INTEGRATE CORPORATION POB 1928 Corvallis OR USA 97339 503-754-1207 In any case, once you get a GET/SAVE binary for your machine, you can then LOAD your program, LOAD BIN the GET/SAVE binary, then perform a SAVE to a file name of your choice. You can then convert the file using LIFUTIL in exactly the same way you convert a data file. * You can similarly use LIFUTIL to convert DOS TEXT files into S80 DATA files; if the DOS TEXT file contained ASCII numeric strings, the strings can be read in one-by-one and converted to numbers using the VAL statement; if the DOS text file contains a S80 program listing, it can be loaded using the GET statement. [%%] Transferring S80 To DOS 3 [3] Transferring Files Over HP-IB * As noted, however, LIFUTIL isn't always the best solution, since many HP-85s only have tape drives. If that is the case, fortunately most HP-85s also have HP-IB interfaces, and it is possible to transfer files over HP-IB. This has the catch that the customer has to have an HP-IB interface for the PC -- the HP 82335A or the HP 82990A -- and a DOS programming language to control it -- but the 82335's cost is competitive to other solutions, and GW BASIC or QuickBASIC are cheap. (Besides, if people were using the HP-IB interface on the HP-85 for instrument control, it is likely they need or have an HP-IB card on their target PC as well.) Transferring HP-85 programs and data over HP-IB to a PC is easy, as long as certain simple rules are followed. * To perform file transfers, I set up a system consisting of an HP-85 with an HP-IB interface (tape drive only; no disk drive) and a Vectra ES/12 AT-class PC, using an 82335A HP-IB interface (under GW BASIC -- note that the programs can also be run under QuickBASIC, with a few changes in HP-IB routine syntax). The general approach for transferring programs over HPIB from the HP-85 to the PC is simple: 1: Make the PC an HP-IB listener (using the 82335 IOCONTROL command). 2: Have the PC perform an IOENTERS (enter a string) without using a timeout (so the PC will wait indefinitely for the string). 3: Make the HP-85 an HPIB talker (how this is done depends on what ROMs the HP-85 has and will be discussed presently). 4: Use the HP-85 statement PRINTER IS 7 to make the HP-85's HP-IB interface the default printer output. Program listings can then be sent over the bus using PLIST. 5: When the PC receives a string over the HP-IB, it prints or stores it, and then performs another IOENTERS to get the next string. Transferring S80 To DOS 4 * I wrote the following GWBASIC program -- named S80XFER -- which used the 82335 routines to read the information sent over the HP-IB from the HP-85: _________________________________________________________________________ 10 ' Load SETUP.BAS file here for 82335A initializations. .............................................................. 1160 OPTION BASE 1 1170 ' 1180 ISC=7 1190 MAX=80 1200 ' 1210 N1=6 1220 N2=1 1230 CALL IOCONTROL(ISC,N1,N2) ' Make machine a listener. 1240 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1250 CLS 1260 PRINT "Please configure your Series-80 to talk." 1270 BUFFER$=SPACE$(80) 1280 CALL IOENTERS(ISC,BUFFER$,MAX,ACTUAL) ' Dummy read to clear commands. 1290 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1300 ' 1310 OPEN "O", #1, "\S80FILE" 1320 ' 1330 CLS 1340 PRINT "Please print the data from your Series-80 computer." 1350 PRINT "Print '>END<' to end the transfer." 1360 ' 1370 BUFFER$=SPACE$(80) 1380 CALL IOENTERS(ISC,BUFFER$,MAX,ACTUAL) ' Enter data. 1390 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1400 IF LEFT$(BUFFER$,5)=">END<" THEN 1450 ' If end, get out of loop. 1410 PRINT LEFT$(BUFFER$,ACTUAL-2) ' Print data. 1420 PRINT #1, LEFT$(BUFFER$,ACTUAL-2) ' Store it in file. 1430 GOTO 1370 1440 ' 1450 PRINT "Done!" 1460 CLOSE #1 ' Close file. 1470 END _________________________________________________________________________ Transferring S80 To DOS 5 This is a very simple program, and follows the scheme: _________________________________________________________________________ Initialize the HP-IB interface. Set up the HP-IB interface as an HPIB listener using IOCONTROL. Clear the display and tell the user to set up the S80 as a talker. Perform a dummy HP-IB read to clear out the HP-IB control characters. Open data file S80FILE. Clear the display and print "Waiting for data!" LOOP: Perform an IOENTERS and wait for string to come across the HP-IB. IF first five characters of string are ">END<" THEN EXIT LOOP. ELSE Print the string (strip off CR-LF at end). Store the string in the data file (strip off CR-LF at end). END LOOP Print "Done!" Close the file. END _________________________________________________________________________ A few comments will clear up any confusion caused by minor details: % An IOENTERS -- basically, a "dummy" HP-IB read -- is performed after you set up the HP-85 as a talker. Why this is done is explained presently -- please be patient. % The IOENTERS routine enters the string sent over the HP-IB into a string variable (BUFFER$ in this case) up to AND INCLUDING the carriage return- line feed that terminates it. If the string variable is then PRINTed to the display or the data file, the PRINT will perform its own CR-LF and also print the CR-LF stored in the string variable, causing the output to double-skip lines. So -- the GWBASIC LEFT$ function is used to print all the characters loaded into the string -- except the CR-LF characters at the end. % Note that since the main loop of this program spends most of its time hanging in an IOENTERS for data to come over the loop, the only clean way to tell it to quit is to send a termination command (I chose ">END<") over the HP-IB from the HP-85. When the program reads the ">END<" string, it exits the main loop, prints a final message, closes the data file, and stops. Transferring S80 To DOS 6 * Running S80XFER is easy. Turn on both the HP-85 and the PC, run GWBASIC / S80XFER on the PC, and follow S80XFER's instructions. When S80XFER prints: "Please configure your Series-80 to talk." -- then you set up the HP-85 as a talker in one of two ways: 1: If you have an I/O ROM (built into the HP-85B) you execute: SEND 7; MTA Sends My Talk Address; sets up HP-85 as talker. PRINTER IS 7 Designate HP-IB interface as printer output. PRINT Prints CR-LF; clears HP-IB command read by S80XFER. Sending the "MTA" command over the HP-IB designates the HP-85's bus interface as a talker. (While the MTA command is recognized only the the HP-85's own HP-IB interface, it is still sent out over the HP-IB ... them's the rules.) Once that is done, PRINTER IS 7 sets the HP-IB interface itself (instead of a device on the HP-IB) as the default printer output. Now the HP-85 will assume that there is somebody listening to the HP-IB and send information over the HP-IB, without bothering to send any commands -- which is exactly what is wanted. (The final PRINT statement simply sends a CR-LF over the HP-IB -- so that S80XFER can complete its dummy read and throw away the MTA command that it read.) 2: If you DON'T have an I/O ROM and you have a Plotter/Printer ROM (you have to have one or another to get the HP-85 to speak HP-IB) you get to the same place by a more roundabout route: PRINTER IS 705 Set up dummy HP-IB device as printer. PRINT Perform dummy transaction to set MTA. PRINTER IS 7 Designate HP-IB interface as printer output. What is going on here is a little tricky. The statement PRINTER IS 705 designates an HP-IB device at address 705 as the default printer. When the PRINT statement on the next line is executed, the following HP-IB transaction takes place: Send UnListen (UNL) HP-IB command. Send Listener Address 5 (LAD5) command. Send My Talk Address (MTA) command. Send a CR-LF. Transferring S80 To DOS 7 Now this is bogus, in a way -- the HP-IB card on the PC, once you run S80XFER, doesn't have to be addressed -- it is effectively in "listen always" mode and reads everything sent across the HP-IB (commands, data, whatever; it doesn't care). The selection of HP-IB address 5 is arbitrary; the PC doesn't recognize the address. The only important thing that this does is send MTA to the HP-85's HP-IB interface, so it can act as a talker. The CR-LF at the end allows S80XFER to complete its dummy read and throw away the three bus commands (UNL-LAD5-MTA) it has read off the HP-IB. Once that is done, PRINTER IS 7 sets up the HP-IB interface as the default printer output, as before. There's no need to execute a PRINT statement again, since the three HP-IB commands have already been cleared. * Once the HP-85 has been set up as a talker, you can load your HP-85 program and then send it be executing: PLIST When the listing is finished, you end the transaction by executing (from the HP-85): PRINT ">END<" * This scheme works okay if all you want to send is one file, but if you want to send multiple files, you have to go through steps 2 through 5 for each file (since every time you run S80XFER, its HP-IB setup routines assert an IFC signal on the HP-IB -- which clears the HP-85's HP-IB interface so it's not a talker anymore.) But this is easy to fix by modifying S80XFER to contain a loop that begins by asking the following question: Enter file name ('Q' to quit)? When you enter the file name, the revised S80XFER (call it FILEXFER) reads the data sent over the HP-IB, as before, and stores it in the designated file; when you send ">END<" it jumps back to the beginning of the loop and asks for another file name. Transferring S80 To DOS 8 FILEXFER is a simple modification of S80XFER: _________________________________________________________________________ 1160 OPTION BASE 1 1170 ' 1180 ISC=7 1190 MAX=80 1200 ' 1210 N1=6 1220 N2=1 1230 CALL IOCONTROL(ISC,N1,N2) ' Make machine a listener. 1240 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1250 CLS 1260 PRINT "Please configure your Series-80 to talk." 1270 BUFFER$=SPACE$(80) 1280 CALL IOENTERS(ISC,BUFFER$,MAX,ACTUAL) ' Dummy read. 1290 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1300 CLS 1310 ' 1320 REPLY$=SPACE$(80) ' Get file name. 1330 INPUT "Please enter a file name ('Q' to quit): ",REPLY$ 1340 IF REPLY$="Q" OR REPLY$="q" THEN 1610 1350 ON ERROR GOTO 1400 1360 OPEN "O",#1,REPLY$ 1370 ON ERROR GOTO 0 1380 GOTO 1440 1390 ' 1400 CLS ' Error routine for files. 1410 PRINT "Can't open: ";REPLY$ 1420 GOTO 1320 1430 ' 1440 CLS 1450 PRINT "Please print the data from your Series-80 computer." 1460 PRINT "Print '>END<' to end the transfer." 1470 ' 1480 BUFFER$=SPACE$(80) 1490 CALL IOENTERS(ISC,BUFFER$,MAX,ACTUAL) ' Enter data. 1500 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1510 IF LEFT$(BUFFER$,5)=">END<" THEN 1560 ' If end, get out of loop. 1520 PRINT LEFT$(BUFFER$,ACTUAL-2) ' Print data. 1530 PRINT #1, LEFT$(BUFFER$,ACTUAL-2) ' Store it in file. 1540 GOTO 1480 1550 ' 1560 PRINT "File transfer complete!" 1570 CLOSE #1 ' Close file. 1580 CLS 1590 GOTO 1320 ' Get next file name. 1600 ' 1610 CLS 1620 PRINT "Done!" 1630 END _________________________________________________________________________ Transferring S80 To DOS 9 * These experiments were performed on an HP-85 with no HP-IB disk drive, which is a common configuration. However, if you have an HP-85 with an HP-IB disk drive and want to transfer programs from that disk drive to your PC, you have to be somewhat careful. The problem is that, as noted, as long as S80XFER is doing an IOENTERS, it is effectively in "listen always" mode on the HP-IB. That means that if you access the disk drive under such conditions, S80XFER will grab all the bytes in the transaction with the disk drive and dump them to your file -- which is an interesting experiment, if you don't mind watching garbage being spewed across the display of your PC. (I always like watching the "happy face" characters -- who says Big Blue has no sense of humor?) This problem is easy to avoid -- you can always load your program into your HP-85 from disk BEFORE you run S80XFER, and no problem will occur. (If you need to transfer multiple programs using FILEXFER, you can load the program when FILEXFER asks you for the file name -- since FILEXFER isn't performing an IOENTERS when it's waiting for your file name.) However, if you have an extremely big file that cannot be loaded at one time, you may consider scrounging up a second HP-IB interface -- and load your data on one HP-IB, then send it over on the other. * S80XFER and FILEXFER can also be used to transfer numeric data from an HP-85 to a PC; all the HP-85 has to do is set itself up as a talker (as before), read a data file, and print it over the HP-IB. As an example, I created a sample data file on my HP-85 with the following program: _________________________________________________________________________ 10 CLEAR 20 DISP "Creating data!" 30 CREATE "DSET",100,32 40 ASSIGN# 1 TO "DSET" 50 FOR N=1 TO 100 60 PRINT# 1 ; N,1/N,N*N,SQR(N) 70 NEXT N 80 ASSIGN# 1 TO * 90 DISP "Finished!" 100 END _________________________________________________________________________ Transferring S80 To DOS 10 This created a file named "DSET" that contained the integers from 1 to 100, along with the reciprocal, square, and square root of each. I then ran S80XFER on my PC, set up the HP-85 as a talker (as above) and ran the following program -- named PRDAT -- on my HP-85 to send the data over: _________________________________________________________________________ 10 CLEAR 20 DISP "Reading data file!" 30 ASSIGN# 1 TO "DSET" 40 FOR N=1 TO 100 50 READ# 1 ; W,X,Y,Z 60 PRINT USING 70 ; W,X,Y,Z 70 IMAGE 3D,X,D.6D,X,5D,X,2D.3D ! Format: NNN N.NNNNNN NNNNN NN.NNN 80 NEXT N 90 ASSIGN# 1 TO * 100 PRINT ">END<" 110 DISP "Finished!" 120 END _________________________________________________________________________ Note that this program could've just as easily been written to set the HP-85 up as a talker, without user intervention. The end result of the data transfer was a PC data file containing ASCII numeric data: 1 1.000000 1 1.000 2 .500000 4 1.414 3 .333333 9 1.732 4 .250000 16 2.000 5 .200000 25 2.236 6 .166667 36 2.449 ... 99 .010101 9801 9.950 100 .010000 10000 10.000 * But suppose you want to convert the data from its ASCII numeric form into something a PC program can use? How that is done depends on the language you use, but it's easy in GWBASIC: Use the VAL statement (which converts an ASCII numeric string to a numeric value). It is, however, much easier for GWBASIC to convert the ASCII numeric strings if it gets them one at a time (and not four at the time, as in the previous example). Transferring S80 To DOS 11 As a test, I modified HP-85 PRDAT program by changing the following statements: 60 PRINT USING 70 ; W,X,Y,Z 70 IMAGE 3D,X,D.6D,X,5D,X,2D.3D ! Format: NNN N.NNNNNN NNNNN NN.NNN -- to: 60 PRINT W @ PRINT X 70 PRINT Y @ PRINT Z -- and by deleting line 100: 100 PRINT ">END<" I then modified S80XFER as follows to transfer the 400 numbers: _________________________________________________________________________ 1150 ' 1160 OPTION BASE 1 1170 ISC = 7 1180 MAX=80 1190 DIM ARRAY(100,4) 1200 ' 1210 N1=6 1220 N2=1 1230 CALL IOCONTROL(ISC,N1,N2) ' Make machine a listener. 1240 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1250 CLS 1260 PRINT "Please configure your Series-80 to talk." 1270 BUFFER$ = SPACE$(80) 1280 CALL IOENTERS(ISC,BUFFER$,MAX,ACTUAL) ' Dummy read. 1290 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1300 CLS 1310 ' 1320 OPEN "O",#1,"DFILE" 1330 CLS 1340 PRINT "Please print the data from your Series-80 computer." 1350 ' 1360 FOR X=1 TO 100 1370 FOR Y=1 TO 4 1380 BUFFER$ = SPACE$(80) 1390 CALL IOENTERS(ISC,BUFFER$,MAX,ACTUAL) ' Enter data. 1400 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1410 PRINT LEFT$(BUFFER$,ACTUAL-2) ' Print data. 1420 ARRAY(X,Y)= VAL(LEFT$(BUFFER$,ACTUAL-2)) ' Store it in array. 1430 NEXT Y 1440 NEXT X 1450 ' 1460 PRINT "Transfer complete!" 1470 CLS 1480 ' Transferring S80 To DOS 12 1490 FOR X=1 TO 100 1500 PRINT ARRAY(X,1);ARRAY(X,2);ARRAY(X,3);ARRAY(X,4) 1510 NEXT X 1520 ' 1530 PRINT "Done!" 1540 END _________________________________________________________________________ Worked neatly (or at least it did after I realized that the CLEAR command in GWBASIC is NOT the same as CLS -- CLEAR doesn't clear the screen, it reinitializes all the variables!) * While the examples above were written for an HP-85, they work just as well on the HP-86/87 -- with a few conditions: % The HP-86/87 computers always used external disk drives; the comments I made about using an external disk drive with the HP-85 are applicable here. % None of the HP-86/87 computers have a built-in I/O ROM, but they all have the printer capabilities provided by the Plotter/Printer ROM built in. * While there's less need to send data and programs from the PC back to Series 80, it can be done just as easily as the reverse ... here's how it's done. The following GWBASIC program uses the HP-IB Command Library to read a file and send it over the HPIB: _________________________________________________________________________ 10 ' HP-IB SETUP code goes here. ... 790 OPTION BASE 1 800 ' 810 ISC=7 820 ' 830 N1=5 840 N2=1 850 CALL IOCONTROL(ISC,N1,N2)' Make machine a talker. 860 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 870 ' 880 CLS ' Get file to send. 890 REPLY$=SPACE$(80) 900 INPUT "Please enter the file name ('Q' to quit): ",REPLY$ 910 IF REPLY$="Q" OR REPLY$="q" THEN 1260 ' Stop if 'Q'. 920 ON ERROR GOTO 970 930 OPEN "I",#1,REPLY$ 940 ON ERROR GOTO 0 950 GOTO 1000 960 ' 970 PRINT "Can't open: "REPLY$ 980 GOTO 890 990 ' Transferring S80 To DOS 13 1000 CLS 1010 BUFFER$=SPACE$(80) 1020 LENGTH=0 1030 CALL IOOUTPUTS(ISC,BUFFER$,LENGTH) 1040 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR ' Clear HPIB. 1050 ' 1060 CLS 1070 ' 1080 IF EOF(1) GOTO 1160 ' Check for last line of file. 1090 LINE INPUT #1,BUFFER$ ' Get line from file. 1100 PRINT BUFFER$ ' Display it. 1110 LENGTH = LEN(BUFFER$) 1120 CALL IOOUTPUTS(ISC,BUFFER$,LENGTH) ' Send it over HP-IB. 1130 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1140 GOTO 1080 1150 ' 1160 CLOSE #1 ' Close input file. 1170 BUFFER$=">END<" ' Send terminator. 1180 LENGTH=LEN(BUFFER$) 1190 CALL IOOUTPUTS(ISC,BUFFER$,LENGTH) 1200 IF PCIB.ERR<>NOERR THEN ERROR PCIB.BASERR 1210 PRINT "File transfer complete!" 1220 INPUT "Do you want to transfer another file (y/n)";REPLY$ 1230 CLS 1240 IF REPLY$="Y" OR REPLY$="y" GOTO 900 1250 ' 1260 CLS 1270 PRINT "All done!" 1280 END _________________________________________________________________________ This program is easy to use; all you do is run it, and it asks: Please enter the file name ('Q' to quit): If you enter "Q", the program ends immediately; otherwise the program hangs, waiting for the S80 to take the first line. Once the S80 begins reading the HP-IB output, the GWBASIC program begins to pump out the lines of the input file (note that it echoes each line to the PC display as a check). Once the file has been read, the GWBASIC program sends an ">END<" termination string over the HP-IB and then displays: File transfer complete! Do you want to transfer another file (y/n)? If you enter "Y", the program asks you for another file; if you enter any other letter, the program stops. Transferring S80 To DOS 14 * Of course, there has to be a matching program on the S80 side to read the data sent over; the following HP-85 program does the job: _________________________________________________________________________ 10 OPTION BASE 1 20 RESET 7 ! Clear HP-IB. 30 DIM B$[256] 40 CLEAR 50 DISP "WAITING FOR DATA." 60 DISP "PRESS 'CONT' WHEN READY." 70 PAUSE 80 ON ERROR GOTO 90 ! If PC sends, IFC, set up again. 90 CLEAR 100 DISP "DATA:" 110 SEND 7 ; MLA ! Make HP-85 a listener. 120 ENTER 7 ; B$ ! Dummy read to clear bus. 130 ENTER 7 ; B$ ! Read line. 140 IF B$=">END<" THEN 170 ! Check for terminator. 150 DISP B$ ! Display the line. 160 GOTO 130 ! Get next line. 170 DISP ! Finished ... 180 DISP "All done!" 190 END _________________________________________________________________________ This program is easy to operate, too -- all you have to do is run it, and it comes up with: WAITING FOR DATA. PRESS 'CONT' WHEN READY. When you press CONT, it clears the HP-85's display and then displays: DATA: -- then lists the data sent from the PC, and finally displays: All done! By the way, it doesn't really matter what sequence you run the two programs in -- it will work either way, one program will hang on the bus until the other one is ready. Note that the program does a "dummy read" of the HP-IB before it starts reading the data sent over the bus. This is because the GWBASIC program on the other end does a "dummy send" before it starts to make sure that the MTA command it sends over the bus is cleared before it sends data; the dummy read on the HP-85 side gets rid of this line before reading the data. * However, all this program does is read the data and display it; it will have to be modified if you want to actually process the data on the HP-85. Transferring S80 To DOS 15 As an example, the following revision of the program stores the data into an DATA file for later use: _________________________________________________________________________ 10 OPTION BASE 1 20 RESET 7 ! Clear HP-IB. 30 DIM B$[256] 40 CLEAR 50 DISP "SIZE OF FILE (BYTES)"; ! Get size of file. 60 INPUT S 70 CLEAR 80 ON ERROR GOTO 100 ! Purge "PGM" file if it exists. 90 PURGE "PGM" 100 OFF ERROR 110 CREATE "PGM",INT(S/230)+1 ! Create "PGM" file. 120 ASSIGN# 1 TO "PGM" ! Open it. 130 DISP "WAITING FOR DATA." 140 DISP "PRESS 'CONT' WHEN READY." 150 PAUSE 160 ON ERROR GOTO 170 ! If IFC, set up HP-IB again. 170 CLEAR 180 DISP "PROGRAM:" 190 SEND 7 ; MLA ! Make HP-85 a listener. 200 ENTER 7 ; B$ ! Dummy read to clear HP-IB. 210 ENTER 7 ; B$ ! Get line. 220 IF B$=">END<" THEN 260 ! If terminator, jump out of loop. 230 DISP B$ ! Display line. 240 PRINT# 1 ; B$ ! Store it in file. 250 GOTO 210 ! Get next line. 260 DISP 270 DISP "All done!" 280 ASSIGN# 1 TO * ! Close file. 290 END _________________________________________________________________________ This program is exactly the same as the previous one, except that it stores the data in a DATA file -- named "PGM" -- and so asks the user up front: SIZE OF FILE (BYTES)? This step is necessary since the file size must be specified when creating an ASCII file. The file is named "PGM" because it can be used to send a program listing from the PC to the HP-85; once the program is there, the GETSAVE binary can be used to bring the file into the HP-85's BASIC interpreter for operation. * This example is used for ASCII files. If you want to send numeric data, you can send it as ASCII numeric strings and use the HP-85 VAL statement to convert it to binary for use or storage as binary in a DATA file. [%%] Transferring S80 To DOS 16 [4] Transferring Files Over Serial * Sending programs or data over a serial link from an S80 to a PC is a simple and generally cheap means of transferring such information if you have a serial card for the S80. Sending programs or data from an S80 to a PC is simple. It requires the following equipment: % PC data communications software that can perform ASCII file transfers. % A PC with a serial port. % An S80 82939A (standard, no option) serial card. % A 24542M modem cable. % For an HP-85, a plotter/printer or I/O ROM (not needed on HP-86/87). The precise details of the transaction will change, depending on the PC data communications software used, but as an example I performed the transfers using the "Telecommunications" option provided by my PCTOOLS DESKTOP software package. DESKTOP is a compact software package that provides a simple text editor, database, calculators, and so on -- plus a simple terminal emulator that permits ASCII file transfers (where data is sent as a stream of ASCII characters and dumped to a file). There are a wide variety of other products with similar capabilities; if it can be done with DESKTOP's rudimentary terminal emulator, it can be done with almost anything. * I linked my HP-85 to my Vectra PC by linking the S80 82939A serial card to the Vectra's 9-pin COM1 serial port over the 24542M modem cable. I had already configured the S80 serial card to the following defaults: % Interface select code (ISC) 10, which is the card's default. % 9600 baud. % 8 data bits. % 1 stop bit. % No parity. This was done by opening the serial card with a cross-head screwdriver and setting the two DIP switch packs as follows: +-----------------+ OFF 0 | +-+ +-+ +-+ +-+ | | |X| | | | | | | | | +-+ +-+ +-+ +-+ | | | | |X| |X| |X| | ON 1 | +-+ +-+ +-+ +-+ | +-----------------+ 1 2 3 4 +-----------------------------------------+ OFF 0 | +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ | | |X| |X| |X| |X| | | | | | | | | | | | | | | +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ | | | | | | | | | | |X| |X| |X| |X| |X| |X| | ON 1 | +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ | +-----------------------------------------+ 1 2 3 4 5 6 7 8 9 10 I was then ready to send information from the S80. Setting up the PC to receive the information was even simpler. Transferring S80 To DOS 17 I ran DESKTOP on my PC, then pressed "T" to select "Telecommunications" from the main menu. When the telecommunications panel popped up, I pressed "ALT-E" to select the "Edit" menu, and pressed "C" to select "Create new entry." This brought up the following screen that allowed me to specify the configuration for a communications transaction: +--------------------------------------------------------------------+ | NAME: s80 | | PHONE NUMBER: | | SCRIPT FILE: | | | | TERMINAL PORT PARITY DUPLEX DATA-BITS STOP-BITS | | (*) TTY (*) COM1 (*) NONE (*) FULL ( ) SEVEN (*) ONE | | ( ) COM2 ( ) ODD ( ) HALF (*) EIGHT ( ) TWO | | ( ) COM3 ( ) EVEN | | ( ) COM4 ( ) SPACE | | ( ) MARK | | | | BAUD DIALING END-OF-LINE PROCESSING FLOW +------+ | | ( ) 300 (*) TONE RECEIVE SEND CONTROL |ACCEPT| | | ( ) 1200 ( ) PULSE ( ) ADD LF ( ) STRIP LF ( ) XON/XOFF +------+ | | ( ) 2400 ( ) ADD CR ( ) STRIP CR (*) NONE +------+ | | ( ) 4800 (*) NONE (*) NONE |CANCEL| | | (*) 9600 +------+ | | ( ) 19200 | +--------------------------------------------------------------------+ I set the various fields as shown (I didn't specify a phone number since I had a direct connection from the Vectra PC to the S80), selected "ACCEPT" and returned to the Telecommunications panel. I moved the cursor to the "s80" entry in the panel, pressed "Alt-A" to select the "Actions" menu, then pressed "M" (for "Manual") to set up the connection. The Telecommunications panel then went into on-line mode, and I pressed the "F6" softkey to receive an ASCII transfer; a panel popped up to ask for a file to dump the received data into, so I entered an arbitrary file name -- "C:\JUNK" -- and selected "Save"; a panel popped up to indicate that the file did not exist; I selected "OK" to proceed. Now I was ready to send an S80 program over the serial link to the PC. I LOADed a program on the S80 entered: PRINTER IS 10 -- to enable the serial port as printer output, and then entered: PLIST This listed the program over the serial link to the PC; DESKTOP displayed the listing and stored it into C:\JUNK. When the listing was complete, I went back to DESKTOP and pressed the F8 softkey to close C:\JUNK. All done. Transferring S80 To DOS 18 * Sending a DATA file from the S80 to the PC works exactly the same way on the PC side (as far as the PC knows or cares, the data is just a stream of ASCII characters) but it is a little more complicated on the S80 side. The user must write an S80 BASIC program to execute PRINTER IS 10, read the data in from the file, and then PRINT it (in the desired format) over the serial link. If you have an S80 program -- like FILE/80 or WORD/80 -- that can print its data files on its own, you can simply specify the printer as 10 and print the data across directly. * Sending information in the other direction is a little trickier, at least on the S80 side, since S80s are very slow; provisions must be made on the S80 for "flow control" so that the PC will not send information faster than the S80 can receive it (otherwise information will be lost). The S80 must also have an I/O ROM so it can ENTER serial information ... note again that the I/O ROM is built into the HP-85B, but NOT into any other S80 model. However, the process is easier on the PC side, since there is no need to use telecommunications software; all you have to do is use the DOS PRINT command and print the data file to a COM port. Using the DOS PRINT command leads to a simple means of flow control; most printers are slow and so can temporarily halt serial data flow by setting a serial control line (DSR) to "0", and then enable it again by setting the line to "1". Even this sort of flow control is not absolutely reliable on an S80 at high baud rates, since the PC may be halfway through sending a character when the S80 clears the DSR line, which causes the character to be lost. This means that low baud rates (like 1200 baud) need to be used. * As an example, I sent a DOS TEXT file containing a program listing back to the S80 over serial. I used the same hardware configuration and switch settings as before; I didn't bother to open up the S80 serial card to change the baud rate, since it was simpler to change it programmatically. I wrote the following S80 program to read in the serial data and write it to the display: ____________________________________________________________________ 10 CLEAR 20 DIM B$[256] ! Define buffer to accept serial data. 30 RESET 10 ! Reset serial port. 40 CONTROL 10,3;8 ! Set baud rate to 1200 baud. 50 ! 60 DISP "Waiting for input:" 70 ASSERT 10;7 @ ENTER 10;B$ @ ASSERT 10;3 ! Set DSR, ENTER, clear DSR. 80 DISP B$ ! Display data. 90 IF B$#">END<" THEN 60 ! If not last line, then get next line. 100 ! 110 DISP "Done!" 120 END ____________________________________________________________________ Transferring S80 To DOS 19 * I ran this program and went back to the PC. The first thing I did was edit the file I wanted to send by placing a line containing the string ">END<" as the very last line of the file; this allowed the S80 to exit from the file transfer gracefully. Then I set up the proper serial parameters with the DOS MODE command: MODE COM1:1200,N,8,1,P -- and printed the file across using the DOS PRINT command, specifying COM1 as the PRINT output. * All this S80 program does is display the data sent to it; what actually needs to be done in practice with the data depends on the application. Consider the problem of sending a program to an S80 in a form that can be run on the S80. Normally, S80 programs are STORED as a series of binary tokens that correspond to BASIC statements; the S80 LOAD statement assumes a tokenized program file, and will give an error message if it is used to attempt to LOAD a program stored as a listing of ASCII text. Fortunately, the GET/SAVE binary can read such a listing into the interpreter, as long as you have saved the ASCII listing in the appropriate format. I modified the example program to store the serial data in a file as well as dump it to the display: ____________________________________________________________________ 10 CLEAR 20 DIM B$[256] ! Define buffer to accept serial data. 30 RESET 10 ! Reset serial port. 40 CONTROL 10,3;8 ! Set baud rate to 1200 baud. 50 DISP "Size of file (in bytes)?" ! Get file size. 60 INPUT F1 70 CLEAR 80 ON ERROR GOTO 100 ! Destroy old file (if it exists). 90 PURGE "PGM" 100 CREATE "PGM",INT(F1/230)+1 ! Create file of proper size. 110 OFF ERROR 120 ASSIGN# 1 TO "PGM" ! Open file. 130 ! 140 DISP "Waiting for input:" 150 ASSERT 10;7 @ ENTER 10;B$ @ ASSERT 10;3 ! Set DSR, ENTER, clear DSR. 160 DISP B$ ! Display data. 170 IF B$=">END<" THEN 210 ! If line, then quit. 180 PRINT# 1 ; B$ ! Dump line to file. 190 GOTO 150 ! Get next line. 200 ! 210 DISP "Done!" 220 ASSIGN# 1 to * Close file. 230 END 120 END ____________________________________________________________________ Transferring S80 To DOS 20 This program works the same as the previous one, with the addition of statements for creating a file and storing data into it. Note that it always creates the file as "PGM"; if this is a problem, the program could be modified to ask the user for a name. Note that it also asks the user for the size of the file that is to be sent across, since the S80 must specify the number of records (each 256 bytes long) needed to store the file. (I divide the file size by 230 instead of 256 since there is a certain overhead required for each string stored in the file; I inflate the file size by 10% to compensate.) I performed the same procedure as before to print an S80 listing from the PC to the S80 when the transfer was complete, I performed: GET "PGM" -- and then ran the program, no problems. * The standard S80 82939A serial card is configured as a female DCE ("Data Communications Equipment" -- meaning it's wired like a modem) connection; there is also an 82939A Option 001 which is configured as a male DTE ("Data Terminal Equipment" -- meaning it's wired like a terminal) connection. Just for the sake of completeness, I found an Option 001 card and hooked it to my Vectra PC with a 24542G cable and 92222F (female-on-each-end) sexchanger. The transfers were performed exactly the same as before, with one difference: handshaking has to be performed with the DTR line instead of the DSR line, so the statements in the example programs that performs the ENTER has to be changed to: ASSERT 10;7 @ ENTER 10;B$ @ ASSERT 10;6 ! Set DTR, ENTER, clear DTR. [<>]