Mixed Mode Programs (new) [ Introduction to MPE XL for MPE V Programmers Migration Guide ] MPE/iX 5.0 Documentation
Introduction to MPE XL for MPE V Programmers Migration Guide
Mixed Mode Programs (new)
Programs can be developed and compiled in MPE V/E, and migrated to run on
MPE XL CM. Unless you specify otherwise, the instructions will be
translated to HP-PA commands by the emulator. If you use the program
very often, however, you will probably want the Object Code Translator
(OCT) to make and permanently append translated code to your original
program file.
The Switch subsystem allows calls to procedures or routines that operate
in the alternate mode (that is, an NM program can call a CM procedure, or
vice versa). A switch stub is a routine that acts as an intermediate
step betweeen a calling procedure in one operating mode and a called
procedure in another. The Switch Assist Tool (SWAT) can help you create
switch stubs from NM to CM.
A call to a switch stub looks exactly like a call to the actual procedure
in the mode of the calling procedure. Thus, cross-mode procedure calls
are transparent to the calling application and its users.
For more information about creating switch stubs and SWAT, refer to
Switch Programming Guide (32650-90014).
Running MPE V/E Programs on an MPE XL System
The MPE XL system determines whether or not to run a program in NM when
the RUN command activates the MPE XL Loader. The loader checks the file
code of the program file. If it is an NM program file or a CM program
file, the loader loads the program.
If it is a CM program file, the loader provides information to the system
indicating whether or not the file contains translated code. (Translated
code is code that has been produced by the Object Code Translator (OCT).)
The Emulator and OCT are described below. Table 2-3 describes the file
codes, file names, and descriptions of MPE XL executable files.
Table 2-3. MPE XL Executable Files
------------------------------------------------------------------------------------------------
| | | |
| FILE CODE | FILENAME | FILE CONTENT |
| | | |
------------------------------------------------------------------------------------------------
| | | |
| 1028 | RL | Compatibility Mode Relocatable Library |
| | | |
| |
| | | |
| 1029 | PROG | Compatibility Mode program file |
| | | |
| |
| | | |
| 1030 | NMPRG | Native Mode program file |
| | | |
| |
| | | |
| 1031 | SL | Compatibility Mode segmented library |
| | | |
| |
| | | |
| 1032 | NMPRG | Native Mode executable library |
| | | |
| |
| | | |
| 1033 | NMRL | Native Mode relocatable library |
| | | |
| |
| | | |
| 1034 | PROG | MPE V/E translated program file |
| | | |
| |
| | | |
| 1461 | NMOBJ | Native Mode Object File |
| | | |
| |
| | | |
| 1462 | PASLB | HP-Pascal/XL Source Library |
| | | |
------------------------------------------------------------------------------------------------
The system begins execution of a program file that is in NM after it is
loaded. If the loaded program file is in CM, the system calls the
Emulator to execute the CM code.
Emulating or Translating
If the code is not translated, then the emulator dynamically translates
the MPE V/E code into equivalent HP-PA instructions.
OCT is used to translate an MPE V/E program file and produce two output
files; a translated CM program file and a list file containing error
messages. The translated program file is appended to a copy of the
original program file, thus creating a larger file. The list file
defaults to $STDLIST.
The primary advantage of running translated code instead of emulated code
is faster performance. However, the file size is larger than that of the
original untranslated file.
The MPE XL command to run OCT is OCTCOMP. For detailed information on
translated code, refer to Migration Process Guide (30367-90007).
Errors, Aborts, and Debugging
Much error management and abort control depends on the language you use.
Consult the manual for your programming language for techniques,
statements, and translations for error messages. MPE XL subsystems
produce their own error messages.
Condition code numbers for error checking are still used for some
intrinsics, as in MPE V/E, but many MPE XL intrinsics use a status
parameter instead. The status parameter returns a 32-bit value,
interpreted as two 16-bit fields analogous to the condition code and the
PRINTFILEINFO intrinsic. The first 16-bit field tells you if an error or
warning occurred, using a code for the type of error. The second 16-bit
field tells you the subsystem where the error occurred.
The status parameter is optional, but recommended. If you do not use the
status parameter, and an error occurs, the program may cause an abort.
It is good programming practice to check for errors after each intrinsic
call. However, you must be sure to check the right information. The
status parameter does not effect the Condition Code setting. If you use
an intrinsic that has a status parameter and then check the Condition
Code, you will get information, but not about your intrinsic.
You can still use offsets to trace errors in programs. However, an
optimizing compiler may reorder the sequence of instructions. For
example, an invariant expression may have been moved outside a loop. If
you get confusing results and suspect this is the case, try recompiling
with the optimization level set to the minimum. This way, the sequence
of instructions in your coding will be a better match to the sequence of
instructions actually being executed.
The MPE XL System Debugger is entirely different from the MPE V/E
Debugger. If you are debugging a CM program, do not follow in
instructions in the MPE V/E Debug documentation. You should become
familiar with HP Symbolic Debugger User's Guide (92435-90001) and System
Debug Reference Manual (32650-90013).
MPE/iX 5.0 Documentation