Closed irmen closed 7 years ago
Note: I'm using your library quite successfully to let my commodore-64 emulator to actually run 6502 machine code! If you're interested https://github.com/irmen/pyc64
Looks good to me - what do you think @mnaberez ?
I think at some point we should introduce some kind of "machine" model. Look at how long the constructor args list has grown:
def __init__(self, mpu_type=NMOS6502, completekey='tab', stdin=None,
stdout=None, argv=None, memory=None, putc_addr=0xF001, getc_addr=0xF004):
Rather than passing in an mpu_type
, memory
, putc_addr
, and getc_addr
, which the monitor uses to make a machine, we could just pass a machine instance that has all these things wired up:
def __init__(self, machine=None, completekey='tab', stdin=None, stdout=None, argv=None):
The default "machine" would be called Kowalski
or similar, since the 0xF001
and 0xF002
areas are from Michal Kowalski's 6502 Assembler & Simulator.
I think this pull request is fine so I'm going to merge it, but the above is where I'd like to see it go in the future.
Note: I'm using your library quite successfully to let my commodore-64 emulator to actually run 6502 machine code! If you're interested https://github.com/irmen/pyc64
Neat!
With this change it is now possible to start a Monitor on an already existing block of memory, rather than it creating a new block of empty memory everytime it is started. You can quit out of the monitor, do something else with the memory, and restart a monitor later if want.