flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > symbol table

Author
Thread Post new topic Reply to topic
Ralph



Joined: 04 Oct 2003
Posts: 86
Ralph 06 Mar 2004, 22:50
Hello,

In x86.inc, under symbols:, I was wondering what those last two values mean. Eg "db 2,'ah',10h,14h". What do 10h and 14h represent? What part of the assembler processes them?
Post 06 Mar 2004, 22:50
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 07 Mar 2004, 21:20
These are codes for internal fasm's format of parsed source. For example AH symbol is represented in such source by two bytes - first 10h (it identifies the register symbol), second 14h (the high nibble is identificator of registers group - 1 means 8-bit general register, the low nibble is number of the register).

In parsed source all symbols that begin with the byte in range 10h-1Fh are two-bytes long, first byte identifies the group of symbols, second byte is the identificator of symbol inside the specific group. For example when first byte is 11h, symbol is one of the size operators, and the second byte represent the size itself (1 - byte, 2 - word, etc). Currently the first byte determines one of the following groups:
Assembly language symbols (first byte 10h-17h):

  • 10h - registers;
  • 11h - size operators ("byte, "word", etc);
  • 12h - jump range operators ("near" of "far");
  • 13h - code type selection operators ("use16" and "use32").

Formatter-specific symbols (first byte 18h-1Fh):

  • 18h - output format identificator;
  • 19h - section flag;
  • 1Ah - PE data directory identificator;
  • 1Bh - PE format flag;
  • 1Ch - section alignment symbol.


Bytes of value 20h or greater usually represent the expression operators, like "+", "eq", etc. - these symbols are of one byte length. Byte 28h (code of left parenthesis) marks the beginning of numerical expression, byte 5Bh (code of left square bracket) marks the beginning of address expression - these parts of parsed source have various length, and have their own internal format (which can be the topic of some other post).

When first byte is below 10h, it means one of the elementary assembler commands. Currently only the following values are used:

  • 0 - end of source
  • 1 - assembly language instruction - it is followed by three bytes, first two are the 16-bit offset of instruction handler routine, relative to the starting address of assembler module, third is the 8-bit parameter that should be passed in AL register to that routine (look into adding custom instructions tutorial for more information about those routines);
  • 2 - label definition - it is followed by five bytes, first four form the 32-bit address of the symbol structure (look here for the description of its format), the last byte is the size identifier for the label (will be stored at offset 10 in that structure);
  • 3 - constant definition - the following bytes are the same as in case of label;
  • 0Fh - start of new line - it is followed by four bytes, which form the 32-bit pointer to the original line in the preprocessed source.
Post 07 Mar 2004, 21:20
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 11 Feb 2013, 07:31
In flat assembler 1.71 there is a new elementary command added:
  • 4 - addressing space label - it is followed by four bytes that contain the 32-bit address of symbol structure.
Post 11 Feb 2013, 07:31
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.