Exemple #1
0
  def _name_or_addr(self, address):
    if isinstance(address, str):
      assert len(address) == 1, repr(address)
      address = ord(address)

    if isinstance(address, int):
      name = '%#06x' % address
      address = int2addr(address)
    else:
      assert isinstance(address, intbv), repr(address)
      name = self._name_of_address_thunk(address)
    return name, address
Exemple #2
0
  def __init__(self, initial_context=None):
    if initial_context is None:
      initial_context = G.copy()

    self.context = defaultdict(lambda: int2addr(0))
    self.context.update(self._instruction_namespace())
    self.context.update((f.__name__, f) for f in (
        self.define,
        self.org,
        self.label,
        self.dw,
        self.db,
        low,
        high,
        )
      )
    self.context['range'] = xrange
    self.context.update(initial_context)

    self.here = int2addr(0)
    self.data = {}
    ##    UBRR0H=0xc5,
    ##    UCSR0A=0xc0,
    ##    UCSR0B=0xc1,
    ##    UCSR0C=0xc2,
    ##    TXEN0=3, # Transmitter Enable
    ##    RXEN0=4, # Receiver Enable
    ##
    ##    RXC0=7, # USART Receive Complete
    ##    UDR0=0xc6,
    ##    UDRE0=5,
)

# Register mnemonics.
defs.update(('r%i' % n, n) for n in range(32))

defs = dict((k, int2addr(v)) for k, v in defs.items())

# ***** CPU REGISTER DEFINITIONS *****************************************
defs.update(
    XH=defs['r27'],
    XL=defs['r26'],
    X=defs['r26'],
    YH=defs['r29'],
    YL=defs['r28'],
    Y=defs['r28'],
    ZH=defs['r31'],
    ZL=defs['r30'],
    Z=defs['r30'],
)

##
Exemple #4
0
def _f(n):
  if isinstance(n, str):
    n = int(n, 16)
  return int2addr(n)
Exemple #5
0
##    UCSR0B=0xc1,
##    UCSR0C=0xc2,
##    TXEN0=3, # Transmitter Enable
##    RXEN0=4, # Receiver Enable
##
##    RXC0=7, # USART Receive Complete
##    UDR0=0xc6,
##    UDRE0=5,
)


# Register mnemonics.
defs.update(('r%i'% n, n) for n in range(32))


defs = dict((k, int2addr(v)) for k, v in defs.items())


# ***** CPU REGISTER DEFINITIONS *****************************************
defs.update(
  XH	= defs['r27'],
  XL	= defs['r26'],
  X	= defs['r26'],
  YH	= defs['r29'],
  YL	= defs['r28'],
  Y	= defs['r28'],
  ZH	= defs['r31'],
  ZL	= defs['r30'],
  Z	= defs['r30'],
  )