ZX Format #03
29 февраля 1996
  IS-DOS  

IS-DOS - "object module format *. obj IS-DOS assembly language."

<b>IS-DOS</b> -
Category "IS-DOS - programmers" No 3


            Prokopenko SV

        Ed. Eliseev, VA


    "The format object modules *. obj

           IS-DOS Assembler "
________________________________________


     This article discusses the object module format adopted in 
the IS-DOS and supported by IS-DOS assembler and linker object 
modules link.com. This format is an official standard IS-DOS. 
If you want to move to the IS-DOS finished object modules from 
other operating systems (such as CP / M 80), or write your own 
translator of any high-level language, we strongly

recommend that you stick with it
format that would allow the sharing of your developments with
IS-DOS Assembler and simplify the creation of
ready-made library of procedures for the IS-DOS.


     The article is written primarily
for professional programmers and software developers wishing to
create tools
Programming for the IS-DOS.

            ________________


     Files in the format *. obj created
IS-DOS Assembler and provide input
files for the linker link.com.


     The task is to create link.com
downloadable code module from *. com
one or more object modules
received broadcast program texts.


     Object file *. obj consists of
several regions, with lengths and relative displacements of the 
beginning of the file identified in its first 32 bytes (see 
Table 1): 


                            Table 1.

   Description of object files
--------------------------------------- Deposed. length value
---------------------------------------
  0,1 (2) - a reference to the area of ​​global
               Ballroom Character Module -

               region [1] (the shift from

               beginning of the file)

  2,3 (2) - the length of the field


  4,5 (2) - a reference to the area of ​​complex
               symmetric with respect to the expression
               stresses that determine the global
               Ballroom symbols of the module -

               region [2] (the shift from

               beginning of the file)

  6.7 (2) - the length of the field


  8.9 (2) - a reference to the area of
               programmatic area code

               [3] (offset from the beginning

               file)
10.11 (2) - the length of the field

12.13 (2) - a reference to the region of hell
               ests custom

               cell module and the remaining
               shihsya nevychislennymi in

               translation time expression
               stresses that determine the

               values ​​of these cells

               region [4] (the shift from

               beginning of the file)
14.15 (2) - the length of the field

16-29 (14) - reserve

30-31 (2) - checksum lane
               Out of 30 bytes file.
--------------------------------------

     The checksum is considered the standard for IS-DOS way: a 
two-byte cell, summed up the values ​​of individual bytes of a 
file. 


     Further, in the object module are listed above the field 
in the named order. Linker link.com important that followed the 
first area of ​​global symbols (offset from the beginning of 
the file = 32). The order of the remaining areas are not 
important. 

            ________________


     Region 1. Global symbols

     defined in this module.


     All global symbols of the module are placed in this area 
as a 16 byte records in a format close to the format

Table of global symbols *. gtb. The differences relate only to 
character values ​​and tag (*) these values. (See Table 2.)


-------------(*) Tag (English tag - a label ztiketka) -
Part of the data item (one or more bits of the word), which 
determines its type. (Editor's note.)

-------------
                          Table 2.
 The structure of global symbols.
---------------------------------------
  Offset. length value
---------------------------------------
   0,1 (2) - a reference to the previous

                  record

   2,3 (2) - a reference to the following

                  record

     4 (1) - number of characters in

                  the name of the symbol (N)

     5 (N) - marks the name of the symbol

                  (Symbols)

   5 + N (1) - the tag value of the symbol

   6 + N (2) - symbol value
---------------------------------------
 Possible tag values ​​of the symbol:

 1 - a symbol defined in terms of external

     seekability expression that

     must be recorded in the 2

     object module. In this case,

     bytes at offset 6 and 6 + N + N +1 is not

     defined.


     In other cases, the actual value
 character is in a word at offset
 6 + N.

 % 10000000 - tag absolute value

     symbol.

 % 1 ******* - tag relative or

     complex relative importance

     symbol, where ******* - the degree of
     relativity (see description Assem
     Blair p.p.3.5.1, transferability when

     expression evaluation). Relative
     positive values ​​are determined by relative
     relative to the beginning of the module.


     The degree of relativity here - it's
number of displacements, ie a number specifying how many times 
a unit address must be added or subtracted to / from the value

symbol when linking to a particular address. This number is 
defined as the 7-digit number with the sign bit in the bit 
number 6. 

     Here, bit 6 plays the same role that
and bit 7 in the 8-bit signed number.

     Thus, if 6 bits = 1, then
module address will not be added, and subtracted from the value 
of the symbol when linking. 


     For example, after defining in assembler $ MET EQU - $ 
($-a reference to the program counter) $ MET object file 
receive the tag value # FF, and the layout of the module 
address will be subtracted from the values ​​$ MET once. 

            ________________


  Area 2. Outside of seekability

   expressions for the global symbols

     defined in this module.


     Expressions must be written in
postfix (*) form, separated
from another source 9 and lie in the same manner as that of the 
global symbols related to these expressions. 

-------------(*) Postfix form of the expressions -
a form in which the operands are first written, and then - 
Operators for example 2 instead of 4 + 2 + 4. (Editor's note.)

-------------

     Operands are written in standard form (see Table. 4 in the 
section "Format of the expressions"). As an example of such an 
expression can be reduced as follows: 

     Let MET - label offset from
beginning of the module # 33.

     For the global label $ met EQU
MET/256 in the object file will be placed
such expression in region 2 (hex format):

 80 33 00 80 00 01 2F.

    # 33256 /

            ________________


   Area 3. The code module.


     The area should contain the code of the processor up to a 
configurable value of bytes and words. And everything must be 
defined relative 2-byte values. Bytes, not defined in the 
module, or certain as external, complex relative, and

also relative, but not 2-byte
length can be any value (assembler writes back 0).

            ________________


      Area 4. Addresses and values

      custom cell module.


     The region consists of the records (two types), and should 
okanchivaetsya 4 bytes # FF.



             Types:


     1.Adresa 2-byte cells with a relative value.


     For example, in a fragment of MET: LD
HL, MET value at MET +1 will be
simple relative (to the register is loaded label value) and, 
therefore, address MET +1 should be written in 4 areas

as a record type 1. This address is an offset from the beginning
area code object module to a custom cell. In this case, the 
relative importance of the custom will be lie on the address in 
the code module. Therefore, to set up 2-byte cell is enough to 
know its address. This, practically, the most common type of 
custom values ​​for layout modules.



     2. All other addresses of cells whose values ​​are not 
determined until the end during the broadcast (along with the 
expressions that define these values). Format this record is as 
follows (see Table 3) 


                          Table 3

  Address format custom cells.
--------------------------------------- Deposed. length value
---------------------------------------
  0.1 (2) - # FFFF - sign of the beginning
              la record to distinguish it from

              record type 1.

  2 (1) - tag is determined by the value
              notation:

              0 - 2-byte word

              1 - 1 - byte cell

              2 - cell - the argument

                short transition teams
                of the type

                JR AAA; JR CC, AAA; where

                CC-condition for the transition.

              3 - number of bits (for any

                command of bit operations)

              4 - type of interruption (the argument
                ment teams IM)

              5 - number of restarts (the argument
                ment team RST)


  3,4 (2) - address is set

              cell (the same as that

              in the case record type 1)

  5 -... ... - An expression in postfix

              form (for details see

              below under the heading "Four
              Math Expressions ").

   ... (1) - Code 9 - a sign of the end

              expression.
---------------------------------------


           Format expressions.


     To speed up computation
expressions when linking them is usually written in postfix 
form, ie when the operators come after their arguments. 

Recognizes the following operators:

Binary:

+ 2B addition
- 2D subtraction
* 2A multiplication
/ 2F division
'& 26 bitwise logical "and".
@ 40 bitwise logical "or".
! 21 bitwise logical exclusion
      sponding to "or".
? 3F MOD operator

Unary:

, 2C minus sign (the sign of number)
^ 5E squaring (2 ^)


  The recording format of the arguments following
(See Table 4).


                           Table 4.

     The format of the operands in expressions.
---------------------------------------
  Offset. length value
---------------------------------------
   0 1 - Tag value of the argument.

   1 2 - Numeric value argument
                ment.

      or

   1 N - Symbolic value

                argument length in the N values
                Cove, is used to

                inclusion in the expression

                undefined in the module

                characters. N can be

                1 to 6.
---------------------------------------
Types of tags:

 If the high bit - 1, then the argument

     has a numeric value.

 % 10000000 - the argument ab
     absolutely

 % 1 ******* - relative or complex

     the relative value of the argument

     ******* degree (see the description of the degree of
     description of the area 1).

 If the high bit - 0, then the argument NEs
     us to undefined symbol in module
     ox, and the tag determines the number of settlement
     leduyuschih him symbol characters.


     For example, the tag% 00000 *** asterisks indicate the 
number of characters in the symbol. This number can be from 1 
to 6. 


       Examples of records of expressions:

Expression


            <MET+1> / 256 '& amp2 ^ 3,

where MET - mark with a relative shift in the module # 10, will 
appear in object module as the next line in the

hex format:

81 10 00 80 01 00 80 00 01 2B 2F

  MET 1 + 256 /

80 03 00 5E 26

   March 2 ~ '&

81 - tag relative importance of degree 1 (for the label MET).

80 - the tag of the absolute values ​​for the numbers
1, 256 and 3.

Expression


               2 * <MET+1>,

where MET - not defined in the module symbol will appear in the 
object module as the following string in hex format:


80 02 00 03 4D 45 54 80 01 00 2B 2A

    2 M E T 1 + *

80 - the tag of the absolute values ​​for the numbers
2 and 1.

03 - the tag character values ​​for the undefined symbols MET 3 
characters. ________________________________________







Other articles:

IS-DOS - "IS-DOS - for beginners" No 3

IS-DOS - "Window System IS-DOS".

IS-DOS - "object module format *. obj IS-DOS assembly language."

IS-DOS - "The format of the table of local symbols IS-DOS assembly language."

Authors Journal - ZX-Format No.3

Iron - Bugfix TR-DOS.

Iron - a new sound card: General Sound.

Iron - a new model of the Spectrum: Scorpion ZS 256 Turbo +.

Iron - on turbirovanie Spectrum machines.

Iron - an overview of modems for the ZX Spectrum.

Iron - The bus architecture of the Spectrum (concept).

Toys - "Last battle" (The Last Stand) a detailed description.

Toys - 48 irons (second level).

Toys - a dozen of the most sold in St. Petersburg.

Toys - description of the game BATMAN-II.

Toys - What's new: The Light Corridor, Jonny Quest in Doctor Zins, Bedlam, Bubble Dizzy, Navy Seals, Pirates.

Contest - a competition for computer anecdote.

Lottery - a lottery for the readers.

From the authors - the third edition of the journal.

a rest - Hu, user, wait!

a rest - glyukodrom: Most ERRORS.

Help - Another treatise on ocherdnoy obolchka and beyond.

Mailbox - discussion.

Mailbox - Translator.

Mailbox - letters from readers.

Premiere - TASM 4.0 (Turbo ASseMbler for ZX-Spectrum 128k)

Premiere - The Adventures of Winnie the Pooh.

Programmers - Basic to all number 3.

Programmers - Matching games: the adaptation of programs to disk.

Programmers - Matching games: zykrytye codes.

Programmers - adapttsatsiya games: immortality.

Programmers - assembler: Excursion to the anatomy of the ZX

Miscellaneous - Amiga: questions and answers.

Miscellaneous - Amiga: news.

Miscellaneous - Prospects for P / O.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Tusovka - On the last holiday "Moskovsky Komsomolets".
Version - 2 versions of the game: INDIANA JONES and the FATE of ATLANTIS.
Championship - European Championship is over.
solid jokes - 8 & 20 jokes jokes. 10 of the best demonstrations. Collection of statements by Soviet officers.
Razbiralka - The description text games TIME COP demo.
intro - the first room we got a few ACiDpaper responses.
Graphics - Image ANSI graphics.
assaults - Scorpion, GMX and zone.
Programming - the program allows to change the screen image in the mode of 48K in the form of vertical blinds with a simultaneous color change of the curb.

В этот день...   21 November