In a normal environment not required, but sometimes it must be used: problems cannot be solved with a pure high level language code completely but only with a little help from machine code. |
Here a compilation of possible solutions. | |
---|---|
RSX |
The RSX will be coded in assembler and their functions will be called through standard BDOS calls.
Then a .COM file generated by a high level language will be combined with the RSX by the CP/M tool GENCOM .
A benefit is that the RSX may be used also from other .COM files.
A good article introducting the function of a RSX will be found here.
( Article in German only)
|
Modules |
Microsoft designed the REL80-format which also other manufacturers have adopted.
High level languages mostly use libraries.
These may be expanded by user written routines also coded in assembler.
Some hints will be found here.
( Article in German only)
Also the HI-TECH Z80 CP/M C compiler supports libraries but not the REL-80 format. |
Constants |
BASIC (as well as TURBO Pascal, look here for the item KERNEL.INC articles in German only) allows working on pre-compiled routines by the DATA statement.
(In TURBO Pascal use const array instead).
An example for generating DATA statements from a .HEX file will be found here.
Another utility for generating DATA statements from a .HEX , .REL or .COM file will be found here.
Parameters will be passed through the Z80 registers as described in the AMSTRAD
user manual for the PCW, part 2, Mallard-BASIC, appendix III, paragraph 3.
|
Inline |
TURBO Pascal allows the including of machine code in any procedure and function.
But only as a stream of constant bytes which must be generated from assembler code.
Unfortunately it does not work with an existing TURBO Pascal tool.
So an additional program is required or the bytes must be inserted manually.
It is a good idea to generate inline code from an existing REL80 formatted module.
Another way to generate the code is using a list file created by an assembler.
The first method was described in 1986 in the magazin MC.
( Article in German only)
Benefit of the first method: The processing is based upon the REL80 format. This results in an application which does not depend on a special assembler. Disadvantage of the first method: The source code is not available. The second method was also described in 1986 in the magazin CT. ( Article in German only) Benefit of the second method: Beneath the binary code the list file also contains source code which may be simply inserted into the Pascal program as comment. This is a great benefit in terms of clarity. Disadvantage of the second method: Due to a great difference of LIST formats this method focusses on one assembler only. Look here for an overview of some formats. In those days I decided to use the REL80 format. Look here for my implementation. ( Article in German only) Later I found a program package by MITEK containing an assembler which generated REL-80 code as well as inline code. Called by ZAS Datei [$]T it created a file named DATEI.INC.
Besides pure inline code it also outputs the listing embedded in a comment.
This makes the inline code more understandable.
|