-
- MicroInstructionMemory mpm;
- try (InputStream mpmStream = mpmFile.getContents())
- {
- mpm = MicroInstructionMemoryParser.parseMemory(miMemDef, mpmStream);
- }
- catch (IOException e)
- {
- throw new CoreException(new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, "Unexpected IO exception reading MPM file", e));
- }
-
- String initialRAMFileName = configuration.getAttribute(INITIAL_RAM_FILE_ATTR, "");
- MainMemory mem;
- if (!"".equals(initialRAMFileName))
- {
- IFile initialRAMFile = project.getFile(initialRAMFileName);
- try (InputStream initialRAMStream = initialRAMFile.getContents())
- {
- mem = MainMemoryParser.parseMemory(mainMemDef, initialRAMStream);
- }
- catch (IOException e)
- {
- throw new CoreException(
- new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, "Unexpected IO exception reading initial RAM file", e));
- }
- } else
- mem = null;
-
- MachineDebugTarget debugTarget = new MachineDebugTarget(launch, machineDefinition);
+ Optional<IFile> mpromFile = fileOptional(project, configuration.getAttribute(MPROM_FILE_ATTR, ""));
+ Optional<IFile> memFile = fileOptional(project, configuration.getAttribute(INITIAL_RAM_FILE_ATTR, ""));
+ MachineDebugTarget debugTarget = new MachineDebugTarget(launch, mpmFile, mpromFile, memFile, machineDefinition);
+ // TODO make selectable whether the machine starts paused or not