Technical
support e-mail : mktmk<at>narod.ru.
Home
pageааааааааааааааа ааааааа: http://mktmk.narod.ru.
аааааааааааааааааааа Converter *.exe files
ааааааааааааааааааааааааа Users guide
аааааааааааааааааааааааааааа v1.00
ааааааааааааааааааааааааааа Summary
а This document describe converter from DOS-exe
(MZ format) files to *.rom
format,
suitable for loading to absolute addresses. For this conversion all
segment
information from relocation table of *.exe file correct according to
the
address of loading. Output *.rom file should be
written to
additional
information may be write to *.rom file.
а This program can be used for create BIOS,
BIOS extenders for I/O card
and
another software for x86 platform based embedded systems.
а This program can use for big length *.exe
files (length is more, than 64K).
аааааааааааааааааааааааа аааContents
1.
General description
2. The
purpose of program
3.
Conditions of application
4. The
problem description
5.
Structure of the project
6. The
input data
7. The
output data
ааааааааааааааааааааааааааа 1. General
description
а The program have command line interface. The
program is tested by
Library istream of
ааааааааааааааааааааааааааа 2. The purpose of
program
а The program is intended for conversion from
DOS-exe format to *.rom format,
suitable
for loading to absolute addresses.
ааааааааааааааааааааааааааа 3. Conditions of
application
а The program run
under Windows like Win-console application.
For use
under another platform it is necessary to correct some types:
typedef unsigned intаааааа exe2rom_32;
typedef unsigned short int
exe2rom_16;
typedef unsigned charааааа exe2rom_8;
From file exe2rom.h and rebuild project.
ааааааааааааааааааааааааааа 4. The problem
description
а It is necessary to provide conversion from
DOS-exe format to *.rom format,
suitable
for loading to absolute addresses. For this conversion all segment
information
from relocation table of *.exe file correct according to the
address
of loading.
а Also it is possible collect some statistics
about *.exe file (like tdump.exe)
and write
to *.rom file some additional information (check sum
of file,
length of
file, values of SS:SP and CS:IP).
ааааааааааааааааааааааааааа 5. Structure of the
project
аа Project structure:
аа
аа 1.а exe2rom.exeа -
executed file
аа 2.а exe2rom.cppа -
functions - members of a class exe2rom_convert.
аа 3.а exe2rom1.cpp - main and functions - members of a class
exe2rom_err.
аа 4.а exe2rom.hааа - header
file of the project.
аа 5.а comline.cppа - functions for work with command line
switch.
аа 6.а comline.hааа - header file for comline.cpp.
аа 7.а alfserv.hааа - declaration of structure of additional
information.
аа 8.а clerr.hааааа - declaration of class for error service
аа 9.а readrus.txtа - this
document in Russian
аа 10. readeng.txtа - this document in English
ааааааааааааааааааааааааааа 6. The input data
а The input data are set in command line. Format
of command line:
exe2rom
[-sw1 -sw2 ... -swn] input_filename
output_filename report_filename
Usage:
exe2romаааааааа - name of program
sw1...swnаааааа - switch of
program
input_filenameа
- name of
input DOS-exe file
output_filename - name of output rom-file
report_filename - name of output report file
Hexadecimal
number in switch must have leading "0x", like C-style.
All
number in switch must be in hex format with leading "0x".
Switch
of the program are:
-s0xXXXXX
- start absolute address (only five hex digit). From this address the
program
will be load. All segment references from relocation table of input
*.exe file correct according to this address. Address 0xXXXXX must be in hex
format
with leading "0x". Last hex digit must be zero.
-l0xXXXXX - length of output *.rom file (five
hex digit).
If output file less than the specified value, output file increase by
filling.
If
output file more than the specified value, output file do not increase.
If the
key is not specified, output file do not increase.
-a0xXX - value for filling output file. By default XX=0x00.
-t - if
this key present, additional information write to the end of
output
file.
Format
of additional information:
template
< class T32, class T16, class T8 > struct alfserv {
T32 loadadr;
T32 lenfile;
T16 ss;
T16 sp;
T16 ip;
T16 cs;
T16
reserved;
T8 csum;
T8 lastbyte;
};
а The structure alfserv
write to file after binary image. If switch -l0xXXXXX
present,
the structure alfserv write to file before filling.
а Meaning of fields of structure alfserv:
loadadrа
- start
address from switch -s0xXXXXX (32 bit)
lenfileа
- length
of file with length of structure alfserv and without
length
аааааааааа of filling
(32 bit)
ssаааааа - value of
segment stack from register DOS-exe file (16 bit)
spаааааа - value of stack pointer from register
DOS-exe file (16 bit)
ipаааааа -
value of instruction pointer register from DOS-exe file (16 bit)
csаааааа - value of
segment code register from DOS-exe file (16 bit)
reserved
- reserve field (16 bit, it is equal 0x0001)
csumаааа -
control sum of file (8 bit). All bytes of file are summarized.
аааааааааа The fillings bytes are not
summarized. Structures alfserv is
аааааааааа summarized,
if switch -t or -f present. Start value of csum is 1.
lastbyte - last byte of structure alfserv.
By default is 1. May be change
аааааааааа by -b
switch.
-bXXаааа - last byte of structures alfserv.
Example:
exe2rom
-s0x40000 example.exe example.rom
In this
example create file example.rom from example.exe.
File example.rom
should be
load from physical address 0x40000.
-f - if
this key present, additional information write to the beginning of
output
file.
If both
switch (-t and -f) present, the switch -f is valid.
аааааааааааааааааааааааааааа 7. The output data
аа The
output data are displayed to screen and write to file of report
if it is
given. The program does not analyze format DOS-exe file and does not
check it.
Therefore if input file have not DOS-exe format undefined behavior
is occur.