2015-10-16 09:40:38 +00:00
|
|
|
"""Data/storage model for SixtyPical."""
|
|
|
|
|
|
|
|
class LocationRef(object):
|
|
|
|
def __init__(self, name):
|
|
|
|
self.name = name
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return 'LocationRef(%r)' % self.name
|
|
|
|
|
2015-10-16 22:12:52 +00:00
|
|
|
def __eq__(self, other):
|
|
|
|
return isinstance(other, LocationRef) and other.name == self.name
|
|
|
|
|
2015-10-16 09:40:38 +00:00
|
|
|
|
|
|
|
class ConstantRef(object):
|
|
|
|
def __init__(self, value):
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return 'ConstantRef(%r)' % self.value
|
|
|
|
|
2015-10-16 22:12:52 +00:00
|
|
|
def __eq__(self, other):
|
|
|
|
return isinstance(other, ConstantRef) and other.value == self.value
|
|
|
|
|
2015-10-16 09:40:38 +00:00
|
|
|
|
|
|
|
# TODO type=byte
|
|
|
|
|
|
|
|
REG_A = LocationRef('a')
|
|
|
|
REG_X = LocationRef('x')
|
|
|
|
REG_Y = LocationRef('y')
|
|
|
|
|
|
|
|
# TODO type=bit
|
|
|
|
|
|
|
|
FLAG_Z = LocationRef('z')
|
|
|
|
FLAG_C = LocationRef('c')
|
|
|
|
FLAG_N = LocationRef('n')
|
|
|
|
FLAG_V = LocationRef('v')
|