Commit 6dfc408f authored by Iulian Gheorghiu's avatar Iulian Gheorghiu

Fix 02 segment line for 20 bit address length.

Add 04 segment line for 32 bit address length.
parent 4d25fff4
No preview for this file type
......@@ -78,7 +78,7 @@ namespace IntelHexToVerilogMem
if (chkCalc != (byte)chk)
{
Console.WriteLine("Invalid checksum.");
return;
Environment.Exit(-4);
}
string lineType = line.Substring(7, 2);
if (lineType == "00") // Data line//Contains data and 16-bit address. The format described above.
......@@ -118,7 +118,7 @@ namespace IntelHexToVerilogMem
}
else if (lineType == "02") //Extended segment address//Segment-base address. Used when 16 bits are not enough, identical to 80x86 real mode addressing. The address specified by the 02 record is multiplied by 16 (shifted 4 bits left) and added to the subsequent 00 record addresses. This allows addressing of up to a megabyte of address space. The address field of this record has to be 0000, the byte count is 02 (the segment is 16-bit). The least significant hex digit of the segment address is always 0.
{
extendedAddress = Convert.ToUInt32(line.Substring(3, 4), 16) << 16;
extendedAddress = Convert.ToUInt32(line.Substring(9, 4), 16) << 4;
}
else if (lineType == "03") //Start segment address//For 80x86 processors, it specifies the initial content of the CS:IP registers. The address field is 0000, the byte count is 04, the first two bytes are the CS value, the latter two are the IP value.
{
......@@ -126,7 +126,7 @@ namespace IntelHexToVerilogMem
}
else if (lineType == "04") //Extended line address//Allowing for fully 32 bit addressing. The address field is 0000, the byte count is 02. The two data bytes represent the upper 16 bits of the 32 bit address, when combined with the address of the 00 type record.
{
extendedAddress = Convert.ToUInt32(line.Substring(9, 4), 16) << 16;
}
else if (lineType == "05") //Start line address//The address field is 0000, the byte count is 04. The 4 data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU.
{
......
......@@ -5,3 +5,6 @@ c:\users\work\documents\visual studio 2010\Projects\IntelHexToVerilogMem\IntelHe
C:\Users\Work\documents\visual studio 2010\Projects\IntelHexToVerilogMem\IntelHexToVerilogMem\obj\x86\Debug\IntelHexToVerilogMem.csprojResolveAssemblyReference.cache
C:\GitHub\INTEL-HEX-TO-VERILOG-MEM\IntelHexToVerilogMem\obj\x86\Debug\IntelHexToVerilogMem.exe
C:\GitHub\INTEL-HEX-TO-VERILOG-MEM\IntelHexToVerilogMem\obj\x86\Debug\IntelHexToVerilogMem.pdb
C:\GitHub\INTEL-HEX-TO-VERILOG-MEM\IntelHexToVerilogMem\bin\Debug\IntelHexToVerilogMem.exe
C:\GitHub\INTEL-HEX-TO-VERILOG-MEM\IntelHexToVerilogMem\bin\Debug\IntelHexToVerilogMem.pdb
C:\GitHub\INTEL-HEX-TO-VERILOG-MEM\IntelHexToVerilogMem\obj\x86\Debug\IntelHexToVerilogMem.csprojResolveAssemblyReference.cache
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment