1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-11-02 19:04:38 +00:00

Assembler now accepts an MPU instance.

This commit is contained in:
Mike Naberezny 2009-04-07 21:56:03 -07:00
parent 3ef4a8abc2
commit ab9337bb5a
3 changed files with 5 additions and 3 deletions

View File

@ -24,7 +24,7 @@ class Assembler:
['imm', re.compile(r'^#\$([0-9A-F]{2})$')] # "#$12"
]
def __init__(self, address_parser=None, mpu=None):
def __init__(self, mpu=None, address_parser=None):
""" If a configured AddressParser is passed, symbolic addresses
may be used in the assembly statements.
"""

View File

@ -25,7 +25,7 @@ class Monitor(cmd.Cmd):
self._add_shortcuts()
self._address_parser = AddressParser()
self._disassembler = Disassembler(self._mpu, self._address_parser)
self._assembler = Assembler(self._address_parser)
self._assembler = Assembler(self._mpu, self._address_parser)
cmd.Cmd.__init__(self, completekey, stdin, stdout)
def onecmd(self, line):

View File

@ -1,5 +1,6 @@
import unittest
import sys
from py65.devices.mpu6502 import MPU
from py65.assembler import Assembler
from py65.utils.addressing import AddressParser
@ -925,8 +926,9 @@ class AssemblerTests(unittest.TestCase):
# Test Helpers
def assemble(self, statement, pc=0000):
mpu = MPU()
address_parser = AddressParser()
assembler = Assembler(address_parser)
assembler = Assembler(mpu, address_parser)
return assembler.assemble(statement, pc)
def test_suite():