XFER4171 - Direct File Transfer between HP71 and HP41 computer. Copyright 1988 by Michael Markov XFER4171 consists of two complementary programs, XFER41 and XFER71 that run on the HP71 and HP41, respectively. These programs allow you to transfer files and data freely between the two machines, to include HP41 PRogram files, which are stored in a dedicated HP71 text file called PR41, TEXT (AScii) files, Extended Memory Data files, and data stored in data registers such as R00 - R??. This file documents these programs and provides user instructions. HP71 REQUIRES EDLEX AND THE HPIL MODULE HP41 REQUIRES THE HPIL MODULE AND HP82183A EXTENDED I/O MODULE. Obviously, you also need Extended Memory in order to transfer AScii (TEXT) or data files. HP41CX capability is assumed. THE "PR41" TEXT FILE IS ASSUMED TO EXIST IN THE HP71. It is used to store HP41 program files in the format required by INP and OUTP. It should be created with CREATE TEXT PR41 if it does not already exist. USER INSTRUCTIONS: To insure trouble-free operation, type RESET HPIL on the HP71, and turn it OFF. Turn the HP41 off, and connect the HP41 to the HP71. You should NOT connect other peripherals in the loop, since it slows communications on the loop. In particular, avoid connecting a thermal printer, since the printer mode switch position / presence affects HP41 flags and output modes. You may leave the HP71 off, or press [ON]. DO NOT RUN PROGRAMS, AND DISABLE THE STARTUP OPTION IF YOU CHOOSE TO LEAVE THE HP71 OFF. "Wake-up" conditions w/o STARTUP minimize problems. DO NOT PRESS KEYS OR OTHERWISE LOAD STUFF INTO THE INPUT BUFFER. Turn the HP41 ON, and XEQ any of the HP41 routines listed below. Keep in mind that most of the routines require a filename in the alpha register. See below. Thereafter, you may XEQ other routines, as desired. You should not have to repeat the above initialization routine unless some error occurs. The HP71 is forced into device mode by the HP41. No action needs be taken on the HP71. HOWEVER, the HP71 may not be running programs or be in CALC mode. It is possible to check HP71 status to determine whether it is "busy" using the REQUEST (HP71) instruction and INSTAT (HP41). Such testing is NOT implemented because otherwise the size of the HP41 control programs grows rapidly. The HP41 sends out IFC frames to takeover control of the loop, then puts the HP71 into REMOTE mode and tells it to CALL XFER41... thereafter, information is exchanged to tell the HP71 what to do, ie., the option number and filename. The carefully choreographed exchange continues until the job is done. To the extent possible, work is done by the HP71 to minimize HP41 overhead. Currently, the following options are available: [0] Send HP71 directory to the HP41. XEQ "DIR71" on the HP41. Alpha reg. : N/A [1] Download an HP41 program file from HP71. XEQ "LOADP" on the HP41. Alpha reg. must contain the name of the file to be downloaded, 7 chars. max [2] Upload an HP41 program file to the HP71. XEQ "STOP " on the HP41. Alpha reg. must contain the name of the file to be uploaded, 7 chars. max [3] Upload an HP41 TEXT file. XEQ "UPTXT" on the HP41. Alpha reg. must contain the name of the file to be uploaded, 7 chars. max [4] Download an HP41 TEXT file. XEQ "DNTXT" on the HP41. Alpha reg. must contain the name of the file to be downloaded, 7 chars. max If a record is more than 254 bytes long, it is subdivided into 254 byte records (max allowed by HP41). [5] Send HP41 printed output to an HP71 TEXT file. XEQ "PR71" on the HP41. Alpha reg. must contain the name of the HP71 text file into which the "printed" output is to be stored. 8 chars. max The HP71 will continue to store output until you XEQ "PREND". In this mode, you can upload the contents of data registers with PRREG, PRREGX, PRSTK, ect. KEEP IN MIND THAT THE DISPLAY MODE CONTROLS SIGNIFICANT DIGITS... F/E 9 (FIX/ENG 9) OR SCI 9 MODES ARE REQUIRED TO INSURE MAXIMUM PRECISION FOR THE INFORMATION TO BE UPLOADED. ==>CAUTION, NNN'S MAY BE NORMALIZED. F/E 9 mode can be set with the FE routine. Alternatively, use the F/E keyword (CCD ROM). NOTE THAT YOU MUST USE THE "PR71" OPTION IF YOU WANT TO UPLOAD THE CONTENTS OF DATA REGISTERS OR DATA FILES IF ANY STRINGS ARE STORED IN THE SUBJECT FILE OR DATA REGISTERS. [6] Purge an HP41 program file out of PR41. XEQ "PURPR" on the HP41. Alpha reg. must contain the name of the file to be purged. 7 chars. max. PURPR allows you to purge ONLY HP41 PRogram files. Other HP71 files can be purged more efficiently using the HP71 PURGE instruction. [7] Upload an HP41 data file from Extended Memory to an HP71 SDATA file. XEQ "UPDAT" on the HP41. CAUTION: FOR NUMERIC DATA ONLY! Alpha reg. must contain the name of the file to be uploaded. 7 chars. max. [8] Download an HP71 SDATA file and stuff it into an Extended Memory data file. XEQ "DNDAT" on the HP41. (numeric data only) Alpha reg. must contain the name of the file to be downloaded. 7 chars. max You can verify the validity of the HP41 program checksum, the last two bytes sent by OUTP as follows: (incoming) IF HTD(A$[1,4])#(LEN(A$)-6)/2 THEN 'ERROR' S=0 @ FOR I=1 TO LEN(A$)-3 STEP 2 @ S=S+HTD(A$[I,I+1]) @ NEXT I IF A$[LEN(A$)-1]#DTH$(S)[4] THEN ERROR... Given the above information, it should be relatively easy to write a software development system for the HP41 that runs on the HP71. XFER41 and the associated HP41 programs in the XFER71 file take care of uploading and downloading the stuff directly. The HP71 could just as easily store the data on mass storage for indirect transfers. See TPRP41D (HP75) on CHHU03. TPRP41D implements a simple scheme for translating HP41 program hex code to the equivalent RPN mnemonics. This could be improved upon by writing a LEX file. SDATA files consist of an integer multiple of 8 byte registers. The least significant digit is "lost" when using HP41 seven byte registers. Also, the HP71 STD and (FIX / SCI / ENG ) (10 or 11) modes can cause the ascii representation of numbers sent by OUTPUT to be incompatible with IND, because IND cannot handle a mantisa with more than 10 digits... HP71 TEXT files have 2 byte "length-of-record" headers, while the HP41 supports only 1 byte "length-of-records". HP41 text files therefore take less room than equivalent HP71 files. HOWEVER: HP41 text file records cannot exceed 254 bytes in length. 0600 CALL XFER41 0610 SUB XFER41 0620 DIM F$,A$[4500],B$[4500] @ REAL N ! we want to be able the largest program 0630 STD @ CONTROL OFF @ STANDBY ON ! device mode, wait forever if need be ! for HP-IL response. 0640 ASSIGN #1 TO PR41 * now that initial setup is done, find out the desired option 0650 ENTER :LOOP ;N$ @ IF N$='0' THEN 'OPT0' ! DIR71 does not need a filename 0660 ENTER :LOOP ;F$ ! Get the filename, or whatever * filenames are 7 chars. maximum. We do not (yet) handle name,newname choices 0670 F$[8]='' @ GOTO 'OPT'&N$ ! effectively, GTO IND