mirror of
https://github.com/mnaberez/py65.git
synced 2024-11-04 17:04:56 +00:00
Assembler now accepts an MPU instance.
This commit is contained in:
parent
3ef4a8abc2
commit
ab9337bb5a
@ -24,7 +24,7 @@ class Assembler:
|
|||||||
['imm', re.compile(r'^#\$([0-9A-F]{2})$')] # "#$12"
|
['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
|
""" If a configured AddressParser is passed, symbolic addresses
|
||||||
may be used in the assembly statements.
|
may be used in the assembly statements.
|
||||||
"""
|
"""
|
||||||
|
@ -25,7 +25,7 @@ class Monitor(cmd.Cmd):
|
|||||||
self._add_shortcuts()
|
self._add_shortcuts()
|
||||||
self._address_parser = AddressParser()
|
self._address_parser = AddressParser()
|
||||||
self._disassembler = Disassembler(self._mpu, self._address_parser)
|
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)
|
cmd.Cmd.__init__(self, completekey, stdin, stdout)
|
||||||
|
|
||||||
def onecmd(self, line):
|
def onecmd(self, line):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
|
from py65.devices.mpu6502 import MPU
|
||||||
from py65.assembler import Assembler
|
from py65.assembler import Assembler
|
||||||
from py65.utils.addressing import AddressParser
|
from py65.utils.addressing import AddressParser
|
||||||
|
|
||||||
@ -925,8 +926,9 @@ class AssemblerTests(unittest.TestCase):
|
|||||||
# Test Helpers
|
# Test Helpers
|
||||||
|
|
||||||
def assemble(self, statement, pc=0000):
|
def assemble(self, statement, pc=0000):
|
||||||
|
mpu = MPU()
|
||||||
address_parser = AddressParser()
|
address_parser = AddressParser()
|
||||||
assembler = Assembler(address_parser)
|
assembler = Assembler(mpu, address_parser)
|
||||||
return assembler.assemble(statement, pc)
|
return assembler.assemble(statement, pc)
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
|
Loading…
Reference in New Issue
Block a user