本文整理汇总了Python中py65.utils.addressing.AddressParser.number方法的典型用法代码示例。如果您正苦于以下问题:Python AddressParser.number方法的具体用法?Python AddressParser.number怎么用?Python AddressParser.number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py65.utils.addressing.AddressParser
的用法示例。
在下文中一共展示了AddressParser.number方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_number_label_dec_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_label_dec_offset(self):
parser = AddressParser()
parser.labels = {"foo": 0xC000}
self.assertEqual(0xC003, parser.number("foo++3"))
self.assertEqual(0xBFFD, parser.number("foo-+3"))
self.assertEqual(0xC003, parser.number("foo + +3"))
self.assertEqual(0xBFFD, parser.number("foo - +3"))
示例2: test_number_label_bin_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_label_bin_offset(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
self.assertEqual(0xC003, parser.number('foo+%00000011'))
self.assertEqual(0xBFFD, parser.number('foo-%00000011'))
self.assertEqual(0xC003, parser.number('foo + %00000011'))
self.assertEqual(0xBFFD, parser.number('foo - %00000011'))
示例3: test_number_bad_label
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_bad_label(self):
parser = AddressParser()
try:
parser.number('bad_label')
self.fail()
except KeyError, why:
self.assertEqual('Label not found: bad_label', why[0])
示例4: test_number_bad_label_with_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_bad_label_with_offset(self):
parser = AddressParser()
try:
parser.number('bad_label+3')
self.fail()
except KeyError as exc:
self.assertEqual('Label not found: bad_label', exc.args[0])
示例5: test_number_label_dec_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_label_dec_offset(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
self.assertEquals(0xC003, parser.number('foo++3'))
self.assertEquals(0xBFFD, parser.number('foo-+3'))
self.assertEquals(0xC003, parser.number('foo + +3'))
self.assertEquals(0xBFFD, parser.number('foo - +3'))
示例6: test_number_bad_label_with_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_bad_label_with_offset(self):
parser = AddressParser()
try:
parser.number("bad_label+3")
self.fail()
except KeyError, why:
self.assertEqual("Label not found: bad_label", why[0])
示例7: test_number_bad_label_with_offset
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_bad_label_with_offset(self):
parser = AddressParser()
try:
parser.number('bad_label+3')
self.fail()
except KeyError as why:
self.assertEqual("'Label not found: bad_label'", str(why))
示例8: test_number_bad_label_syntax
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_bad_label_syntax(self):
parser = AddressParser()
parser.labels = {'foo': 0xFFFF}
try:
parser.number('#$foo')
self.fail()
except KeyError as exc:
self.assertEqual('Label not found: #$foo', exc.args[0])
示例9: test_number_label_offset_default_radix
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_label_offset_default_radix(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
parser.radix = 16
self.assertEqual(0xC010, parser.number('foo+10'))
self.assertEqual(0xBFF0, parser.number('foo-10'))
self.assertEqual(0xC010, parser.number('foo + 10'))
self.assertEqual(0xBFF0, parser.number('foo - 10'))
parser.radix = 10
self.assertEqual(0xC00A, parser.number('foo+10'))
self.assertEqual(0xBFF6, parser.number('foo-10'))
self.assertEqual(0xC00A, parser.number('foo + 10'))
self.assertEqual(0xBFF6, parser.number('foo - 10'))
示例10: test_number_label
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_label(self):
parser = AddressParser()
parser.labels = {'foo': 0xC000}
self.assertEqual(0xC000, parser.number('foo'))
示例11: test_number_default_radix
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_default_radix(self):
parser = AddressParser()
parser.radix = 10
self.assertEqual(10, parser.number('10'))
parser.radix = 16
self.assertEqual(16, parser.number('10'))
示例12: test_number_bin_literal
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_bin_literal(self):
parser = AddressParser()
self.assertEqual(129, parser.number('%10000001'))
示例13: test_number_dec_literal
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_dec_literal(self):
parser = AddressParser()
self.assertEqual(49152, parser.number('+49152'))
示例14: Monitor
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
#.........这里部分代码省略.........
requested = args.upper()
new_mpu = mpus.get(requested, None)
if new_mpu is None:
self._output("Unknown MPU: %s" % args)
available_mpus()
else:
self._reset(new_mpu)
self._output("Reset with new MPU %s" % self._mpu.name)
def help_mpu(self):
self._output("mpu\t\tPrint available microprocessors.")
self._output("mpu <type>\tSelect a new microprocessor.")
def do_EOF(self, args):
self._output('')
return 1
def help_EOF(self):
self._output("To quit, type ^D or use the quit command.")
def do_quit(self, args):
return self.do_EOF(args)
def help_quit(self):
return self.help_EOF()
def do_assemble(self, args):
split = args.split(None, 1)
if len(split) != 2:
return self._interactive_assemble(args)
start, statement = split
try:
start = self._address_parser.number(start)
except KeyError:
self._output("Bad label: %s" % start)
return
bytes = self._assembler.assemble(statement, start)
if bytes is None:
self._output("Assemble failed: %s" % statement)
else:
end = start + len(bytes)
self._mpu.memory[start:end] = bytes
self.do_disassemble('%04x:%04x' % (start, end))
def help_assemble(self):
self._output("assemble <address> <statement>")
self._output("Assemble a statement at the address.")
def _interactive_assemble(self, args):
if args == '':
start = self._mpu.pc
else:
try:
start = self._address_parser.number(args)
except KeyError:
self._output("Bad label: %s" % start)
return
assembling = True
while assembling:
prompt = "\r$%04x " % (start)
line = console.line_input(prompt,
stdin=self.stdin, stdout=self.stdout)
示例15: test_number_hex_literal
# 需要导入模块: from py65.utils.addressing import AddressParser [as 别名]
# 或者: from py65.utils.addressing.AddressParser import number [as 别名]
def test_number_hex_literal(self):
parser = AddressParser()
self.assertEqual(49152, parser.number('$c000'))