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
230 230
231 def list(self):231 def list(self):
232 232
233 address = 0233 for i, ins in enumerate(self.code):
234 for ins in self.code:234 print hex(i), str(ins)
235 print hex(address), str(ins)
236 address += ins.size
237 235
238 236
239class RuntimeFlag:237class RuntimeFlag:
@@ -255,8 +253,6 @@ class Instruction: · 15 unmodified lines
255 253
256 def __init__(self, f):254 def __init__(self, f):
257 255
258 self.start = f.tell()
259
260 self.opcode = read_B(f)256 self.opcode = read_B(f)
261 self.address_mode = read_B(f)257 self.address_mode = read_B(f)
262 258
@@ -268,8 +264,6 @@ class Instruction: · 5 unmodified lines
268 264
269 destination = self.address_mode & 0x07265 destination = self.address_mode & 0x07
270 self.destination, self.destination_type = self.read_operand(destination, f)266 self.destination, self.destination_type = self.read_operand(destination, f)
271
272 self.size = f.tell() - self.start
273 267
274 def read_operand(self, operand, f):268 def read_operand(self, operand, f):
275 269