Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!inria!litp!pda From: pda@litp.ibp.fr (Pierre DAVID) Newsgroups: comp.sys.handhelds Subject: Saturn Assembler (Part 3/8) Message-ID: <3304@litp.ibp.fr> Date: 5 Jul 90 16:22:33 GMT Reply-To: pda@litp.ibp.fr.UUCP (Pierre DAVID) Organization: M.A.S.I., Universite P. & M. Curie, Paris, FRANCE Lines: 1038 #---------------------------------- cut here ---------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Pierre David on Sun Jul 1 12:32:54 1990 # # This archive contains: # areuh/doc/readme.dos areuh/doc/compc.doc # areuh/doc/areuh110.doc # # Error checking via wc(1) will be performed. LANG=""; export LANG PATH=/bin:/usr/bin:$PATH; export PATH echo x - areuh/doc/readme.dos cat >areuh/doc/readme.dos <<'@EOF' HP-71 DEVELOPMENT SYSTEM NOT FOR COMMERCIAL DISTRIBUTION - NOT FOR COMMERCIAL DISTRIBUTION - NOT FOR MMERCIAL DISTRIBUTION - NOT FOR COMMERCIAL DISTRIBUTION - NOT FOR COMMERCIA ISTRIBUTION - NOT FOR COMMERCIAL DISTRIBUTION - NOT FOR COMMERCIAL DISTRIBU Notice : this is a public domain software. You are encouraged to make copies of it. Feel free to distribute it. The only restriction is that it cannot be distributed on a commercial basis. INTRODUCTION ------------ This disk contains the AREUH development system. It is intended to produce LEX or BIN files for the HP-71B, using a PC or compatible computer. This system includes an assembler, a linker, a message table generator, and miscellaneous useful tools. It is a sophisticated set of programs. They have been optimized for speed without compromising capabilities. The assembler is able to process source files either compatible with Forth / Assembler Rom or HP development system. It should be able to understand all source file formats. The linker is a convenient tool to develop large projects as well as small ones. The table message generator (like other tools) is very easy to use, and greatly simplify the creation of such tables. It was written by Pierre David and Janick Taillandier, from PPC-Paris. We are happy to thank Stephane Barizien for its efficient help for all MS-DOS problems. As described above, you are welcome to copy and distribute it free. We hope it will help HP-71 software development. It is our common interest. It was used by the authors to develop : - JPCROM (19+ KB Lex file, 461 KB source files, assembled in 2.20 minutes) JPCROM is the PPC-Paris LEX file, including 100 various keywords. - GRAPHIC (9 KB Lex file, 290 KB source files, assembled in 1.15 minutes) GRAPHIC is a commercial product, providing graphic capabilities similar to HP-85, HP-41, HP-200 graphic languages on a ThinkJet (MOVE, DRAW, LABEL...). I - HISTORY ----------- The AREUH development system (AREUH stands for Assembleur Relogeable En Utilisation Heuristique) was developed from April to August 1986 on a UNIX machine : the HP Integral Personal Computer. Unfortunately, many people are now using PC or compatible. So, in July 1987, we have decided to adapt AREUH to these so called computers. The process was rather hard for us : we had to find a PC, a C compiler, an HPIL card, etc. We also had a lot of difficulties with the surprising C compiler implementation, as well as with the numerous but powerless text editors... We have no personal interest in this MS-DOS version. It was a tough job to get it work, and we get no profit from it. This was done to allow all HP-71 developers to benefit from our tool and stop using archaic ones, and we hope to see more HP-71 software. We wish this could help. We hope the time we have spent on this project will not be a wasted time. We would appreciate receiving feed-back from you. It would also be nice to mention that your software has been developed with this assembler. II - WHY A LINKER ? ------------------- If you take a look at the IDS Vol. III, or HPIL IDS, you may notice that HP used a linker. Other large projects, such as JPCROM or GRAPHIC have been using a linker. Using a linker allows splitting a large problem into small, manageable units : you have only small files to edit and assemble. You divide your problem into functional units, with clear interfaces. You work on one module at a time, you don't have to take care of the others. Incidentally, you spare time because you have only one module to assemble, and you have small convenient facilities, such as local labels known only inside the module, and global ones known everywhere. III - PRINCIPLE --------------- A : THE TWO MODES ----------------- The assembler has two operating modes : - compatibility mode - modular mode The first one is intended to assemble all source files written for the Assembler Rom. All macro-operations such as LEX, BIN, CHAIN... are supported. No linkage step is needed. The second one is similar to the description given in IDS Vol. I, chapter 16. In fact, it has more features than this one. This mode needs a linkage step, and supports local and global labels. A global label is preceded by an "=" character. To use the compatibility mode, the first line of the file must be a LEX or BIN macro-operation. Any other first line activates modular mode. If you wish to use system entry points in compatibility mode, you can use the RDSYMB macro-operation. It will read the specified file to load all supported entry points. You don't need any more to write long lists of EQU to use system entry points. In modular mode, everything is automatic. The system entry points addresses are loaded at link time. In both modes, you cannot use FORTH, WORD and WORDI macro-operations. In modular mode, you cannot use LEX, ID, MSG, POLL, ENTRY, CHAR, TOKEN, KEY, ENDTXT, BIN and CHAIN. B : LISTINGS ------------ You can output assembler or linker listings, with optional complete cross-reference section. For an example, see FINPUT listing in JPC43 (April 1987). C : ADDED FEATURES ------------------ Compared with the Assembler Rom, or HP's one, the following features have been added : - label names may have up to 12 significant characters (13 if they are preceded by an "=" symbol). - all opcodes and modifiers are not case sensitive. You can mix freely lower and upper case characters. Label names are always case sensitive. - conditional assembly is allowed, with macro-operation IF. The syntax is : IF ELSE ENDIF The ELSE part is optional. - the macro-operation RDSYMB (ReaD SYMBol) was implemented to load a file containing entry points. The syntax is : RDSYMB In this MS-DOS version, can be an absolute file reference (such as a:\lib\hp71.ep), or a relative one. In the last case, the file is looked for in specific locations. - D0=HEX and D1=HEX, undocumented and bugged opcodes in the Assembler Rom are present and unbugged ! - numerical values are processed on 6 hexadecimal digits (nibbles), as in HP's assembler. This allows providing LC(6) and CON(6) instructions. - litteral constants may be delimited either by ' (quote) or by \ (backslash) symbols. - there is no limit on parenthesis level. - a new constant type is supported : binary constants. They are used with a % symbol : for example : %01110001 = #71 = 113. - new operators have been added. They are ~ -> *256+ ^ -> power ` -> one's complement All operators are listed below, in descending order or precedence. ~ (*256+) ^ (power) - (unary minus) ` (one's complement) & (logical and) ! (logical or) * (multiplication) / (integer division) + (addition) - (binary subtraction) - FiLeNd label is automatically added at the end of each assembled file or module. In modular mode, a global label =FiLeNd is automatically added after the last module during link step. IV - USING THE PROGRAMS ----------------------- A : File naming conventions : ----------------------------- - source files have the ".as" (Areuh Source) extension, - object file resulting from assembly in modular mode have the ".ao" (Areuh Object) extension, - list files have the ".al" (Areuh List) extension, - message description files have the ".am" (Areuh Message) extension, - entry points files have the ".ep" (Entry Point) extension, - complete lex files (result of aas in compatibility mode or ald) are named "lex". These are suggested names. You can override them using full names. However, using them is easier. B : Assembler (aas) and Linker (ald) ------------------------------------ Both programs share the same options. -o specifies the name of output file. If the specified name is a directory, the output file is written in this directory, using default name. -a produces a listing in the specified file. If the specified name is a directory, the listing file is written in this directory, using default name. -A produces a listing on standard output. -l specifies the physical page length in number of lines (default is 72, for 12" paper). Text length is (page length - 6). -x asks for a cross-reference table. Should be used only when -a or -A options are specified. -p enables interactive options input. If no option or file name is specified after aas or ald, you automatically enter interactive prompt mode. After aas, you have to supply the source file names (wild card characters allowed). File names order is irrelevant. After ald, you have to supply the intermediate file names (wild card characters allowed). File names order is very important, it corresponds to the link order. The linker is limited to 80 files. As far as MS-DOS command lines are limited to a small numbers of characters, you may have difficulties to specify a full ald command. In this case, you can use interactive prompting : ald : For example : =eDIRFL:Directory Full If you want to use building blocks, the building block text must be enclosed within square brackets, for example : =eUNEXP:Unexpected [Message ] [Message ] (with a white space) is a local building block. It will be created in the message table. Amg recognizes automatically mainframe building blocks. For example : =eBADMD:[Invalid ]Mode [Invalid ] (with a white space) is a mainframe building block. The message table will reference it without creating it. Messages are numbered from 0. If an argument is given, it must be a number, and messages will be numbered from it. Amg checks that there is a message whose total length is multiple of 16 nibbles, as requested by the HP-71 Operating System. Otherwise, an error is written in the generated file. D : Downloading to HP-71 : -------------------------- Two utilities are provided to download the assembled files to the HP-71. You can use either the RS232 interface or the HP82973 HPIL interface. RS232 : (program a2rs) ---------------------- The syntax is : a2rs [ ] If no file name is specified, the default is "lex". For the connection, we have used the following cable : PC HP82164A RS232/HPIL 2 ----\ /---- 2 x 3 ----/ \---- 3 4 ----\ /---- 4 x 5 ----/ \---- 5 6 ----\ /---- 6 x 20 ----/ \---- 20 7 ----------- 7 The HP82164A must be configured from the HP-71 by : REMOTE @ OUTPUT :RS232;"LI5;C0" @ LOCAL before running a2rs, you have to enter on your HP-71 : COPY :RS232 HPIL : (program a2lex) ---------------------- Prior to transfer your assembled file, you must use a2lex to convert the file to the format needed by HPILLINK. The syntax is : a2lex [ ] If no file name is specified, the default is "lex". The ".lex" extension is automatically appended to the converted file. Then, you can download using HPILLINK. CUSTOMIZING YOUR DOWNLOADING PROGRAM : (program a2?) ---------------------------------------------------- The syntax will be : a2? [ ] If no file name is specified, the default is "lex". In order to allow you to use any device you may wish to download your LEX, we give you the source code for a2lex (file a2lex.c) as an example. You have to write only three functions in C : init () : initializes your interface output (char c) : outputs the character c to your interface term () : terminates the process. These functions can be empty. They are only responsible for the interface, and not for the conversion process. V - EXAMPLES ------------ To assemble "compat.as" (compatibility mode), you must type : aas compat The output will be in "lex" file. To assemble "compat.as" with listing and cross-reference section, sent to file "list", type : aas -xalist -l66 compat or aas -x -a list -l 66 compat.as To assemble the same file with interactive options input, simply type : aas then enter "compat" then press [RETURN] (output is default, "lex") then enter "list" (for listing file) then enter "yes" (for cross reference) then enter "66" (for page length) To assemble files "x1.as", "x2.as", "x3.as" (modular mode), you must type : aas x*.as or aas x1 x2 x3 To link these files, with a listing and cross-reference in file "list", and a lex file in "totolex", you must type : ald -xalist -ototolex x1 x2 x3 Warning : the order of object modules if important. To create a message table from "jpc.am", you must type : amg mes.as If you wish to number these messages starting from 27, you must type : amg 27 mes.as VI - ENTRY POINTS FILES ----------------------- AREUH is provided with two files : hp71.ep : mainframe supported entry points and symbols hpil.ep : hpil supported entry points These files are looked for in the following directories : current directory c:\hp71\ c:\lib\hp71\ c:\lib\ c:\areuh\lib\ or at the location specifed by RDSYMB. You can add entry points to these files, or use other files. Only hp71.ep is automatically loaded at link time. If you want to use hpil.ep or your own file, you must load them explicitly at assembly time with RDSYMB. The supplied files are sorted in reverse order. This is only for speed considerations. Each label has its name, followed by its hexadecimal value on the next line. If you find any error in these files, please inform us. VII - IN CASE OF PROBLEMS ------------------------- If you have a problem, before reporting it to us, please check if the problem is not in your source code or computer system. We will try to answer your questions or solve your problems (NOT hardware or connection problems). Send us on a 3.5" LIF (or MS-DOS) format your source code, with a complete description and localization of your problem. This is not a programming aid service... Write to : Pierre David or Janick Taillandier 33 Bd St Martin 335 rue Lecourbe 75003 Paris 75015 Paris FRANCE FRANCE APPENDIX 1 : DISTRIBUTION DISK ------------------------------ This disks contains the following files : aas.exe Areuh ASsembler ald.exe Areuh LoaDer (Loader = Linker under UNIX) amg.exe Areuh Message table Generator a2lex.exe Areuh To HPILLINK LEX format a2rs.exe Areuh To RS232 adp.exe Areuh DumP (utility to dump intermediate files) readme This file xmp\compat.as Example for compatibility mode xmp\x1.as Example for modular mode (file header) xmp\x2.as Example for modular mode (execution routine) xmp\x3.as Example for modular mode (decomparse routines) xmp\jpc.am Example of message table description (from JPCROM) src\copy.h body of a2lex program src\a2lex.c dedicated I/O routines lib\hp71.ep HP-71 supported entry points and symbols lib\hpil.ep HP-IL supported entry points APPENDIX 2 : MS-DOS NOTE ------------------------ These programs have been successfully tested on an HP 150, MS-DOS 2.11 and on an AT compatible MS-DOS 3.20. We have used Microsoft C 4.0 to compile all programs. Enjoy ! Pierre David & Janick Taillandier @EOF set `wc -lwc areuh/doc/compc.doc <<'@EOF' COMMUNICATION HP-71 <=> PC Michael Markov (PPC Paris 301) This file documments three HP-71 programs I use to upload and download files to and from my HP110. They can also be used to do the same with IBM PC or compatible machines equipped with an HP82973 HPIL Interface. Why do I need special programs to do this, when HPILLINK provides the ability to upload and download files from the PC keyboard? Because I only want to exchange files with the PC, not use a remote keyboard for my HP-71. The editor I have on the PC or the HP110 (Ed Gilbert's Editor, NOT memomaker) is much faster than any text editors I have on the HP-71, they handle long text files without slowing down to the speed of cold molasses, and have features HP-71 users only dream of. Editing BASIC programs is usually faster without the delays introduced by the remote keyboard. Finally - HPILLINK set-up with the remote keyboard does a number of unfriendly things, such as mess-up my STARTUP, my key assignments, or even FREEPORT memory I do not want FREEPORTED, if I do not have KEYBOARD LEX in my machine. Still, it is nice to have mass storage and printers at work, by way of HPILLINK and the IBM XT in my department. Being able to share data stored in my HP-71 using the HPILLINK /C option helps keep my bosses happy with my HP-71. Hence, the routines below. NOTE: LINK 1.02 (Southern Software) provides similar capabilities. I hear there soon will be a new version called LINK PLUS, with many interesting features. I use LINK 1.02 rather than HPILLINK if I want to use the PC as a printer or as a video interface for my HP-71. The first program is intended to upload or download a single file at a time, from the HP-71 keyboard. Before using this program, you must run the HPILLINK.EXE program on the PC, and connect the HP-71 to the PC HP-IL port. When you download a file, you must provide the full file name, such as: JUNK.TEX When you upload a file, the program will automatically supply the correct file extension if you have the FTYPE$ keyword available. See source code below. If not, the extension will be left blank, and you will have to RENAME the file from the PC keyboard if you want the correct extension. The file transfer takes little or no time. Once done, disconnect the HP-71, exit HPILLINK with the F8 key, and do whatever you desire with either the PC or the HP-71. Enjoy! 0010 ! PC71EX - Transfer HP71 files between a PC and an HP71 with HPILLINK 0020 ! Copyright Michael Markov 1988 0030 ! 0040 ! Uses FTYPE$ keyword from DATACOM ROM - See FLTYPELXS for source 0050 ! This is required if you want to provide the proper file extension 0060 ! when uploading files to an IBM PC via HPILLINK /HP82973 Interface card 0070 ! or to an HP110 running HPILLINK. 0080 ! 0090 ! If you do not have the FTYPE$ keyword, comment-out the line 300 : 0100 ! 300 T$=FTYPE$(F$) 0110 ! 0120 ! The advantage of this program is that it allows file transfers without 0130 ! messing-up your favorite STARTUP, your key assignments, or FREEPORTing 0140 ! stuff you may not want free-ported. This was developed when I started 0150 ! to make heavy use of my HP110 to edit HP71 source code files, which I 0160 ! then assembled using the AREUH (PPC-Paris) assembler-linker before 0170 ! downloading the resulting LEX for testing in the HP71. I had no need for 0180 ! an external keyboard since the EDITOR I use on my HP110 is considerably 0190 ! faster than EDTEXT, and provides more flexibility. 0200 ! 0210 LOCAL @ DISP 'Up or Download?(U/D)' 0220 A$=UPRC$(KEYWAIT$) @ IF A$='D' THEN 240 0230 IF A$='U' THEN 280 ELSE 210 0240 LOCAL @ INPUT 'DOWNLOAD FILE? ';F$ @ IF F$='' THEN END 0250 P=DEVADDR(':PC') 0260 SEND UNT TALK P DDT 0 UNT MTA LISTEN P DATA F$ EOL 0270 COPY :P @ GOTO 240 0280 INPUT 'Upload file? ';F$ @ IF F$='' THEN END 0290 P=DEVADDR(':PC') @ T$='' 0300 T$=FTYPE$(F$)[1,3] ! comment out if FTYPES keyword not available 0310 SEND UNL LISTEN P MTA DDL 0 DATA F$,'.',T$,10 0320 COPY F$ TO :P @ GOTO 280 The second program is a minor variant of the PC71EX program given above. It allows you to upload or download ROM images just as if the PC was an HPIL disk drive. There is one interesting difference: the file stored on the DOS disk will take less space than on HPIL mass storage. Apparently, HPILLINK and ROMCOPY version RCPY:E were designed to work together better than the mass storage option! Here, we see the advantages of an intelligent mass storage device. 0010 ! PCROM - Transfer HP71 ROM images between a PC and an HP71 with HPILLINK 0011 ! and ROMCOPY LEX. 0020 ! Copyright Michael Markov 1988 0030 ! 0040 ! This program is a slightly modified version of PC71EX, elsewhere on this 0041 ! swapdisk. See PCCOMM for documentation. 0042 ! 0210 LOCAL @ DISP 'Up or Download?(U/D)' 0220 A$=UPRC$(KEYWAIT$) @ IF A$='D' THEN 240 0230 IF A$='U' THEN 280 ELSE 210 0240 LOCAL @ INPUT 'DOWNLOAD FILE? ';F$ @ IF F$='' THEN END 0241 INPUT 'To :PORT(#)? ','5';N 0250 P=DEVADDR(':PC') @ IF NOT POS(F$,'.ROM') THEN F$=F$&'.ROM' 0260 SEND UNT TALK P DDT 0 UNT MTA LISTEN P DATA F$ EOL 0261 X=POS(UPRC$(F$),'.ROM') @ F$=F$[1,X-1]&':'&STR$(P) 0270 ROMCOPY F$ TO ':PORT('&STR$(N)&')' @ GOTO 240 0280 INPUT 'Upload file? ';F$ @ IF F$='' THEN END 0281 INPUT 'From :PORT(#)? ','5';N 0290 P=DEVADDR(':PC') @ X=POS(UPRC$(F$),'.ROM') @ IF X THEN F$=F$[1,X-1] 0310 SEND UNL LISTEN P MTA DDL 0 DATA F$,'.ROM',10 0320 ROMCOPY ':PORT('&STR$(N)&')' TO :P @ GOTO 280 The last program allows you to upload many files to the PC, under the control of an HP-71 program. I have used it to transfer entire swapdisks to my HP110, for friends that have HP-71 machines and PC's, but not HP9114 drives. They then read the disks as best they can. I understand that there is a new package from Personalized Software called READHP, that allows IBM machines to read 3.5" disks formatted by HP machines. It should be possible to download files from the PC with a PCTODISK program, just as easily as you can upload entire disks. The easiest approach would be to start things going by creating a TEXT file with all the desired filenames and extensions with the DIR A: >DIR.TEX. Then use PC71EX to download the file, and let your HP-71 control the download to an HPIL mass storage device. I have not needed to do this, since I am not (as of this date) getting any contributions on DOS disks. However, if HP abandons HPIL, this may be the only way to have peripherals for our HP41/HP75/HP71 computers, may they last many years. (Have you purchased a spare HP-71 yet? NO? Why?). NOTE: PCTODISK does not yet exist, except as an idea. It is one of my many 'to do sometime' projects. Anyways, easy PC<==>HP71 communications will greatly ease the transition to the world of DOS/OS2 machines, where instead of HP BASIC you will be forced to learn PASCAL, C, MEGA BASIC or QUICK BASIC if you want to do any serious programming. Obvioulsy, the PC must be running HPILLINK, and the default drive to which HPILLINK writes the files should be as empty as possible. Load HPILLINK with A:HPILLINK, then replace the disk in the default drive (usually A:) with a newly formated disk. On the HP71, run DISKTOPC. When the program stops, replace the disk in the default drive, and run DISKTOPC on the HP71 to continue the upload. NOTE: Do NOT purge the temporary directory file (default DIRFL), except at the start of the upload, before the first file is transfered. This allows the PDIR keyword (JPCROM) to create a new file that contains all the information you need to upload the disk. The HP-71 automatically deletes file entries as the upload goes on. Any time the DISKTOPC program stops, you can LIST DIRFL to find out how many files still ave to be uploaded. Note that the program polls the PC to determine whether the remote load failed for any reason, such as no space remaining available on the PC. This program is intended to be used in conjunction with a video interface on the HPIL loop. The program uses JPCROM to create a directory listing of the disk to be uploaded to the PC. This is by far the most convenient way. Among other things, JPCROM implements a poll handler that allows your HP-71 to identify HP-41, HP-75 and other non-HP71-standard file types. This allows you to tag the file names to help identify the contents of the file. HPILLINK does not recognize HP-41 or HP-75 file types. In fact, it does not recognize all HP-71 file types, atleast, not the version I have (Maybe revision E does better, but I do not have that yet. It should be obvious that minor changes to line 240 allow uploading only HP-71 files, or only HP41 files, etc, should you so desire. 0010 ! DISKTOPC - UPLOAD FILES TO PC WITH HPILLINK 0020 ! This program is available, at least in concept, in the HPILLINK 0030 ! documentation. It implements the task in a way that helps minimizes 0040 ! user intervention. It was written to facilitate uploading Swapdisks 0050 ! to an IBM PC equipped with an HPIL interface card. 0060 ! 0070 ! Since the HP71 is the controller, you can have a disk drive on the loop, 0080 ! and copy each file from the drive to the IBM PC, using a minimum of 0090 ! HP-71 memory. 0100 ! JPCROM REQUIRED. IF NOT AVAILABLE, CREATE DISK DIRECTORY LISTING WITH 0110 ! SOME BASIC ROUTINE SUCH AS DIR71 0120 CONTROL ON @ RESET HPIL @ RESTORE IO @ DISPLAY IS :DISPLAY 0130 INPUT "Which drive? ";D 0140 P=DEVADDR('%16('&STR$(D)&')') 0150 INPUT 'temp. file? ','DIRFL';F$ 0155 ON ERROR GOTO 161 0160 PDIR :P TO F$ @ GOTO 169 0161 OFF ERROR @ DISP ERRM$;'Purge? (Y/N)' 0162 A$=UPRC$(KEYWAIT$) @ IF A$='Y' THEN PURGE F$ @ GOTO 155 0169 OFF ERROR @ ASSIGN #1 TO F$ @ RESTORE #1 0180 DIM A$[60] @ D=DEVADDR(':PC') @ STANDBY ON @ REMOTE 0190 FOR I=0 TO FILESZR(F$)-1 @ READ #1;A$ @ DISP I;A$ 0200 IF SPOLL(D)#5 THEN 270 0210 F$=TRIM$(A$[1,10]) 0220 T$=TRIM$(A$[14,19])[1,3] 0230 IF T$='41:' OR T$='75:' THEN G$=F$&T$[1,2] @ T$='UNK' ELSE G$=F$ 0240 SEND UNL LISTEN D MTA DDL 0 DATA G$,'.',T$,10 0250 COPY F$&':'&STR$(P) TO :D 0260 NEXT I 0270 LOCAL @ DISP 'HP110 Drive A full-delete last file copied' 0280 READ #1,I-2;A$ @ DISP 'last file copied: ';I-2;A$ 0281 FOR J=I-2 TO 0 STEP -1 @ DELETE #1,J @ NEXT J 0290 STANDBY OFF @ CONTROL OFF @ END LEX 'FTYPELEX' LEX file name TITLE FTYPELEX, File type LEX, Samuel H Chau [242] * ID #F6 compatible with DCLEX in DATACOMM ROM MSG 0 no message table POLL 0 no poll handler * ENTRY FTYPE CHAR #F string function * KEY 'FTYPE$' Syntax: FTYPE$('file specifier') or * FTYPE$(assign channel #) * Returns file type as a 5-char string * Null string returned if file not found * Example: FTYPE$('FORTHRAM') returns FORTH TOKEN 1 ENDTXT end of text table ************************ * **** EQUate Table **** * AVE=D1 EQU #18BB8 update AVMEME from D1 or C BSERR EQU #0939A BASIC system error D0=AVS EQU #09B2C set D0 to address in AVMEMS D1MSTK EQU #1954E set D1 at MTMSTK (AVMEME) FDCH# EQU #114AC find channel # in assign table FFIB# EQU #122EF find file number in FIB FILXQ$ EQU #09B95 filename execute for a string expression FINDF EQU #09F77 find a file FLTDH EQU #1B223 convert 12-digit flt to HEX integer FNRTN EQU #0F23C function return FTYPDC EQU #06902 file type decompile FUNCR0 EQU #2F89B function scratch RAM start POLL EQU #12337 poll LEX files with process # POPMTH EQU #1B3DB skip past item on MATH stack RSTKA P integer parameter? GOYES FTYP03 yes: interpret as channel # A=A+1 P ?A#0 B not string parameter? GOYES FTYP01 yes: parameter is invalid GOTO FTYP09 no: interpret string as file specifier FTYP01 LC(4) eFSPEC load Invalid filespec error FTYP02 GOVLNG BSERR BASIC error exit FTYP03 D1=D1+ 16 pop integer argument off MATH stack GOSUB ave=d1 update stack top pointer GOSBVL FLTDH convert 12 form channel # to HEX integer B=A B put HEX form in B for FDCH# GOSBVL FDCH# find channel # in assign table GONC FTYP08 not found: ready for exit ?A=0 B channel closed? no: A(B)=FIB# GOYES FTYP08 yes: punt! GOSBVL FFIB# find file # in FIB GOC FTYP08 not found? yes: punt! no: D1 @ file # in FIB D1=D1+ 5 advance to file type entry in FIB FTYP04 GOSBVL D0=AVS set D0 to AVMEMS C=0 W preclear C DAT0=C W blank out word at AVMEMS D0=D0+ 2 point past one null GOSBVL FTYPDC get file type (5 chars), D0 points past it GOSUB d1mstk set D1 to AVMEME GOSBVL D0=AVS set D0 to AVMEMS C=DAT0 W get file type in C ?C=0 B not at file type string? GOYES FTYP06 yes: move pointer down FTYP05 ?C=0 B end of file type string? GOYES FTYP07 yes: ready for string return D1=D1- 2 point D1 down 1 char DAT1=C B push one ASCII char onto stack FTYP06 CSR W CSR W shift to next char in file type string GOTO FTYP05 continue building string on stack FTYP07 GOSBVL STRHED generate string header on stack GOSBVL RSTKareuh/doc/areuh110.doc <<'@EOF' USING AREUH WITH A HP110 Michael Markov (PPC Paris 301) Using AREUH with an HP110 presents a variety of problems, most of which are related to the fact that AREUH requires about 200+K of memory to run. This leaves you with 70K of EDISC for your source code, intermediate files, listing files, and anything else you may feel you absolutely have to have, such as ED110, in case you need to edit the source file, or HPILLINK to upload and download LEX files.... Keep in mind that listing files are roughly twice the size of source files, and that the object file takes some room. Needless to say, this means that you cannot keep the 150K byte AAS.EXE program in the A: drive. Therefore, HP100 owners who still want to use AREUH for serious work must resign themselves to loading AAS.EXE from disk each time they wish to assemble a LEX file. Worse, unless they are working with source files of 20K or less, they must also resign themselves to either sending the listing file to a disk file, or to a printer. Either approach means that execution time is much slower than you would expect from the AREUH documentation. Still, my HP110 and AREUH allow me to assemble a 42K source code files about 4 minutes, while my HP71 requires over half an hour to do the same job, in spite of a 1.9 times speed-up. (Yes, I am considering the purchase of a 512K base Portable Plus with a 1 or 2 Meg RAM card, but considering the cost, maybe I would be better off with a full-size desk top machine.) Let me hasten to say that 20K source files are quite sufficient for individual keywords. Assembling such small files is unbelievably fast, and very convenient for debugging sessions. You will have few problems assembling such files using either the compatibility mode or the modular mode. However, source code files show a definite tendency to grow: TXTSORTS, once less than 13K, is now 42K. TKS, the source for DISASMLX, grew to 77K from similar beginnings. The following material describes the work-arounds I developed to allow me to assemble such source files more or less painlessly. Since the major space and memory waster is saving the listing file, you must ask yourself whether you need a listing file. In the compatibility mode, you can use the LIST OFF and LIST ON keywords to suppress the listing file for portions of the files that you have already assembled successfully in previous sessions. For example, with the LIST OFF suppressing most of the TKS listing, DISASMLX can be assembled in about two minutes. This is definitely worth taking advantage of -- just list the portion of the source that includes any new keyword you add to the file you are building. This will let you know if any jumps are out of range, which is the most common problem when adding a new keyword to a file, assuming you have already tested and assembled the keyword separately. However, there always comes the time when you need a complete listing for code-packing/ code review purposes. When this happens, I use the following procedure: 1) If your source code file is more than 20K bytes long, prepare a work disk that contains ONLY HPILLINK, the source code and any symbol files you use, to include the entry point files found in the AREUH disk \LIB subdirectory. You should first format this disk, then copy the symbol files from AREUH to the work disk with COPY C:\LIB\*.EP D: (If you have only one drive, first copy the files to the A: drive, then to the work disk. Next, copy any special Symbol files to be loaded with RDSYMB. Finally, copy the source code file to the work disk. This may sound complicated, but if you use AREUH frequently, you will prepare several work disks in a single session, so that all you have to do in this step is add the source code. You can reuse such work disks at any time by simply deleting old source and listing files. Do not forget to add any special symbol files. When your souce file grows beyond the size that can be edited with MEMOMAKER, you may want to add your favorite EDitor software. While this limits the space remaining free for the source and listing files, it is very convenient. You should seriously consider breaking-up your larger source code files into smaller files (20K or less) that can be assembled from the A: drive, as execution time suffers badly when assembling the source from mass storage. The AREUH loader-linker will allow you to combine the resulting intermediate files into a single large LEX file. See WRITHEAD.BAS and WRITHEAD.DOC on the disk. These files help a lot when using the modular mode. If you do NOT use supported entry points, you can assemble source files of up to about 60K from the A: drive, since you do not need to have the entry point files in either the A: drive (current directory) or the C: drive... 2) Format a blank 3.5" disk in drive C: 3) Backup your HP110 with COPY *.* C: (from MS-DOS) 4) Delete all files except the source code file to be assembled, and PACK.COM. If the file is in excess of 30K or 60K (see step 1 above), delete everything except PACK.COM since you have to assemble the source from the work disk prepared in step 1 above. NOTE: If you use AREUH frequently, you will already have back-up disks, and you need only back-up current work in progress. 5) PACK the A: drive (Type PACK [Return]). 6) You may now delete PACK.COM if you are real short of memory. 7) EXIT MS-DOS, and press the f6 key (System Configuration). 8) Increase the Memory allocation to 200+ Kbytes. 9) Exit the configuration menu, and return to MS-DOS. 10) Replace the disk in your C: drive with the AREUH disk. 11) Copy any entry point files required from the C:\LIB subdirectory to the A: drive (unless these files are available on your work disk). 11) Load AAS.EXE with C:AAS - The interactive mode is a must if you have only one drive. Otherwise, you can use toggles documented in the README file to more or less duplicate what follows. 12) Once the interactive menu comes up, replace the AREUH disk with your work disk. This may be the work disk prepared in step 1, or the back-up disk created in step 2 and 3. This disk will be used to save the listing file. 13) Now, you are ready to respond to the prompts in the interactive menu: Source in drive A: Source in drive C: Source file : TXTSORTS.TEX C:TXTSORTS.TEX Object file : TSORT TSORT output to A: drive Listing File : C:LIST C:LIST listing to disk Cross Reference: Y Y Yes, nice to have Page length : 88 88 I use 8 lines per inch to save paper While assembling version 7 of the above LEX, I got an object file of 3066 bytes and a listing file of 74K bytes. The LEX itself, after conversion to HPILLINK format with the AREUH A2LEX.EXE program and downloading to the HP71 was 1513 bytes long (TSORTLX7). You can read the source from one external drive, direct the object file to the same disk, while having the AREUH disk in a second drive, and send the listing file to a third drive, assuming you can borrow one (I used a cassette drive to check this.) This flexibility should allows HP110 users to assemble LEX files of up to 32K. 14) I actually work with two disk drives, which simplifies things. I keep the AREUH disk in drive C: and the work disk in drive D:, so that I respond to the Listing file : prompt with D:LIST. Minor difference that makes life somewhat easier. 15) Now, I look at the listing file using Ed Gilbert's Editor, which I keep on the work disk: D:ED D:LIST (EDit file LIST on drive D:). If you have only one drive, you may do the same using drive C: 16) If there are errors, edit the source file and go back to step 1. Otherwise, put the AREUH disk in drive C: and execute the A2LEX program: C:A2LEX TSORT This creates a new file in HPILLINK format with the LEX extension. 17) Finally, you are ready to download the LEX file to your HP71 using HPILLINK: D:HPILLINK (or, if you have only one drive, replace the AREUH disk with your work disk, and use C:HPILLINK) 18) See the PCCOMM file elsewhere on this disk to findout how to transfer files between your HP-17 and your HP110 with a minimum of effort. NOTE: The HP-71 MAY REMAIN ON THE LOOP WHILE ALL OF THE ABOVE IS GOING ON, PROVIDED THAT YOU FIRST EXECUTE "CONTROL OFF". WARNING: The HP110 may tell you that your drive has a bad unit if you try any mass storage operation after the HP-71 has been the controller. This is because the HP110 usually works with 512 byte mass storage sectors, while the HP71 normally uses 256 byte sectors. Reply Ignore to the problem prompt. Thereafter, you should no longer have problems. @EOF set `wc -lwc