This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What is the function of the "paragraph number" in a HEX file?

Hlello,everyone,

Now I use the C167 system, and when I have compiled a project with uVision, I will find the first line in the HEX file like this:":020000020000FC".

In the "Intel HEX File Format" section of "C16x/ST10 Assembler and Utilities User's Guide ", it says that "The Intel HEX file contains 8086 segment address records to specify a paragraph number (one paragraph is 16 bytes).The paragraph number is used as the offset for all subsequent data records in the HEX file.".

And I know that "0000" befor the "FC" is the paragraph number,but I don't understand what's the true meaning of the "paragraph number". And why a paragraph is 16 bytes?

can you tell me ?

Thanks .

  • This historically comes from INTEL and is not relevant for you, since the segments in
    the C16x and XC16x are fixed.

    At a PC you find following register

    Codesegment CS IP Instructionpointer
    Datasegment DS SI/DI/BX (Index register )
    Extrasegment ES SI/DI/BX
    Stack-Segment SS SP/BP
    -------------------------------------
    IP = Instruction Pointer
    SI = Source Index
    DI = Destination Index
    SP = Stackpointer
    BP = Base Pointer
    -------------------------------------

    Segmentregisters are only 16 Bit wide, what
    is not enough to address e.g 1 MB memory or
    more.
    That's why it the tricky offset addressing,
    was found.

    We divide the memory by 16. This results in 65536 points in memory which have a distance of 16 byte to each other.

    This points are called PARAGRAPH's.


    if we now need a 20-bit address to address such a paragraph, we must multiply the contence of the related segment register
    by 16.
    With Hexa-numbers this is easy done.
    Simply concatenate a '0'.
    This 20-bit addresse is now the start point of the segment.

    To move in such a segment you need a second register called offset register.
    ....

    So we have a notation as

    Segment : Offset
    e.g.
    C000:0400 PC-side
    e.g.
    C014BEH
    CO = segment 14BE = offset

    Offsetregisters are 16-bit wide too and so
    they can only address 64 KByte.
    This is the reason, why a segment can be max. 64kByte.

    But as you see, here we use data page pointer
    as offset with 16KByte each.
    So the calculation of addresses is slightly different between and micro.

  • Thanks.

    Then it is not use for me in the C167 system?I want to make sure.

    If some use, then how can I change the paragraph number?

  • Usually you can select the output format.
    This is than HEX-386(H167) under 'Options for Target" --> "Output".

    So you get a Extended Linear-Address Record.

    There is no reason to think about the paragraphs.

    µVision2 will handle it for you.