Skip to content
Browse files

Literal values of A no longer act as memory addresses

  • Loading branch information...
1 parent 2b37d8e commit bcadcb9328011109768a04608d9df2a33ecf9643 @andre-d andre-d committed Apr 8, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 dcpu16.py
View
7 dcpu16.py
@@ -17,7 +17,7 @@
# offsets into DCPU16.memory corresponding to addressing mode codes
-SP, PC, O = 0x1001B, 0x1001C, 0x1001D
+SP, PC, O, LIT = 0x1001B, 0x1001C, 0x1001D, 0x1001E
def opcode(code):
@@ -36,7 +36,7 @@ def __init__(self, memory, plugins=[]):
self.plugins = plugins
- self.memory = [memory[i] if i < len(memory) else 0 for i in range(0x1001E)]
+ self.memory = [memory[i] if i < len(memory) else 0 for i in range(0x1001F)]
self.skip = False
self.cycle = 0
@@ -182,6 +182,9 @@ def get_operand(self, a, dereference=False):
else:
literal = True
arg1 = a % 0x20
+ if not dereference:
+ self.memory[LIT] = arg1
+ arg1 = LIT
if dereference and not literal:
arg1 = self.memory[arg1]

0 comments on commit bcadcb9

Please sign in to comment.
Something went wrong with that request. Please try again.