File RMKGEN.DOC ---------------- Chris Kennington 9th July 1985 Generation of Research Machines Kermit -------------------------------------- 0. Modules Required and Status. ---------------------------- RM Kermit consists of two parts. The high-level routines, coded in "C", are responsible for the whole program organization and behaviour. Low-level routines, mostly coded in assembler, provide the interfaces for driving the keyboard, screen and communications. A base-package for the C code is also required. The C-coded routines, which were written at RML, have the status of "copyright - freely available", as requested by U. of Columbia. (They do in fact contain a small amount of code originating from U of Columbia C-Kermit.) The low-level interface routines, also written at RML, are RML copyright and their source-text is not generally available. The distribution files of RM Kermit therefore consist of the C-coded source of the high-level routines plus object or REL files for the low-level ones. The high-level files for either version are:- RMKEXT.H RMKMAIN.C RMKDATA.C RMKDISK.C RMKKEY.C RMKLINE.C RMKPARM.C RMKREC.C RMKSEND.C RMKUTIL2.C RMKCSUPP.C plus either RMK480Z.C or RMKNIMB.C 1. 480Z Interface Files. --------------------- The files required to complete the 480Z version depend on whether the communications are to be via the disk-unit (IDC) or direct from the SIO4 port on the back of the 480Z (in which case network disks must be used). The relevant line-driver files for the IDC version are: IDCEQUS1.REL IDCBASE.REL IDCDRIV.REL The relevant line-driver files for the Network version are: SIOBASE1.REL SIODRIV1.REL In both cases the base-package and interface files must also be included (see also section 3 below): CS4COM.REL RMKERMIT.REL CBASE6.REL 2. Nimbus Interface Files. ----------------------- Both Nimbus versions (for Aux and Piconet communications) use the same basic code to drive the communications line. The destinction between the two is in a short C-coded steering-file, whose name is RMKSAUX.C for the Aux (RS422) version, and RMKSPIC.C for the Piconet (RS232C) version. The low-level driver code is then supplied by: RMCOMMS.O & RMOUTC.O When a version of Kermit is released for the Data Communications Controller, this is expected to require a completely different version of the communications drivers. Instructions for the generation of this version will be promulgated when it becomes available (expected late 1985). 3. Handling of C-Coded Files. -------------------------- Development of RM Kermit on both 480Z and Nimbus has been carried out using the Aztec C-compiler, version 1.06d. For internal reasons, the global header file RMKEXT.H is referred to in the C-sources as "b:kext.h"; suitable renaming must be done before any recompilation is undertaken, and attention may be needed to the disks on which files are located. Aztec's .H files will also be required. Development of the 480Z version has encountered difficulties because the program is large enough to almost fill the TPA of a 56-Kbyte CP/M. The pre-exisiting low-level communications routines were in RML's own Z80 assembly-code, which is assembled by RML ZASM to produce Microsoft-compatible .REL files. Aztec's C-compiler was used to generate Intel assembly code, assembled by Microsoft's M80 to produce Microsoft .REL files. The main reason for splitting the source into so many small files was to permit this compilation under CP/M. Linking by Microsoft's L80 linker was impossible (since this builds its module in store); Prospero's PROLINK was therefore used. This has a restriction on the use of external data + offsets, which caused a few special types of C-statement to be avoided (these are flagged in the text). In addition, PROLINK will not search the Aztec Microsoft-compatible library correctly, so a tailored library module CBASE6.REL was constructed by hand. Also, for reasons internal to CP/M and the communications drivers, it was found necessary to initialize the driver package before initializing the C base-package; the Aztec C-initialization MBEGIN has therefore to be modified and is supplied as file RMKERMIT.REL (which also controls the name of the .COM module). This version makes a call to s4go() and then a call to BDOS (to alter the bottom-of-BDOS pointers) before allowing Aztec-C to set up its stack. Other methods of solving these problems are obviously possible. If any user wishes to modify the current 480Z version, he will need M80 and PROLINK as well as Aztec-C, and may need to extract additional library modules from the Aztec base-package library. There were no such problems with the Nimbus version. The .O (object) files supplied are direct outputs from Aztec's AS assembler, using 80186 assembly code which is very close to that for Microsoft MASM. Linkage has been carried out by Aztec's LN linker using the library C.LIB from Aztec-C 1.06d. 4. Linking Revised Versions. ------------------------- In either 480Z or Nimbus versions, insertion of revised communications code is very simple. Once the new code has been assembled by ZASM / M80 or AS respectively, it may be linked by PROLINK or LN using the appropriate one of the following directives:- -- for 480Z with IDC communications: c: a:PROLINK d:rmkermit,cbase6,rmkdata,rmkmain,cs4com,rmkcsupp,idcbase,rmk480z, rmkdisk,rmkkey,rmkparm,rmkrec,rmksend,rmkline,rmkutil2, idcequs1,idcdriv d: REN ikmit.com=rmkermit.com a: -- for 480Z with direct SIO4 communications: c: a:PROLINK d:rmkermit,cbase6,rmkdata,rmkmain,cs4com,rmkcsupp,siobase1,rmk480z, rmkdisk,rmkkey,rmkparm,rmkrec,rmksend,rmkline,rmkutil2, siodriv1 d: REN nkmit.com=rmkermit.com a: -- for Nimbus with Aux communications: LN -f alink REN b:rmkermit.exe akmit.exe where file "alink" consists of -v -o b:rmkermit.exe b:rmkmain.o b:rmknimb.o b:rmkdisk.o b:rmkparm.o b:rmkdata.o b:rmkline.o b:rmkkey.o b:rmkrec.o b:rmksend.o b:rmkutil2.o b:rmkcsupp.o b:rmksaux.o b:rmcomms.o a:rmoutc.o a:c.lib -- for Nimbus with Piconet communications LN -f plink REN b:rmkermit.exe pkmit.exe where file "alink" consists of -v -o b:rmkermit.exe b:rmkmain.o b:rmknimb.o b:rmkdisk.o b:rmkparm.o b:rmkdata.o b:rmkline.o b:rmkkey.o b:rmkrec.o b:rmksend.o b:rmkutil2.o b:rmkcsupp.o b:rmkspic.o b:rmcomms.o a:rmoutc.o a:c.lib All these files make certain assumptions about the disks on which specific files are located. These are the locations used in the original development and may need changing if a different environment is used. 5. Total Rebuild - 480Z. ----------------------- A "SUBMIT" file for total regeneration of 480Z Kermit is given below. This is for a local-disk 480Z with MD2 IDC, assuming that the C-system is on a:, the sources on b:, most of the .RELs on c:, and leaving the generated .COMs on d:. Note that Aztec's TINY library is used, and that careful attention has had to be given to the space allocated to the various tables during compilation. cz -DTINY -E20 -L12 -Y18 -MO d:kmain.mac b:rmkmain.c M80 c:kmain,=d:kmain/I era d:kmain.mac cz -DTINY -E20 -L12 -Y18 -MO d:kdata.mac b:rmkdata.c M80 c:kdata,=d:kdata/I era d:kdata.mac cz -DTINY -E20 -L12 -Y22 -MO d:k480z.mac b:rmk480z.c M80 c:k480z,=d:k480z/I era d:k480z.mac cz -DTINY -E25 -L12 -Y22 -MO d:kkey.mac b:rmkkey.c M80 c:kkey,=d:kkey/I era d:kkey.mac cz -DTINY -E25 -L12 -Y18 -MO d:kdisk.mac b:rmkdisk.c M80 c:kdisk,=d:kdisk/I era d:kdisk.mac cz -DTINY -E20 -L12 -Y18 -MO d:kline.mac b:rmkline.c M80 c:kline,=d:kline/I era d:kline.mac cz -DTINY -E20 -L12 -Y18 -MO d:kparm.mac b:rmkparm.c M80 c:kparm,=d:kparm/I era d:kparm.mac cz -DTINY -E20 -L12 -Y18 -MO d:krec.mac b:rmkrec.c M80 c:krec,=d:krec/I era d:krec.mac cz -DTINY -E20 -L12 -Y18 -MO d:ksend.mac b:rmksend.c M80 c:ksend,=d:ksend/I era d:ksend.mac cz -DTINY -E20 -L12 -Y18 -MO d:kutil2.mac b:rmkutil2.c M80 c:kutil2,=d:kutil2/I era d:kutil2.mac cz -DTINY -E20 -L12 -Y18 -MO d:kcsupp.mac b:rmkcsupp.c M80 c:kcsupp,=d:kcsupp/I era d:kcsupp.mac era d:?kmit.com c: a:prol d:kermit,cbase6,kdata,kmain,cs4com,kcsupp,idcbase,k480z,kdisk,kkey,kparm,krec,ksend,kline,kutil2,idcequs1,idcdriv d: ren ikmit.com=kermit.com c: a:prol d:kermit,cbase6,kdata,kmain,cs4com,kcsupp,siobase1,k480z,kdisk,kkey,kparm,krec,ksend,kline,kutil2,siodriv1 d: ren nkmit.com=kermit.com a: stat d:*.com 6. Total Rebuild - Nimbus. ------------------------- A suitable .BAT file for total regeneration of Nimbus Kermit is given below. This assumes a standard C-system on a:, and all the text files etc. on b:. REM Compile all of Kermit & link it for Aux & Piconet a: CC b:rmkmain CC b:rmkdata CC b:rmkdisk CC b:rmkkey CC b:rmkline CC b:rmkparm CC b:rmkrec CC b:rmksend CC b:rmkutil2 CC b:rmkcsupp CC b:rmknimb CC b:rmksaux CC b:rmkspic DIR b:rmk*.o/p LN -f alink REN b:rmkermit.exe akmit.exe LN -f plink REN b:rmkermit.exe pkmit.exe DIR b:?kmit.com 7. Conditional Compilations. ------------------------- The common C-files (RMKEXT.H and RMK*.C except 480Z and NIMB) mostly contain a small amount of #ifdef-controlled conditional compilation to distinguish between MSDOS (Nimbus) and CP/M (480Z) versions. RMKDISK.C contains a lot of such conditionals. All are keyed to the #define variable MPUZ80, supplied by Aztec as predefined in the CP/M-Z80 version of C 1.06 and not so defined in the MSDOS-8086 version. Many of these conditionals are either trivial or organizational, but the whole area should be reviewed by anyone making major alterations to the source or the way in which it is used. In particular, any attempt to produce an 8080 version is likely to end up with MSDOS conditionals since the Aztec pre#defined variable will then be MPU8080. **********************************************************