1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-06 20:29:34 +00:00

Assembling now tolerates extra whitespace between opcode and operand

This commit is contained in:
Mike Naberezny 2014-01-25 21:30:27 -08:00
parent f2fe2492c7
commit c69ebc34ca
3 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,8 @@
- Fixed BRK on 65C02 so it clears the decimal flag. On NMOS 6502, the
decimal flag is unaffected on BRK. On 65C02, it is always cleared.
- Assembling now tolerates extra whitespace between opcode and operand.
0.17 (2013-10-26)
- Added support for Python 3.2 and 3.3 based on work by David Beazley.

View File

@ -145,6 +145,8 @@ class Assembler:
and parsing the address part using AddressParser. The result of
the normalization is a tuple of two strings (opcode, operand).
"""
statement = ' '.join(str.split(statement))
# normalize target in operand
match = self.Statement.match(statement)
if match:

View File

@ -15,6 +15,9 @@ class AssemblerTests(unittest.TestCase):
self.assertRaises(KeyError,
self.assemble, 'lda foo')
def test_assemble_tolerates_extra_whitespace(self):
self.assemble(' lda #$00 ') # should not raise
def test_assemble_bad_number_raises_overflowerror(self):
self.assertRaises(OverflowError,
self.assemble, 'lda #$fff')