Jump to content

Hexadecimal: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
Base 16, also known as '''Hexadecimal''' or '''Hex''' is a numbering system that has a radix of 16 and therefore a natural encoding for [[16 bit]] systems and processors, and commonly used to represent values for 32, 64 and 128 bit systems as well.
Base 16, also known as '''Hexadecimal''' or '''Hex''' is a numbering system that has a radix of 16 and therefore a natural encoding for 16-bit systems and processors, and commonly used to represent values for 32, 64 and 128 bit systems as well.


==Hex file format==
==Hex file format==
Line 6: Line 6:
;Intel hex files
;Intel hex files
By far the most common of these is the '''Intel Hex''' (ihex) format although other formats did exist at one point in time. The intel format is very simple, it is an [[ASCII]] text file with [[DOS]] style line endings that contains a sequence of lines like this one:
By far the most common of these is the '''Intel Hex''' (ihex) format although other formats did exist at one point in time. The intel format is very simple, it is an [[ASCII]] text file with [[DOS]] style line endings that contains a sequence of lines like this one:
 
:10012000194E79234623965778239EDA3F01B2CAA7
<pre>
:10012000194E79234623965778239EDA3F01B2CAA7
</pre>


Which represent the following:
Which represent the following:
 
{|class="wikitable"
{| class="wikitable" border="1" cellpadding="5" cellspacing="0"
|-
|-
!Start code||Byte count||Address||Record type||Data||Checksum
!Start code||Byte count||Address||Record type||Data||Checksum
Line 20: Line 16:
|-
|-
|Semicolon||2 hex digits representing the number of bytes in data field. Max 0xFF (255)||4 hex digits representing 16-bit beginning memory address offset||See below||Sequence of bytes||Two's complement of all hex numbers in the line added together
|Semicolon||2 hex digits representing the number of bytes in data field. Max 0xFF (255)||4 hex digits representing 16-bit beginning memory address offset||See below||Sequence of bytes||Two's complement of all hex numbers in the line added together
|-
|}
|}


;Record types
;Record types
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2">
* 00 Data
* 00 Data
* 01 End Of File
* 01 End Of File
Line 31: Line 25:
* 04 Extended Linear Address
* 04 Extended Linear Address
* 05 Start Linear Address
* 05 Start Linear Address
</div>


The last line in the file must always be record type 01 which represents "End Of File" or  
The last line in the file must always be record type 01 which represents "End Of File" or  
 
:00000001FF
<pre>
:00000001FF
</pre>


====OS/2 text editors with Hex file support====
====OS/2 text editors with Hex file support====
Line 43: Line 33:
* [[Preditor/2]] - Hex editing support built in - Commercial - Discontinued.
* [[Preditor/2]] - Hex editing support built in - Commercial - Discontinued.


[[Category:Number and coding systems]][[Category:File formats]]
[[Category:File formats]]

Revision as of 23:01, 26 January 2017

Base 16, also known as Hexadecimal or Hex is a numbering system that has a radix of 16 and therefore a natural encoding for 16-bit systems and processors, and commonly used to represent values for 32, 64 and 128 bit systems as well.

Hex file format

An plain text file that uses hexadecimal values to store machine language code in, it was a common way to store data and executables in the early days of personal computing computing when operating systems were less common than simple loaders and machine code monitors, but in modern day use it is primarily used for files that need to be loaded directly into a memory address such as files to be loaded into microcontrollers, firmware files and so on.

Intel hex files

By far the most common of these is the Intel Hex (ihex) format although other formats did exist at one point in time. The intel format is very simple, it is an ASCII text file with DOS style line endings that contains a sequence of lines like this one:

:10012000194E79234623965778239EDA3F01B2CAA7

Which represent the following:

Start code Byte count Address Record type Data Checksum
: 10 0120 00 19 4E 79 23 46 23 96 57 78 23 9E DA 3F 01 B2 CA A7
Semicolon 2 hex digits representing the number of bytes in data field. Max 0xFF (255) 4 hex digits representing 16-bit beginning memory address offset See below Sequence of bytes Two's complement of all hex numbers in the line added together
Record types
  • 00 Data
  • 01 End Of File
  • 02 Extended Segment Address
  • 03 Start Segment Address
  • 04 Extended Linear Address
  • 05 Start Linear Address

The last line in the file must always be record type 01 which represents "End Of File" or

:00000001FF

OS/2 text editors with Hex file support

  • jEdit - Java based - Hex file syntax highlighting built in - Current.
  • Preditor/2 - Hex editing support built in - Commercial - Discontinued.