mnaberez / py65

Emulate 6502-based microcomputer systems in Python
BSD 3-Clause "New" or "Revised" License
234 stars 68 forks source link

Using -r on the command line crashes py65mon #41

Closed SamCoVT closed 6 years ago

SamCoVT commented 6 years ago

I've been using an older version of py65mon (installed by pip) for a while now. I would like the ability to redirect getc and putc to/from strings, and it looks like the newest version here has exactly what I need.

I installed py65 directly from github using pip3. When I run it with the -r option, I get:

$ py65mon -r taliforth-py65mon.bin 
Error: <class 'AttributeError'>, 'Monitor' object has no attribute 'addrMask': file: /usr/local/lib/python3.6/site-packages/py65/monitor.py line: 634
Traceback (most recent call last):
  File "/usr/local/bin/py65mon", line 11, in <module>
    load_entry_point('py65==1.0.1.dev0', 'console_scripts', 'py65mon')()
  File "/usr/local/lib/python3.6/site-packages/py65/monitor.py", line 874, in main
    c = Monitor()
  File "/usr/local/lib/python3.6/site-packages/py65/monitor.py", line 58, in __init__
    self._parse_args(argv)
  File "/usr/local/lib/python3.6/site-packages/py65/monitor.py", line 121, in _parse_args
    self.onecmd(cmd)
  File "/usr/local/lib/python3.6/site-packages/py65/monitor.py", line 147, in onecmd
    self._output_mpu_status()
  File "/usr/local/lib/python3.6/site-packages/py65/monitor.py", line 256, in _output_mpu_status
    self._output("\n" + repr(self._mpu))
AttributeError: 'Monitor' object has no attribute '_mpu'

It doesn't matter what is typed after the -r command (the file doesn't even need to exist).

I'm running python 3.6.5 on Fedora Linux. py65mon is listed as 1.0.1.dev0, and was installed with pip3 directly from github on 2018-06-25.

BigEd commented 6 years ago

Agreed, the rom loading is broken at HEAD. Can you try rolling back by two commits:

pip3 install https://github.com/mnaberez/py65/archive/d014a20a739aea5c7867914dabaac053b9b42967.zip

BigEd commented 6 years ago

And I should add, this means I broke it!

SamCoVT commented 6 years ago

That appears to work. It also has the getc/putc callbacks I was interested in playing with, so I'll work with that version until the HEAD version is fixed. Thanks!

mnaberez commented 6 years ago

@SamCoVT @BigEd It should be fixed in 6e21008. I added some tests so we don't break it again. Please give it a try and let me know if you still have any issues. Thanks!

SamCoVT commented 6 years ago

That works now. Thanks!