History

Adjusted the list method to output indices instead of byte addresses for instructions since the program counter is actually an index into the sequence of instructions and not an address into the memory holding the encoded instructions.

David Boddie committed 9 years ago

Commit bbbabb51 parent 0d4808d1 file · +2 −8Browse files

Unified · Split

dis.py+2−8
@@ -230,10 +230,8 @@ class Dis: · 229 unmodified lines
230230
231231 def list(self):
232232
233− address = 0
234− for ins in self.code:
235− print hex(address), str(ins)
236− address += ins.size
233+ for i, ins in enumerate(self.code):
234+ print hex(i), str(ins)
237235
238236
239237 class RuntimeFlag:
@@ -255,8 +253,6 @@ class Instruction: · 15 unmodified lines
255253
256254 def __init__(self, f):
257255
258− self.start = f.tell()
259−
260256 self.opcode = read_B(f)
261257 self.address_mode = read_B(f)
262258
@@ -268,8 +264,6 @@ class Instruction: · 5 unmodified lines
268264
269265 destination = self.address_mode & 0x07
270266 self.destination, self.destination_type = self.read_operand(destination, f)
271−
272− self.size = f.tell() - self.start
273267
274268 def read_operand(self, operand, f):
275269