The original article was printed in June 1986 of the magazine „MC". This free translation was published at the Simtel freeware archive.
Generating inline files used in Turbo Pascal 3.0.

M80 assembly routines as 'inline' statements for Turbo-Pascal

From MC - Die Microcomputer Zeitschrift Juni 1986

"free translation" by BGE.

To stop the messy handcoding of inline statements, PMLINK takes the REL-file and generates an INL-file. The INL-file can be [either] included via {$I} or edited into the Turbo-source. As an example see ROTLFT.* or GETBTS.* .
PMLINK prompts for name of REL-file {extension if left out defaults to .REL} - and name of INL-file {name and extension default to name of REL-file and extension INL}. An empty answer for another REL-file stops PMLINK.
PMLINK consists of three modules {PMLINK.PAS, PMLINK.BIT and PMLINK.UTL}. A slightly changed version uses PMLINK's service to replace the original GETBITS routine with assembly code. {see differences between PMLINK.BIO and PMLINK.BIT using the newly generated GETBTS in assembly {or inline} code.
PMLINK uses two passes. In pass one it reads the REL-file and constructs a table containing BYTE,flags and Symbols / Offsets {to be able to work out "ld A,(NUM + 5)". Pass two then generates the code for the .INL file.

PMLINK limitations and features

Names and Symbols can only be 6 characters max !! {GETBITS ==> GETBTS}
Turbo routines callable from assembly {see call to InByte} [for Turbo V2 users : place a typed BYTE constant infront of the routine to be called - i.e. CONST InBtAd: byte = 0; infront of the routine. Change the CALL InByte to CALL InBtAd and declare InBtAd external. The compiled program will see InBtAd as a NO-OP and work as planned].
PMLINK is NOT a linking loader , so declarations of ASEG, DSEG, COMMON, PHASE or PUBLIC will not be handled correctly. It is however possible to use LIB80 to combine several assembly routines. PMLINK will handle the combined pieces correctly and seperate the code via Begin-End sequences plus keeping the original names as comments.
All Items, which PMLINK can't handle, will be flagged with error messages, computation is not interrupted - although the generated inline code is not necessarily correct anymore.
Turbo Pascal executes special code for functions, which return their values in HL - in this case, the assembly functions should end with a RET to circumvent Turbo Pascals unneeded special code.
Assembly routines using VAR parameters have to be aware, that the parameters only POINT to the cell holding the value - they DO NOT hold the value directly. Parameters transfered via call or declared inside a procedure or function however hold their values directly.
For the sake of completeness find the routine ROTLFT here as assembly, as listing and as inline.

Advertised by Werner Cirsovius
November 2014
Published on the web