210100C9
It returned this:
2A2A54493833462A
1A0A0046696C6520
67656E6572617465
6420627920576162
6269745369676E00
0000000000000000
00000000004000D0
018000650524F475
2414D00000018001
600BB6D210100C9C
E00B
4000 is the size, but it was supposed to be 0400. So, am I missing a switch in the code?
def to_binary(hex_string):
ints = [int(hex_string[i:i+2], 16) for i in range(0,len(hex_string),2)]
return struct.pack('B' * len(ints), *ints)
dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "8XP Files (*.8xp)|*.8xp", \
wx.SAVE | wx.OVERWRITE_PROMPT)
if dlg.ShowModal() == wx.ID_OK:
programData = self.inputText.GetValue()
dataLengthBigEndian = len(programData)/2
littleEndian = dataLengthBigEndian % 256 * 256 + (dataLengthBigEndian / 256)
sample8xp = "2A2A54493833462A1A0A0046696C652067656E657261746564206279205761626269745369676E0000000000000000000000000000"""+str(hex(littleEndian)[2:])+"0D0018000650524F4752414D00000018001600BB6D"+programData+"CE0B"
print littleEndian
print dataLengthBigEndian
self.filename=dlg.GetFilename()
self.dirname=dlg.GetDirectory()
filehandle=open(os.path.join(self.dirname, self.filename),'wb')
filehandle.write(to_binary(sample8xp))
filehandle.close()
self.SetTitle('Assemblex - '+self.filename)
dlg.Destroy()