package com.microchip.mplab.ipecmd.displays; import com.microchip.crownking.Pair; import com.microchip.crownking.edc.DCR; import com.microchip.crownking.edc.Field; import com.microchip.crownking.edc.MemoryPartition; import com.microchip.crownking.edc.Option; import com.microchip.crownking.edc.PIC; import com.microchip.crownking.edc.RegisterMap; import com.microchip.crownking.mplabinfo.FamilyDefinitions.Family; import com.microchip.crownking.mplabinfo.FamilyDefinitions.SubFamily; import com.microchip.mplab.crownkingx.xField; import com.microchip.mplab.crownkingx.xMemoryPartition; import com.microchip.mplab.crownkingx.xPIC; import com.microchip.mplab.ipe.displays.data.ConfigBitsData; import com.microchip.mplab.ipe.displays.data.ConfigField; import com.microchip.mplab.ipe.displays.data.ConfigSetting; import com.microchip.mplab.ipe.displays.data.ConfigWord; import com.microchip.mplab.ipe.displays.data.RegistersPIC; import com.microchip.mplab.ipe.displays.data.RegistersPIC.RegPIC; import com.microchip.mplab.ipelib.common.SharedData; import com.microchip.mplab.ipelib.device.CDevice; import com.microchip.mplab.ipelib.tools.IPENotifier; import com.microchip.mplab.mdbcore.memory.MemoryModel; import com.microchip.mplab.mdbcore.memory.PhysicalMemory; import com.microchip.mplab.mdbcore.memory.MultiPartition.MODE; import com.microchip.mplab.mdbcore.memory.memorytypes.ConfigurationBits; import com.microchip.mplab.mdbcore.memory.memorytypes.ProgramMemory; import com.microchip.mplab.mdbcore.memory.memorytypes.TestMemory; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.openide.util.Exceptions; import org.w3c.dom.Node; public class MemoryView { private SharedData sharedData; private CDevice deviceInfo; private IPENotifier ipeNotify = null; private ConfigBitsData m_DataConfigBits = null; private ArrayList m_Words = null; private long userIDpic32 = 0L; private String[][] Memory; private long userIDpic32_Addr = 0L; private boolean todisplayascii = true; private RegistersPIC m_RegistersPIC; public MemoryView(CDevice device) { this.deviceInfo = device; this.ipeNotify = IPENotifier.getIPENotifierController(); this.sharedData = SharedData.getSingletonObject(); } public boolean showProgramMemory(long startAddr, long endAddr) { boolean retVal = false; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; this.sharedData.setPgmMemBytes(this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr)); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getProgramMemoryData(startAddr, endAddr)); retVal = this.displayProgramMemory( "Program Memory", this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr), true, addrInc, numberOfColumns, bytesPerWord, startAddr, endAddr ); } } } return retVal; } public boolean showProgramMemory(String id, long startAddr, long endAddr) { boolean retVal = false; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; if (id != null) { if (!this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().isEmpty() && id == null) { id = "Single"; } long begin_Addr; if (this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().isEmpty()) { begin_Addr = 0L; long end_Addr = (Long)this.sharedData.getAssemblySession().GetDevice().getMainPartition().getCodeRange().second; } else { begin_Addr = (Long)((MemoryPartition)this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().get(id)).getCodeRange().first; if (begin_Addr > 0L) { begin_Addr -= (Long)((MemoryPartition)this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().get("only")).getCodeRange().first; } long end_Addr = (Long)((MemoryPartition)this.sharedData.getAssemblySession().GetDevice().getIDOntoPartition().get(id)).getCodeRange().second; } this.sharedData.setPgmMemBytes(2L * (endAddr - begin_Addr)); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getProgramMemoryData(id)); retVal = this.displayProgramMemory( "Program Memory", this.sharedData.getPgmMemBytes().length, true, addrInc, numberOfColumns, bytesPerWord, startAddr, endAddr ); } } else { this.sharedData.setPgmMemBytes(this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr)); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getProgramMemoryData(startAddr, endAddr)); retVal = this.displayProgramMemory( "Program Memory", this.deviceInfo.getPgmTotalMemoryInBytes(startAddr, endAddr), true, addrInc, numberOfColumns, bytesPerWord, startAddr, endAddr ); } } } } return retVal; } public boolean showDataFlashMemory(long startAddr, long endAddr) { boolean retVal = false; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; this.sharedData.setPgmMemBytes(this.deviceInfo.getDataFlashMemory()); if (this.deviceInfo.isDataFlash()) { this.sharedData.setPgmMemBytes(this.deviceInfo.getDataFlashMemory()); retVal = this.showDataFlash(startAddr, endAddr); } } } return retVal; } public boolean displayProgramMemory(String typOfMemory, long totByte, boolean isMemory, int adinc, int noC, int byPW, long startAddr, long endAddr) { int count = 0; long dat = 0L; String dataDisplayOnRow = ""; String s = null; byte[] memDat = null; boolean retVal = true; long currentRangeAddr = 0L; if (!this.sharedData.getUIMode()) { long actualStartAddress = 0L; if (this.sharedData.getDeviceName().getMainPartition().hasCode()) { actualStartAddress = (Long)this.sharedData.getDeviceName().getMainPartition().getCodeRange().first; } if (this.sharedData.getAssemblySession().GetDevice().getFamily() == Family.PIC32) { count = (int)(byPW * adinc * (startAddr - actualStartAddress)); } else if (this.sharedData.getAssemblySession().GetDeviceName().startsWith("ATSAM")) { count = 0; } else { count = (int)(byPW / adinc * startAddr); } } memDat = this.sharedData.getPgmMemBytes(); if (memDat.length == totByte && totByte != 0L) { float remainder = (float)(totByte % 16L); totByte /= 16L; if (remainder > 0.0) { totByte++; } if (this.todisplayascii) { this.Memory = new String[(int)totByte + 1][noC + 2]; } else { this.Memory = new String[(int)totByte + 1][noC + 1]; } for (int ilp = 0; ilp < totByte; ilp++) { String[] buff; if (this.todisplayascii) { buff = new String[noC + 2]; } else { buff = new String[noC + 1]; } int jlp = 0; if (adinc != 4) { buff[0] = String.format("%06X", startAddr + ilp * noC * adinc); } else { buff[0] = String.format("%08X", Long.valueOf(Long.toHexString(startAddr), 16) + ilp * noC * adinc); String tempS = buff[0].substring(4).toUpperCase(); String tempP = buff[0].substring(0, 4).toUpperCase(); if (this.sharedData.getUIMode()) { buff[0] = String.format("%s_%s", tempP, tempS); } else { buff[0] = String.format("%s%s", tempP, tempS); } } currentRangeAddr = this.sharedData.hexToDecimal(buff[0]); String[] labelString; if (this.todisplayascii) { labelString = new String[noC + 2]; } else { labelString = new String[noC + 1]; } labelString[0] = "Address"; for (int m = 1; m < noC + 1; m++) { if (this.sharedData.getAssemblySession().GetDevice().getMemTraits().getCodeWordTraits().getAddrInc() == 2L) { labelString[m] = ""; } else { labelString[m] = Long.toHexString(adinc * (m - 1)).toUpperCase(); } } labelString[noC + 1] = "ASCII"; this.Memory[0] = labelString; String k1 = ""; for (int var29 = 1; var29 <= noC; var29++) { if (byPW == 4) { if (count < memDat.length) { if (count == memDat.length - 1) { break; } dat = this.sharedData.getMSBLSB32(memDat[count + 3], memDat[count + 2], memDat[count + 1], memDat[count]); if (adinc == 2) { s = String.format("%1$06X", dat).toUpperCase(); if (s.length() > 6) { s = s.substring(s.length() - 6, s.length()); } } else { s = String.format("%08X", dat); } } else { s = "-- -- --"; } buff[var29] = s; if (!s.equals("-- -- --")) { k1 = k1 + " " + this.getASCIIValue(memDat[count], memDat[count + 1], memDat[count + 2], memDat[count + 3]); } if (this.todisplayascii && var29 == noC && !k1.equals("")) { buff[noC + 1] = k1; } count += 4; } else { if (count < memDat.length) { dat = this.sharedData.getMSBLSB_Integer(memDat[count + 1], memDat[count]); s = String.format("%1$04X", dat).toUpperCase(); } else { s = "-- --"; } buff[var29] = s; if (!s.equals("-- --")) { k1 = k1 + " " + this.getASCIIValuefor2Values(memDat[count], memDat[count + 1]); } if (this.todisplayascii && var29 == noC && !k1.equals("")) { buff[noC + 1] = k1; } count += 2; } } if (this.sharedData.getUIMode()) { System.arraycopy(buff, 0, this.Memory[ilp + 1], 0, buff.length); } else { dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buff.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff[localLoop] + " "; } if (currentRangeAddr >= startAddr && currentRangeAddr <= endAddr) { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } } } return retVal; } private String getASCIIValuefor1Values(byte msb) { return this.validate(msb); } private String getASCIIValuefor2Values(byte msb, byte lsb) { byte[] byteArray = new byte[]{msb, lsb}; String result = ""; for (int i = 0; i < byteArray.length; i++) { result = result + this.validate(byteArray[i]); } return result; } private String getASCIIValue(byte msb1, byte msb2, byte lsb1, byte lsb2) { byte[] byteArray = new byte[]{msb1, msb2, lsb1, lsb2}; String result = ""; for (int i = 0; i < byteArray.length; i++) { result = result + this.validate(byteArray[i]); } return result; } private String validate(byte value) { byte[] byteArray = new byte[]{value}; String result = ""; int temp = 0; String s = String.format("%x", value); temp = Integer.valueOf(s, 16); if (temp >= 32 && temp < 127) { try { result = new String(byteArray, "ASCII"); } catch (UnsupportedEncodingException var7) { Exceptions.printStackTrace(var7); } return result; } else { return "."; } } public String[][] getMemoryArray() { return this.Memory; } public boolean showEEMemory(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; int cou = 0; String s1 = null; long dat = 0L; int count = 0; long currentRangeAddr = 0L; String dataDisplayOnRow = ""; if (this.sharedData.getAssemblySession() != null) { if (!this.deviceInfo.isValidEEMemoryRange(startAddr, endAddr)) { return false; } int var33 = 1; int var31 = 1; float remainder = (float)((endAddr - startAddr) % 16L); numberOfColumns = 16 / var33; String[] labelString = new String[numberOfColumns + 1]; labelString[0] = "Address"; for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(var31 * (m - 1)).toUpperCase(); } byte[] relevanBytes = null; this.sharedData.setEEMemBytes((int)(endAddr - startAddr)); if (this.deviceInfo.isEEMemory() && this.deviceInfo.getEEmemoryRange()) { byte[] dummy = this.deviceInfo.getEEMemoryData(); relevanBytes = new byte[(int)(endAddr - startAddr)]; if (startAddr > dummy.length) { startAddr -= (Long)this.sharedData.getDeviceName().getMagicEEDataRange().first; endAddr -= (Long)this.sharedData.getDeviceName().getMagicEEDataRange().first; } System.arraycopy(dummy, (int)startAddr, relevanBytes, 0, relevanBytes.length); this.sharedData.setEEMemBytes(relevanBytes); } long p = (endAddr - startAddr) / 16L; if (remainder > 0.0) { p++; } byte[] eeB = relevanBytes; long il = 0L; if (this.todisplayascii) { this.Memory = new String[(int)p + 1][numberOfColumns + 2]; } else { this.Memory = new String[(int)p + 1][numberOfColumns + 1]; } for (long var42 = 0L; var42 < p; var42++) { int jl = 0; String[] buff1; if (this.todisplayascii) { buff1 = new String[numberOfColumns + 2]; } else { buff1 = new String[numberOfColumns + 1]; } buff1[0] = String.format("%06X", startAddr + var42 * numberOfColumns * var31); if (this.todisplayascii) { labelString = new String[numberOfColumns + 2]; } else { labelString = new String[numberOfColumns + 1]; } labelString[0] = "Address"; for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(var31 * (m - 1)).toUpperCase(); } labelString[numberOfColumns + 1] = "ASCII"; this.Memory[0] = labelString; Family family = this.sharedData.getAssemblySession().GetDevice().getFamily(); if (family != Family.DSPIC30 && family != Family.DSPIC33 && family != Family.PIC24) { currentRangeAddr = this.sharedData.hexToDecimal(buff1[0]); } else { currentRangeAddr = this.sharedData.hexToDecimal(buff1[0]) + (Long)this.sharedData.getAssemblySession().GetDevice().getEEDataRange().first; } String k1 = ""; for (int jlp = 1; jlp <= numberOfColumns; jlp++) { if (var31 == 2) { String s; if (count < eeB.length) { dat = this.sharedData.getMSBLSB_Integer(eeB[count + 1], eeB[count]); s = String.format("%04X", dat); } else { s = "--"; } buff1[jlp] = s; if (!s.equals("--")) { k1 = k1 + " " + this.getASCIIValuefor2Values(eeB[count], eeB[count + 1]); } if (this.todisplayascii && jlp == numberOfColumns && !k1.equals("")) { buff1[numberOfColumns + 1] = k1; } } else { String sx; if (count < eeB.length) { dat = this.sharedData.getByteasInt(eeB[count]); sx = String.format("%02X", dat); } else { sx = "--"; } buff1[jlp] = sx; if (!sx.equals("--")) { k1 = k1 + " " + this.getASCIIValuefor1Values(eeB[count]); } if (this.todisplayascii && jlp == numberOfColumns && !k1.equals("")) { buff1[numberOfColumns + 1] = k1; } } count += var31; } if (this.sharedData.getUIMode()) { for (int i = 0; i < buff1.length; i++) { this.Memory[(int)var42 + 1][i] = buff1[i]; } } else { dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; } if (family == Family.DSPIC30 || family == Family.DSPIC33 || family == Family.PIC24) { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } else if (currentRangeAddr >= startAddr && currentRangeAddr <= endAddr) { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } } } return retVal; } public boolean showUserIDinUI() { int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; String[] elabelString = new String[]{"Address", "USER ID"}; Family family = this.sharedData.getDeviceName().getFamily(); if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { String maskset = this.sharedData.getAssemblySession().GetDevice().get("masksetid"); if (!maskset.contains("KFAB") && !maskset.contains("KFAE")) { bytesPerWord = (int)this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getWordSize(); } else { bytesPerWord = 2; } if (this.deviceInfo.hasOTPMemory()) { bytesPerWord = (int)this.sharedData.getDeviceName().getMemTraits().getUserOTPWordTraits().getWordSize(); } if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } } String[] labelString = new String[numberOfColumns + 2]; labelString[0] = "Address"; for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); } labelString[numberOfColumns + 1] = "ASCII"; this.sharedData.setUserIDMemBytes(this.deviceInfo.getuserIDTotalBytes()); long userIDTotalBytes = this.deviceInfo.getuserIDTotalBytes(); byte[] UserIDbuf = new byte[(int)userIDTotalBytes]; if (this.deviceInfo.isUserID() || this.deviceInfo.hasOTPMemory()) { UserIDbuf = this.deviceInfo.getUserIDdata(); } else if (this.sharedData.getDeviceName().getFamily().is32Bit()) { this.initConfigWordsXML1("ACTIVE"); UserIDbuf[0] = (byte)(this.userIDpic32 & 255L); UserIDbuf[1] = (byte)(this.userIDpic32 >> 8 & 255L); } if (this.deviceInfo.getuserIDTotalBytes() > 16L) { long totB = this.deviceInfo.getuserIDTotalBytes(); totB /= 16L; this.Memory = new String[(int)totB + 1][numberOfColumns + 2]; this.Memory[0] = labelString; for (int ilp = 0; ilp < totB; ilp++) { String[] buff1 = new String[numberOfColumns + 2]; int jlp = 0; buff1[0] = String.format("%06X", ilp * numberOfColumns * addrInc + this.deviceInfo.getUSerIDAdd()); String k1 = ""; for (int var44 = 1; var44 <= numberOfColumns; var44++) { if (bytesPerWord == 4) { dat = this.sharedData.getMSBLSB32(UserIDbuf[count + 3], UserIDbuf[count + 2], UserIDbuf[count + 1], UserIDbuf[count]); s = String.format("%1$06X", dat); if (s.length() > 6) { s = s.substring(s.length() - 6, s.length()); } buff1[var44] = s; k1 = k1 + " " + this.getASCIIValue(UserIDbuf[count], UserIDbuf[count + 1], UserIDbuf[count + 2], UserIDbuf[count + 3]); if (this.todisplayascii && var44 == numberOfColumns) { buff1[numberOfColumns + 1] = k1; } count += bytesPerWord; } else { dat = this.sharedData.getMSBLSB_Integer(UserIDbuf[count + 1], UserIDbuf[count]); s = String.format("%1$04X", dat); if (s.length() > 4) { s = s.substring(s.length() - 4, s.length()); } buff1[var44] = s; k1 = k1 + " " + this.getASCIIValuefor2Values(UserIDbuf[count], UserIDbuf[count + 1]); if (this.todisplayascii && var44 == numberOfColumns) { buff1[numberOfColumns + 1] = k1; } count += bytesPerWord; } } this.Memory[ilp + 1] = buff1; } } else { String[] TableRowArray = new String[2]; if (this.sharedData.getDeviceName().getFamily().is32Bit()) { this.Memory = new String[2][2]; this.Memory[0] = elabelString; TableRowArray[0] = Long.toHexString(this.userIDpic32_Addr).toUpperCase(); TableRowArray[1] = Long.toHexString(this.userIDpic32).toUpperCase(); this.Memory[1] = TableRowArray; this.displayUserID(this.Memory); return true; } if (family == Family.PIC18) { this.Memory = new String[UserIDbuf.length + 1][2]; this.Memory[0] = elabelString; for (int y = 0; y < UserIDbuf.length; y++) { String h = String.format("%X", UserIDbuf[y]); String[] arr = new String[]{Long.toHexString((Long)this.sharedData.getDeviceName().getUserIDRange().first + y), h.toUpperCase()}; this.Memory[y + 1] = arr; } } else { try { if (UserIDbuf.length == 2) { UserIDtoDisplay = this.sharedData.getMSBLSB(UserIDbuf[1], UserIDbuf[0]).toUpperCase(); TableRowArray[0] = Long.toHexString(this.deviceInfo.getUSerIDAdd()); TableRowArray[1] = UserIDtoDisplay; this.Memory = new String[2][1]; this.Memory[0] = elabelString; this.Memory[1] = TableRowArray; } else if (UserIDbuf.length == 4) { String[] temp = new String[]{ this.sharedData.getUserID(UserIDbuf[1]) + this.sharedData.getUserID(UserIDbuf[0]), null, this.sharedData.getUserID(UserIDbuf[3]) + this.sharedData.getUserID(UserIDbuf[2]), null }; this.Memory = new String[3][2]; this.Memory[0] = elabelString; for (int y = 0; y < 2; y++) { String[] array = new String[]{ Long.toHexString( (Long)this.sharedData.getDeviceName().getUserIDRange().first + this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getAddrInc() * y ), temp[y * 2] }; this.Memory[y + 1] = array; } } else { if (UserIDbuf.length < 8) { UserIDtoDisplay = UserIDtoDisplay.concat(this.sharedData.getMSBLSB(UserIDbuf[0], UserIDbuf[2]).toUpperCase()); TableRowArray[1] = UserIDtoDisplay; TableRowArray[0] = Long.toHexString(this.deviceInfo.getUSerIDAdd()).toUpperCase(); this.Memory = new String[2][1]; this.Memory[0] = elabelString; this.Memory[1] = TableRowArray; return true; } if (UserIDbuf.length == 8) { String[] temp = new String[8]; temp[0] = this.sharedData.getUserID(UserIDbuf[1]) + this.sharedData.getUserID(UserIDbuf[0]); temp[2] = this.sharedData.getUserID(UserIDbuf[3]) + this.sharedData.getUserID(UserIDbuf[2]); temp[4] = this.sharedData.getUserID(UserIDbuf[5]) + this.sharedData.getUserID(UserIDbuf[4]); temp[6] = this.sharedData.getUserID(UserIDbuf[7]) + this.sharedData.getUserID(UserIDbuf[6]); this.Memory = new String[5][2]; this.Memory[0] = elabelString; for (int y = 0; y < 4; y++) { String[] array = new String[]{ Long.toHexString( (Long)this.sharedData.getDeviceName().getUserIDRange().first + this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getAddrInc() * y ), temp[y * 2] }; this.Memory[y + 1] = array; } } else { int mask = 255; if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Midrange) { mask = 127; } else if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Baseline) { mask = 15; } UserIDbuf[0] = (byte)(UserIDbuf[0] & mask); UserIDbuf[2] = (byte)(UserIDbuf[2] & mask); UserIDbuf[4] = (byte)(UserIDbuf[4] & mask); UserIDbuf[6] = (byte)(UserIDbuf[6] & mask); this.Memory = new String[5][2]; this.Memory[0] = elabelString; for (int y = 0; y < 4; y++) { String[] array = new String[]{ Long.toHexString( (Long)this.sharedData.getDeviceName().getUserIDRange().first + this.sharedData.getDeviceName().getMemTraits().getUserIDWordTraits().getAddrInc() * y ), this.sharedData.getUserID(UserIDbuf[y * 2]) }; this.Memory[y + 1] = array; } } } } catch (Exception var22) { } } } this.displayUserID(this.Memory); return true; } private void displayUserID(String[][] mem) { StringBuilder result = new StringBuilder(); for (int i = 0; i < mem.length; i++) { for (int j = 0; j < mem[i].length; j++) { if (j > 0) { result.append(mem[i][j]); result.append("\n"); } else { result.append(mem[i][j]).append(" "); } } } this.ipeNotify.setMessageNotification(result.toString()); } public boolean showUserID(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int bytesPerWord = 0; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } } String[] labelString = new String[numberOfColumns + 1]; labelString[0] = "Address"; for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); } if (!this.deviceInfo.isUserID()) { return false; } else { this.sharedData.setUserIDMemBytes(this.deviceInfo.getuserIDTotalBytes()); long userIDTotalBytes = this.deviceInfo.getuserIDTotalBytes(); byte[] UserIDbuf = new byte[(int)userIDTotalBytes]; if (this.deviceInfo.isUserID()) { UserIDbuf = this.deviceInfo.getUserIDdata(); } else if (this.sharedData.getAssemblySession().GetDevice().getFamily().is32Bit()) { this.initConfigWordsXML(); UserIDbuf[0] = (byte)(this.userIDpic32 & 255L); UserIDbuf[1] = (byte)(this.userIDpic32 >> 8 & 255L); } if (this.deviceInfo.getuserIDTotalBytes() > 16L) { long totB = this.deviceInfo.getuserIDTotalBytes(); totB /= 16L; for (int ilp = 0; ilp < totB; ilp++) { String[] buff1 = new String[numberOfColumns + 1]; int jlp = 0; buff1[0] = String.format("%06X", ilp * numberOfColumns * addrInc + this.deviceInfo.getUSerIDAdd()); for (int var40 = 1; var40 <= numberOfColumns; var40++) { dat = this.sharedData.getMSBLSB32(UserIDbuf[count + 3], UserIDbuf[count + 2], UserIDbuf[count + 1], UserIDbuf[count]); s = String.format("%1$06X", dat); if (s.length() > 6) { s = s.substring(s.length() - 6, s.length()); } buff1[var40] = s; count += 4; } dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; } this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } else { String[] var10000 = new String[]{"Address", "USER ID"}; int totBytesToDisplay = (int)(this.deviceInfo.getuserIDTotalBytes() / this.deviceInfo.getBytesPerWord()); String[] UserIDAddsArray = new String[totBytesToDisplay]; String[] UserIDDataArray = new String[totBytesToDisplay]; if (this.sharedData.getAssemblySession().GetDevice().getFamily().is32Bit()) { UserIDAddsArray[0] = Long.toHexString(this.userIDpic32_Addr).toUpperCase(); } UserIDtoDisplay = ""; try { int sf = UserIDbuf.length; if (this.sharedData.getAssemblySession().GetDevice().getFamily() == Family.PIC18) { for (int y = 0; y < sf; y++) { String h = String.format("%x", UserIDbuf[y]); UserIDDataArray[0] = UserIDtoDisplay.concat(Long.toHexString(Integer.valueOf(h, 16).longValue()).toUpperCase() + "\t"); } } else if (UserIDbuf.length == 2) { UserIDDataArray[0] = this.sharedData.getMSBLSB(UserIDbuf[1], UserIDbuf[0]).toUpperCase(); } else if (UserIDbuf.length < 8) { UserIDDataArray[0] = UserIDtoDisplay.concat(this.sharedData.getMSBLSB(UserIDbuf[0], UserIDbuf[2]).toUpperCase()); } else { int mask = 255; Family family = this.sharedData.getDeviceName().getFamily(); if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Midrange) { mask = 255; } else if (this.deviceInfo.getuserIDTotalBytes() == 8L && family == Family.Baseline) { mask = 15; } UserIDbuf[0] = (byte)(UserIDbuf[0] & mask); UserIDbuf[2] = (byte)(UserIDbuf[2] & mask); UserIDbuf[4] = (byte)(UserIDbuf[4] & mask); UserIDbuf[6] = (byte)(UserIDbuf[6] & mask); int index = 0; for (int i = 0; i < UserIDbuf.length; i += 2) { UserIDDataArray[index] = UserIDtoDisplay.concat(this.sharedData.getMSBLSB(UserIDbuf[i + 1], UserIDbuf[i]).toUpperCase()); UserIDAddsArray[index] = Long.toHexString(this.deviceInfo.getUSerIDAdd() + index).toUpperCase(); index++; } } } catch (Exception var28) { } dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < UserIDAddsArray.length; localLoop++) { dataDisplayOnRow = UserIDAddsArray[localLoop] + " - " + UserIDDataArray[localLoop]; this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } return retVal; } } public boolean initConfigWordsXML() { boolean bAdded = false; boolean bRet = false; int m_nRowFieldCount = 0; int m_nFieldDescMaxLen = 0; int m_numberOfWords = 0; if (this.deviceInfo.getConfigMemoryData() == null) { return false; } else { this.m_DataConfigBits = new ConfigBitsData(this.sharedData.getAssemblySession()); if (this.m_Words != null) { this.m_Words.clear(); } xPIC m_pic = null; m_pic = this.sharedData.getAssemblySession().GetDevice(); if (!(m_pic instanceof PIC)) { return false; } else { byte[] config = new byte[this.deviceInfo.getConfigMemoryData().length + 10]; config = this.deviceInfo.getConfigMemoryData(); int a = 0; this.m_Words = new ArrayList<>(); for (Entry entry : m_pic.getAddrOntoDCR().entrySet()) { long nAddr = entry.getKey(); Node node = entry.getValue(); DCR reg = new DCR(node); String regName = reg.getName(); long uDef = 0L; if (this.deviceInfo.getConfigBytesPerWord() == 4) { uDef = config[a + 3]; uDef &= 255L; uDef <<= 8; uDef += config[a + 2] & 255L; } if (this.deviceInfo.getConfigBytesPerWord() != 1) { if (config.length > a) { uDef = config[a + 1]; uDef &= 255L; uDef <<= 8; uDef += config[a] & 255L; } } else { uDef += config[a] & 255L; } a += this.deviceInfo.getConfigBytesPerWord(); ConfigWord cfgWord = new ConfigWord(); cfgWord.ConfigWordName = regName; cfgWord.address = nAddr; cfgWord.defaultValue = uDef; for (Entry bitField : reg.getPlaceOntoField().entrySet()) { ConfigField cfgField = new ConfigField(); long uBit = bitField.getKey(); Node bitNode = bitField.getValue(); Field field = new xField(bitNode); boolean bHide = field.isHidden(); String fieldNam = field.getName(); if (fieldNam.equalsIgnoreCase("userid")) { this.userIDpic32 = field.getMask(); this.userIDpic32 &= uDef; this.userIDpic32_Addr = nAddr; } boolean debug = field.getName().equalsIgnoreCase("DEBUG") || field.getName().equalsIgnoreCase("BKBUG") || field.getName().equalsIgnoreCase("BACKBUG"); if (debug) { } if (!bHide) { String fieldName = field.getName(); String fieldDesc = field.getDesc(); long uMask = field.getMask(); long uBitMask = uMask << (int)uBit; m_nRowFieldCount++; cfgField.FieldName = fieldName; cfgField.FieldCategory = fieldDesc; cfgField.mask = uBitMask; cfgWord.mask = uBitMask; for (Node optionNode : field.getUniqueOptions()) { Option option = new Option(optionNode); ConfigSetting cfgSetting = new ConfigSetting(); cfgSetting.OptionName = option.getName(); cfgSetting.SettingDesc = option.getDesc(); Long optMask = option.getMask() << (int)uBit; Long optVal = option.getValue() << (int)uBit; cfgSetting.SettingValue = optVal; cfgSetting.SettingReqd = optMask; cfgField.m_Set.add(cfgSetting); int DescLen = cfgSetting.SettingDesc.length(); if (m_nFieldDescMaxLen < DescLen) { m_nFieldDescMaxLen = DescLen; } } if (cfgField.m_Set.size() > 0 && cfgField.FieldName.length() > 0) { cfgField.CurrentSettingDesc = ((ConfigSetting)cfgField.m_Set.get(0)).SettingDesc; cfgField.CurrentOptionName = ((ConfigSetting)cfgField.m_Set.get(0)).OptionName; } bAdded = cfgWord.m_Field.add(cfgField); } } bAdded = this.m_Words.add(cfgWord); m_numberOfWords = Math.max(1, m_numberOfWords); } this.m_DataConfigBits.m_Words = this.m_Words; m_pic = null; return bRet; } } } public byte[] getConfigMemoryData(String prefix) { PhysicalMemory configMemory = this.deviceInfo.getMemory(ConfigurationBits.class); if (configMemory != null) { long begin_Addr = (Long)this.sharedData.getDeviceName().getMainPartition().getDCRRange().first; long end_Addr = (Long)this.sharedData.getDeviceName().getMainPartition().getDCRRange().second; if (!this.sharedData.getDeviceName().getIDOntoPartition().isEmpty() && !prefix.equals("bootcfg")) { if (prefix.equals("")) { prefix = "only"; } MemoryPartition part = (MemoryPartition)this.sharedData.getDeviceName().getIDOntoPartition().get(prefix); begin_Addr = (Long)part.getDCRRange().first; end_Addr = (Long)part.getDCRRange().second; } long memDiff = end_Addr - begin_Addr; int offset = (int)((int)memDiff * this.sharedData.getDeviceName().getMemTraits().getConfigFuseWordTraits().getWordSize()); if (offset > 0) { byte[] bytes = new byte[offset]; configMemory.RefreshFromTarget(begin_Addr, offset); configMemory.Read(begin_Addr, offset, bytes); return bytes; } else { return null; } } else { return null; } } public boolean initConfigWordsXML1(String strRegisterPrefix) { if (this.getConfigMemoryData("") == null) { return false; } else { this.m_DataConfigBits = new ConfigBitsData(this.sharedData.getAssemblySession()); boolean bRet = false; int m_nRowFieldCount = 0; int m_nFieldDescMaxLen = 0; int m_numberOfWords = 0; if (this.m_Words != null) { this.m_Words.clear(); } xPIC m_pic = null; m_pic = this.sharedData.getDeviceName(); RegisterMap rm = null; if (m_pic instanceof xPIC) { boolean m_bhasPartitions = !m_pic.getIDOntoPartition().isEmpty(); xMemoryPartition xmp = m_pic.getMainPartition(); if (xmp instanceof xMemoryPartition) { if (m_bhasPartitions && strRegisterPrefix.equalsIgnoreCase("bootcfg")) { rm = xmp.getRegisterMap(); } else if (m_bhasPartitions && !strRegisterPrefix.isEmpty()) { MemoryPartition part = (MemoryPartition)m_pic.getIDOntoPartition().get(strRegisterPrefix); if (part instanceof MemoryPartition) { rm = part.getRegisterMap(); } } if (rm == null) { rm = xmp.getRegisterMap(); } } } if (!(rm instanceof RegisterMap)) { return false; } else { this.m_Words = new ArrayList<>(); SubFamily subFamily = m_pic.getSubFamily(); boolean bPIC32MZ_FILTER = false; if (subFamily == SubFamily.PIC32MZ && 0 != strRegisterPrefix.compareTo("ACTIVE")) { bPIC32MZ_FILTER = true; } Map mapEntry; if (bPIC32MZ_FILTER) { mapEntry = rm.getAddrOntoAltDCR(); } else { mapEntry = rm.getAddrOntoDCR(); } for (Entry entry : mapEntry.entrySet()) { long nAddr = entry.getKey(); Node node = entry.getValue(); DCR reg = new DCR(node); String regName = reg.getName(); long uDef = reg.getDefault(); if (!bPIC32MZ_FILTER || regName.startsWith(strRegisterPrefix)) { ConfigWord cfgWord = new ConfigWord(); cfgWord.ConfigWordName = regName; cfgWord.address = nAddr; cfgWord.defaultValue = this.deviceInfo.getMemory(ConfigurationBits.class).GetMemoryModel().GetPhysicalMemory().ReadWord(nAddr); for (Entry bitField : reg.getPlaceOntoField().entrySet()) { ConfigField cfgField = new ConfigField(); long uBit = bitField.getKey(); Node bitNode = bitField.getValue(); Field field = new xField(bitNode); boolean bHide = field.isHidden(); String fieldNam = field.getName(); if (fieldNam.equalsIgnoreCase("userid")) { this.userIDpic32 = field.getMask(); if (this.sharedData.getAssemblySession().GetDevice().getSubFamily() == SubFamily.PIC32MM) { this.userIDpic32 = cfgWord.defaultValue >> 16; } else { this.userIDpic32 = cfgWord.defaultValue & this.userIDpic32; } this.userIDpic32_Addr = nAddr; } if (!bHide) { String fieldName = field.getName(); String fieldDesc = field.getDesc(); long uMask = field.getMask(); long uBitMask = uMask << (int)uBit; m_nRowFieldCount++; cfgField.FieldName = fieldName; cfgField.FieldCategory = fieldDesc; cfgField.mask = uBitMask; cfgWord.mask = uBitMask; for (Node optionNode : field.getUniqueOptions()) { try { Option option = new Option(optionNode); cfgField.bValueRange = option.isRange(); ConfigSetting cfgSetting = new ConfigSetting(); cfgSetting.OptionName = option.getName(); cfgSetting.SettingDesc = option.getDesc(); if (cfgField.bValueRange) { Long optMinValue = cfgSetting.MinValue = option.getMinValue(); Long optMaxValue = cfgSetting.MaxValue = option.getMaxValue(); System.out.println(cfgSetting.OptionName + " : " + cfgSetting.SettingDesc); System.out.println("MinValue=0x" + Long.toHexString(optMinValue) + " : Val=0x" + Long.toHexString(optMaxValue)); } else { long optMask = option.getMask() << (int)uBit; long optVal = option.getValue() << (int)uBit; cfgSetting.SettingValue = optVal; cfgSetting.SettingReqd = optMask; } cfgField.m_Set.add(cfgSetting); int DescLen = cfgSetting.SettingDesc.length(); if (m_nFieldDescMaxLen < DescLen) { m_nFieldDescMaxLen = DescLen; } } catch (Exception var45) { } } if (cfgField.m_Set.size() > 0 && cfgField.FieldName.length() > 0) { cfgField.CurrentSettingDesc = ((ConfigSetting)cfgField.m_Set.get(0)).SettingDesc; cfgField.CurrentOptionName = ((ConfigSetting)cfgField.m_Set.get(0)).OptionName; } boolean bAdded = cfgWord.m_Field.add(cfgField); } else { System.out.println(field.getName()); System.out.println(field.getMask()); System.out.println("\n"); } } boolean bAdded = this.m_Words.add(cfgWord); m_numberOfWords = Math.max(1, m_numberOfWords); } } this.m_DataConfigBits.m_Words = this.m_Words; m_pic = null; return bRet; } } } boolean updateSettings(long lAddress, long lSize) { MemoryModel m_Memory = this.deviceInfo.getMemModel(); if (!(this.m_DataConfigBits instanceof ConfigBitsData)) { return false; } else { for (long K = 0L; K < lSize; K += m_Memory.WordIncrement()) { long lTargetAddr = lAddress + K; long configValue = 0L; boolean bFoundWord = false; ConfigWord cfgWord = new ConfigWord(); configValue = m_Memory.GetPhysicalMemory().ReadWord(lTargetAddr); for (int iWord = 0; iWord < this.m_DataConfigBits.m_Words.size(); iWord++) { cfgWord = (ConfigWord)this.m_DataConfigBits.m_Words.get(iWord); if (cfgWord instanceof ConfigWord && lTargetAddr == cfgWord.address) { bFoundWord = true; ((ConfigWord)this.m_DataConfigBits.m_Words.get(iWord)).defaultValue = configValue; break; } } if (bFoundWord) { boolean bFound = false; for (ConfigField cfgField : cfgWord.m_Field) { for (ConfigSetting cfgSetting : cfgField.m_Set) { long requiredMask = cfgSetting.SettingReqd; if (requiredMask == 0L) { requiredMask = cfgField.mask; } long lCurrentValue = configValue & requiredMask; if (lCurrentValue == cfgSetting.SettingValue) { cfgField.CurrentSettingDesc = cfgSetting.SettingDesc; cfgField.CurrentOptionName = cfgSetting.OptionName; bFound = true; break; } } if (!bFound && cfgField.m_Set.size() > 0) { ConfigSetting cfgSetting = (ConfigSetting)cfgField.m_Set.get(0); cfgField.CurrentSettingDesc = cfgSetting.SettingDesc; cfgField.CurrentOptionName = cfgSetting.OptionName; } } } } return true; } } public boolean showConfigMemory(long startAddr, long endAddr) { boolean retVal = true; boolean addressDisplay = false; String dataDisplayOnRow = ""; String AlldataDisplayOnRow = ""; xPIC m_pic = this.sharedData.getDeviceName(); ProgramMemory mem = (ProgramMemory)this.sharedData.getAssemblySession().getLookup().lookup(ProgramMemory.class); if (m_pic.getSubFamily().equals(SubFamily.PIC32MZ)) { this.initConfigWordsXML1("ACTIVE"); } else if (!m_pic.getIDOntoPartition().isEmpty()) { if (mem.GetMode() != MODE.UNIFIED) { this.initConfigWordsXML1("first"); this.initConfigWordsXML1("second"); this.initConfigWordsXML1("bootcfg"); } else { this.initConfigWordsXML1(""); } } else { this.initConfigWordsXML1(""); } this.updateSettings(this.deviceInfo.getConfigStart(), this.deviceInfo.getConfigSize()); String[] StringToDisplay = new String[7]; List FieldCurWord = null; for (int q = 0; q < this.m_Words.size(); q++) { ConfigWord curWord = this.m_Words.get(q); FieldCurWord = curWord.m_Field; for (int qs = 0; qs < FieldCurWord.size(); qs++) { StringToDisplay = new String[7]; if (qs == 0) { StringToDisplay[0] = Long.toHexString(curWord.address).toUpperCase(); StringToDisplay[1] = curWord.ConfigWordName.toUpperCase(); StringToDisplay[2] = Long.toHexString(curWord.defaultValue).toUpperCase(); } else { StringToDisplay[0] = ""; StringToDisplay[1] = ""; StringToDisplay[2] = ""; } StringToDisplay[3] = FieldCurWord.get(qs).FieldName; StringToDisplay[4] = FieldCurWord.get(qs).CurrentOptionName; StringToDisplay[5] = FieldCurWord.get(qs).FieldCategory; StringToDisplay[6] = FieldCurWord.get(qs).CurrentSettingDesc; if (!addressDisplay) { AlldataDisplayOnRow = StringToDisplay[0] + " "; addressDisplay = true; } dataDisplayOnRow = StringToDisplay[2] + " "; if (dataDisplayOnRow.trim().length() != 0) { AlldataDisplayOnRow = AlldataDisplayOnRow + dataDisplayOnRow; } } } this.ipeNotify.setMessageNotification(AlldataDisplayOnRow); return retVal; } public boolean showFlashData(long startAddr, long endAddr) { boolean retVal = true; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; int cou = 0; String s1 = null; String[] labelString = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}; String[] labelString1 = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "ASCII"}; this.sharedData.setFlashBytes(this.deviceInfo.getFlashMemoryData().length); if (this.deviceInfo.isFlashData() && this.deviceInfo.getFlashDataRange()) { this.sharedData.setFlashBytes(this.deviceInfo.getFlashMemoryData()); } long p = this.deviceInfo.getFlashMemoryData().length / 16; byte[] eeB = this.deviceInfo.getFlashMemoryData(); Family f = this.sharedData.getAssemblySession().GetDevice().getFamily(); if (this.todisplayascii) { this.Memory = new String[(int)p + 1][18]; this.Memory[0] = labelString1; } else { this.Memory = new String[(int)p + 1][17]; this.Memory[0] = labelString; } for (int il = 0; il < p; il++) { int jl = 0; String[] buff1; if (this.todisplayascii) { buff1 = new String[18]; } else { buff1 = new String[17]; } buff1[0] = String.format("%06X", il * 16); String k1 = ""; for (int jlp = 1; jlp <= 16; jlp++) { dat = this.sharedData.getByteasInt(eeB[count]); s = String.format("%02X", dat); buff1[jlp] = s; k1 = k1 + " " + this.getASCIIValuefor1Values(eeB[count]); if (this.todisplayascii && jlp == 16) { buff1[17] = k1; } count++; } dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; } if (this.sharedData.getUIMode()) { this.Memory[il + 1] = buff1; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } return retVal; } public boolean showDataFlash(long startAddr, long endAddr) { boolean retVal = true; long dat = 0L; int count = 0; String s = ""; String UserIDtoDisplay = ""; String dataDisplayOnRow = ""; int cou = 0; String s1 = null; String[] labelString = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7"}; String[] labelString1 = new String[]{"Address", "0", "1", "2", "3", "4", "5", "6", "7", "ASCII"}; this.sharedData.setFlashBytes(this.deviceInfo.getDataFlashMemory().length); if (this.deviceInfo.isDataFlash() && this.deviceInfo.getDataFlashRange()) { this.sharedData.setFlashBytes(this.deviceInfo.getDataFlashMemory()); } long p = this.deviceInfo.getDataFlashMemory().length / 16; byte[] eeB = this.deviceInfo.getDataFlashMemory(); Family f = this.sharedData.getAssemblySession().GetDevice().getFamily(); if (this.todisplayascii) { this.Memory = new String[(int)p + 1][10]; this.Memory[0] = labelString1; } else { this.Memory = new String[(int)p + 1][9]; this.Memory[0] = labelString; } for (int il = 0; il < p; il++) { int jl = 0; String[] buff1; if (this.todisplayascii) { buff1 = new String[10]; } else { buff1 = new String[9]; } buff1[0] = String.format("%03X", il * 8); String k1 = ""; for (int jlp = 1; jlp <= 8; jlp++) { dat = this.sharedData.getMSBLSB_Integer(eeB[count + 1], eeB[count]); s = String.format("%04X", dat).toUpperCase(); buff1[jlp] = s; k1 = k1 + " " + this.getASCIIValuefor2Values(eeB[count], eeB[count + 1]); if (this.todisplayascii && jlp == 8) { buff1[9] = k1; } count += 2; } dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; } if (this.sharedData.getUIMode()) { this.Memory[il + 1] = buff1; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } return retVal; } public boolean showBootFlashData(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int count = 0; String s = ""; String dataDisplayOnRow = ""; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } } String[] labelString; if (this.todisplayascii) { labelString = new String[numberOfColumns + 2]; } else { labelString = new String[numberOfColumns + 1]; } labelString[0] = "Address"; for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); } labelString[numberOfColumns + 1] = "ASCII"; this.sharedData.setBootFlashBytes(this.deviceInfo.getBootMemInBytes()); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setBootFlashBytes(this.deviceInfo.getBootMemData()); } byte[] boot = this.deviceInfo.getBootMemData(); long totBoot = this.deviceInfo.getBootMemInBytes(); totBoot /= 16L; if (this.todisplayascii) { this.Memory = new String[(int)totBoot + 1][numberOfColumns + 2]; } else { this.Memory = new String[(int)totBoot + 1][numberOfColumns + 1]; } this.Memory[0] = labelString; for (int ilp = 0; ilp < totBoot; ilp++) { String[] buff1; if (this.todisplayascii) { buff1 = new String[numberOfColumns + 2]; } else { buff1 = new String[numberOfColumns + 1]; } int jlp = 0; buff1[0] = String.format("%08X", Long.valueOf("1FC00000", 16) + ilp * numberOfColumns * addrInc); String tempS = buff1[0].substring(4).toUpperCase(); String tempP = buff1[0].substring(0, 4).toUpperCase(); buff1[0] = String.format("%s_%s", tempP, tempS); String k1 = ""; for (int var29 = 1; var29 <= numberOfColumns; var29++) { long dat = this.sharedData.getMSBLSB32(boot[count + 3], boot[count + 2], boot[count + 1], boot[count]); s = String.format("%08X", dat); buff1[var29] = s; k1 = k1 + " " + this.getASCIIValue(boot[count], boot[count + 1], boot[count + 2], boot[count + 3]); if (this.todisplayascii && var29 == numberOfColumns) { buff1[numberOfColumns + 1] = k1; } count += 4; } dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buff1.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buff1[localLoop] + " "; } if (this.sharedData.getUIMode()) { this.Memory[ilp + 1] = buff1; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } return retVal; } public boolean showAuxiliaryData(long startAddr, long endAddr) { boolean retVal = true; int addrInc = 0; int numberOfColumns = 0; int count = 0; String s = ""; String dataDisplayOnRow = ""; int bytesPerWord = 0; if (this.sharedData.getAssemblySession() != null && this.sharedData.getAssemblySession().GetDevice().getFamily().compareTo(Family.SEE) != 0) { bytesPerWord = this.deviceInfo.getBytesPerWord(); if (bytesPerWord != -1) { addrInc = this.deviceInfo.getAddrInc(); numberOfColumns = 16 / bytesPerWord; } } String[] labelString; if (this.todisplayascii) { labelString = new String[numberOfColumns + 2]; } else { labelString = new String[numberOfColumns + 1]; } labelString[0] = "Address"; for (int m = 1; m < numberOfColumns + 1; m++) { labelString[m] = Long.toHexString(addrInc * (m - 1)).toUpperCase(); } labelString[numberOfColumns + 1] = "ASCII"; this.sharedData.setAuxMemBytes(this.deviceInfo.getAuxMemTotalMemoryInBytes()); if (this.deviceInfo.isProgramMemory()) { this.sharedData.setAuxMemBytes(this.deviceInfo.getAuxMemData()); } byte[] auxData = this.deviceInfo.getAuxMemData(); long tota = this.deviceInfo.getAuxMemTotalMemoryInBytes() * 2L; int countaux = 0; long dataux = 0L; tota /= 16L; if (this.todisplayascii) { this.Memory = new String[(int)tota + 1][numberOfColumns + 2]; } else { this.Memory = new String[(int)tota + 1][numberOfColumns + 1]; } this.Memory[0] = labelString; for (int ilp = 0; ilp < tota; ilp++) { String[] buffaux; if (this.todisplayascii) { buffaux = new String[numberOfColumns + 2]; } else { buffaux = new String[numberOfColumns + 1]; } int jlp = 0; buffaux[0] = String.format("%06X", ilp * numberOfColumns * addrInc + this.deviceInfo.auxMemBeginAddr); String k1 = ""; for (int var30 = 1; var30 <= numberOfColumns; var30++) { dataux = this.sharedData.getMSBLSB32(auxData[countaux + 3], auxData[countaux + 2], auxData[countaux + 1], auxData[countaux]); String saux = String.format("%1$06X", dataux); if (saux.length() > 6) { saux = saux.substring(saux.length() - 6, saux.length()); } buffaux[var30] = saux; k1 = k1 + " " + this.getASCIIValue(auxData[countaux], auxData[countaux + 1], auxData[countaux + 2], auxData[countaux + 3]); if (this.todisplayascii && var30 == numberOfColumns) { buffaux[numberOfColumns + 1] = k1; } countaux += 4; } dataDisplayOnRow = ""; for (int localLoop = 0; localLoop < buffaux.length; localLoop++) { dataDisplayOnRow = dataDisplayOnRow + buffaux[localLoop] + " "; } if (this.sharedData.getUIMode()) { this.Memory[ilp + 1] = buffaux; } else { this.ipeNotify.setMessageNotification(dataDisplayOnRow); } } return retVal; } public boolean showDIAMemory() { String[] labelString = new String[]{"Address", "Name", "Hex"}; Pair p = this.sharedData.getAssemblySession().GetDevice().getMainPartition().getDIARange(); int m_nRowCount = 0; this.m_RegistersPIC = new RegistersPIC(this.sharedData.getAssemblySession()); if (!(this.m_RegistersPIC instanceof RegistersPIC)) { return false; } else { for (RegPIC rr : this.m_RegistersPIC.m_Registers) { if (rr.m_lAddress <= (Long)p.second && rr.m_lAddress != -1L) { m_nRowCount++; } } this.Memory = new String[m_nRowCount + 1][3]; this.Memory[0] = labelString; MemoryModel memory = (MemoryModel)this.sharedData.getAssemblySession().getLookup().lookup(TestMemory.class); int currentRow = 1; for (RegPIC rrx : this.m_RegistersPIC.m_Registers) { if (rrx instanceof RegPIC) { if (rrx instanceof RegPIC && memory instanceof MemoryModel && rrx.m_lAddress != -1L) { try { if (rrx.m_lAddress > (Long)p.second) { break; } rrx.m_nValue = memory.GetPhysicalMemory().ReadWord(rrx.m_lAddress); } catch (ArrayIndexOutOfBoundsException var11) { var11.printStackTrace(); } } boolean bRegionName = rrx.m_lAddress == -1L; for (int nCol = 0; nCol < 3; nCol++) { switch (nCol) { case 0: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%X", rrx.m_lAddress); } break; case 1: if (!bRegionName) { this.Memory[currentRow][nCol] = rrx.RegName; } break; case 2: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%04X", rrx.m_nValue & 16383L); } } } if (!bRegionName) { currentRow++; } } } int row = this.Memory.length; int col = this.Memory[0].length; StringBuilder sb = new StringBuilder(); for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { sb.append(this.Memory[i][j] + " "); } sb.append("\n"); } this.ipeNotify.setMessageNotification(sb.toString()); return true; } } public boolean showDCIMemory() { String[] labelString = new String[]{"Address", "Name", "Hex"}; int m_nRowCount = 0; this.m_RegistersPIC = new RegistersPIC(this.sharedData.getAssemblySession()); if (!(this.m_RegistersPIC instanceof RegistersPIC)) { return false; } else { Pair p = this.m_RegistersPIC.getRangeDCI(); for (RegPIC rr : this.m_RegistersPIC.m_Registers) { if (rr.m_lAddress >= (Long)p.first) { m_nRowCount++; } } this.Memory = new String[m_nRowCount + 1][3]; this.Memory[0] = labelString; int currentRow = 1; Iterator var12 = this.m_RegistersPIC.m_Registers.iterator(); while (true) { RegPIC rrx; while (true) { if (!var12.hasNext()) { this.ipeNotify.setMessageNotification(""); return true; } rrx = (RegPIC)var12.next(); if (rrx instanceof RegPIC) { MemoryModel memory = (MemoryModel)this.sharedData.getAssemblySession().getLookup().lookup(TestMemory.class); if (!(rrx instanceof RegPIC) || !(memory instanceof MemoryModel) || rrx.m_lAddress == -1L) { break; } try { if (rrx.m_lAddress >= (Long)p.first) { rrx.m_nValue = memory.GetPhysicalMemory().ReadWord(rrx.m_lAddress); break; } } catch (ArrayIndexOutOfBoundsException var10) { var10.printStackTrace(); break; } } } boolean bRegionName = rrx.m_lAddress == -1L; for (int nCol = 0; nCol < 3; nCol++) { switch (nCol) { case 0: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%X", rrx.m_lAddress); } break; case 1: if (!bRegionName) { this.Memory[currentRow][nCol] = rrx.RegName; } break; case 2: if (!bRegionName) { this.Memory[currentRow][nCol] = String.format("%04X", rrx.m_nValue & 16383L); } } } if (!bRegionName) { currentRow++; } } } } }