示例#1
0
    def __repr__(self):
        flags = itoa(self.p, 2).rjust(8, "0")
        indent = " " * (len(self.name) + 2)

        out = "%s PC  AC XR YR SP NV-BDIZC\n" + "%s: %04x %02x %02x %02x %02x %s"

        return out % (indent, self.name, self.pc, self.a, self.x, self.y, self.sp, flags)
示例#2
0
文件: mpu6502.py 项目: mar77i/py65
    def __repr__(self):
        flags = itoa(self.p, 2).rjust(8, '0')

        out = "{}  PC   AC XR YR SP NV-BDIZC\n{}: "
        if self.jammed:
            out += "-- -- -- -- -JAMMED-"
        else:
            out += "{:04x} {:02x} {:02x} {:02x} {:02x} {}"
        return out.format(' ' * len(self.name), self.name,
                 self.pc, self.a, self.x, self.y, self.sp, flags)
示例#3
0
文件: monitor.py 项目: dabeaz/py65
    def do_tilde(self, args):   
        try:
            num = self._address_parser.number(args)
        except ValueError:
            self._output("Syntax error: %s" % args)
            return

        self._output("+%u" % num)
        self._output("$%02x" % num)
        self._output("%04o" % num)
        self._output(itoa(num, 2).zfill(8))
示例#4
0
    def do_tilde(self, args):
        if args == '':
            return self.help_tilde()

        try:
            num = self._address_parser.number(args)
            self._output("+%u" % num)
            self._output("$" + self.byteFmt % num)
            self._output("%04o" % num)
            self._output(itoa(num, 2).zfill(8))
        except KeyError:
            self._output("Bad label: %s" % args)
        except OverflowError:
            self._output("Overflow error: %s" % args)
    def do_tilde(self, args):
        if args == '':
            return self.help_tilde()

        try:
            num = self._address_parser.number(args)
            self._output("+%u" % num)
            self._output("$" + self.byteFmt % num)
            self._output("%04o" % num)
            self._output(itoa(num, 2).zfill(8))
        except KeyError:
            self._output("Bad label: %s" % args)
        except OverflowError:
            self._output("Overflow error: %s" % args)
示例#6
0
文件: mpu6502.py 项目: BigEd/py65
  def __repr__(self):
    flags  = itoa(self.p, 2).rjust(self.byteWidth, '0')
    indent = ' ' * (len(self.name) + 2)

    return self.reprformat() % (indent, self.name, 
                  self.pc, self.a, self.x, self.y, self.sp, flags)
示例#7
0
 def test_itoa_hex_output(self):
     self.assertEqual('a', itoa(10, base=16))
示例#8
0
 def test_itoa_decimal_output(self):
     self.assertEqual('10', itoa(10, base=10))
示例#9
0
 def test_itoa_bin_output(self):
     self.assertEqual('1010', itoa(10, base=2))
示例#10
0
    def __repr__(self):
        flags = itoa(self.p, 2).rjust(self.BYTE_WIDTH, '0')
        indent = ' ' * (len(self.name) + 2)

        return self.reprformat() % (indent, self.name, self.pc, self.a, self.x,
                                    self.y, self.sp, flags)
示例#11
0
文件: cpu.py 项目: pombredanne/DenPy
 def __repr__(self):
     return '<CPU:%s PC=%04X A=%02X X=%02X Y=%02X SP=%02X NV-B-IZC=%s>' % (
         self.name, self.pc, self.a, self.x, self.y, self.sp + 0x0100,
         itoa(self.p, 2).rjust(8, '0')
     )