Implemented "Extended Segment Address Record", so it supports files that exceed 65536 bytes

Needed for: https://github.com/Lauszus/PhysicaloidLibrary
This commit is contained in:
Kristian Sloth Lauszus 2013-09-20 14:49:56 +02:00
parent 5710c01e99
commit ecce53c3f2
1 changed files with 8 additions and 1 deletions

View File

@ -134,13 +134,20 @@ public class IntelHexParser {
case EXT_LIN:
if (record.length == 2) {
upperAddress = ((record.data[0] & 0xFF) << 8) + (record.data[1] & 0xFF);
upperAddress <<= 16;
upperAddress <<= 16; // ELA is bits 16-31 of the segment base address (SBA), so shift left 16 bits
} else {
throw new Exception("Invalid EXT_LIN record (" + recordIdx + ")");
}
break;
case EXT_SEG:
if (record.length == 2) {
upperAddress = ((record.data[0] & 0xFF) << 8) + (record.data[1] & 0xFF);
upperAddress <<= 4; // ESA is bits 4-19 of the segment base address (SBA), so shift left 4 bits
} else {
throw new Exception("Invalid EXT_SEG record (" + recordIdx + ")");
}
break;
case START_SEG:
case START_LIN:
throw new Exception(record.type + " record not implemented (" + recordIdx + ")");