6

I was wondering what binary executable file format the Sharp X68000 used. Apparently the OS looks and feels quite a bit like MS-DOS but is not MS-DOS. Instead of .EXE it uses an .X file extension for runnable programs.

After quite a bit of searching, I found a resource in Japanese and imperfect English translation that includes the format of these files under the headings Xファイルヘッダの構造 and -X file header structure.

But interestingly, just after is another section titled ・Zファイルヘッダの構造 and -Z file header structure.

It includes fields that suggest this file format also contains machine code:

$02     1.l     Text section size
$06     1.l     Data section size
$16     1.l     Run (execution) address

Could this be an object file format used by compilers and linkers? Or perhaps a second executable file format? I can't seem to find them mentioned anywhere else.

1

2 Answers 2

3

There is a diagram of the steps and formats involved in the assembly process on page 9 of the X68000 C COMPILER PRO-68K manual.

It says

  • AS アセンブル: AS assembler
  • オブジェクト ファイル: object file
  • LIB ライグラリアン: LIB librarian
  • ライグラリ ファイル: library file
  • LK リンカ: LK linker
  • x形式 実行 プログラム: x-format executable program
  • CV コンバータ: CV converter
  • r形式 実行 プログラム: r-format executable program
  • z形式 実行 プログラム: z-format executable program
  • DB デブッガ: DB debugger

So after linking, you can use the CV utility to convert the x-format into the r-format or the z-format, and use those formats for debugging (and presumably also run them directly).

That means the z-format is not an object file format.

Looking at the differences in the header information from your link, my guess would be that the z-format resolves all relocation information in the x-format in advance.


And the SHARP Compiler PRO 68 K New Kit manual has a whole section on the converter program on page 22:

2.1.5 コンバート

x形式のプログラムは、先頭につけられたり ロケーション情報を削除し、フ ルリロケータブルなr形式の実行可能プログラムに変換することができま す。

この作業にはコンバータ (CV.X)を用います。

Human68kの実行型ファイルにはx形式、z形式、r形式の3つのタイプが あ ります。

コンバータはx形式を変換してr形式またはz形式を作成します。

x形式では、コード、スタック、データなどが、メモリ上で、4つの独立し た領域に割あてられます。

したがって、それぞれを参照するさい、混同がなく、再配置が可能な長所が あります。

一般に高級言語をコンパイルした場合には、管理性のよさから、こちらのメ モリの形式が自動的に選択されます。

z形式は、絶対アドレスにロードされ、この固定番地にロードされないと実行することはできません。

r形式は、フルリロケータプリ形式ともいい、メモリのどの位置にローディ ングしても実行が可能です。

このうち、どちらを選択するかによって、ソースプログラム上でのメモリの 表現の仕方が違ってきますのぞ注意してください。

注 :プログラムの設計上すべてのx形式ファイルがr形式に変換できるわけではありません 。

The DeepL translation looks like it's good enough:

2.1.5 Conversion

A program in x format can be converted to a fully relocatable executable program in r format by removing the prefix and location information.

This is done using the converter (CV.X).

There are three types of Human68k executable files: x-format, z-format, and r-format.

The converter converts the x-format to r-format or z-format.

In x-format, code, stack, data, etc. are allocated to four separate areas in memory.

Thus, there are referred to separately, and they have the advantage of being relocatable.

Generally, when compiling high-level languages, this memory format is automatically selected for its manageability.

The z format is loaded to an absolute address and cannot be executed unless it is loaded to this fixed address.

The r format, also called the full relocator pre format, can be executed no matter where in memory it is loaded.

Depending on which of the two you choose, the way memory is represented in the source program may differ.

Note: Not all x-format files can be converted to r-format due to the design of the program.

So as I guessed, the z-format is pre-relocated to an absolute address, resolving the relocation information, while the r-format is even more general than the x-format, and allows you to load the program at any address.

1
  • Good find! Of course now I wonder also what an r-file is (-: Commented Aug 1 at 7:43
0

I found another source that enumerates that .R. .Z, and .X files are three types of executable files on the X68000. Sadly it doesn't tell us what the differences are between them, though it does suggest that .X files use overlays:

Data Crystal / X68k/DOSCALL / $ff4b _EXEC Load/execute a program

You can also specify the extension of the executable file name.
    If is not .X, .Z, or .R, the file type is specified in the upper 8 bits of FILE.
    Specify the TYPE to specify the format of the file.

    TYPE = 1    .R
    TYPE = 2    .Z
    TYPE = 3    .X

And then I found another source which says the same but also adds that there are also object files which have the extension .o

魔法使いの森 / Old Good COMPUTER!! / X68000 / X68kのフリーソフト

MS-DOSでは多くのアプリケーションが、暗黙の了解によって統一した拡張子を使っていますが、X68kでもそれは同様で

.x .r .z    実行ファイル
.c .h .s    ソースファイル
.o          オブジェクトファイル
などは統一して使われていました。

In MS-DOS, many applications use the same unified extension by tacit
agreement, and the same is true in X68k.

.x .r .z    Executable files  
.c .h .s    source file
.o          Object files
were used uniformly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .