These notes are designed to assist developers who wish to generate ROMable
applications coded in Prospero Pascal or Fortran. Because of the wide variety of
such environments, they cannot do more than provide guidance, and the reader
must adapt the general guidance to meet his own needs. It is however assumed
that the application is intended to run completely apart from the DOS operating
system and BIOS.
A zip file (ROMABLE.ZIP,
?? KB) containing the files to
accompany these notes is available.
Program Layout
In Part II of the User Manual there is a description of the contents of an
object module produced by the compiler, and the effect of the H option which
selects a memory model; in the Pascal manual this is section 6, in the Fortran
manual it is section 5. From the compiled object modules and a selection of the
run-time library, the linker builds an executable file which can be loaded and
run by DOS. The .EXE file layout is described in detail in many reference books
on DOS; briefly, it contains three parts:
When DOS loads a program, it reads the image into memory and adds the base address to the words within the image which were specified in the relocation table. It then sets the initial values of SS and SP, and passes control to the point specified in the header. Non-initialised parts of the program such as the stack are typically not included in the image, but are allocated adjacent higher addresses.
+----------+-----------------+-----------+ | Code | Static data | Stack | | <---- Program image ----> | | +----------+-----------------+-----------+ ^DS ^SS
Program startup
Control is always passed initially to module H01D in the library, for
which source code is provided. This sets the DS register to the base of DGROUP,
and after performing some mainly DOS-related tasks calls the Pascal or Fortran
main program. The main program normally starts with three library calls:
The main program code then begins.
Coding the application
File operations, the H1 and H2 memory models, the Pascal heap (new and
dispose), and Fortran blank COMMON all rely on DOS services, and cannot be used
in the final form of a ROMable application, though some diagnostic outputs may
be useful while initial checking is done under DOS. It is also necessary to
decide how run-time exception reporting will be handled; there is essentially a
choice between providing an alternative version of the default reporting
routine, or of using "own" exception handling as described in Part IV
of the User Manual. This decision will depend on individual circumstances.
Adapting the Program Layout
When running in a ROM/RAM environment, the former holds the equivalent of
the program image in the diagram above. Some changes must be made, however,
before the image is ready for conversion:
Overall Procedure
It is generally recommended to check out parts of the program in the DOS
environment before embarking on the ROM conversion. At this stage the Probe
debugger can be used, or diagnostic statements can be added. However, the value
of this step will clearly depend on the quality of the test facilities in the
final environment.
When the program is ready for transfer to EPROM, the following procedure
is recommended.
Modifying H01D
The positions of ROM and RAM areas within the address space of the target
environment must be known. Modify H01D.ASM as indicated, and
reassemble with the supplied assembler include files.
Because of the wide variety of target environments, these notes
cannot be exhaustive for any individual case. It is assumed that users are
familiar with the Intel architecture and assembler programming, and are prepared
to adapt the suggestions given here to meet their individual requirements.
Prospero cannot undertake to provide advice apart from that related to the
functioning of their own products.
Prospero Software Ltd.
May 1992