mirror of
https://github.com/mnaberez/py65.git
synced 2025-03-06 17:29:43 +00:00
monitor: swap byte order for load and save (affects 16-byte binaries)
This commit is contained in:
parent
36a0731483
commit
5802220fc5
@ -439,7 +439,7 @@ class Monitor(cmd.Cmd):
|
||||
if self.byteWidth==8:
|
||||
bytes=map(ord, bytes)
|
||||
elif self.byteWidth==16:
|
||||
bytes=map(lambda msb,lsb: (ord(msb)<<8)+ord(lsb),bytes[1::2],bytes[0::2])
|
||||
bytes=map(lambda msb,lsb: (ord(msb)<<8)+ord(lsb),bytes[0::2],bytes[1::2])
|
||||
|
||||
self._fill(start, start, bytes)
|
||||
|
||||
@ -457,9 +457,9 @@ class Monitor(cmd.Cmd):
|
||||
try:
|
||||
f = open(filename, 'wb')
|
||||
for byte in bytes:
|
||||
for char in range (0,self.byteWidth,8):
|
||||
f.write(chr(byte & 0xff))
|
||||
byte = byte >> 8
|
||||
# output each octect from msb first
|
||||
for shift in range (self.byteWidth-8,-1,-8):
|
||||
f.write(chr((byte>>shift) & 0xff))
|
||||
f.close()
|
||||
except (OSError, IOError), why:
|
||||
msg = "Cannot save file: [%d] %s" % (why[0], why[1])
|
||||
|
Loading…
x
Reference in New Issue
Block a user