mirror of
https://github.com/rzzzwilson/pymlac.git
synced 2025-06-10 09:32:41 +00:00
Clean up
This commit is contained in:
@@ -20,141 +20,6 @@ RED = (128, 0, 0)
|
||||
CANVAS_WIDTH = 1024
|
||||
CANVAS_HEIGHT = 1024
|
||||
|
||||
# Position of version string on panel (in panel coordinates)
|
||||
VERSION_POSN = (173,0)
|
||||
|
||||
# Positions of device boxes
|
||||
BOX_POSNX = 5
|
||||
BOX_POSNY = 45
|
||||
BOX_OFFSETY = 42
|
||||
BOX_WIDTH = 246
|
||||
BOX_HEIGHT = 20
|
||||
LABEL_OFFSETY = -19
|
||||
EOF_OFFSETX = CANVAS_WIDTH + BOX_POSNX + 180
|
||||
TAGS_OFFSETY = -17
|
||||
ON_OFFSETX = 1254
|
||||
OFF_OFFSETX = 1247
|
||||
FILE_OFSETX = 1032
|
||||
FILE_OFFSETY = +1
|
||||
|
||||
PTR_BOX_POSNY = BOX_POSNY
|
||||
PTR_LABEL_POSN = (BOX_POSNX, PTR_BOX_POSNY + LABEL_OFFSETY)
|
||||
PTR_EOF_POSN = (EOF_OFFSETX, PTR_BOX_POSNY + TAGS_OFFSETY)
|
||||
PTR_ON_POSN = (ON_OFFSETX, PTR_BOX_POSNY + TAGS_OFFSETY)
|
||||
PTR_OFF_POSN = (OFF_OFFSETX, PTR_BOX_POSNY + TAGS_OFFSETY)
|
||||
PTR_FILE_POSN = (FILE_OFSETX, PTR_BOX_POSNY + FILE_OFFSETY)
|
||||
|
||||
PTP_BOX_POSNY = PTR_BOX_POSNY + BOX_OFFSETY
|
||||
PTP_LABEL_POSN = (BOX_POSNX, PTP_BOX_POSNY + LABEL_OFFSETY)
|
||||
PTP_EOF_POSN = (EOF_OFFSETX, PTP_BOX_POSNY + TAGS_OFFSETY)
|
||||
PTP_ON_POSN = (ON_OFFSETX, PTP_BOX_POSNY + TAGS_OFFSETY)
|
||||
PTP_OFF_POSN = (OFF_OFFSETX, PTP_BOX_POSNY + TAGS_OFFSETY)
|
||||
PTP_FILE_POSN = (FILE_OFSETX, PTP_BOX_POSNY + FILE_OFFSETY)
|
||||
|
||||
TTYIN_BOX_POSNY = PTP_BOX_POSNY + BOX_OFFSETY
|
||||
TTYIN_LABEL_POSN = (BOX_POSNX, TTYIN_BOX_POSNY + LABEL_OFFSETY)
|
||||
TTYIN_EOF_POSN = (EOF_OFFSETX, TTYIN_BOX_POSNY + TAGS_OFFSETY)
|
||||
TTYIN_ON_POSN = (ON_OFFSETX, TTYIN_BOX_POSNY + TAGS_OFFSETY)
|
||||
TTYIN_OFF_POSN = (OFF_OFFSETX, TTYIN_BOX_POSNY + TAGS_OFFSETY)
|
||||
TTYIN_FILE_POSN = (FILE_OFSETX, TTYIN_BOX_POSNY + FILE_OFFSETY)
|
||||
|
||||
TTYOUT_BOX_POSNY = TTYIN_BOX_POSNY + BOX_OFFSETY
|
||||
TTYOUT_LABEL_POSN = (BOX_POSNX, TTYOUT_BOX_POSNY + LABEL_OFFSETY)
|
||||
TTYOUT_EOF_POSN = (EOF_OFFSETX, TTYOUT_BOX_POSNY + TAGS_OFFSETY)
|
||||
TTYOUT_ON_POSN = (ON_OFFSETX, TTYOUT_BOX_POSNY + TAGS_OFFSETY)
|
||||
TTYOUT_OFF_POSN = (OFF_OFFSETX, TTYOUT_BOX_POSNY + TAGS_OFFSETY)
|
||||
TTYOUT_FILE_POSN = (FILE_OFSETX, TTYOUT_BOX_POSNY + FILE_OFFSETY)
|
||||
|
||||
LEDAC_LABEL_OFFSETY = -18
|
||||
LEDL_POSNX = 0
|
||||
LEDAC_POSNX = 17
|
||||
LEDAC_POSNY = 715
|
||||
LEDPC_LABEL_OFFSETY = -18
|
||||
LEDPC_POSNX = 17
|
||||
LEDPC_POSNY = LEDAC_POSNY + 35
|
||||
LED_BIT_OFFSETX = 15
|
||||
LED_BIT_RANGE = (15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
|
||||
|
||||
LEDL_SCREEN_POSNX = CANVAS_WIDTH + LEDL_POSNX
|
||||
LEDAC_SCREEN_POSNX = CANVAS_WIDTH + LEDAC_POSNX
|
||||
LEDAC_SCREEN_POSNY = LEDAC_POSNY
|
||||
|
||||
LEDPC_SCREEN_POSNX = CANVAS_WIDTH + LEDPC_POSNX
|
||||
LEDPC_SCREEN_POSNY = LEDPC_POSNY
|
||||
|
||||
PANEL_WIDTH = 256
|
||||
|
||||
REGS_MON_DIVIDERY = 205
|
||||
ROM_MON_DIVIDERY = 285
|
||||
FILE_ROM_DIVIDER = 690
|
||||
MON_LED_DIVIDERY = 775
|
||||
BOX_BOT_DIVIDERY = 875
|
||||
|
||||
BOX_POSNY = 802
|
||||
|
||||
REGL_BOX_POSNX = 73
|
||||
REGL_BOX_POSNY = BOX_POSNY
|
||||
REGL_BOX_WIDTH = 15
|
||||
REGL_BOX_HEIGHT = 20
|
||||
|
||||
REGAC_BOX_POSNX = 95
|
||||
REGAC_BOX_POSNY = REGL_BOX_POSNY
|
||||
REGAC_BOX_WIDTH = 55
|
||||
REGAC_BOX_HEIGHT = 20
|
||||
REGPC_BOX_POSNX = 170
|
||||
REGPC_BOX_POSNY = REGL_BOX_POSNY
|
||||
REGPC_BOX_WIDTH = 55
|
||||
REGPC_BOX_HEIGHT = 20
|
||||
|
||||
REGDX_BOX_POSNX = 33
|
||||
REGDX_BOX_POSNY = BOX_POSNY + 40
|
||||
REGDX_BOX_WIDTH = 55
|
||||
REGDX_BOX_HEIGHT = 20
|
||||
|
||||
REGDY_BOX_POSNX = 95
|
||||
REGDY_BOX_POSNY = REGDX_BOX_POSNY
|
||||
REGDY_BOX_WIDTH = 55
|
||||
REGDY_BOX_HEIGHT = 20
|
||||
|
||||
REGDPC_BOX_POSNX = 170
|
||||
REGDPC_BOX_POSNY = REGDX_BOX_POSNY
|
||||
REGDPC_BOX_WIDTH = 55
|
||||
REGDPC_BOX_HEIGHT = 20
|
||||
|
||||
BOX_DATA_OFFSETX = 4
|
||||
BOX_DATA_OFFSETY = 2
|
||||
|
||||
BOOTROM_POSNX = 10
|
||||
BOOTROM_POSNY = 215
|
||||
|
||||
BOOTROM_LABEL_POSN = (BOOTROM_POSNX, BOOTROM_POSNY)
|
||||
BOOTROM_LOADPTR_RADIO_POSN = (BOOTROM_POSNX + 5, BOOTROM_POSNY + 20)
|
||||
BOOTROM_LOADPTR_LABEL_POSN = (BOOTROM_POSNX + 28, BOOTROM_POSNY + 18)
|
||||
BOOTROM_LOADTTY_RADIO_POSN = (BOOTROM_POSNX + 5, BOOTROM_POSNY + 40)
|
||||
BOOTROM_LOADTTY_LABEL_POSN = (BOOTROM_POSNX + 28, BOOTROM_POSNY + 40)
|
||||
BOOTROM_WRITABLE_POSN = (BOOTROM_POSNX + 125, BOOTROM_POSNY + 20)
|
||||
BOOTROM_WRITABLE_LABEL_POSN = (BOOTROM_POSNX + 148, BOOTROM_POSNY + 18)
|
||||
|
||||
SCREEN_BOOTROM_WRITABLE_POSN = (CANVAS_WIDTH + BOOTROM_POSNX + 125, BOOTROM_POSNY + 20)
|
||||
SCREEN_BOOTROM_LOADPTR_RADIO_POSN = (CANVAS_WIDTH + BOOTROM_POSNX + 5, BOOTROM_POSNY + 20)
|
||||
SCREEN_BOOTROM_LOADTTY_RADIO_POSN = (CANVAS_WIDTH + BOOTROM_POSNX + 5, BOOTROM_POSNY + 40)
|
||||
|
||||
QUITBUTTON_POSN = (142, 930)
|
||||
HALTBUTTON_POSN = (14, 930)
|
||||
RUNBUTTON_POSN = HALTBUTTON_POSN
|
||||
SINGLESTEPBUTTON_POSN = (14, 890)
|
||||
|
||||
SCREEN_QUITBUTTON_POSN = (CANVAS_WIDTH + 142, 930)
|
||||
SCREEN_HALTBUTTON_POSN = (CANVAS_WIDTH + 14, 930)
|
||||
SCREEN_SINGLESTEPBUTTON_POSN = (CANVAS_WIDTH + 14, 890)
|
||||
|
||||
HALT_RECT = (SCREEN_HALTBUTTON_POSN, (100, 25))
|
||||
QUIT_RECT = (SCREEN_QUITBUTTON_POSN, (100, 25))
|
||||
SINGLESTEP_RECT = (SCREEN_SINGLESTEPBUTTON_POSN, (228, 25))
|
||||
ROM_WRITABLE_RECT = (SCREEN_BOOTROM_WRITABLE_POSN, (19, 19))
|
||||
LOADPTR_RADIO_RECT = (SCREEN_BOOTROM_LOADPTR_RADIO_POSN, (19, 19))
|
||||
LOADTTY_RADIO_RECT = (SCREEN_BOOTROM_LOADTTY_RADIO_POSN, (19, 19))
|
||||
|
||||
# 'core' size (words) and save filename
|
||||
CORE_FILENAME = 'pymlac.core'
|
||||
#MEMORY_SIZE = 040000 # 16K words memory size
|
||||
|
||||
158
pymlac/pymlac
158
pymlac/pymlac
@@ -32,8 +32,8 @@ count = 1
|
||||
|
||||
# display window
|
||||
WindowTitleHeight = 22
|
||||
#DefaultAppSize = (600, 600+WindowTitleHeight)
|
||||
DefaultAppSize = (1024, 1024+WindowTitleHeight)
|
||||
DefaultAppSize = (600, 600+WindowTitleHeight)
|
||||
#DefaultAppSize = (1024, 1024+WindowTitleHeight)
|
||||
|
||||
|
||||
def abort(msg):
|
||||
@@ -239,83 +239,83 @@ def usage():
|
||||
sys.exit()
|
||||
|
||||
|
||||
def main():
|
||||
"""Start of the emulator."""
|
||||
|
||||
# get operations list
|
||||
ops = handle_options()
|
||||
|
||||
# Initialize the emulator.
|
||||
boot_rom = 'ptr' # default ROM loader
|
||||
Imlac.init(0, TRACE_FILENAME, None, None, boot_rom, CORE_FILENAME)
|
||||
|
||||
# now perform operations
|
||||
for (operation, args) in ops:
|
||||
if operation == 'boot':
|
||||
Memory.set_ROM(args)
|
||||
Trace.comment('Bootstrap ROM set to %s' % args.upper())
|
||||
elif operation == 'clear':
|
||||
Memory.clear_core()
|
||||
Trace.comment('Core cleared')
|
||||
elif operation == 'load_ptp':
|
||||
Ptp.mount(args)
|
||||
Trace.comment("File '%s' mounted on PTP" % args)
|
||||
elif operation == 'load_ptr':
|
||||
Ptr.mount(args)
|
||||
Trace.comment("File '%s' mounted on PTR" % args)
|
||||
elif operation == 'data':
|
||||
MainCPU.DS = args
|
||||
Trace.comment('Dataswitch value set to %06o' % args)
|
||||
elif operation == 'run':
|
||||
MainCPU.PC = args
|
||||
Trace.comment('Running from address %06o' % args)
|
||||
if Imlac.tracestart:
|
||||
Trace.comment('DPC\tDisplay\t\tPC\tMain\t\tRegs')
|
||||
Trace.comment('------ ------------- ------ -------------- '
|
||||
'-----------------------')
|
||||
Imlac.run()
|
||||
Trace.comment('Imlac halted')
|
||||
elif operation == 'set':
|
||||
Trace.comment("Setting memory from file '%s'" % args)
|
||||
elif operation == 'trace':
|
||||
if args == 'off':
|
||||
Imlac.tracestart = None
|
||||
Imlac.traceend = None
|
||||
else:
|
||||
(start, end) = args
|
||||
Imlac.tracestart = start
|
||||
Imlac.traceend = end
|
||||
tstart = Imlac.tracestart
|
||||
if tstart is not None:
|
||||
tstart = '%06o' % tstart
|
||||
tend = Imlac.traceend
|
||||
if tend is not None:
|
||||
tend = '%06o' % tend
|
||||
Trace.comment('Trace set to (%s, %s)' % (tstart, tend))
|
||||
elif operation == 'ttyin':
|
||||
TtyIn.mount(args)
|
||||
Trace.comment("File '%s' mounted on TTYIN" % args)
|
||||
elif operation == 'ttyout':
|
||||
TtyOut.mount(args)
|
||||
Trace.comment("File '%s' mounted on TTYOUT" % args)
|
||||
elif operation == 'view':
|
||||
Trace.comment("Viewing memory from file '%s'" % args)
|
||||
elif operation == 'write':
|
||||
if args == 'on':
|
||||
Memory.using_rom = True
|
||||
elif args == 'off':
|
||||
Memory.using_rom = False
|
||||
else:
|
||||
abort("Invalid view arg: %s" % args)
|
||||
Trace.comment('ROM write protect set %s' % args.upper())
|
||||
elif operation == 'x':
|
||||
(low, high) = args
|
||||
Memory.dump(args)
|
||||
Trace.comment('Memory dumped: %07o to %07o' % (low, high))
|
||||
else:
|
||||
abort('Invalid internal operation: %s' % operation)
|
||||
|
||||
Imlac.close(CORE_FILENAME)
|
||||
#def main():
|
||||
# """Start of the emulator."""
|
||||
#
|
||||
# # get operations list
|
||||
# ops = handle_options()
|
||||
#
|
||||
# # Initialize the emulator.
|
||||
# boot_rom = 'ptr' # default ROM loader
|
||||
# Imlac.init(0, TRACE_FILENAME, None, None, boot_rom, CORE_FILENAME)
|
||||
#
|
||||
# # now perform operations
|
||||
# for (operation, args) in ops:
|
||||
# if operation == 'boot':
|
||||
# Memory.set_ROM(args)
|
||||
# Trace.comment('Bootstrap ROM set to %s' % args.upper())
|
||||
# elif operation == 'clear':
|
||||
# Memory.clear_core()
|
||||
# Trace.comment('Core cleared')
|
||||
# elif operation == 'load_ptp':
|
||||
# Ptp.mount(args)
|
||||
# Trace.comment("File '%s' mounted on PTP" % args)
|
||||
# elif operation == 'load_ptr':
|
||||
# Ptr.mount(args)
|
||||
# Trace.comment("File '%s' mounted on PTR" % args)
|
||||
# elif operation == 'data':
|
||||
# MainCPU.DS = args
|
||||
# Trace.comment('Dataswitch value set to %06o' % args)
|
||||
# elif operation == 'run':
|
||||
# MainCPU.PC = args
|
||||
# Trace.comment('Running from address %06o' % args)
|
||||
# if Imlac.tracestart:
|
||||
# Trace.comment('DPC\tDisplay\t\tPC\tMain\t\tRegs')
|
||||
# Trace.comment('------ ------------- ------ -------------- '
|
||||
# '-----------------------')
|
||||
# Imlac.run()
|
||||
# Trace.comment('Imlac halted')
|
||||
# elif operation == 'set':
|
||||
# Trace.comment("Setting memory from file '%s'" % args)
|
||||
# elif operation == 'trace':
|
||||
# if args == 'off':
|
||||
# Imlac.tracestart = None
|
||||
# Imlac.traceend = None
|
||||
# else:
|
||||
# (start, end) = args
|
||||
# Imlac.tracestart = start
|
||||
# Imlac.traceend = end
|
||||
# tstart = Imlac.tracestart
|
||||
# if tstart is not None:
|
||||
# tstart = '%06o' % tstart
|
||||
# tend = Imlac.traceend
|
||||
# if tend is not None:
|
||||
# tend = '%06o' % tend
|
||||
# Trace.comment('Trace set to (%s, %s)' % (tstart, tend))
|
||||
# elif operation == 'ttyin':
|
||||
# TtyIn.mount(args)
|
||||
# Trace.comment("File '%s' mounted on TTYIN" % args)
|
||||
# elif operation == 'ttyout':
|
||||
# TtyOut.mount(args)
|
||||
# Trace.comment("File '%s' mounted on TTYOUT" % args)
|
||||
# elif operation == 'view':
|
||||
# Trace.comment("Viewing memory from file '%s'" % args)
|
||||
# elif operation == 'write':
|
||||
# if args == 'on':
|
||||
# Memory.using_rom = True
|
||||
# elif args == 'off':
|
||||
# Memory.using_rom = False
|
||||
# else:
|
||||
# abort("Invalid view arg: %s" % args)
|
||||
# Trace.comment('ROM write protect set %s' % args.upper())
|
||||
# elif operation == 'x':
|
||||
# (low, high) = args
|
||||
# Memory.dump(args)
|
||||
# Trace.comment('Memory dumped: %07o to %07o' % (low, high))
|
||||
# else:
|
||||
# abort('Invalid internal operation: %s' % operation)
|
||||
#
|
||||
# Imlac.close(CORE_FILENAME)
|
||||
|
||||
|
||||
class PymlacFrame(wx.Frame):
|
||||
|
||||
Reference in New Issue
Block a user