visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Pascal :: How can I open a TPU file to see the procedures?


By: VB guy Canada  Date: 08/02/2003 00:00:00  English  Points: 100 Status: Answered
Quality : Excellent
I have a TPU file, SVGA.TPU that contains lots of advanced procedures for image/display handling, but I've lost the documentationand canot find it anywhere. Is there any way I can open up the TPU file and see what the procedures are and the input/syntax of them?

Thanks in advance.
VBG
By: VGR Date: 08/02/2003 21:59:00 English  Type : Answer
sort of.
you'll need luck too 8-)

I would suggest to try to finc such a program on the Web, this must exist somewhere.

Then an other suggestion is to always keep the Implemnattion section in a "nameofunit.int" file, like Borland did at the time Turbo-Pascal wasn't delivered in source.

Now let's look at a TPU (I can have the exact format for you to finely describe the TPU unit in a "pascalissime" magazine, but I don"t have them all here)

This unit for example :
Unit VideoInit;

Interface

Uses Dos;

Var mode_video, colnum, page_disp : Byte;

Procedure GetVideo;

Implementation

Procedure GetVideo;
Var parms : Registers;

Begin
parms.AX:=$0F00;
Intr(16,parms);
mode_video:=Lo(parms.AX);
colnum:=Hi(parms.AX);
page_disp:=Hi(parms.BX);
End;

Begin { Init Part }
WriteLn('Vid‚oInit');
End. { GETVIDEO Procedure }

comes in TPU format as (non-printable characters will become ???)
TPU5 ??? VIDEOINITZ ??? SYSTEMZ ??? DOSZ???MODE_VIDEOS???COLNUMS??? PAGE_DISPS???GETVIDEOT???PARMSS???UNITS\VIDEOINI.DSE???Vid‚oInitU???

You can see the uses clause' units (system, Crt, Dos, etc), the global variables and constants, the name of the implemented functions & procedures, and even the functions called and strings displayed in the init section.

at least, you'll have the names of the constants, variables and procedures&functions declared.

I'll come back later if I find the detailed description of the TPU format


By: VGR Date: 08/02/2003 22:10:00 English  Type : Comment
I found a program for TPW 1.0 and TP6

it could work with earlier TPs (5.0, 5.5, mainly)

it's at <A HREF="http://myfileformats.com/download.php?url=/files/intrfc70.zip&id=6680&name=TPU">http://myfileformats.com/download.php?url=/files/intrfc70.zip&id=6680&name=TPU</a>

ZIP of 65 KB

Description :


This is an outline of the structure of the Turbo Pascal 6.0 and Turbo
Pascal for Windows 1.0 TPU file format. Both use the same format of TPU
file, with signature TPU9.

There are five sections; the first one has ten subsections. Each
section is limited to 64K in size.

I. SYMBOL SECTION

This section contains all the symbolic information, and has several
subsections.

The size is given in header.symsize. Actual size in file is rounded up
to next even paragraph, as are all the sections.

A. Header subsection (/H turns display on)

Contains sizes, pointers, flags, and signature TPU9. Structure given in
HEAD.PAS. About $40 bytes, but it's not clear where it ends - the last
part is always zeroed.

B. Object subsection (/N turns display off, or /I turns full display on)

An unfortunate choice of a name: this section contains all the symbolic
information, not just for Objects. It contains one or two hash tables
to get access to the various objects: the interfaced objects are
available from the one at ofs_hashtable, all debuggable ones are
available from the one at ofs_full_hash. There are also other smaller
hash tables: members of records, locals to functions/procedures, etc.
HASH.PAS decodes the hash table.

There are basically two types of records: obj_rec's and type_def_rec's.
Obj_rec's give the name and "type", and are followed by specialized
information describing the object. Type_def_rec's give constructions
for type definitions. Both are given in NAMELIST.PAS and NAMETYPE.PAS,
though the type_def_rec's should be handled by their own unit.

C. Entry point subsection (/E turns display on)

This is an array of fixed length records, one per
function/procedure/method in the unit. It gives the code block of the
routine, and the entry point within that code block. The first entry is
for the initialization section of the unit.

D. Code block subsection (/D turns display on)

This is an array of fixed length records, one per block of code
(usually, one per routine, but .OBJ files get just one block).

E. Const block subsection (/C turns display on)

Another array of fixed length records, one per block of initialized
data. (This will be a typed Const declaration, or the VMT of an object.

F. Var block subsection (/V turns display on)

The same sort of thing for uninitialized static data.

G. Window DLL subsection (/W turns display on)

This section never appears in TP6 files, only in TPW. It gives a table
of external names which TPW for links to Dynamic Link Libraries.

H. Unit list subsection (/U turns display on)

All units on which this one depends are listed, in variable length
records.

I. Source names subsection (/S turns display on)

This section lists the source files, and .OBJ files that were linked
into this unit.

J. Line lengths subsection (/M turns display on)

If debugging is turned on, the records here give the correspondence
between source code lines and bytes in the code blocks.

II. CODE SECTION (/B turns display on)

This section contains the compiled object code, in the order listed in
the code block subsection above. I don't know if there is any
separation between blocks.

III. CONST SECTION (/G turns display on)

The initialized data, in the order of the const blocks.

IV. CODE RELOCATION RECORDS (/R turns display on)

A big array of fixed length records, giving the relocation fixups for
the code blocks.

V. CONST RELOCATION RECORDS (/O turns display on)

An array in the same format as IV, giving the relocation fixups for the
const blocks. Used for fixups for the VMT tables of objects, and
initialized pointer constants.

By: VGR Date: 08/02/2003 22:12:00 English  Type : Comment
FYI,

my TP5 compiled units have signature TPU5, not TPU9

By: grg99 Date: 08/02/2003 22:16:00 English  Type : Comment
Might it be this SVGA.TPU:

<A HREF="http://www.ryledesign.com/download/bgivid.pdf">http://www.ryledesign.com/download/bgivid.pdf</a>



By: monange Date: 08/02/2003 22:34:00 English  Type : Assist
There are TPU disassembly programs available. They are not perfect but may do enough for you. See


<A HREF="http://www8.pair.com/dmurdoch/programs/">http://www8.pair.com/dmurdoch/programs/</a>
<A HREF="ftp://garbo.uwasa.fi/pc/turbspec/twu1.zip">ftp://garbo.uwasa.fi/pc/turbspec/twu1.zip</a>
<A HREF="ftp://garbo.uwasa.fi/pc/turbopas/intrfc70.zip">ftp://garbo.uwasa.fi/pc/turbopas/intrfc70.zip</a>
<A HREF="ftp://garbo.uwasa.fi/pc/turbopas/intrfc62.zip">ftp://garbo.uwasa.fi/pc/turbopas/intrfc62.zip</a>
<A HREF="ftp://garbo.uwasa.fi/pc/turbopa7/tpu2tps.zip">ftp://garbo.uwasa.fi/pc/turbopa7/tpu2tps.zip</a>
<A HREF="ftp://garbo.uwasa.fi/pc/turbspec/twu1.zip">ftp://garbo.uwasa.fi/pc/turbspec/twu1.zip</a>
<A HREF="http://pascal.sources.ru/hacker/unit6dis.htm">http://pascal.sources.ru/hacker/unit6dis.htm</a>

You should then be able to determine the procedures and parameters required.

Do register to be able to answer

EContact
browser fav
page generated in 300.745960 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page