From: Manfred Steiner Date: Fri, 21 Dec 2018 05:12:19 +0000 (+0100) Subject: handling of intel hex record type 2 and 4 (extended addresses) X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=f30a5032fc1c16f5c0456432b4bfeedf54208002;p=sx%2Feasyprogrammer.git handling of intel hex record type 2 and 4 (extended addresses) --- diff --git a/src/at/htlkaindorf/sx/EasyProgrammer/data/RSNOutputStream.java b/src/at/htlkaindorf/sx/EasyProgrammer/data/RSNOutputStream.java index f932873..434a1c0 100644 --- a/src/at/htlkaindorf/sx/EasyProgrammer/data/RSNOutputStream.java +++ b/src/at/htlkaindorf/sx/EasyProgrammer/data/RSNOutputStream.java @@ -183,13 +183,14 @@ public class RSNOutputStream extends FilterOutputStream break; case 2: // Extended Segment Address - throw new Exception("Intel-Hex Format - Typ 02 not supported yet"); + executeIntelHexTyp02(b); + break; case 3: // Start Segment Address Record throw new Exception("Intel-Hex Format - Typ 03 not supported yet"); case 4: // Extended Linear Address Record - throw new Exception("Intel-Hex Format - Typ 04 not supported yet"); + executeIntelHexTyp04(b); case 5: // Start Linear Address Record throw new Exception("Intel-Hex Format - Typ 05 not supported yet"); @@ -270,6 +271,24 @@ public class RSNOutputStream extends FilterOutputStream memoryContent.setComplete(true); } + + private void executeIntelHexTyp02 (int [] b) throws Exception { + if (b[3] != 2) { + throw new RuntimeException("Falscher Typ"); + } + int b4 = (int)b[4]; if (b4 < 0) b4 += 256; + int b5 = (int)b[5]; if (b5 < 0) b5 += 256; + this.offset = (b4 * 256 + b5) << 4; + } + + private void executeIntelHexTyp04 (int [] b) throws Exception { + if (b[3] != 4) { + throw new RuntimeException("Falscher Typ"); + } + int b4 = (int)b[4]; if (b4 < 0) b4 += 256; + int b5 = (int)b[5]; if (b5 < 0) b5 += 256; + this.offset = (b4 * 256 + b5) << 16; + } @Override public String toString()