From 13c408bbdd957d4f270d91a8f3d95d074e71d45b Mon Sep 17 00:00:00 2001 From: Azalea Date: Wed, 9 Nov 2022 23:41:40 -0500 Subject: [PATCH] [O] Refactor --- CreateMarsJar.bat | 1 - CreateMarsJar.sh | 2 - build.gradle | 11 +- convert_encoding.py | 17 + settings.gradle | 12 +- src/main/java/Mars.java | 13 +- src/main/java/mainclass.txt | 2 - src/main/java/mars/Globals.java | 454 +-- src/main/java/mars/ProgramStatement.java | 1057 +++--- src/main/java/mars/Settings.java | 2657 ++++++++------- src/main/java/mars/mips/hardware/Memory.java | 28 +- .../mips/instructions/InstructionSet.java | 34 +- .../syscalls/SyscallPrintFloat.java | 28 +- .../syscalls/SyscallPrintInt.java | 18 +- src/main/java/mars/tools/DigitalLabSim.java | 713 ++-- src/main/java/mars/tools/MipsXray.java | 2957 ++++++++--------- src/main/java/mars/venus/MessagesPane.java | 1010 +++--- src/main/java/mars/venus/VenusUI.java | 2041 ++++++------ .../ALUcontrolDatapath.xml | 0 .../{java => resources}/Config.properties | 0 src/main/{java => resources}/MARSlicense.txt | 0 .../{java => resources}/MipsXRayOpcode.xml | 0 src/main/{java => resources}/PseudoOps.txt | 0 .../{java => resources}/Settings.properties | 0 .../{java => resources}/Syscall.properties | 0 .../{java => resources}/controlDatapath.xml | 0 src/main/{java => resources}/docs/Mars.html | 0 .../docs/allclasses-frame.html | 0 .../docs/allclasses-noframe.html | 0 .../docs/constant-values.html | 0 .../docs/deprecated-list.html | 0 .../{java => resources}/docs/help-doc.html | 0 .../{java => resources}/docs/index-all.html | 0 src/main/{java => resources}/docs/index.html | 0 .../docs/mars/ErrorList.html | 0 .../docs/mars/ErrorMessage.html | 0 .../docs/mars/Globals.html | 0 .../docs/mars/MIPSprogram.html | 0 .../docs/mars/MarsLaunch.html | 0 .../docs/mars/MarsSplashScreen.html | 0 .../docs/mars/ProcessingException.html | 0 .../docs/mars/ProgramStatement.html | 0 .../docs/mars/Settings.html | 0 .../docs/mars/assembler/Assembler.html | 0 .../docs/mars/assembler/DataTypes.html | 0 .../docs/mars/assembler/Directives.html | 0 .../docs/mars/assembler/Macro.html | 0 .../docs/mars/assembler/MacroPool.html | 0 .../docs/mars/assembler/OperandFormat.html | 0 .../docs/mars/assembler/SourceLine.html | 0 .../docs/mars/assembler/Symbol.html | 0 .../docs/mars/assembler/SymbolTable.html | 0 .../docs/mars/assembler/Token.html | 0 .../docs/mars/assembler/TokenList.html | 0 .../docs/mars/assembler/TokenTypes.html | 0 .../docs/mars/assembler/Tokenizer.html | 0 .../docs/mars/assembler/TranslationCode.html | 0 .../docs/mars/assembler/package-frame.html | 0 .../docs/mars/assembler/package-summary.html | 0 .../docs/mars/assembler/package-tree.html | 0 .../mars/mips/dump/AbstractDumpFormat.html | 0 .../mars/mips/dump/AsciiTextDumpFormat.html | 0 .../docs/mars/mips/dump/BinaryDumpFormat.html | 0 .../mars/mips/dump/BinaryTextDumpFormat.html | 0 .../docs/mars/mips/dump/DumpFormat.html | 0 .../docs/mars/mips/dump/DumpFormatLoader.html | 0 .../mars/mips/dump/HexTextDumpFormat.html | 0 .../mars/mips/dump/IntelHexDumpFormat.html | 0 .../docs/mars/mips/dump/MIFDumpFormat.html | 0 .../mips/dump/SegmentWindowDumpFormat.html | 0 .../docs/mars/mips/dump/package-frame.html | 0 .../docs/mars/mips/dump/package-summary.html | 0 .../docs/mars/mips/dump/package-tree.html | 0 .../docs/mars/mips/hardware/AccessNotice.html | 0 .../mips/hardware/AddressErrorException.html | 0 .../docs/mars/mips/hardware/Coprocessor0.html | 0 .../docs/mars/mips/hardware/Coprocessor1.html | 0 .../InvalidRegisterAccessException.html | 0 .../docs/mars/mips/hardware/Memory.html | 0 .../mips/hardware/MemoryAccessNotice.html | 0 .../mips/hardware/MemoryConfiguration.html | 0 .../mips/hardware/MemoryConfigurations.html | 0 .../docs/mars/mips/hardware/Register.html | 0 .../mips/hardware/RegisterAccessNotice.html | 0 .../docs/mars/mips/hardware/RegisterFile.html | 0 .../mars/mips/hardware/package-frame.html | 0 .../mars/mips/hardware/package-summary.html | 0 .../docs/mars/mips/hardware/package-tree.html | 0 .../mips/instructions/BasicInstruction.html | 0 .../instructions/BasicInstructionFormat.html | 0 .../instructions/ExtendedInstruction.html | 0 .../mars/mips/instructions/Instruction.html | 0 .../mips/instructions/InstructionSet.html | 0 .../mips/instructions/SimulationCode.html | 0 .../mars/mips/instructions/package-frame.html | 0 .../mips/instructions/package-summary.html | 0 .../mars/mips/instructions/package-tree.html | 0 .../syscalls/AbstractSyscall.html | 0 .../instructions/syscalls/RandomStreams.html | 0 .../mips/instructions/syscalls/Syscall.html | 0 .../instructions/syscalls/SyscallClose.html | 0 .../syscalls/SyscallConfirmDialog.html | 0 .../instructions/syscalls/SyscallExit.html | 0 .../instructions/syscalls/SyscallExit2.html | 0 .../syscalls/SyscallInputDialogDouble.html | 0 .../syscalls/SyscallInputDialogFloat.html | 0 .../syscalls/SyscallInputDialogInt.html | 0 .../syscalls/SyscallInputDialogString.html | 0 .../syscalls/SyscallMessageDialog.html | 0 .../syscalls/SyscallMessageDialogDouble.html | 0 .../syscalls/SyscallMessageDialogFloat.html | 0 .../syscalls/SyscallMessageDialogInt.html | 0 .../syscalls/SyscallMessageDialogString.html | 0 .../instructions/syscalls/SyscallMidiOut.html | 0 .../syscalls/SyscallMidiOutSync.html | 0 .../syscalls/SyscallNumberOverride.html | 0 .../instructions/syscalls/SyscallOpen.html | 0 .../syscalls/SyscallPrintChar.html | 0 .../syscalls/SyscallPrintDouble.html | 0 .../syscalls/SyscallPrintFloat.html | 0 .../syscalls/SyscallPrintInt.html | 0 .../syscalls/SyscallPrintIntBinary.html | 0 .../syscalls/SyscallPrintIntHex.html | 0 .../syscalls/SyscallPrintIntUnsigned.html | 0 .../syscalls/SyscallPrintString.html | 0 .../syscalls/SyscallRandDouble.html | 0 .../syscalls/SyscallRandFloat.html | 0 .../instructions/syscalls/SyscallRandInt.html | 0 .../syscalls/SyscallRandIntRange.html | 0 .../syscalls/SyscallRandSeed.html | 0 .../instructions/syscalls/SyscallRead.html | 0 .../syscalls/SyscallReadChar.html | 0 .../syscalls/SyscallReadDouble.html | 0 .../syscalls/SyscallReadFloat.html | 0 .../instructions/syscalls/SyscallReadInt.html | 0 .../syscalls/SyscallReadString.html | 0 .../instructions/syscalls/SyscallSbrk.html | 0 .../instructions/syscalls/SyscallSleep.html | 0 .../instructions/syscalls/SyscallTime.html | 0 .../instructions/syscalls/SyscallWrite.html | 0 .../instructions/syscalls/package-frame.html | 0 .../syscalls/package-summary.html | 0 .../instructions/syscalls/package-tree.html | 0 .../docs/mars/package-frame.html | 0 .../docs/mars/package-summary.html | 0 .../docs/mars/package-tree.html | 0 .../docs/mars/simulator/BackStepper.html | 0 .../docs/mars/simulator/DelayedBranch.html | 0 .../docs/mars/simulator/Exceptions.html | 0 .../mars/simulator/ProgramArgumentList.html | 0 .../simulator/Simulator.StopListener.html | 0 .../docs/mars/simulator/Simulator.html | 0 .../docs/mars/simulator/SimulatorNotice.html | 0 .../docs/mars/simulator/SwingWorker.html | 0 .../docs/mars/simulator/package-frame.html | 0 .../docs/mars/simulator/package-summary.html | 0 .../docs/mars/simulator/package-tree.html | 0 ...tMarsToolAndApplication.ConnectButton.html | 0 ...rsToolAndApplication.EnterKeyListener.html | 0 .../tools/AbstractMarsToolAndApplication.html | 0 .../docs/mars/tools/BHTEntry.html | 0 .../docs/mars/tools/BHTSimGUI.html | 0 .../docs/mars/tools/BHTSimulator.html | 0 .../docs/mars/tools/BHTableModel.html | 0 .../docs/mars/tools/BitmapDisplay.html | 0 .../docs/mars/tools/CacheSimulator.html | 0 ...italLabSim.HexaKeyboard.EcouteurClick.html | 0 .../tools/DigitalLabSim.HexaKeyboard.html | 0 .../tools/DigitalLabSim.OneSecondCounter.html | 0 .../DigitalLabSim.SevenSegmentDisplay.html | 0 .../DigitalLabSim.SevenSegmentPanel.html | 0 .../docs/mars/tools/DigitalLabSim.html | 0 .../docs/mars/tools/FloatRepresentation.html | 0 .../docs/mars/tools/InstructionCounter.html | 0 .../mars/tools/InstructionStatistics.html | 0 .../docs/mars/tools/IntroToTools.html | 0 .../tools/KeyboardAndDisplaySimulator.html | 0 .../docs/mars/tools/MarsBot.html | 0 .../docs/mars/tools/MarsTool.html | 0 .../tools/MemoryReferenceVisualization.html | 0 .../docs/mars/tools/ScavengerHunt.html | 0 .../docs/mars/tools/ScreenMagnifier.html | 0 .../docs/mars/tools/package-frame.html | 0 .../docs/mars/tools/package-summary.html | 0 .../docs/mars/tools/package-tree.html | 0 .../docs/mars/util/Binary.html | 0 .../docs/mars/util/EditorFont.html | 0 .../docs/mars/util/FilenameFinder.html | 0 .../docs/mars/util/MemoryDump.html | 0 .../docs/mars/util/PropertiesFile.html | 0 .../docs/mars/util/SystemIO.html | 0 .../docs/mars/util/package-frame.html | 0 .../docs/mars/util/package-summary.html | 0 .../docs/mars/util/package-tree.html | 0 .../mars/venus/AbstractFontSettingDialog.html | 0 .../docs/mars/venus/Coprocessor0Window.html | 0 .../docs/mars/venus/Coprocessor1Window.html | 0 .../docs/mars/venus/DataSegmentWindow.html | 0 .../docs/mars/venus/EditCopyAction.html | 0 .../docs/mars/venus/EditCutAction.html | 0 .../mars/venus/EditFindReplaceAction.html | 0 .../docs/mars/venus/EditPane.html | 0 .../docs/mars/venus/EditPasteAction.html | 0 .../docs/mars/venus/EditRedoAction.html | 0 .../docs/mars/venus/EditSelectAllAction.html | 0 .../docs/mars/venus/EditTabbedPane.html | 0 .../docs/mars/venus/EditUndoAction.html | 0 .../docs/mars/venus/Editor.html | 0 .../docs/mars/venus/ExecutePane.html | 0 .../docs/mars/venus/FileCloseAction.html | 0 .../docs/mars/venus/FileCloseAllAction.html | 0 .../docs/mars/venus/FileDumpMemoryAction.html | 0 .../docs/mars/venus/FileExitAction.html | 0 .../docs/mars/venus/FileNewAction.html | 0 .../docs/mars/venus/FileOpenAction.html | 0 .../docs/mars/venus/FilePrintAction.html | 0 .../docs/mars/venus/FileSaveAction.html | 0 .../docs/mars/venus/FileSaveAllAction.html | 0 .../docs/mars/venus/FileSaveAsAction.html | 0 .../docs/mars/venus/FileStatus.html | 0 .../docs/mars/venus/GuiAction.html | 0 ...HardcopyWriter.PrintCanceledException.html | 0 .../docs/mars/venus/HardcopyWriter.html | 0 .../docs/mars/venus/HelpAboutAction.html | 0 .../docs/mars/venus/HelpHelpAction.html | 0 .../docs/mars/venus/LabelsWindow.html | 0 .../docs/mars/venus/MainPane.html | 0 .../docs/mars/venus/MessagesPane.html | 0 .../mars/venus/NumberDisplayBaseChooser.html | 0 .../docs/mars/venus/PopupListener.html | 0 .../docs/mars/venus/RegistersPane.html | 0 .../docs/mars/venus/RegistersWindow.html | 0 .../docs/mars/venus/RepeatButton.html | 0 .../docs/mars/venus/RunAssembleAction.html | 0 .../docs/mars/venus/RunBackstepAction.html | 0 .../mars/venus/RunClearBreakpointsAction.html | 0 .../docs/mars/venus/RunGoAction.html | 0 .../docs/mars/venus/RunPauseAction.html | 0 .../docs/mars/venus/RunResetAction.html | 0 .../docs/mars/venus/RunSpeedPanel.html | 0 .../docs/mars/venus/RunStepAction.html | 0 .../docs/mars/venus/RunStopAction.html | 0 .../venus/RunToggleBreakpointsAction.html | 0 .../SettingsAddressDisplayBaseAction.html | 0 .../mars/venus/SettingsAssembleAllAction.html | 0 .../venus/SettingsAssembleOnOpenAction.html | 0 .../venus/SettingsDelayedBranchingAction.html | 0 .../docs/mars/venus/SettingsEditorAction.html | 0 .../venus/SettingsExceptionHandlerAction.html | 0 .../mars/venus/SettingsExtendedAction.html | 0 .../venus/SettingsHighlightingAction.html | 0 .../docs/mars/venus/SettingsLabelAction.html | 0 .../SettingsMemoryConfigurationAction.html | 0 .../mars/venus/SettingsPopupInputAction.html | 0 .../venus/SettingsProgramArgumentsAction.html | 0 .../SettingsSelfModifyingCodeAction.html | 0 .../mars/venus/SettingsStartAtMainAction.html | 0 .../venus/SettingsValueDisplayBaseAction.html | 0 .../SettingsWarningsAreErrorsAction.html | 0 .../docs/mars/venus/TextSegmentWindow.html | 0 .../docs/mars/venus/ToolAction.html | 0 .../docs/mars/venus/ToolLoader.html | 0 .../docs/mars/venus/VenusUI.html | 0 .../venus/editors/MARSTextEditingArea.html | 0 .../editors/generic/GenericTextArea.html | 0 .../venus/editors/generic/package-frame.html | 0 .../editors/generic/package-summary.html | 0 .../venus/editors/generic/package-tree.html | 0 .../jeditsyntax/DefaultInputHandler.html | 0 .../InputHandler.MacroRecorder.html | 0 .../InputHandler.NonRecordable.html | 0 .../InputHandler.NonRepeatable.html | 0 .../jeditsyntax/InputHandler.Wrapper.html | 0 .../jeditsyntax/InputHandler.backspace.html | 0 .../InputHandler.backspace_word.html | 0 .../jeditsyntax/InputHandler.clip_copy.html | 0 .../jeditsyntax/InputHandler.clip_cut.html | 0 .../jeditsyntax/InputHandler.clip_paste.html | 0 .../jeditsyntax/InputHandler.delete.html | 0 .../jeditsyntax/InputHandler.delete_word.html | 0 .../InputHandler.document_end.html | 0 .../InputHandler.document_home.html | 0 .../editors/jeditsyntax/InputHandler.end.html | 0 .../jeditsyntax/InputHandler.home.html | 0 .../editors/jeditsyntax/InputHandler.html | 0 .../InputHandler.insert_break.html | 0 .../jeditsyntax/InputHandler.insert_char.html | 0 .../jeditsyntax/InputHandler.insert_tab.html | 0 .../jeditsyntax/InputHandler.next_char.html | 0 .../jeditsyntax/InputHandler.next_line.html | 0 .../jeditsyntax/InputHandler.next_page.html | 0 .../jeditsyntax/InputHandler.next_word.html | 0 .../jeditsyntax/InputHandler.overwrite.html | 0 .../jeditsyntax/InputHandler.prev_char.html | 0 .../jeditsyntax/InputHandler.prev_line.html | 0 .../jeditsyntax/InputHandler.prev_page.html | 0 .../jeditsyntax/InputHandler.prev_word.html | 0 .../jeditsyntax/InputHandler.repeat.html | 0 .../jeditsyntax/InputHandler.select_all.html | 0 .../jeditsyntax/InputHandler.toggle_rect.html | 0 .../jeditsyntax/JEditBasedTextArea.html | 0 .../editors/jeditsyntax/JEditTextArea.html | 0 .../venus/editors/jeditsyntax/KeywordMap.html | 0 .../editors/jeditsyntax/PopupHelpItem.html | 0 .../editors/jeditsyntax/SyntaxDocument.html | 0 .../editors/jeditsyntax/SyntaxStyle.html | 0 .../editors/jeditsyntax/SyntaxUtilities.html | 0 .../editors/jeditsyntax/TextAreaDefaults.html | 0 .../TextAreaPainter.Highlight.html | 0 .../editors/jeditsyntax/TextAreaPainter.html | 0 .../editors/jeditsyntax/TextUtilities.html | 0 .../editors/jeditsyntax/package-frame.html | 0 .../editors/jeditsyntax/package-summary.html | 0 .../editors/jeditsyntax/package-tree.html | 0 .../tokenmarker/MIPSTokenMarker.html | 0 .../jeditsyntax/tokenmarker/Token.html | 0 .../tokenmarker/TokenMarker.LineInfo.html | 0 .../jeditsyntax/tokenmarker/TokenMarker.html | 0 .../tokenmarker/package-frame.html | 0 .../tokenmarker/package-summary.html | 0 .../jeditsyntax/tokenmarker/package-tree.html | 0 .../mars/venus/editors/package-frame.html | 0 .../mars/venus/editors/package-summary.html | 0 .../docs/mars/venus/editors/package-tree.html | 0 .../docs/mars/venus/package-frame.html | 0 .../docs/mars/venus/package-summary.html | 0 .../docs/mars/venus/package-tree.html | 0 .../docs/overview-frame.html | 0 .../docs/overview-summary.html | 0 .../docs/overview-tree.html | 0 .../docs/package-frame.html | 0 .../{java => resources}/docs/package-list | 0 .../docs/package-summary.html | 0 .../docs/package-tree.html | 0 .../docs/resources/inherit.gif | Bin .../docs/serialized-form.html | 0 .../{java => resources}/docs/stylesheet.css | 0 .../help/Acknowledgements.html | 0 .../help/BugReportingHelp.html | 0 .../help/ExceptionsHelp.html | 0 ..._of_links_for_posting_to_MARS_website.html | 0 .../help/MIPSInstructionSetSong.html | 0 .../{java => resources}/help/MacrosHelp.html | 0 .../help/MarsHelpCommand.html | 0 .../help/MarsHelpDebugging.html | 0 .../help/MarsHelpHistory.html | 0 .../{java => resources}/help/MarsHelpIDE.html | 0 .../help/MarsHelpIntro.html | 0 .../help/MarsHelpLimits.html | 0 .../help/MarsHelpSettings.html | 0 .../help/MarsHelpTools.html | 0 .../{java => resources}/help/SyscallHelp.html | 0 .../help/SyscallMessageDialogError.gif | Bin .../help/SyscallMessageDialogInformation.gif | Bin .../help/SyscallMessageDialogQuestion.gif | Bin .../help/SyscallMessageDialogWarning.gif | Bin src/main/{java => resources}/help/mipsref.pdf | Bin .../{java => resources}/images/ALUcontrol.png | Bin .../{java => resources}/images/Assemble16.png | Bin .../{java => resources}/images/Assemble22.png | Bin .../{java => resources}/images/Copy16.png | Bin .../{java => resources}/images/Copy22.png | Bin src/main/{java => resources}/images/Cut16.gif | Bin src/main/{java => resources}/images/Cut22.gif | Bin src/main/{java => resources}/images/Cut24.gif | Bin .../{java => resources}/images/Dump16.png | Bin .../{java => resources}/images/Dump22.png | Bin .../{java => resources}/images/Edit_tab.jpg | Bin .../images/Execute_tab.jpg | Bin .../{java => resources}/images/Find16.png | Bin .../{java => resources}/images/Find22.png | Bin .../{java => resources}/images/Help16.png | Bin .../{java => resources}/images/Help22.png | Bin .../images/MarsSurfacePathfinder.jpg | Bin .../images/MarsThumbnail.gif | Bin .../{java => resources}/images/MyBlank16.gif | Bin .../{java => resources}/images/MyBlank24.gif | Bin src/main/{java => resources}/images/New16.png | Bin src/main/{java => resources}/images/New22.png | Bin .../{java => resources}/images/Next22.png | Bin .../{java => resources}/images/Open16.png | Bin .../{java => resources}/images/Open22.png | Bin .../{java => resources}/images/Paste16.png | Bin .../{java => resources}/images/Paste22.png | Bin .../{java => resources}/images/Pause16.png | Bin .../{java => resources}/images/Pause22.png | Bin .../{java => resources}/images/Play16.png | Bin .../{java => resources}/images/Play22.png | Bin .../{java => resources}/images/Previous22.png | Bin .../{java => resources}/images/Print16.gif | Bin .../{java => resources}/images/Print22.gif | Bin .../{java => resources}/images/Print24.gif | Bin .../{java => resources}/images/RedMars16.gif | Bin .../{java => resources}/images/RedMars32.GIF | Bin .../{java => resources}/images/RedMars50.gif | Bin .../{java => resources}/images/Redo16.png | Bin .../{java => resources}/images/Redo22.png | Bin .../{java => resources}/images/Reset16.png | Bin .../{java => resources}/images/Reset22.png | Bin .../{java => resources}/images/Save16.png | Bin .../{java => resources}/images/Save22.png | Bin .../{java => resources}/images/SaveAs16.png | Bin .../{java => resources}/images/SaveAs22.png | Bin .../{java => resources}/images/StepBack16.png | Bin .../{java => resources}/images/StepBack22.png | Bin .../images/StepForward16.png | Bin .../images/StepForward22.png | Bin .../{java => resources}/images/Stop16.png | Bin .../{java => resources}/images/Stop22.png | Bin .../{java => resources}/images/Undo16.png | Bin .../{java => resources}/images/Undo22.png | Bin .../{java => resources}/images/control.png | Bin .../{java => resources}/images/datapath.png | Bin src/main/{java => resources}/images/mars.ico | Bin .../{java => resources}/images/mars32.ico | Bin .../{java => resources}/images/register.png | Bin .../{java => resources}/registerDatapath.xml | 0 417 files changed, 5494 insertions(+), 5561 deletions(-) delete mode 100644 CreateMarsJar.bat delete mode 100755 CreateMarsJar.sh create mode 100644 convert_encoding.py delete mode 100644 src/main/java/mainclass.txt rename src/main/{java => resources}/ALUcontrolDatapath.xml (100%) rename src/main/{java => resources}/Config.properties (100%) rename src/main/{java => resources}/MARSlicense.txt (100%) rename src/main/{java => resources}/MipsXRayOpcode.xml (100%) rename src/main/{java => resources}/PseudoOps.txt (100%) rename src/main/{java => resources}/Settings.properties (100%) rename src/main/{java => resources}/Syscall.properties (100%) rename src/main/{java => resources}/controlDatapath.xml (100%) rename src/main/{java => resources}/docs/Mars.html (100%) rename src/main/{java => resources}/docs/allclasses-frame.html (100%) rename src/main/{java => resources}/docs/allclasses-noframe.html (100%) rename src/main/{java => resources}/docs/constant-values.html (100%) rename src/main/{java => resources}/docs/deprecated-list.html (100%) rename src/main/{java => resources}/docs/help-doc.html (100%) rename src/main/{java => resources}/docs/index-all.html (100%) rename src/main/{java => resources}/docs/index.html (100%) rename src/main/{java => resources}/docs/mars/ErrorList.html (100%) rename src/main/{java => resources}/docs/mars/ErrorMessage.html (100%) rename src/main/{java => resources}/docs/mars/Globals.html (100%) rename src/main/{java => resources}/docs/mars/MIPSprogram.html (100%) rename src/main/{java => resources}/docs/mars/MarsLaunch.html (100%) rename src/main/{java => resources}/docs/mars/MarsSplashScreen.html (100%) rename src/main/{java => resources}/docs/mars/ProcessingException.html (100%) rename src/main/{java => resources}/docs/mars/ProgramStatement.html (100%) rename src/main/{java => resources}/docs/mars/Settings.html (100%) rename src/main/{java => resources}/docs/mars/assembler/Assembler.html (100%) rename src/main/{java => resources}/docs/mars/assembler/DataTypes.html (100%) rename src/main/{java => resources}/docs/mars/assembler/Directives.html (100%) rename src/main/{java => resources}/docs/mars/assembler/Macro.html (100%) rename src/main/{java => resources}/docs/mars/assembler/MacroPool.html (100%) rename src/main/{java => resources}/docs/mars/assembler/OperandFormat.html (100%) rename src/main/{java => resources}/docs/mars/assembler/SourceLine.html (100%) rename src/main/{java => resources}/docs/mars/assembler/Symbol.html (100%) rename src/main/{java => resources}/docs/mars/assembler/SymbolTable.html (100%) rename src/main/{java => resources}/docs/mars/assembler/Token.html (100%) rename src/main/{java => resources}/docs/mars/assembler/TokenList.html (100%) rename src/main/{java => resources}/docs/mars/assembler/TokenTypes.html (100%) rename src/main/{java => resources}/docs/mars/assembler/Tokenizer.html (100%) rename src/main/{java => resources}/docs/mars/assembler/TranslationCode.html (100%) rename src/main/{java => resources}/docs/mars/assembler/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/assembler/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/assembler/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/AbstractDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/AsciiTextDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/BinaryDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/BinaryTextDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/DumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/DumpFormatLoader.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/HexTextDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/IntelHexDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/MIFDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/SegmentWindowDumpFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/mips/dump/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/AccessNotice.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/AddressErrorException.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/Coprocessor0.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/Coprocessor1.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/InvalidRegisterAccessException.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/Memory.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/MemoryAccessNotice.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/MemoryConfiguration.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/MemoryConfigurations.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/Register.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/RegisterAccessNotice.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/RegisterFile.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/mips/hardware/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/BasicInstruction.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/BasicInstructionFormat.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/ExtendedInstruction.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/Instruction.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/InstructionSet.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/SimulationCode.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/AbstractSyscall.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/RandomStreams.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/Syscall.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallClose.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallConfirmDialog.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallExit.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallExit2.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallInputDialogDouble.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallInputDialogFloat.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallInputDialogInt.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallInputDialogString.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMessageDialog.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMessageDialogDouble.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMessageDialogFloat.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMessageDialogInt.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMessageDialogString.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMidiOut.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallMidiOutSync.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallNumberOverride.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallOpen.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintChar.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintDouble.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintFloat.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintInt.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintIntBinary.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintIntHex.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintIntUnsigned.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallPrintString.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallRandDouble.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallRandFloat.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallRandInt.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallRandIntRange.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallRandSeed.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallRead.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallReadChar.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallReadDouble.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallReadFloat.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallReadInt.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallReadString.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallSbrk.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallSleep.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallTime.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/SyscallWrite.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/mips/instructions/syscalls/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/simulator/BackStepper.html (100%) rename src/main/{java => resources}/docs/mars/simulator/DelayedBranch.html (100%) rename src/main/{java => resources}/docs/mars/simulator/Exceptions.html (100%) rename src/main/{java => resources}/docs/mars/simulator/ProgramArgumentList.html (100%) rename src/main/{java => resources}/docs/mars/simulator/Simulator.StopListener.html (100%) rename src/main/{java => resources}/docs/mars/simulator/Simulator.html (100%) rename src/main/{java => resources}/docs/mars/simulator/SimulatorNotice.html (100%) rename src/main/{java => resources}/docs/mars/simulator/SwingWorker.html (100%) rename src/main/{java => resources}/docs/mars/simulator/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/simulator/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/simulator/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/tools/AbstractMarsToolAndApplication.ConnectButton.html (100%) rename src/main/{java => resources}/docs/mars/tools/AbstractMarsToolAndApplication.EnterKeyListener.html (100%) rename src/main/{java => resources}/docs/mars/tools/AbstractMarsToolAndApplication.html (100%) rename src/main/{java => resources}/docs/mars/tools/BHTEntry.html (100%) rename src/main/{java => resources}/docs/mars/tools/BHTSimGUI.html (100%) rename src/main/{java => resources}/docs/mars/tools/BHTSimulator.html (100%) rename src/main/{java => resources}/docs/mars/tools/BHTableModel.html (100%) rename src/main/{java => resources}/docs/mars/tools/BitmapDisplay.html (100%) rename src/main/{java => resources}/docs/mars/tools/CacheSimulator.html (100%) rename src/main/{java => resources}/docs/mars/tools/DigitalLabSim.HexaKeyboard.EcouteurClick.html (100%) rename src/main/{java => resources}/docs/mars/tools/DigitalLabSim.HexaKeyboard.html (100%) rename src/main/{java => resources}/docs/mars/tools/DigitalLabSim.OneSecondCounter.html (100%) rename src/main/{java => resources}/docs/mars/tools/DigitalLabSim.SevenSegmentDisplay.html (100%) rename src/main/{java => resources}/docs/mars/tools/DigitalLabSim.SevenSegmentPanel.html (100%) rename src/main/{java => resources}/docs/mars/tools/DigitalLabSim.html (100%) rename src/main/{java => resources}/docs/mars/tools/FloatRepresentation.html (100%) rename src/main/{java => resources}/docs/mars/tools/InstructionCounter.html (100%) rename src/main/{java => resources}/docs/mars/tools/InstructionStatistics.html (100%) rename src/main/{java => resources}/docs/mars/tools/IntroToTools.html (100%) rename src/main/{java => resources}/docs/mars/tools/KeyboardAndDisplaySimulator.html (100%) rename src/main/{java => resources}/docs/mars/tools/MarsBot.html (100%) rename src/main/{java => resources}/docs/mars/tools/MarsTool.html (100%) rename src/main/{java => resources}/docs/mars/tools/MemoryReferenceVisualization.html (100%) rename src/main/{java => resources}/docs/mars/tools/ScavengerHunt.html (100%) rename src/main/{java => resources}/docs/mars/tools/ScreenMagnifier.html (100%) rename src/main/{java => resources}/docs/mars/tools/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/tools/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/tools/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/util/Binary.html (100%) rename src/main/{java => resources}/docs/mars/util/EditorFont.html (100%) rename src/main/{java => resources}/docs/mars/util/FilenameFinder.html (100%) rename src/main/{java => resources}/docs/mars/util/MemoryDump.html (100%) rename src/main/{java => resources}/docs/mars/util/PropertiesFile.html (100%) rename src/main/{java => resources}/docs/mars/util/SystemIO.html (100%) rename src/main/{java => resources}/docs/mars/util/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/util/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/util/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/venus/AbstractFontSettingDialog.html (100%) rename src/main/{java => resources}/docs/mars/venus/Coprocessor0Window.html (100%) rename src/main/{java => resources}/docs/mars/venus/Coprocessor1Window.html (100%) rename src/main/{java => resources}/docs/mars/venus/DataSegmentWindow.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditCopyAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditCutAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditFindReplaceAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditPane.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditPasteAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditRedoAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditSelectAllAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditTabbedPane.html (100%) rename src/main/{java => resources}/docs/mars/venus/EditUndoAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/Editor.html (100%) rename src/main/{java => resources}/docs/mars/venus/ExecutePane.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileCloseAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileCloseAllAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileDumpMemoryAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileExitAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileNewAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileOpenAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FilePrintAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileSaveAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileSaveAllAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileSaveAsAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/FileStatus.html (100%) rename src/main/{java => resources}/docs/mars/venus/GuiAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/HardcopyWriter.PrintCanceledException.html (100%) rename src/main/{java => resources}/docs/mars/venus/HardcopyWriter.html (100%) rename src/main/{java => resources}/docs/mars/venus/HelpAboutAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/HelpHelpAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/LabelsWindow.html (100%) rename src/main/{java => resources}/docs/mars/venus/MainPane.html (100%) rename src/main/{java => resources}/docs/mars/venus/MessagesPane.html (100%) rename src/main/{java => resources}/docs/mars/venus/NumberDisplayBaseChooser.html (100%) rename src/main/{java => resources}/docs/mars/venus/PopupListener.html (100%) rename src/main/{java => resources}/docs/mars/venus/RegistersPane.html (100%) rename src/main/{java => resources}/docs/mars/venus/RegistersWindow.html (100%) rename src/main/{java => resources}/docs/mars/venus/RepeatButton.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunAssembleAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunBackstepAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunClearBreakpointsAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunGoAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunPauseAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunResetAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunSpeedPanel.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunStepAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunStopAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/RunToggleBreakpointsAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsAddressDisplayBaseAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsAssembleAllAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsAssembleOnOpenAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsDelayedBranchingAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsEditorAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsExceptionHandlerAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsExtendedAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsHighlightingAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsLabelAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsMemoryConfigurationAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsPopupInputAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsProgramArgumentsAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsSelfModifyingCodeAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsStartAtMainAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsValueDisplayBaseAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/SettingsWarningsAreErrorsAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/TextSegmentWindow.html (100%) rename src/main/{java => resources}/docs/mars/venus/ToolAction.html (100%) rename src/main/{java => resources}/docs/mars/venus/ToolLoader.html (100%) rename src/main/{java => resources}/docs/mars/venus/VenusUI.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/MARSTextEditingArea.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/generic/GenericTextArea.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/generic/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/generic/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/generic/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/DefaultInputHandler.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.MacroRecorder.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRecordable.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRepeatable.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.Wrapper.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace_word.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_copy.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_cut.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_paste.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.delete.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.delete_word.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.document_end.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.document_home.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.end.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.home.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_break.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_char.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_tab.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.next_char.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.next_line.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.next_page.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.next_word.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.overwrite.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_char.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_line.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_page.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_word.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.repeat.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.select_all.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/InputHandler.toggle_rect.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/JEditBasedTextArea.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/JEditTextArea.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/KeywordMap.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/PopupHelpItem.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/SyntaxDocument.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/SyntaxStyle.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/SyntaxUtilities.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/TextAreaDefaults.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.Highlight.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/TextUtilities.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/MIPSTokenMarker.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/Token.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.LineInfo.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/venus/editors/package-tree.html (100%) rename src/main/{java => resources}/docs/mars/venus/package-frame.html (100%) rename src/main/{java => resources}/docs/mars/venus/package-summary.html (100%) rename src/main/{java => resources}/docs/mars/venus/package-tree.html (100%) rename src/main/{java => resources}/docs/overview-frame.html (100%) rename src/main/{java => resources}/docs/overview-summary.html (100%) rename src/main/{java => resources}/docs/overview-tree.html (100%) rename src/main/{java => resources}/docs/package-frame.html (100%) rename src/main/{java => resources}/docs/package-list (100%) rename src/main/{java => resources}/docs/package-summary.html (100%) rename src/main/{java => resources}/docs/package-tree.html (100%) rename src/main/{java => resources}/docs/resources/inherit.gif (100%) rename src/main/{java => resources}/docs/serialized-form.html (100%) rename src/main/{java => resources}/docs/stylesheet.css (100%) rename src/main/{java => resources}/help/Acknowledgements.html (100%) rename src/main/{java => resources}/help/BugReportingHelp.html (100%) rename src/main/{java => resources}/help/ExceptionsHelp.html (100%) rename src/main/{java => resources}/help/HTML_of_links_for_posting_to_MARS_website.html (100%) rename src/main/{java => resources}/help/MIPSInstructionSetSong.html (100%) rename src/main/{java => resources}/help/MacrosHelp.html (100%) rename src/main/{java => resources}/help/MarsHelpCommand.html (100%) rename src/main/{java => resources}/help/MarsHelpDebugging.html (100%) rename src/main/{java => resources}/help/MarsHelpHistory.html (100%) rename src/main/{java => resources}/help/MarsHelpIDE.html (100%) rename src/main/{java => resources}/help/MarsHelpIntro.html (100%) rename src/main/{java => resources}/help/MarsHelpLimits.html (100%) rename src/main/{java => resources}/help/MarsHelpSettings.html (100%) rename src/main/{java => resources}/help/MarsHelpTools.html (100%) rename src/main/{java => resources}/help/SyscallHelp.html (100%) rename src/main/{java => resources}/help/SyscallMessageDialogError.gif (100%) rename src/main/{java => resources}/help/SyscallMessageDialogInformation.gif (100%) rename src/main/{java => resources}/help/SyscallMessageDialogQuestion.gif (100%) rename src/main/{java => resources}/help/SyscallMessageDialogWarning.gif (100%) rename src/main/{java => resources}/help/mipsref.pdf (100%) rename src/main/{java => resources}/images/ALUcontrol.png (100%) rename src/main/{java => resources}/images/Assemble16.png (100%) rename src/main/{java => resources}/images/Assemble22.png (100%) rename src/main/{java => resources}/images/Copy16.png (100%) rename src/main/{java => resources}/images/Copy22.png (100%) rename src/main/{java => resources}/images/Cut16.gif (100%) rename src/main/{java => resources}/images/Cut22.gif (100%) rename src/main/{java => resources}/images/Cut24.gif (100%) rename src/main/{java => resources}/images/Dump16.png (100%) rename src/main/{java => resources}/images/Dump22.png (100%) rename src/main/{java => resources}/images/Edit_tab.jpg (100%) rename src/main/{java => resources}/images/Execute_tab.jpg (100%) rename src/main/{java => resources}/images/Find16.png (100%) rename src/main/{java => resources}/images/Find22.png (100%) rename src/main/{java => resources}/images/Help16.png (100%) rename src/main/{java => resources}/images/Help22.png (100%) rename src/main/{java => resources}/images/MarsSurfacePathfinder.jpg (100%) rename src/main/{java => resources}/images/MarsThumbnail.gif (100%) rename src/main/{java => resources}/images/MyBlank16.gif (100%) rename src/main/{java => resources}/images/MyBlank24.gif (100%) rename src/main/{java => resources}/images/New16.png (100%) rename src/main/{java => resources}/images/New22.png (100%) rename src/main/{java => resources}/images/Next22.png (100%) rename src/main/{java => resources}/images/Open16.png (100%) rename src/main/{java => resources}/images/Open22.png (100%) rename src/main/{java => resources}/images/Paste16.png (100%) rename src/main/{java => resources}/images/Paste22.png (100%) rename src/main/{java => resources}/images/Pause16.png (100%) rename src/main/{java => resources}/images/Pause22.png (100%) rename src/main/{java => resources}/images/Play16.png (100%) rename src/main/{java => resources}/images/Play22.png (100%) rename src/main/{java => resources}/images/Previous22.png (100%) rename src/main/{java => resources}/images/Print16.gif (100%) rename src/main/{java => resources}/images/Print22.gif (100%) rename src/main/{java => resources}/images/Print24.gif (100%) rename src/main/{java => resources}/images/RedMars16.gif (100%) rename src/main/{java => resources}/images/RedMars32.GIF (100%) rename src/main/{java => resources}/images/RedMars50.gif (100%) rename src/main/{java => resources}/images/Redo16.png (100%) rename src/main/{java => resources}/images/Redo22.png (100%) rename src/main/{java => resources}/images/Reset16.png (100%) rename src/main/{java => resources}/images/Reset22.png (100%) rename src/main/{java => resources}/images/Save16.png (100%) rename src/main/{java => resources}/images/Save22.png (100%) rename src/main/{java => resources}/images/SaveAs16.png (100%) rename src/main/{java => resources}/images/SaveAs22.png (100%) rename src/main/{java => resources}/images/StepBack16.png (100%) rename src/main/{java => resources}/images/StepBack22.png (100%) rename src/main/{java => resources}/images/StepForward16.png (100%) rename src/main/{java => resources}/images/StepForward22.png (100%) rename src/main/{java => resources}/images/Stop16.png (100%) rename src/main/{java => resources}/images/Stop22.png (100%) rename src/main/{java => resources}/images/Undo16.png (100%) rename src/main/{java => resources}/images/Undo22.png (100%) rename src/main/{java => resources}/images/control.png (100%) rename src/main/{java => resources}/images/datapath.png (100%) rename src/main/{java => resources}/images/mars.ico (100%) rename src/main/{java => resources}/images/mars32.ico (100%) rename src/main/{java => resources}/images/register.png (100%) rename src/main/{java => resources}/registerDatapath.xml (100%) diff --git a/CreateMarsJar.bat b/CreateMarsJar.bat deleted file mode 100644 index 4c3c04a..0000000 --- a/CreateMarsJar.bat +++ /dev/null @@ -1 +0,0 @@ -jar cmf mainclass.txt Mars.jar PseudoOps.txt Config.properties Syscall.properties Settings.properties MARSlicense.txt mainclass.txt MipsXRayOpcode.xml registerDatapath.xml controlDatapath.xml ALUcontrolDatapath.xml CreateMarsJar.bat CreateMarsJar.sh Mars.java Mars.class docs help images mars \ No newline at end of file diff --git a/CreateMarsJar.sh b/CreateMarsJar.sh deleted file mode 100755 index 0a35332..0000000 --- a/CreateMarsJar.sh +++ /dev/null @@ -1,2 +0,0 @@ -# If you can't generate due of permissions, do a "chmod +x CreateMarsJar.sh". -jar cmf mainclass.txt Mars.jar PseudoOps.txt Config.properties Syscall.properties Settings.properties MARSlicense.txt mainclass.txt MipsXRayOpcode.xml registerDatapath.xml controlDatapath.xml ALUcontrolDatapath.xml CreateMarsJar.bat CreateMarsJar.sh Mars.java Mars.class docs help images mars \ No newline at end of file diff --git a/build.gradle b/build.gradle index 07b4ffd..b2eeba6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,3 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * This generated file contains a sample Java application project to get you started. - * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle - * User Manual available at https://docs.gradle.org/7.5.1/userguide/building_java_projects.html - * This project uses @Incubating APIs which are subject to change. - */ - plugins { // Apply the application plugin to add support for building a CLI application in Java. id 'application' @@ -34,5 +25,5 @@ testing { application { // Define the main class for the application. - mainClass = 'mars.assembler.App' + mainClass = 'Mars' } diff --git a/convert_encoding.py b/convert_encoding.py new file mode 100644 index 0000000..ddd292d --- /dev/null +++ b/convert_encoding.py @@ -0,0 +1,17 @@ +import os +from pathlib import Path +from subprocess import check_output + +if __name__ == '__main__': + java = Path('src/main/java') + files = [Path(root) / f for root, dir, files in os.walk(java) for f in files] + + for f in files: + ftype = check_output(f'file {f}', shell=True).decode() + if '8859' not in ftype: + continue + + print(f'Converting {f} to UTF-8...') + f.write_text(f.read_text('ISO-8859-1'), 'utf8') + + # print(files) diff --git a/settings.gradle b/settings.gradle index 1017f31..849dad2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,11 +1 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/7.5.1/userguide/multi_project_builds.html - * This project uses @Incubating APIs which are subject to change. - */ - -rootProject.name = 'MARS-Assembler' +rootProject.name = 'MARS' diff --git a/src/main/java/Mars.java b/src/main/java/Mars.java index 1e26974..3b2d1fb 100644 --- a/src/main/java/Mars.java +++ b/src/main/java/Mars.java @@ -1,4 +1,3 @@ - /* Copyright (c) 2003-2006, Pete Sanderson and Kenneth Vollmar @@ -29,14 +28,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /** * Portal to Mars - * + * * @author Pete Sanderson * @version March 2006 **/ - public class Mars { - public static void main(String[] args) { - new mars.MarsLaunch(args); - } - } +public class Mars { + public static void main(String[] args) { + new mars.MarsLaunch(args); + } +} diff --git a/src/main/java/mainclass.txt b/src/main/java/mainclass.txt deleted file mode 100644 index a0b6ddd..0000000 --- a/src/main/java/mainclass.txt +++ /dev/null @@ -1,2 +0,0 @@ -Main-Class: Mars -Class-Path: . diff --git a/src/main/java/mars/Globals.java b/src/main/java/mars/Globals.java index 2cec9f3..00099cd 100644 --- a/src/main/java/mars/Globals.java +++ b/src/main/java/mars/Globals.java @@ -1,12 +1,16 @@ - package mars; - import mars.mips.instructions.syscalls.*; - import mars.mips.instructions.*; - import mars.mips.hardware.*; - import mars.assembler.*; - import mars.venus.*; - import mars.util.*; - import java.io.*; - import java.util.*; +package mars; + +import mars.assembler.SymbolTable; +import mars.mips.hardware.Memory; +import mars.mips.instructions.InstructionSet; +import mars.mips.instructions.syscalls.SyscallNumberOverride; +import mars.util.PropertiesFile; +import mars.venus.VenusUI; + +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Properties; +import java.util.StringTokenizer; /* Copyright (c) 2003-2008, Pete Sanderson and Kenneth Vollmar @@ -38,212 +42,254 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /** * Collection of globally-available data structures. - * - * @author Pete Sanderson + * + * @author Pete Sanderson * @version August 2003 */ - public class Globals - { - // List these first because they are referenced by methods called at initialization. - private static String configPropertiesFile = "Config"; - private static String syscallPropertiesFile = "Syscall"; - - /** The set of implemented MIPS instructions. **/ - public static InstructionSet instructionSet; - /** the program currently being worked with. Used by GUI only, not command line. **/ - public static MIPSprogram program; - /** Symbol table for file currently being assembled. **/ - public static SymbolTable symbolTable; - /** Simulated MIPS memory component. **/ - public static Memory memory; - /** Lock variable used at head of synchronized block to guard MIPS memory and registers **/ - public static Object memoryAndRegistersLock = new Object(); - /** Flag to determine whether or not to produce internal debugging information. **/ - public static boolean debug = false; - /** Object that contains various settings that can be accessed modified internally. **/ - static Settings settings; - /** String to GUI's RunI/O text area when echoing user input from pop-up dialog. */ - public static String userInputAlert = "**** user input : "; - /** Path to folder that contains images */ +public class Globals { + /** + * Path to folder that contains images + */ // The leading "/" in filepath prevents package name from being pre-pended. - public static final String imagesPath = "/images/"; - /** Path to folder that contains help text */ - public static final String helpPath = "/help/"; - /* Flag that indicates whether or not instructionSet has been initialized. */ - private static boolean initialized = false; + public static final String imagesPath = "/images/"; + /** + * Path to folder that contains help text + */ + public static final String helpPath = "/help/"; + /** + * The current MARS version number. Can't wait for "initialize()" call to get it. + */ + public static final String version = "4.5"; + /** + * MARS copyright years + */ + public static final String copyrightYears = getCopyrightYears(); + /** + * MARS copyright holders + */ + public static final String copyrightHolders = getCopyrightHolders(); + /** + * The set of implemented MIPS instructions. + **/ + public static InstructionSet instructionSet; + /** + * the program currently being worked with. Used by GUI only, not command line. + **/ + public static MIPSprogram program; + /** + * Symbol table for file currently being assembled. + **/ + public static SymbolTable symbolTable; + /** + * Simulated MIPS memory component. + **/ + public static Memory memory; + /** + * Lock variable used at head of synchronized block to guard MIPS memory and registers + **/ + public static Object memoryAndRegistersLock = new Object(); + /** + * Flag to determine whether or not to produce internal debugging information. + **/ + public static boolean debug = false; + /** + * String to GUI's RunI/O text area when echoing user input from pop-up dialog. + */ + public static String userInputAlert = "**** user input : "; + /** + * MARS exit code -- useful with SYSCALL 17 when running from command line (not GUI) + */ + public static int exitCode = 0; + public static boolean runSpeedPanelExists = false; + /** + * Object that contains various settings that can be accessed modified internally. + **/ + static Settings settings; /* The GUI being used (if any) with this simulator. */ - static VenusUI gui = null; - /** The current MARS version number. Can't wait for "initialize()" call to get it. */ - public static final String version = "4.5"; - /** List of accepted file extensions for MIPS assembly source files. */ - public static final ArrayList fileExtensions = getFileExtensions(); - /** Maximum length of scrolled message window (MARS Messages and Run I/O) */ - public static final int maximumMessageCharacters = getMessageLimit(); - /** Maximum number of assembler errors produced by one assemble operation */ - public static final int maximumErrorMessages = getErrorLimit(); - /** Maximum number of back-step operations to buffer */ - public static final int maximumBacksteps = getBackstepLimit(); - /** MARS copyright years */ - public static final String copyrightYears = getCopyrightYears(); - /** MARS copyright holders */ - public static final String copyrightHolders = getCopyrightHolders(); - /** Placeholder for non-printable ASCII codes */ - public static final String ASCII_NON_PRINT = getAsciiNonPrint(); - /** Array of strings to display for ASCII codes in ASCII display of data segment. ASCII code 0-255 is array index. */ - public static final String[] ASCII_TABLE = getAsciiStrings(); - /** MARS exit code -- useful with SYSCALL 17 when running from command line (not GUI) */ - public static int exitCode = 0; - - public static boolean runSpeedPanelExists = false; - - private static String getCopyrightYears() { - return "2003-2014"; - } - private static String getCopyrightHolders() { - return "Pete Sanderson and Kenneth Vollmar"; - } - - public static void setGui(VenusUI g) { - gui = g; - } - public static VenusUI getGui() { - return gui; - } - - public static Settings getSettings() { - return settings; - } - + static VenusUI gui = null; + // List these first because they are referenced by methods called at initialization. + private static final String configPropertiesFile = "Config"; + /** + * List of accepted file extensions for MIPS assembly source files. + */ + public static final ArrayList fileExtensions = getFileExtensions(); + /** + * Maximum length of scrolled message window (MARS Messages and Run I/O) + */ + public static final int maximumMessageCharacters = getMessageLimit(); + /** + * Maximum number of assembler errors produced by one assemble operation + */ + public static final int maximumErrorMessages = getErrorLimit(); + /** + * Maximum number of back-step operations to buffer + */ + public static final int maximumBacksteps = getBackstepLimit(); + /** + * Placeholder for non-printable ASCII codes + */ + public static final String ASCII_NON_PRINT = getAsciiNonPrint(); + /** + * Array of strings to display for ASCII codes in ASCII display of data segment. ASCII code 0-255 is array index. + */ + public static final String[] ASCII_TABLE = getAsciiStrings(); + private static final String syscallPropertiesFile = "Syscall"; + /* Flag that indicates whether or not instructionSet has been initialized. */ + private static boolean initialized = false; + + private static String getCopyrightYears() { + return "2003-2014"; + } + + private static String getCopyrightHolders() { + return "Pete Sanderson and Kenneth Vollmar"; + } + + public static VenusUI getGui() { + return gui; + } + + public static void setGui(VenusUI g) { + gui = g; + } + + public static Settings getSettings() { + return settings; + } + /** * Method called once upon system initialization to create the global data structures. **/ - - public static void initialize(boolean gui) { - if (!initialized) { + + public static void initialize(boolean gui) { + if (!initialized) { memory = Memory.getInstance(); //clients can use Memory.getInstance instead of Globals.memory instructionSet = new InstructionSet(); - instructionSet.populate(); + instructionSet.populate(); symbolTable = new SymbolTable("global"); settings = new Settings(gui); initialized = true; - debug = false; - memory.clear(); // will establish memory configuration from setting - } - } - - // Read byte limit of Run I/O or MARS Messages text to buffer. - private static int getMessageLimit() { - return getIntegerProperty(configPropertiesFile, "MessageLimit", 1000000); - } - - // Read limit on number of error messages produced by one assemble operation. - private static int getErrorLimit() { - return getIntegerProperty(configPropertiesFile, "ErrorLimit", 200); - } - - // Read backstep limit (number of operations to buffer) from properties file. - private static int getBackstepLimit() { - return getIntegerProperty(configPropertiesFile, "BackstepLimit", 1000); - } - - // Read ASCII default display character for non-printing characters, from properties file. - public static String getAsciiNonPrint() { - String anp = getPropertyEntry(configPropertiesFile, "AsciiNonPrint"); - return (anp == null) ? "." : ( (anp.equals("space")) ? " " : anp ); - } - - // Read ASCII strings for codes 0-255, from properties file. If string - // value is "null", substitute value of ASCII_NON_PRINT. If string is - // "space", substitute string containing one space character. - public static String[] getAsciiStrings() { - String let = getPropertyEntry(configPropertiesFile,"AsciiTable"); - String placeHolder = getAsciiNonPrint(); - String[] lets = let.split(" +"); - int maxLength = 0; - for (int i = 0; i < lets.length; i++) { - if (lets[i].equals("null")) lets[i] = placeHolder; - if (lets[i].equals("space")) lets[i] = " "; - if (lets[i].length() > maxLength) maxLength = lets[i].length(); - } - String padding = " "; - maxLength++; - for (int i = 0; i < lets.length; i++) { - lets[i] = padding.substring(0,maxLength-lets[i].length()) + lets[i]; - } - return lets; - } - - // Read and return integer property value for given file and property name. - // Default value is returned if property file or name not found. - private static int getIntegerProperty(String propertiesFile, String propertyName, int defaultValue) { - int limit = defaultValue; // just in case no entry is found - Properties properties = PropertiesFile.loadPropertiesFromFile(propertiesFile); - try { + debug = false; + memory.clear(); // will establish memory configuration from setting + } + } + + // Read byte limit of Run I/O or MARS Messages text to buffer. + private static int getMessageLimit() { + return getIntegerProperty(configPropertiesFile, "MessageLimit", 1000000); + } + + // Read limit on number of error messages produced by one assemble operation. + private static int getErrorLimit() { + return getIntegerProperty(configPropertiesFile, "ErrorLimit", 200); + } + + // Read backstep limit (number of operations to buffer) from properties file. + private static int getBackstepLimit() { + return getIntegerProperty(configPropertiesFile, "BackstepLimit", 1000); + } + + // Read ASCII default display character for non-printing characters, from properties file. + public static String getAsciiNonPrint() { + String anp = getPropertyEntry(configPropertiesFile, "AsciiNonPrint"); + return (anp == null) ? "." : ((anp.equals("space")) ? " " : anp); + } + + // Read ASCII strings for codes 0-255, from properties file. If string + // value is "null", substitute value of ASCII_NON_PRINT. If string is + // "space", substitute string containing one space character. + public static String[] getAsciiStrings() { + String let = getPropertyEntry(configPropertiesFile, "AsciiTable"); + String placeHolder = getAsciiNonPrint(); + String[] lets = let.split(" +"); + int maxLength = 0; + for (int i = 0; i < lets.length; i++) { + if (lets[i].equals("null")) lets[i] = placeHolder; + if (lets[i].equals("space")) lets[i] = " "; + if (lets[i].length() > maxLength) maxLength = lets[i].length(); + } + String padding = " "; + maxLength++; + for (int i = 0; i < lets.length; i++) { + lets[i] = padding.substring(0, maxLength - lets[i].length()) + lets[i]; + } + return lets; + } + + // Read and return integer property value for given file and property name. + // Default value is returned if property file or name not found. + private static int getIntegerProperty(String propertiesFile, String propertyName, int defaultValue) { + int limit = defaultValue; // just in case no entry is found + Properties properties = PropertiesFile.loadPropertiesFromFile(propertiesFile); + try { limit = Integer.parseInt(properties.getProperty(propertyName, Integer.toString(defaultValue))); - } - catch (NumberFormatException nfe) { } // do nothing, I already have a default - return limit; - } - - - // Read assembly language file extensions from properties file. Resulting - // string is tokenized into array list (assume StringTokenizer default delimiters). - private static ArrayList getFileExtensions() { - ArrayList extensionsList = new ArrayList(); - String extensions = getPropertyEntry(configPropertiesFile,"Extensions"); - if (extensions != null) { - StringTokenizer st = new StringTokenizer(extensions); - while (st.hasMoreTokens()) { - extensionsList.add(st.nextToken()); - } - } - return extensionsList; - } - - /** - * Get list of MarsTools that reside outside the MARS distribution. - * Currently this is done by adding the tool's path name to the list - * of values for the external_tools property. Use ";" as delimiter! - * @return ArrayList. Each item is file path to .class file - * of a class that implements MarsTool. If none, returns empty list. - */ - public static ArrayList getExternalTools() { - ArrayList toolsList = new ArrayList(); - String delimiter = ";"; - String tools = getPropertyEntry(configPropertiesFile,"ExternalTools"); - if (tools != null) { - StringTokenizer st = new StringTokenizer(tools, delimiter); - while (st.hasMoreTokens()) { - toolsList.add(st.nextToken()); - } - } - return toolsList; - } - - /** - * Read and return property file value (if any) for requested property. - * @param propertiesFile name of properties file (do NOT include filename extension, - * which is assumed to be ".properties") - * @param propertyName String containing desired property name - * @return String containing associated value; null if property not found - */ - public static String getPropertyEntry(String propertiesFile, String propertyName) { - return PropertiesFile.loadPropertiesFromFile(propertiesFile).getProperty(propertyName); - } - - /** - * Read any syscall number assignment overrides from config file. - * @return ArrayList of SyscallNumberOverride objects - */ - public ArrayList getSyscallOverrides() { - ArrayList overrides = new ArrayList(); - Properties properties = PropertiesFile.loadPropertiesFromFile(syscallPropertiesFile); - Enumeration keys = properties.keys(); - while (keys.hasMoreElements()) { + } catch (NumberFormatException nfe) { + } // do nothing, I already have a default + return limit; + } + + + // Read assembly language file extensions from properties file. Resulting + // string is tokenized into array list (assume StringTokenizer default delimiters). + private static ArrayList getFileExtensions() { + ArrayList extensionsList = new ArrayList(); + String extensions = getPropertyEntry(configPropertiesFile, "Extensions"); + if (extensions != null) { + StringTokenizer st = new StringTokenizer(extensions); + while (st.hasMoreTokens()) { + extensionsList.add(st.nextToken()); + } + } + return extensionsList; + } + + /** + * Get list of MarsTools that reside outside the MARS distribution. + * Currently this is done by adding the tool's path name to the list + * of values for the external_tools property. Use ";" as delimiter! + * + * @return ArrayList. Each item is file path to .class file + * of a class that implements MarsTool. If none, returns empty list. + */ + public static ArrayList getExternalTools() { + ArrayList toolsList = new ArrayList(); + String delimiter = ";"; + String tools = getPropertyEntry(configPropertiesFile, "ExternalTools"); + if (tools != null) { + StringTokenizer st = new StringTokenizer(tools, delimiter); + while (st.hasMoreTokens()) { + toolsList.add(st.nextToken()); + } + } + return toolsList; + } + + /** + * Read and return property file value (if any) for requested property. + * + * @param propertiesFile name of properties file (do NOT include filename extension, + * which is assumed to be ".properties") + * @param propertyName String containing desired property name + * @return String containing associated value; null if property not found + */ + public static String getPropertyEntry(String propertiesFile, String propertyName) { + return PropertiesFile.loadPropertiesFromFile(propertiesFile).getProperty(propertyName); + } + + /** + * Read any syscall number assignment overrides from config file. + * + * @return ArrayList of SyscallNumberOverride objects + */ + public ArrayList getSyscallOverrides() { + ArrayList overrides = new ArrayList(); + Properties properties = PropertiesFile.loadPropertiesFromFile(syscallPropertiesFile); + Enumeration keys = properties.keys(); + while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); - overrides.add(new SyscallNumberOverride(key,properties.getProperty(key))); - } - return overrides; - } - - } + overrides.add(new SyscallNumberOverride(key, properties.getProperty(key))); + } + return overrides; + } + +} diff --git a/src/main/java/mars/ProgramStatement.java b/src/main/java/mars/ProgramStatement.java index 3f2ed6e..58325ac 100644 --- a/src/main/java/mars/ProgramStatement.java +++ b/src/main/java/mars/ProgramStatement.java @@ -1,9 +1,11 @@ - package mars; - import mars.assembler.*; - import mars.mips.instructions.*; - import mars.mips.hardware.*; - import mars.util.*; - import java.util.*; +package mars; + +import mars.assembler.*; +import mars.mips.instructions.*; +import mars.mips.hardware.*; +import mars.util.*; + +import java.util.*; /* Copyright (c) 2003-2013, Pete Sanderson and Kenneth Vollmar @@ -35,696 +37,697 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /** * Represents one assembly/machine statement. This represents the "bare machine" level. - * Pseudo-instructions have already been processed at this point and each assembly + * Pseudo-instructions have already been processed at this point and each assembly * statement generated by them is one of these. - * - * @author Pete Sanderson and Jason Bumgarner + * + * @author Pete Sanderson and Jason Bumgarner * @version August 2003 */ - public class ProgramStatement { - private MIPSprogram sourceMIPSprogram; - private String source, basicAssemblyStatement, machineStatement; - private TokenList originalTokenList, strippedTokenList; - private BasicStatementList basicStatementList; - private int[] operands; - private int numOperands; - private Instruction instruction; - private int textAddress; - private int sourceLine; - private int binaryStatement; - private boolean altered; - private static final String invalidOperator = ""; - +public class ProgramStatement { + private MIPSprogram sourceMIPSprogram; + private String source, basicAssemblyStatement, machineStatement; + private TokenList originalTokenList, strippedTokenList; + private BasicStatementList basicStatementList; + private int[] operands; + private int numOperands; + private Instruction instruction; + private int textAddress; + private int sourceLine; + private int binaryStatement; + private boolean altered; + private static final String invalidOperator = ""; + ////////////////////////////////////////////////////////////////////////////////// + /** - * Constructor for ProgramStatement when there are links back to all source and token + * Constructor for ProgramStatement when there are links back to all source and token * information. These can be used by a debugger later on. + * * @param sourceMIPSprogram The MIPSprogram object that contains this statement - * @param source The corresponding MIPS source statement. - * @param origTokenList Complete list of Token objects (includes labels, comments, parentheses, etc) + * @param source The corresponding MIPS source statement. + * @param origTokenList Complete list of Token objects (includes labels, comments, parentheses, etc) * @param strippedTokenList List of Token objects with all but operators and operands removed. - * @param inst The Instruction object for this statement's operator. - * @param textAddress The Text Segment address in memory where the binary machine code for this statement - * is stored. + * @param inst The Instruction object for this statement's operator. + * @param textAddress The Text Segment address in memory where the binary machine code for this statement + * is stored. **/ - public ProgramStatement(MIPSprogram sourceMIPSprogram, String source, TokenList origTokenList, TokenList strippedTokenList, - Instruction inst, int textAddress, int sourceLine) { - this.sourceMIPSprogram = sourceMIPSprogram; - this.source = source; - this.originalTokenList = origTokenList; - this.strippedTokenList = strippedTokenList; - this.operands = new int[4]; - this.numOperands = 0; - this.instruction = inst; - this.textAddress = textAddress; - this.sourceLine = sourceLine; - this.basicAssemblyStatement = null; - this.basicStatementList = new BasicStatementList(); - this.machineStatement = null; - this.binaryStatement = 0; // nop, or sll $0, $0, 0 (32 bits of 0's) - this.altered = false; - } - - + public ProgramStatement(MIPSprogram sourceMIPSprogram, String source, TokenList origTokenList, TokenList strippedTokenList, Instruction inst, int textAddress, int sourceLine) { + this.sourceMIPSprogram = sourceMIPSprogram; + this.source = source; + this.originalTokenList = origTokenList; + this.strippedTokenList = strippedTokenList; + this.operands = new int[4]; + this.numOperands = 0; + this.instruction = inst; + this.textAddress = textAddress; + this.sourceLine = sourceLine; + this.basicAssemblyStatement = null; + this.basicStatementList = new BasicStatementList(); + this.machineStatement = null; + this.binaryStatement = 0; // nop, or sll $0, $0, 0 (32 bits of 0's) + this.altered = false; + } + + ////////////////////////////////////////////////////////////////////////////////// + /** - * Constructor for ProgramStatement used only for writing a binary machine + * Constructor for ProgramStatement used only for writing a binary machine * instruction with no source code to refer back to. Originally supported * only NOP instruction (all zeroes), but extended in release 4.4 to support * all basic instructions. This was required for the self-modifying code * feature. + * * @param binaryStatement The 32-bit machine code. - * @param textAddress The Text Segment address in memory where the binary machine code for this statement - * is stored. + * @param textAddress The Text Segment address in memory where the binary machine code for this statement + * is stored. **/ - public ProgramStatement(int binaryStatement, int textAddress) { - this.sourceMIPSprogram = null; - this.binaryStatement = binaryStatement; - this.textAddress = textAddress; - this.originalTokenList = this.strippedTokenList = null; - this.source = ""; - this.machineStatement = this.basicAssemblyStatement = null; - BasicInstruction instr = Globals.instructionSet.findByBinaryCode(binaryStatement); - if (instr == null) { + public ProgramStatement(int binaryStatement, int textAddress) { + this.sourceMIPSprogram = null; + this.binaryStatement = binaryStatement; + this.textAddress = textAddress; + this.originalTokenList = this.strippedTokenList = null; + this.source = ""; + this.machineStatement = this.basicAssemblyStatement = null; + BasicInstruction instr = Globals.instructionSet.findByBinaryCode(binaryStatement); + if (instr == null) { this.operands = null; this.numOperands = 0; - this.instruction = (binaryStatement==0) // this is a "nop" statement - ? (Instruction) Globals.instructionSet.matchOperator("nop").get(0) - : null; - } - else { + this.instruction = (binaryStatement == 0) // this is a "nop" statement + ? (Instruction) Globals.instructionSet.matchOperator("nop").get(0) : null; + } else { this.operands = new int[4]; this.numOperands = 0; this.instruction = instr; - + String opandCodes = "fst"; String fmt = instr.getOperationMask(); BasicInstructionFormat instrFormat = instr.getInstructionFormat(); int numOps = 0; for (int i = 0; i < opandCodes.length(); i++) { - int code = opandCodes.charAt(i); - int j = fmt.indexOf(code); - if (j >= 0) { - int k0 = 31 - fmt.lastIndexOf(code); - int k1 = 31 - j; - int opand = (binaryStatement >> k0) & ((1 << (k1 - k0 + 1)) - 1); - if (instrFormat.equals(BasicInstructionFormat.I_BRANCH_FORMAT) && numOps == 2) { - opand = opand << 16 >> 16; - } - else if (instrFormat.equals(BasicInstructionFormat.J_FORMAT) && numOps == 0) { - opand |= (textAddress >> 2) & 0x3C000000; - } - this.operands[numOps] = opand; - numOps++; - } + int code = opandCodes.charAt(i); + int j = fmt.indexOf(code); + if (j >= 0) { + int k0 = 31 - fmt.lastIndexOf(code); + int k1 = 31 - j; + int opand = (binaryStatement >> k0) & ((1 << (k1 - k0 + 1)) - 1); + if (instrFormat.equals(BasicInstructionFormat.I_BRANCH_FORMAT) && numOps == 2) { + opand = opand << 16 >> 16; + } else if (instrFormat.equals(BasicInstructionFormat.J_FORMAT) && numOps == 0) { + opand |= (textAddress >> 2) & 0x3C000000; + } + this.operands[numOps] = opand; + numOps++; + } } this.numOperands = numOps; - } - this.altered = false; - this.basicStatementList = buildBasicStatementListFromBinaryCode(binaryStatement, instr, operands, numOperands); - } - - + } + this.altered = false; + this.basicStatementList = buildBasicStatementListFromBinaryCode(binaryStatement, instr, operands, numOperands); + } + + ///////////////////////////////////////////////////////////////////////////// + /** * Given specification of BasicInstruction for this operator, build the * corresponding assembly statement in basic assembly format (e.g. substituting * register numbers for register names, replacing labels by values). + * * @param errors The list of assembly errors encountered so far. May add to it here. **/ - public void buildBasicStatementFromBasicInstruction(ErrorList errors) { - Token token = strippedTokenList.get(0); - String basicStatementElement = token.getValue()+" ";; - String basic = basicStatementElement; - basicStatementList.addString(basicStatementElement); // the operator - TokenTypes tokenType, nextTokenType; - String tokenValue; - int registerNumber; - this.numOperands = 0; - for (int i=1; i> 2; - address = (address - (this.textAddress+Instruction.INSTRUCTION_LENGTH)) >> 2; - absoluteAddress = false; - } - } - ////////////////////////////////////////////////////////////////////// - basic += address; - if (absoluteAddress) { // record as address if absolute, value if relative - basicStatementList.addAddress(address); - } - else { - basicStatementList.addValue(address); - } - this.operands[this.numOperands++] = address; - } - else if (tokenType == TokenTypes.INTEGER_5 || tokenType == TokenTypes.INTEGER_16 || - tokenType == TokenTypes.INTEGER_16U || tokenType == TokenTypes.INTEGER_32) { - - int tempNumeric = Binary.stringToInt(tokenValue); - - /*************************************************************************** - * MODIFICATION AND COMMENT, DPS 3-July-2008 - * - * The modifications of January 2005 documented below are being rescinded. - * All hexadecimal immediate values are considered 32 bits in length and - * their classification as INTEGER_5, INTEGER_16, INTEGER_16U (new) - * or INTEGER_32 depends on their 32 bit value. So 0xFFFF will be - * equivalent to 0x0000FFFF instead of 0xFFFFFFFF. This change, along with - * the introduction of INTEGER_16U (adopted from Greg Gibeling of Berkeley), - * required extensive changes to instruction templates especially for - * pseudo-instructions. - * - * This modification also appears inbuildBasicStatementFromBasicInstruction() - * in mars.ProgramStatement. - * - * ///// Begin modification 1/4/05 KENV /////////////////////////////////////////// - * // We have decided to interpret non-signed (no + or -) 16-bit hexadecimal immediate - * // operands as signed values in the range -32768 to 32767. So 0xffff will represent - * // -1, not 65535 (bit 15 as sign bit), 0x8000 will represent -32768 not 32768. - * // NOTE: 32-bit hexadecimal immediate operands whose values fall into this range - * // will be likewise affected, but they are used only in pseudo-instructions. The - * // code in ExtendedInstruction.java to split this number into upper 16 bits for "lui" - * // and lower 16 bits for "ori" works with the original source code token, so it is - * // not affected by this tweak. 32-bit immediates in data segment directives - * // are also processed elsewhere so are not affected either. - * //////////////////////////////////////////////////////////////////////////////// - * - * if (tokenType != TokenTypes.INTEGER_16U) { // part of the Berkeley mod... - * if ( Binary.isHex(tokenValue) && - * (tempNumeric >= 32768) && - * (tempNumeric <= 65535) ) // Range 0x8000 ... 0xffff - * { - * // Subtract the 0xffff bias, because strings in the - * // range "0x8000" ... "0xffff" are used to represent - * // 16-bit negative numbers, not positive numbers. - * tempNumeric = tempNumeric - 65536; - * // Note: no action needed for range 0xffff8000 ... 0xffffffff - * } - * } - ************************** END DPS 3-July-2008 COMMENTS *******************************/ - - basic += tempNumeric; - basicStatementList.addValue(tempNumeric); - this.operands[this.numOperands++] = tempNumeric; + errors.add(new ErrorMessage(this.sourceMIPSprogram, token.getSourceLine(), token.getStartPos(), "invalid FPU register name")); + return; + } + this.operands[this.numOperands++] = registerNumber; + } else if (tokenType == TokenTypes.IDENTIFIER) { + int address = this.sourceMIPSprogram.getLocalSymbolTable().getAddressLocalOrGlobal(tokenValue); + if (address == SymbolTable.NOT_FOUND) { // symbol used without being defined + errors.add(new ErrorMessage(this.sourceMIPSprogram, token.getSourceLine(), token.getStartPos(), "Symbol \"" + tokenValue + "\" not found in symbol table.")); + return; + } + boolean absoluteAddress = true; // (used below) + ////////////////////////////////////////////////////////////////////// + // added code 12-20-2004. If basic instruction with I_BRANCH format, then translate + // address from absolute to relative and shift left 2. + // + // DPS 14 June 2007: Apply delayed branching if enabled. This adds 4 bytes to the + // address used to calculate branch distance in relative words. + // + // DPS 4 January 2008: Apply the delayed branching 4-byte (instruction length) addition + // regardless of whether delayed branching is enabled or not. This was in response to + // several people complaining about machine code not matching that from the COD3 example + // on p 98-99. In that example, the branch offset reflect delayed branching because + // all MIPS machines implement delayed branching. But the topic of delayed branching + // is not yet introduced at that point, and instructors want to avoid the messiness + // that comes along with it. Our original strategy was to do it like SPIM does, which + // the June 2007 mod (shown below as commented-out assignment to address) does. + // This mod must be made in conjunction with InstructionSet.java's processBranch() + // method. There are some comments there as well. + + if (instruction instanceof BasicInstruction) { + BasicInstructionFormat format = ((BasicInstruction) instruction).getInstructionFormat(); + if (format == BasicInstructionFormat.I_BRANCH_FORMAT) { + //address = (address - (this.textAddress+((Globals.getSettings().getDelayedBranchingEnabled())? Instruction.INSTRUCTION_LENGTH : 0))) >> 2; + address = (address - (this.textAddress + Instruction.INSTRUCTION_LENGTH)) >> 2; + absoluteAddress = false; + } + } + ////////////////////////////////////////////////////////////////////// + basic += address; + if (absoluteAddress) { // record as address if absolute, value if relative + basicStatementList.addAddress(address); + } else { + basicStatementList.addValue(address); + } + this.operands[this.numOperands++] = address; + } else if (tokenType == TokenTypes.INTEGER_5 || tokenType == TokenTypes.INTEGER_16 || tokenType == TokenTypes.INTEGER_16U || tokenType == TokenTypes.INTEGER_32) { + + int tempNumeric = Binary.stringToInt(tokenValue); + + /*************************************************************************** + * MODIFICATION AND COMMENT, DPS 3-July-2008 + * + * The modifications of January 2005 documented below are being rescinded. + * All hexadecimal immediate values are considered 32 bits in length and + * their classification as INTEGER_5, INTEGER_16, INTEGER_16U (new) + * or INTEGER_32 depends on their 32 bit value. So 0xFFFF will be + * equivalent to 0x0000FFFF instead of 0xFFFFFFFF. This change, along with + * the introduction of INTEGER_16U (adopted from Greg Gibeling of Berkeley), + * required extensive changes to instruction templates especially for + * pseudo-instructions. + * + * This modification also appears inbuildBasicStatementFromBasicInstruction() + * in mars.ProgramStatement. + * + * ///// Begin modification 1/4/05 KENV /////////////////////////////////////////// + * // We have decided to interpret non-signed (no + or -) 16-bit hexadecimal immediate + * // operands as signed values in the range -32768 to 32767. So 0xffff will represent + * // -1, not 65535 (bit 15 as sign bit), 0x8000 will represent -32768 not 32768. + * // NOTE: 32-bit hexadecimal immediate operands whose values fall into this range + * // will be likewise affected, but they are used only in pseudo-instructions. The + * // code in ExtendedInstruction.java to split this number into upper 16 bits for "lui" + * // and lower 16 bits for "ori" works with the original source code token, so it is + * // not affected by this tweak. 32-bit immediates in data segment directives + * // are also processed elsewhere so are not affected either. + * //////////////////////////////////////////////////////////////////////////////// + * + * if (tokenType != TokenTypes.INTEGER_16U) { // part of the Berkeley mod... + * if ( Binary.isHex(tokenValue) && + * (tempNumeric >= 32768) && + * (tempNumeric <= 65535) ) // Range 0x8000 ... 0xffff + * { + * // Subtract the 0xffff bias, because strings in the + * // range "0x8000" ... "0xffff" are used to represent + * // 16-bit negative numbers, not positive numbers. + * tempNumeric = tempNumeric - 65536; + * // Note: no action needed for range 0xffff8000 ... 0xffffffff + * } + * } + ************************** END DPS 3-July-2008 COMMENTS *******************************/ + + basic += tempNumeric; + basicStatementList.addValue(tempNumeric); + this.operands[this.numOperands++] = tempNumeric; ///// End modification 1/7/05 KENV /////////////////////////////////////////// - } - else { - basicStatementElement = tokenValue; - basic += basicStatementElement; - basicStatementList.addString(basicStatementElement); + } else { + basicStatementElement = tokenValue; + basic += basicStatementElement; + basicStatementList.addString(basicStatementElement); } // add separator if not at end of token list AND neither current nor // next token is a parenthesis - if ((i < strippedTokenList.size()-1)) { - nextTokenType = strippedTokenList.get(i+1).getType(); - if (tokenType != TokenTypes.LEFT_PAREN && tokenType != TokenTypes.RIGHT_PAREN && - nextTokenType != TokenTypes.LEFT_PAREN && nextTokenType != TokenTypes.RIGHT_PAREN) - { - basicStatementElement = ","; - basic += basicStatementElement; - basicStatementList.addString(basicStatementElement); - } + if ((i < strippedTokenList.size() - 1)) { + nextTokenType = strippedTokenList.get(i + 1).getType(); + if (tokenType != TokenTypes.LEFT_PAREN && tokenType != TokenTypes.RIGHT_PAREN && nextTokenType != TokenTypes.LEFT_PAREN && nextTokenType != TokenTypes.RIGHT_PAREN) { + basicStatementElement = ","; + basic += basicStatementElement; + basicStatementList.addString(basicStatementElement); + } } - } - this.basicAssemblyStatement = basic; - } //buildBasicStatementFromBasicInstruction() - - - + } + this.basicAssemblyStatement = basic; + } //buildBasicStatementFromBasicInstruction() + + ///////////////////////////////////////////////////////////////////////////// + /** * Given the current statement in Basic Assembly format (see above), build the * 32-bit binary machine code statement. + * * @param errors The list of assembly errors encountered so far. May add to it here. **/ - public void buildMachineStatementFromBasicStatement(ErrorList errors) { - - try { - //mask indicates bit positions for 'f'irst, 's'econd, 't'hird operand - this.machineStatement = ((BasicInstruction)instruction).getOperationMask(); - } // This means the pseudo-instruction expansion generated another - // pseudo-instruction (expansion must be to all basic instructions). - // This is an error on the part of the pseudo-instruction author. - catch (ClassCastException cce) { - errors.add(new ErrorMessage(this.sourceMIPSprogram,this.sourceLine,0, - "INTERNAL ERROR: pseudo-instruction expansion contained a pseudo-instruction")); - return; - } - BasicInstructionFormat format = ((BasicInstruction)instruction).getInstructionFormat(); - - if (format == BasicInstructionFormat.J_FORMAT) { + public void buildMachineStatementFromBasicStatement(ErrorList errors) { + + try { + //mask indicates bit positions for 'f'irst, 's'econd, 't'hird operand + this.machineStatement = ((BasicInstruction) instruction).getOperationMask(); + } // This means the pseudo-instruction expansion generated another + // pseudo-instruction (expansion must be to all basic instructions). + // This is an error on the part of the pseudo-instruction author. + catch (ClassCastException cce) { + errors.add(new ErrorMessage(this.sourceMIPSprogram, this.sourceLine, 0, "INTERNAL ERROR: pseudo-instruction expansion contained a pseudo-instruction")); + return; + } + BasicInstructionFormat format = ((BasicInstruction) instruction).getInstructionFormat(); + + if (format == BasicInstructionFormat.J_FORMAT) { if ((this.textAddress & 0xF0000000) != (this.operands[0] & 0xF0000000)) { - // attempt to jump beyond 28-bit byte (26-bit word) address range. - // SPIM flags as warning, I'll flag as error b/c MARS text segment not long enough for it to be OK. - errors.add(new ErrorMessage(this.sourceMIPSprogram, this.sourceLine, 0, - "Jump target word address beyond 26-bit range")); - return; + // attempt to jump beyond 28-bit byte (26-bit word) address range. + // SPIM flags as warning, I'll flag as error b/c MARS text segment not long enough for it to be OK. + errors.add(new ErrorMessage(this.sourceMIPSprogram, this.sourceLine, 0, "Jump target word address beyond 26-bit range")); + return; } // Note the bit shift to make this a word address. this.operands[0] = this.operands[0] >>> 2; - this.insertBinaryCode(this.operands[0], Instruction.operandMask[0], errors); - } - else if (format == BasicInstructionFormat.I_BRANCH_FORMAT) { - for (int i=0; i= numOperands, it returns -1. - **/ - public int getOperand(int i) { - if (i >= 0 && i < this.numOperands) { + **/ + public int getOperand(int i) { + if (i >= 0 && i < this.numOperands) { return operands[i]; - } - else { + } else { return -1; - } - } - - + } + } + + ////////////////////////////////////////////////////////////////////////////// // Given operand (register or integer) and mask character ('f', 's', or 't'), // generate the correct sequence of bits and replace the mask with them. - private void insertBinaryCode(int value, char mask, ErrorList errors) { - int startPos = this.machineStatement.indexOf(mask); - int endPos = this.machineStatement.lastIndexOf(mask); - if (startPos == -1 || endPos == -1) { // should NEVER occur - errors.add(new ErrorMessage(this.sourceMIPSprogram,this.sourceLine,0, - "INTERNAL ERROR: mismatch in number of operands in statement vs mask")); + private void insertBinaryCode(int value, char mask, ErrorList errors) { + int startPos = this.machineStatement.indexOf(mask); + int endPos = this.machineStatement.lastIndexOf(mask); + if (startPos == -1 || endPos == -1) { // should NEVER occur + errors.add(new ErrorMessage(this.sourceMIPSprogram, this.sourceLine, 0, "INTERNAL ERROR: mismatch in number of operands in statement vs mask")); return; - } - String bitString = Binary.intToBinaryString(value, endPos-startPos+1); - String state = this.machineStatement.substring(0, startPos) + bitString; - if (endPos < this.machineStatement.length()-1) - state = state + this.machineStatement.substring(endPos+1); - this.machineStatement = state; - return; - } // insertBinaryCode() - - + } + String bitString = Binary.intToBinaryString(value, endPos - startPos + 1); + String state = this.machineStatement.substring(0, startPos) + bitString; + if (endPos < this.machineStatement.length() - 1) state = state + this.machineStatement.substring(endPos + 1); + this.machineStatement = state; + return; + } // insertBinaryCode() + + ////////////////////////////////////////////////////////////////////////////// - /* - * Given a model BasicInstruction and the assembled (not source) operand array for a statement, - * this method will construct the corresponding basic instruction list. This method is - * used by the constructor that is given only the int address and binary code. It is not - * intended to be used when source code is available. DPS 11-July-2013 - */ - private BasicStatementList buildBasicStatementListFromBinaryCode(int binary, BasicInstruction instr, int[] operands, int numOperands) { - BasicStatementList statementList = new BasicStatementList(); - int tokenListCounter = 1; // index 0 is operator; operands start at index 1 - if (instr == null) { + /* + * Given a model BasicInstruction and the assembled (not source) operand array for a statement, + * this method will construct the corresponding basic instruction list. This method is + * used by the constructor that is given only the int address and binary code. It is not + * intended to be used when source code is available. DPS 11-July-2013 + */ + private BasicStatementList buildBasicStatementListFromBinaryCode(int binary, BasicInstruction instr, int[] operands, int numOperands) { + BasicStatementList statementList = new BasicStatementList(); + int tokenListCounter = 1; // index 0 is operator; operands start at index 1 + if (instr == null) { statementList.addString(invalidOperator); return statementList; - } - else { - statementList.addString(instr.getName()+" "); - } - for (int i=0; i 1 && tokenListCounter 1 && tokenListCounter < instr.getTokenList().size()) { + TokenTypes thisTokenType = instr.getTokenList().get(tokenListCounter).getType(); + if (thisTokenType != TokenTypes.LEFT_PAREN && thisTokenType != TokenTypes.RIGHT_PAREN) { + statementList.addString(","); + } } boolean notOperand = true; - while (notOperand && tokenListCounter + * NOTE: If the Preference objects fail due to security exceptions, changes to settings will not carry over from one + * MARS session to the next. + *

+ * Actual implementation of the Preference objects is platform-dependent. For Windows, they are stored in Registry. To + * see, run regedit and browse to: HKEY_CURRENT_USER\Software\JavaSoft\Prefs\mars + * + * @author Pete Sanderson + **/ +public class Settings extends Observable { + /** + * Flag to determine whether a program can write binary code to the text or data segment and + * execute that code. + */ + public static final int SELF_MODIFYING_CODE_ENABLED = 20; ///////////////////////////// PROPERTY ARRAY INDEXES ///////////////////////////// // Because MARS is programmed to Java 1.4, we cannot use an enumerated type. - + // BOOLEAN SETTINGS... - /** Flag to determine whether or not program being assembled is limited to - basic MIPS instructions and formats. */ - public static final int EXTENDED_ASSEMBLER_ENABLED = 0; - /** Flag to determine whether or not program being assembled is limited to - using register numbers instead of names. NOTE: Its default value is - false and the IDE provides no means to change it! */ - public static final int BARE_MACHINE_ENABLED = 1; - /** Flag to determine whether or not a file is immediately and automatically assembled - upon opening. Handy when using externa editor like mipster. */ - public static final int ASSEMBLE_ON_OPEN_ENABLED = 2; - /** Flag to determine whether only the current editor source file (enabled false) or - all files in its directory (enabled true) will be assembled when assembly is selected. */ - public static final int ASSEMBLE_ALL_ENABLED = 3; - /** Default visibilty of label window (symbol table). Default only, dynamic status - maintained by ExecutePane */ - public static final int LABEL_WINDOW_VISIBILITY = 4; - /** Default setting for displaying addresses and values in hexidecimal in the Execute - pane.*/ - public static final int DISPLAY_ADDRESSES_IN_HEX = 5; - public static final int DISPLAY_VALUES_IN_HEX = 6; - /** Flag to determine whether the currently selected exception handler source file will - be included in each assembly operation. */ - public static final int EXCEPTION_HANDLER_ENABLED = 7; - /** Flag to determine whether or not delayed branching is in effect at MIPS execution. - This means we simulate the pipeline and statement FOLLOWING a successful branch - is executed before branch is taken. DPS 14 June 2007.*/ - public static final int DELAYED_BRANCHING_ENABLED = 8; - /** Flag to determine whether or not the editor will display line numbers. */ - public static final int EDITOR_LINE_NUMBERS_DISPLAYED = 9; - /** Flag to determine whether or not assembler warnings are considered errors. */ - public static final int WARNINGS_ARE_ERRORS = 10; - /** Flag to determine whether or not to display and use program arguments */ - public static final int PROGRAM_ARGUMENTS = 11; - /** Flag to control whether or not highlighting is applied to data segment window */ - public static final int DATA_SEGMENT_HIGHLIGHTING = 12; - /** Flag to control whether or not highlighting is applied to register windows */ - public static final int REGISTERS_HIGHLIGHTING = 13; - /** Flag to control whether or not assembler automatically initializes program counter to 'main's address */ - public static final int START_AT_MAIN = 14; - /** Flag to control whether or not editor will highlight the line currently being edited */ - public static final int EDITOR_CURRENT_LINE_HIGHLIGHTING = 15; - /** Flag to control whether or not editor will provide popup instruction guidance while typing */ - public static final int POPUP_INSTRUCTION_GUIDANCE = 16; - /** Flag to control whether or not simulator will use popup dialog for input syscalls */ - public static final int POPUP_SYSCALL_INPUT = 17; - /** Flag to control whether or not to use generic text editor instead of language-aware styled editor */ - public static final int GENERIC_TEXT_EDITOR = 18; - /** Flag to control whether or not language-aware editor will use auto-indent feature */ - public static final int AUTO_INDENT = 19; - /** Flag to determine whether a program can write binary code to the text or data segment and - execute that code. */ - public static final int SELF_MODIFYING_CODE_ENABLED = 20; - - // NOTE: key sequence must match up with labels above which are used for array indexes! - private static String[] booleanSettingsKeys = {"ExtendedAssembler", "BareMachine", "AssembleOnOpen", "AssembleAll", - "LabelWindowVisibility", "DisplayAddressesInHex", "DisplayValuesInHex", - "LoadExceptionHandler", "DelayedBranching", "EditorLineNumbersDisplayed", - "WarningsAreErrors", "ProgramArguments", "DataSegmentHighlighting", - "RegistersHighlighting", "StartAtMain", "EditorCurrentLineHighlighting", - "PopupInstructionGuidance", "PopupSyscallInput", "GenericTextEditor", - "AutoIndent", "SelfModifyingCode" }; - - /** Last resort default values for boolean settings; will use only if neither - * the Preferences nor the properties file work. If you wish to change them, - * do so before instantiating the Settings object. - * Values are matched to keys by list position. - */ - public static boolean[] defaultBooleanSettingsValues = { // match the above list by position - true, false, false, false, false, true, true, false, false, - true, false, false, true, true, false, true, true, false, false, true, false }; - - // STRING SETTINGS. Each array position has associated name. - /** Current specified exception handler file (a MIPS assembly source file) */ - public static final int EXCEPTION_HANDLER = 0; - /** Order of text segment table columns */ - public static final int TEXT_COLUMN_ORDER = 1; - /** State for sorting label window display */ - public static final int LABEL_SORT_STATE = 2; - /** Identifier of current memory configuration */ - public static final int MEMORY_CONFIGURATION = 3; - /** Caret blink rate in milliseconds, 0 means don't blink. */ - public static final int CARET_BLINK_RATE = 4; - /** Editor tab size in characters. */ - public static final int EDITOR_TAB_SIZE = 5; - /** Number of letters to be matched by editor's instruction guide before popup generated (if popup enabled) */ - public static final int EDITOR_POPUP_PREFIX_LENGTH = 6; - // Match the above by position. - private static final String[] stringSettingsKeys = { "ExceptionHandler", "TextColumnOrder", "LabelSortState", "MemoryConfiguration", "CaretBlinkRate", "EditorTabSize", "EditorPopupPrefixLength" }; - - /** Last resort default values for String settings; - * will use only if neither the Preferences nor the properties file work. - * If you wish to change, do so before instantiating the Settings object. - * Must match key by list position. - */ - private static String[] defaultStringSettingsValues = { "", "0 1 2 3 4", "0", "", "500", "8", "2" }; - - - // FONT SETTINGS. Each array position has associated name. - /** Font for the text editor */ - public static final int EDITOR_FONT = 0; - /** Font for table even row background (text, data, register displays) */ - public static final int EVEN_ROW_FONT = 1; - /** Font for table odd row background (text, data, register displays) */ - public static final int ODD_ROW_FONT = 2; - /** Font for table odd row foreground (text, data, register displays) */ - public static final int TEXTSEGMENT_HIGHLIGHT_FONT = 3; - /** Font for text segment delay slot highlighted background */ - public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FONT = 4; - /** Font for text segment highlighted background */ - public static final int DATASEGMENT_HIGHLIGHT_FONT = 5; - /** Font for register highlighted background */ - public static final int REGISTER_HIGHLIGHT_FONT = 6; - - private static final String[] fontFamilySettingsKeys = { "EditorFontFamily", "EvenRowFontFamily", - "OddRowFontFamily", " TextSegmentHighlightFontFamily", "TextSegmentDelayslotHighightFontFamily", - "DataSegmentHighlightFontFamily", "RegisterHighlightFontFamily" - }; - private static final String[] fontStyleSettingsKeys = { "EditorFontStyle", "EvenRowFontStyle", - "OddRowFontStyle", " TextSegmentHighlightFontStyle", "TextSegmentDelayslotHighightFontStyle", - "DataSegmentHighlightFontStyle", "RegisterHighlightFontStyle" - }; - private static final String[] fontSizeSettingsKeys = { "EditorFontSize", "EvenRowFontSize", - "OddRowFontSize", " TextSegmentHighlightFontSize", "TextSegmentDelayslotHighightFontSize", - "DataSegmentHighlightFontSize", "RegisterHighlightFontSize" - }; - - - /** Last resort default values for Font settings; - * will use only if neither the Preferences nor the properties file work. - * If you wish to change, do so before instantiating the Settings object. - * Must match key by list position shown above. - */ - - // DPS 3-Oct-2012 - // Changed default font family from "Courier New" to "Monospaced" after receiving reports that Mac were not - // correctly rendering the left parenthesis character in the editor or text segment display. - // See http://www.mirthcorp.com/community/issues/browse/MIRTH-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel - private static final String[] defaultFontFamilySettingsValues = { "Monospaced","Monospaced","Monospaced", - "Monospaced","Monospaced","Monospaced","Monospaced" - }; - private static final String[] defaultFontStyleSettingsValues = {"Plain", "Plain", "Plain", "Plain", - "Plain", "Plain", "Plain" - }; - private static final String[] defaultFontSizeSettingsValues = {"12", "12", "12", "12", "12", "12", "12", - }; - - - - // COLOR SETTINGS. Each array position has associated name. - /** RGB color for table even row background (text, data, register displays) */ - public static final int EVEN_ROW_BACKGROUND = 0; - /** RGB color for table even row foreground (text, data, register displays) */ - public static final int EVEN_ROW_FOREGROUND = 1; - /** RGB color for table odd row background (text, data, register displays) */ - public static final int ODD_ROW_BACKGROUND = 2; - /** RGB color for table odd row foreground (text, data, register displays) */ - public static final int ODD_ROW_FOREGROUND = 3; - /** RGB color for text segment highlighted background */ - public static final int TEXTSEGMENT_HIGHLIGHT_BACKGROUND = 4; - /** RGB color for text segment highlighted foreground */ - public static final int TEXTSEGMENT_HIGHLIGHT_FOREGROUND = 5; - /** RGB color for text segment delay slot highlighted background */ - public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_BACKGROUND = 6; - /** RGB color for text segment delay slot highlighted foreground */ - public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FOREGROUND = 7; - /** RGB color for text segment highlighted background */ - public static final int DATASEGMENT_HIGHLIGHT_BACKGROUND = 8; - /** RGB color for text segment highlighted foreground */ - public static final int DATASEGMENT_HIGHLIGHT_FOREGROUND = 9; - /** RGB color for register highlighted background */ - public static final int REGISTER_HIGHLIGHT_BACKGROUND = 10; - /** RGB color for register highlighted foreground */ - public static final int REGISTER_HIGHLIGHT_FOREGROUND = 11; - // Match the above by position. - private static final String[] colorSettingsKeys = { - "EvenRowBackground","EvenRowForeground", "OddRowBackground", "OddRowForeground", - "TextSegmentHighlightBackground", "TextSegmentHighlightForeground", - "TextSegmentDelaySlotHighlightBackground","TextSegmentDelaySlotHighlightForeground", - "DataSegmentHighlightBackground", "DataSegmentHighlightForeground", - "RegisterHighlightBackground", "RegisterHighlightForeground" }; - /** Last resort default values for color settings; - * will use only if neither the Preferences nor the properties file work. - * If you wish to change, do so before instantiating the Settings object. - * Must match key by list position. - */ - private static String[] defaultColorSettingsValues = { - "0x00e0e0e0", "0", "0x00ffffff", "0", "0x00ffff99", "0", "0x0033ff00", "0", "0x0099ccff", "0", "0x0099cc55","0" }; - - - - private boolean[] booleanSettingsValues; - private String[] stringSettingsValues; - private String[] fontFamilySettingsValues; - private String[] fontStyleSettingsValues; - private String[] fontSizeSettingsValues; - private String[] colorSettingsValues; - - private Preferences preferences; - - /** - * Create Settings object and set to saved values. If saved values not found, will set - * based on defaults stored in Settings.properties file. If file problems, will set based - * on defaults stored in this class. + + /** + * Flag to determine whether or not program being assembled is limited to + * basic MIPS instructions and formats. */ - public Settings() { - this(true); - } - - /** - * Create Settings object and set to saved values. If saved values not found, will set - * based on defaults stored in Settings.properties file. If file problems, will set based - * on defaults stored in this class. - * @param gui true if running the graphical IDE, false if running from command line. - * Ignored as of release 3.6 but retained for compatability. + public static final int EXTENDED_ASSEMBLER_ENABLED = 0; + + /** + * Flag to determine whether or not program being assembled is limited to + * using register numbers instead of names. NOTE: Its default value is + * false and the IDE provides no means to change it! */ - - public Settings(boolean gui) { - booleanSettingsValues = new boolean[booleanSettingsKeys.length]; - stringSettingsValues = new String[stringSettingsKeys.length]; - fontFamilySettingsValues = new String[fontFamilySettingsKeys.length]; - fontStyleSettingsValues = new String[fontStyleSettingsKeys.length]; - fontSizeSettingsValues = new String[fontSizeSettingsKeys.length]; - colorSettingsValues = new String[colorSettingsKeys.length]; - // This determines where the values are actually stored. Actual implementation - // is platform-dependent. For Windows, they are stored in Registry. To see, - // run regedit and browse to: HKEY_CURRENT_USER\Software\JavaSoft\Prefs\mars - preferences = Preferences.userNodeForPackage(this.getClass()); - // The gui parameter, formerly passed to initialize(), is no longer needed - // because I removed (1/21/09) the call to generate the Font object for the text editor. - // Font objects are now generated only on demand so the "if (gui)" guard - // is no longer necessary. Originally added by Berkeley b/c they were running it on a - // headless server and running in command mode. The Font constructor resulted in Swing - // initialization which caused problems. Now this will only occur on demand from - // Venus, which happens only when running as GUI. - initialize(); - } - - - /** + public static final int BARE_MACHINE_ENABLED = 1; + /** + * Flag to determine whether or not a file is immediately and automatically assembled + * upon opening. Handy when using externa editor like mipster. + */ + public static final int ASSEMBLE_ON_OPEN_ENABLED = 2; + /** + * Flag to determine whether only the current editor source file (enabled false) or + * all files in its directory (enabled true) will be assembled when assembly is selected. + */ + public static final int ASSEMBLE_ALL_ENABLED = 3; + /** + * Default visibilty of label window (symbol table). Default only, dynamic status + * maintained by ExecutePane + */ + public static final int LABEL_WINDOW_VISIBILITY = 4; + /** + * Default setting for displaying addresses and values in hexidecimal in the Execute + * pane. + */ + public static final int DISPLAY_ADDRESSES_IN_HEX = 5; + public static final int DISPLAY_VALUES_IN_HEX = 6; + /** + * Flag to determine whether the currently selected exception handler source file will + * be included in each assembly operation. + */ + public static final int EXCEPTION_HANDLER_ENABLED = 7; + /** + * Flag to determine whether or not delayed branching is in effect at MIPS execution. + * This means we simulate the pipeline and statement FOLLOWING a successful branch + * is executed before branch is taken. DPS 14 June 2007. + */ + public static final int DELAYED_BRANCHING_ENABLED = 8; + /** + * Flag to determine whether or not the editor will display line numbers. + */ + public static final int EDITOR_LINE_NUMBERS_DISPLAYED = 9; + /** + * Flag to determine whether or not assembler warnings are considered errors. + */ + public static final int WARNINGS_ARE_ERRORS = 10; + /** + * Flag to determine whether or not to display and use program arguments + */ + public static final int PROGRAM_ARGUMENTS = 11; + /** + * Flag to control whether or not highlighting is applied to data segment window + */ + public static final int DATA_SEGMENT_HIGHLIGHTING = 12; + /** + * Flag to control whether or not highlighting is applied to register windows + */ + public static final int REGISTERS_HIGHLIGHTING = 13; + /** + * Flag to control whether or not assembler automatically initializes program counter to 'main's address + */ + public static final int START_AT_MAIN = 14; + /** + * Flag to control whether or not editor will highlight the line currently being edited + */ + public static final int EDITOR_CURRENT_LINE_HIGHLIGHTING = 15; + + /** + * Flag to control whether or not editor will provide popup instruction guidance while typing + */ + public static final int POPUP_INSTRUCTION_GUIDANCE = 16; + + /** + * Flag to control whether or not simulator will use popup dialog for input syscalls + */ + public static final int POPUP_SYSCALL_INPUT = 17; + + /** + * Flag to control whether or not to use generic text editor instead of language-aware styled editor + */ + public static final int GENERIC_TEXT_EDITOR = 18; + + /** + * Flag to control whether or not language-aware editor will use auto-indent feature + */ + public static final int AUTO_INDENT = 19; + /** + * Current specified exception handler file (a MIPS assembly source file) + */ + public static final int EXCEPTION_HANDLER = 0; + /** + * Order of text segment table columns + */ + public static final int TEXT_COLUMN_ORDER = 1; + /** + * State for sorting label window display + */ + public static final int LABEL_SORT_STATE = 2; + + // STRING SETTINGS. Each array position has associated name. + /** + * Identifier of current memory configuration + */ + public static final int MEMORY_CONFIGURATION = 3; + /** + * Caret blink rate in milliseconds, 0 means don't blink. + */ + public static final int CARET_BLINK_RATE = 4; + /** + * Editor tab size in characters. + */ + public static final int EDITOR_TAB_SIZE = 5; + /** + * Number of letters to be matched by editor's instruction guide before popup generated (if popup enabled) + */ + public static final int EDITOR_POPUP_PREFIX_LENGTH = 6; + /** + * Font for the text editor + */ + public static final int EDITOR_FONT = 0; + /** + * Font for table even row background (text, data, register displays) + */ + public static final int EVEN_ROW_FONT = 1; + /** + * Font for table odd row background (text, data, register displays) + */ + public static final int ODD_ROW_FONT = 2; + /** + * Font for table odd row foreground (text, data, register displays) + */ + public static final int TEXTSEGMENT_HIGHLIGHT_FONT = 3; + /** + * Font for text segment delay slot highlighted background + */ + public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FONT = 4; + + + // FONT SETTINGS. Each array position has associated name. + /** + * Font for text segment highlighted background + */ + public static final int DATASEGMENT_HIGHLIGHT_FONT = 5; + /** + * Font for register highlighted background + */ + public static final int REGISTER_HIGHLIGHT_FONT = 6; + /** + * RGB color for table even row background (text, data, register displays) + */ + public static final int EVEN_ROW_BACKGROUND = 0; + /** + * RGB color for table even row foreground (text, data, register displays) + */ + public static final int EVEN_ROW_FOREGROUND = 1; + /** + * RGB color for table odd row background (text, data, register displays) + */ + public static final int ODD_ROW_BACKGROUND = 2; + /** + * RGB color for table odd row foreground (text, data, register displays) + */ + public static final int ODD_ROW_FOREGROUND = 3; + /** + * RGB color for text segment highlighted background + */ + public static final int TEXTSEGMENT_HIGHLIGHT_BACKGROUND = 4; + /** + * RGB color for text segment highlighted foreground + */ + public static final int TEXTSEGMENT_HIGHLIGHT_FOREGROUND = 5; + /** + * RGB color for text segment delay slot highlighted background + */ + public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_BACKGROUND = 6; + /** + * RGB color for text segment delay slot highlighted foreground + */ + public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FOREGROUND = 7; + /** + * RGB color for text segment highlighted background + */ + public static final int DATASEGMENT_HIGHLIGHT_BACKGROUND = 8; + /** + * RGB color for text segment highlighted foreground + */ + public static final int DATASEGMENT_HIGHLIGHT_FOREGROUND = 9; + /** + * RGB color for register highlighted background + */ + public static final int REGISTER_HIGHLIGHT_BACKGROUND = 10; + + + // COLOR SETTINGS. Each array position has associated name. + /** + * RGB color for register highlighted foreground + */ + public static final int REGISTER_HIGHLIGHT_FOREGROUND = 11; + /* Properties file used to hold default settings. */ + private static final String settingsFile = "Settings"; + // NOTE: key sequence must match up with labels above which are used for array indexes! + private static final String[] booleanSettingsKeys = {"ExtendedAssembler", "BareMachine", "AssembleOnOpen", "AssembleAll", "LabelWindowVisibility", "DisplayAddressesInHex", "DisplayValuesInHex", "LoadExceptionHandler", "DelayedBranching", "EditorLineNumbersDisplayed", "WarningsAreErrors", "ProgramArguments", "DataSegmentHighlighting", "RegistersHighlighting", "StartAtMain", "EditorCurrentLineHighlighting", "PopupInstructionGuidance", "PopupSyscallInput", "GenericTextEditor", "AutoIndent", "SelfModifyingCode"}; + // Match the above by position. + private static final String[] stringSettingsKeys = {"ExceptionHandler", "TextColumnOrder", "LabelSortState", "MemoryConfiguration", "CaretBlinkRate", "EditorTabSize", "EditorPopupPrefixLength"}; + /** + * Last resort default values for String settings; will use only if neither the Preferences nor the properties file + * work. If you wish to change, do so before instantiating the Settings object. Must match key by list position. + */ + private static final String[] defaultStringSettingsValues = {"", "0 1 2 3 4", "0", "", "500", "8", "2"}; + private static final String[] fontFamilySettingsKeys = {"EditorFontFamily", "EvenRowFontFamily", "OddRowFontFamily", " TextSegmentHighlightFontFamily", "TextSegmentDelayslotHighightFontFamily", "DataSegmentHighlightFontFamily", "RegisterHighlightFontFamily"}; + private static final String[] fontStyleSettingsKeys = {"EditorFontStyle", "EvenRowFontStyle", "OddRowFontStyle", " TextSegmentHighlightFontStyle", "TextSegmentDelayslotHighightFontStyle", "DataSegmentHighlightFontStyle", "RegisterHighlightFontStyle"}; + private static final String[] fontSizeSettingsKeys = {"EditorFontSize", "EvenRowFontSize", "OddRowFontSize", " TextSegmentHighlightFontSize", "TextSegmentDelayslotHighightFontSize", "DataSegmentHighlightFontSize", "RegisterHighlightFontSize"}; + /** + * Last resort default values for Font settings; + * will use only if neither the Preferences nor the properties file work. + * If you wish to change, do so before instantiating the Settings object. + * Must match key by list position shown above. + */ + + // DPS 3-Oct-2012 + // Changed default font family from "Courier New" to "Monospaced" after receiving reports that Mac were not + // correctly rendering the left parenthesis character in the editor or text segment display. + // See http://www.mirthcorp.com/community/issues/browse/MIRTH-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel + private static final String[] defaultFontFamilySettingsValues = {"Monospaced", "Monospaced", "Monospaced", "Monospaced", "Monospaced", "Monospaced", "Monospaced"}; + private static final String[] defaultFontStyleSettingsValues = {"Plain", "Plain", "Plain", "Plain", "Plain", "Plain", "Plain"}; + private static final String[] defaultFontSizeSettingsValues = {"12", "12", "12", "12", "12", "12", "12",}; + // Match the above by position. + private static final String[] colorSettingsKeys = {"EvenRowBackground", "EvenRowForeground", "OddRowBackground", "OddRowForeground", "TextSegmentHighlightBackground", "TextSegmentHighlightForeground", "TextSegmentDelaySlotHighlightBackground", "TextSegmentDelaySlotHighlightForeground", "DataSegmentHighlightBackground", "DataSegmentHighlightForeground", "RegisterHighlightBackground", "RegisterHighlightForeground"}; + /** + * Last resort default values for color settings; will use only if neither the Preferences nor the properties file + * work. If you wish to change, do so before instantiating the Settings object. Must match key by list position. + */ + private static final String[] defaultColorSettingsValues = {"0x00e0e0e0", "0", "0x00ffffff", "0", "0x00ffff99", "0", "0x0033ff00", "0", "0x0099ccff", "0", "0x0099cc55", "0"}; + private static final String SYNTAX_STYLE_COLOR_PREFIX = "SyntaxStyleColor_"; + private static final String SYNTAX_STYLE_BOLD_PREFIX = "SyntaxStyleBold_"; + private static final String SYNTAX_STYLE_ITALIC_PREFIX = "SyntaxStyleItalic_"; + /** + * Last resort default values for boolean settings; will use only if neither the Preferences nor the properties + * file work. If you wish to change them, do so before instantiating the Settings object. Values are matched to keys + * by list position. + */ + public static boolean[] defaultBooleanSettingsValues = { // match the above list by position + true, false, false, false, false, true, true, false, false, true, false, false, true, true, false, true, true, false, false, true, false}; + private static String[] syntaxStyleColorSettingsKeys, syntaxStyleBoldSettingsKeys, syntaxStyleItalicSettingsKeys; + private static String[] defaultSyntaxStyleColorSettingsValues; + private static boolean[] defaultSyntaxStyleBoldSettingsValues; + private static boolean[] defaultSyntaxStyleItalicSettingsValues; + private final boolean[] booleanSettingsValues; + private final String[] stringSettingsValues; + private final String[] fontFamilySettingsValues; + private final String[] fontStyleSettingsValues; + private final String[] fontSizeSettingsValues; + private final String[] colorSettingsValues; + private final Preferences preferences; + /* ************************************************************************** + This section contains all code related to syntax highlighting styles settings. + A style includes 3 components: color, bold (t/f), italic (t/f) + + The fallback defaults will come not from an array here, but from the + existing static method SyntaxUtilities.getDefaultSyntaxStyles() + in the mars.venus.editors.jeditsyntax package. It returns an array + of SyntaxStyle objects. + + */ + private String[] syntaxStyleColorSettingsValues; + private boolean[] syntaxStyleBoldSettingsValues; + private boolean[] syntaxStyleItalicSettingsValues; + + /** + * Create Settings object and set to saved values. If saved values not found, will set based on defaults stored in + * Settings.properties file. If file problems, will set based on defaults stored in this class. + */ + public Settings() { + this(true); + } + /** + * Create Settings object and set to saved values. If saved values not found, will set based on defaults stored in + * Settings.properties file. If file problems, will set based on defaults stored in this class. + * + * @param gui true if running the graphical IDE, false if running from command line. Ignored as of release 3.6 + * but retained for compatability. + */ + public Settings(boolean gui) { + booleanSettingsValues = new boolean[booleanSettingsKeys.length]; + stringSettingsValues = new String[stringSettingsKeys.length]; + fontFamilySettingsValues = new String[fontFamilySettingsKeys.length]; + fontStyleSettingsValues = new String[fontStyleSettingsKeys.length]; + fontSizeSettingsValues = new String[fontSizeSettingsKeys.length]; + colorSettingsValues = new String[colorSettingsKeys.length]; + // This determines where the values are actually stored. Actual implementation + // is platform-dependent. For Windows, they are stored in Registry. To see, + // run regedit and browse to: HKEY_CURRENT_USER\Software\JavaSoft\Prefs\mars + preferences = Preferences.userNodeForPackage(this.getClass()); + // The gui parameter, formerly passed to initialize(), is no longer needed + // because I removed (1/21/09) the call to generate the Font object for the text editor. + // Font objects are now generated only on demand so the "if (gui)" guard + // is no longer necessary. Originally added by Berkeley b/c they were running it on a + // headless server and running in command mode. The Font constructor resulted in Swing + // initialization which caused problems. Now this will only occur on demand from + // Venus, which happens only when running as GUI. + initialize(); + } + + /** * Return whether backstepping is permitted at this time. Backstepping is ability to undo execution * steps one at a time. Available only in the IDE. This is not a persistent setting and is not under * MARS user control. + * * @return true if backstepping is permitted, false otherwise. */ - public boolean getBackSteppingEnabled() { - return (Globals.program!=null && Globals.program.getBackStepper()!=null && Globals.program.getBackStepper().enabled()); - } - - + public boolean getBackSteppingEnabled() { + return (Globals.program != null && Globals.program.getBackStepper() != null && Globals.program.getBackStepper().enabled()); + } + /** - * Reset settings to default values, as described in the constructor comments. - * @param gui true if running from GUI IDE and false if running from command mode. - * Ignored as of release 3.6 but retained for compatibility. - */ - public void reset(boolean gui) { - initialize(); - } - - - /* ************************************************************************** - This section contains all code related to syntax highlighting styles settings. - A style includes 3 components: color, bold (t/f), italic (t/f) - - The fallback defaults will come not from an array here, but from the - existing static method SyntaxUtilities.getDefaultSyntaxStyles() - in the mars.venus.editors.jeditsyntax package. It returns an array - of SyntaxStyle objects. - - */ - private String[] syntaxStyleColorSettingsValues; - private boolean[] syntaxStyleBoldSettingsValues; - private boolean[] syntaxStyleItalicSettingsValues; - - private static final String SYNTAX_STYLE_COLOR_PREFIX = "SyntaxStyleColor_"; - private static final String SYNTAX_STYLE_BOLD_PREFIX = "SyntaxStyleBold_"; - private static final String SYNTAX_STYLE_ITALIC_PREFIX = "SyntaxStyleItalic_"; - - private static String[] syntaxStyleColorSettingsKeys, syntaxStyleBoldSettingsKeys, syntaxStyleItalicSettingsKeys; - private static String[] defaultSyntaxStyleColorSettingsValues; - private static boolean[] defaultSyntaxStyleBoldSettingsValues; - private static boolean[] defaultSyntaxStyleItalicSettingsValues; - - - public void setEditorSyntaxStyleByPosition( int index, SyntaxStyle syntaxStyle ) { - syntaxStyleColorSettingsValues[index] = syntaxStyle.getColorAsHexString(); - syntaxStyleItalicSettingsValues[index] = syntaxStyle.isItalic(); - syntaxStyleBoldSettingsValues[index] = syntaxStyle.isBold(); - saveEditorSyntaxStyle(index); - } - - public SyntaxStyle getEditorSyntaxStyleByPosition( int index ) { - return new SyntaxStyle(getColorValueByPosition(index, syntaxStyleColorSettingsValues), - syntaxStyleItalicSettingsValues[index], - syntaxStyleBoldSettingsValues[index]); - } - - public SyntaxStyle getDefaultEditorSyntaxStyleByPosition( int index ) { - return new SyntaxStyle(getColorValueByPosition(index, defaultSyntaxStyleColorSettingsValues), - defaultSyntaxStyleItalicSettingsValues[index], - defaultSyntaxStyleBoldSettingsValues[index]); - } - - private void saveEditorSyntaxStyle(int index) { - try { + * Reset settings to default values, as described in the constructor comments. + * + * @param gui true if running from GUI IDE and false if running from command mode. + * Ignored as of release 3.6 but retained for compatibility. + */ + public void reset(boolean gui) { + initialize(); + } + + public void setEditorSyntaxStyleByPosition(int index, SyntaxStyle syntaxStyle) { + syntaxStyleColorSettingsValues[index] = syntaxStyle.getColorAsHexString(); + syntaxStyleItalicSettingsValues[index] = syntaxStyle.isItalic(); + syntaxStyleBoldSettingsValues[index] = syntaxStyle.isBold(); + saveEditorSyntaxStyle(index); + } + + public SyntaxStyle getEditorSyntaxStyleByPosition(int index) { + return new SyntaxStyle(getColorValueByPosition(index, syntaxStyleColorSettingsValues), syntaxStyleItalicSettingsValues[index], syntaxStyleBoldSettingsValues[index]); + } + + public SyntaxStyle getDefaultEditorSyntaxStyleByPosition(int index) { + return new SyntaxStyle(getColorValueByPosition(index, defaultSyntaxStyleColorSettingsValues), defaultSyntaxStyleItalicSettingsValues[index], defaultSyntaxStyleBoldSettingsValues[index]); + } + + private void saveEditorSyntaxStyle(int index) { + try { preferences.put(syntaxStyleColorSettingsKeys[index], syntaxStyleColorSettingsValues[index]); preferences.putBoolean(syntaxStyleBoldSettingsKeys[index], syntaxStyleBoldSettingsValues[index]); preferences.putBoolean(syntaxStyleItalicSettingsKeys[index], syntaxStyleItalicSettingsValues[index]); preferences.flush(); - } - catch (SecurityException se) { + } catch (SecurityException se) { // cannot write to persistent storage for security reasons - } - catch (BackingStoreException bse) { + } catch (BackingStoreException bse) { // unable to communicate with persistent storage (strange days) - } - } - - // For syntax styles, need to initialize from SyntaxUtilities defaults. - // Taking care not to explicitly create a Color object, since it may trigger - // Swing initialization (that caused problems for UC Berkeley when we - // created Font objects here). It shouldn't, but then again Font shouldn't - // either but they said it did. (see HeadlessException) - // On othe other hand, the first statement of this method causes Color objects - // to be created! It is possible but a real pain in the rear to avoid using - // Color objects totally. Requires new methods for the SyntaxUtilities class. - private void initializeEditorSyntaxStyles() { - SyntaxStyle syntaxStyle[] = SyntaxUtilities.getDefaultSyntaxStyles(); - int tokens = syntaxStyle.length; - syntaxStyleColorSettingsKeys = new String[tokens]; - syntaxStyleBoldSettingsKeys = new String[tokens]; - syntaxStyleItalicSettingsKeys = new String[tokens]; - defaultSyntaxStyleColorSettingsValues = new String[tokens]; - defaultSyntaxStyleBoldSettingsValues = new boolean[tokens]; - defaultSyntaxStyleItalicSettingsValues = new boolean[tokens]; - syntaxStyleColorSettingsValues = new String[tokens]; - syntaxStyleBoldSettingsValues = new boolean[tokens]; - syntaxStyleItalicSettingsValues = new boolean[tokens]; - for (int i=0; i=0 && id < booleanSettingsValues.length) { + } + } + // ********************************************************************************* + + + //////////////////////////////////////////////////////////////////////// + // Setting Getters + //////////////////////////////////////////////////////////////////////// + + + /** + * Fetch value of a boolean setting given its identifier. + * + * @param id int containing the setting's identifier (constants listed above) + * @return corresponding boolean setting. + * @throws IllegalArgumentException if identifier is invalid. + */ + public boolean getBooleanSetting(int id) { + if (id >= 0 && id < booleanSettingsValues.length) { return booleanSettingsValues[id]; - } - else { + } else { throw new IllegalArgumentException("Invalid boolean setting ID"); - } - } - - /** - * Setting for whether user programs limited to "bare machine" formatted basic instructions. - * This was added 8 Aug 2006 but is fixed at false for now, due to uncertainty as to what - * exactly constitutes "bare machine". - * @return true if only bare machine instructions allowed, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.BARE_MACHINE_ENABLED) - */ - public boolean getBareMachineEnabled() { - return booleanSettingsValues[BARE_MACHINE_ENABLED]; - } - /** - * Setting for whether user programs can use pseudo-instructions or extended addressing modes - * or alternative instruction formats (all are implemented as pseudo-instructions). - * @return true if pseudo-instructions and formats permitted, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.EXTENDED_ASSEMBLER_ENABLED) - */ - public boolean getExtendedAssemblerEnabled() { - return booleanSettingsValues[EXTENDED_ASSEMBLER_ENABLED]; - } - - /** - * Setting for whether selected program will be automatically assembled upon opening. This - * can be useful if user employs an external editor such as MIPSter. - * @return true if file is to be automatically assembled upon opening and false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.ASSEMBLE_ON_OPEN_ENABLED) - */ - public boolean getAssembleOnOpenEnabled() { - return booleanSettingsValues[ASSEMBLE_ON_OPEN_ENABLED]; - } - - /** - * Setting for whether Addresses in the Execute pane will be displayed in hexadecimal. - * @return true if addresses are displayed in hexadecimal and false otherwise (decimal). - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.DISPLAY_ADDRESSES_IN_HEX) - */ - public boolean getDisplayAddressesInHex() { - return booleanSettingsValues[DISPLAY_ADDRESSES_IN_HEX]; - } - - /** - * Setting for whether values in the Execute pane will be displayed in hexadecimal. - * @return true if values are displayed in hexadecimal and false otherwise (decimal). - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.DISPLAY_VALUES_IN_HEX) - */ - public boolean getDisplayValuesInHex() { - return booleanSettingsValues[DISPLAY_VALUES_IN_HEX]; - } - - /** - * Setting for whether the assemble operation applies only to the file currently open in - * the editor or whether it applies to all files in that file's directory (primitive project - * capability). If the "assemble on open" setting is set, this "assemble all" setting will - * be applied as soon as the file is opened. - * @return true if all files are to be assembled, false if only the file open in editor. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.ASSEMBLE_ALL_ENABLED) - */ - public boolean getAssembleAllEnabled() { - return booleanSettingsValues[ASSEMBLE_ALL_ENABLED]; - } - - - /** - * Setting for whether the currently selected exception handler - * (a MIPS source file) will be automatically included in each - * assemble operation. - @return true if exception handler is to be included in assemble, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.EXCEPTION_HANDLER_ENABLED) - */ - public boolean getExceptionHandlerEnabled() { - return booleanSettingsValues[EXCEPTION_HANDLER_ENABLED]; - } - - /** - * Setting for whether delayed branching will be applied during MIPS - * program execution. If enabled, the statement following a successful - * branch will be executed and then the branch is taken! This simulates - * pipelining and all MIPS processors do it. However it is confusing to - * assembly language students so is disabled by default. SPIM does same thing. - @return true if delayed branching is enabled, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.DELAYED_BRANCHING_ENABLED) - */ - public boolean getDelayedBranchingEnabled() { - return booleanSettingsValues[DELAYED_BRANCHING_ENABLED]; - } - - /** - * Setting concerning whether or not to display the Labels Window -- symbol table. - * @return true if label window is to be displayed, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.LABEL_WINDOW_VISIBILITY) - */ - public boolean getLabelWindowVisibility() { - return booleanSettingsValues[LABEL_WINDOW_VISIBILITY]; - } - - - /** - * Setting concerning whether or not the editor will display line numbers. - * @return true if line numbers are to be displayed, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.EDITOR_LINE_NUMBERS_DISPLAYED) - */ - public boolean getEditorLineNumbersDisplayed() { - return booleanSettingsValues[EDITOR_LINE_NUMBERS_DISPLAYED]; - } - - - /** - * Setting concerning whether or not assembler will consider warnings to be errors. - * @return true if warnings are considered errors, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.WARNINGS_ARE_ERRORS) - */ - public boolean getWarningsAreErrors() { - return booleanSettingsValues[WARNINGS_ARE_ERRORS]; - } - - - /** - * Setting concerning whether or not program arguments can be entered and used. - * @return true if program arguments can be entered/used, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.PROGRAM_ARGUMENTS) - */ - public boolean getProgramArguments() { - return booleanSettingsValues[PROGRAM_ARGUMENTS]; - } - - - /** - * Setting concerning whether or not highlighting is applied to Data Segment window. - * @return true if highlighting is to be applied, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.DATA_SEGMENT_HIGHLIGHTING) - */ - public boolean getDataSegmentHighlighting() { - return booleanSettingsValues[DATA_SEGMENT_HIGHLIGHTING]; - } - - - /** - * Setting concerning whether or not highlighting is applied to Registers, - * Coprocessor0, and Coprocessor1 windows. - * @return true if highlighting is to be applied, false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.REGISTERS_HIGHLIGHTING) - */ - public boolean getRegistersHighlighting() { - return booleanSettingsValues[REGISTERS_HIGHLIGHTING]; - } - - - /** - * Setting concerning whether or not assembler will automatically initialize - * the program counter to address of statement labeled 'main' if defined. - * @return true if it initializes to 'main', false otherwise. - * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID - * (e.g. Settings.START_AT_MAIN) - */ - public boolean getStartAtMain() { - return booleanSettingsValues[START_AT_MAIN]; - } - - /** - * Name of currently selected exception handler file. - * @return String pathname of current exception handler file, empty if none. - */ - public String getExceptionHandler() { - return stringSettingsValues[EXCEPTION_HANDLER]; - } - - /** - * Returns identifier of current built-in memory configuration. - * @return String identifier of current built-in memory configuration, empty if none. - */ - public String getMemoryConfiguration() { - return stringSettingsValues[MEMORY_CONFIGURATION]; - } - - /** - * Current editor font. Retained for compatibility but replaced - * by: getFontByPosition(Settings.EDITOR_FONT) - * @return Font object for current editor font. - */ - public Font getEditorFont() { - return getFontByPosition(EDITOR_FONT); - } - - /** - * Retrieve a Font setting - * @param fontSettingPosition constant that identifies which item - * @return Font object for given item - */ - public Font getFontByPosition(int fontSettingPosition) { - if (fontSettingPosition >=0 && fontSettingPosition < fontFamilySettingsValues.length) { - return EditorFont.createFontFromStringValues(fontFamilySettingsValues[fontSettingPosition], - fontStyleSettingsValues[fontSettingPosition], - fontSizeSettingsValues[fontSettingPosition]); - } - else { + } + } + + /** + * Setting for whether user programs limited to "bare machine" formatted basic instructions. This was added 8 Aug + * 2006 but is fixed at false for now, due to uncertainty as to what exactly constitutes "bare machine". + * + * @return true if only bare machine instructions allowed, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID (e.g. + * Settings.BARE_MACHINE_ENABLED) + */ + @Deprecated + public boolean getBareMachineEnabled() { + return booleanSettingsValues[BARE_MACHINE_ENABLED]; + } + + /** + * Setting for whether user programs can use pseudo-instructions or extended addressing modes or alternative + * instruction formats (all are implemented as pseudo-instructions). + * + * @return true if pseudo-instructions and formats permitted, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID (e.g. + * Settings.EXTENDED_ASSEMBLER_ENABLED) + */ + @Deprecated + public boolean getExtendedAssemblerEnabled() { + return booleanSettingsValues[EXTENDED_ASSEMBLER_ENABLED]; + } + + /** + * Establish setting for whether or not pseudo-instructions and formats are permitted + * in user programs. User can change this setting via the IDE. If setting changes, + * new setting will be written to properties file. + * + * @param value True to permit, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.EXTENDED_ASSEMBLER_ENABLED) + */ + @Deprecated + public void setExtendedAssemblerEnabled(boolean value) { + internalSetBooleanSetting(EXTENDED_ASSEMBLER_ENABLED, value); + } + + /** + * Setting for whether selected program will be automatically assembled upon opening. This can be useful if user + * employs an external editor such as MIPSter. + * + * @return true if file is to be automatically assembled upon opening and false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID (e.g. + * Settings.ASSEMBLE_ON_OPEN_ENABLED) + */ + @Deprecated + public boolean getAssembleOnOpenEnabled() { + return booleanSettingsValues[ASSEMBLE_ON_OPEN_ENABLED]; + } + + /** + * Establish setting for whether a file will be automatically assembled as soon as it + * is opened. This is handy for those using an external text editor such as Mipster. + * If setting changes, new setting will be written to properties file. + * + * @param value True to automatically assemble, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.ASSEMBLE_ON_OPEN_ENABLED) + */ + @Deprecated + public void setAssembleOnOpenEnabled(boolean value) { + internalSetBooleanSetting(ASSEMBLE_ON_OPEN_ENABLED, value); + } + + /** + * Setting for whether Addresses in the Execute pane will be displayed in hexadecimal. + * + * @return true if addresses are displayed in hexadecimal and false otherwise (decimal). + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID (e.g. + * Settings.DISPLAY_ADDRESSES_IN_HEX) + */ + @Deprecated + public boolean getDisplayAddressesInHex() { + return booleanSettingsValues[DISPLAY_ADDRESSES_IN_HEX]; + } + + /** + * Establish setting for whether addresses in the Execute pane will be displayed + * in hexadecimal format. + * + * @param value True to display addresses in hexadecimal, false for decimal. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.DISPLAY_ADDRESSES_IN_HEX) + */ + @Deprecated + public void setDisplayAddressesInHex(boolean value) { + internalSetBooleanSetting(DISPLAY_ADDRESSES_IN_HEX, value); + } + + /** + * Setting for whether values in the Execute pane will be displayed in hexadecimal. + * + * @return true if values are displayed in hexadecimal and false otherwise (decimal). + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID (e.g. + * Settings.DISPLAY_VALUES_IN_HEX) + */ + @Deprecated + public boolean getDisplayValuesInHex() { + return booleanSettingsValues[DISPLAY_VALUES_IN_HEX]; + } + + /** + * Establish setting for whether values in the Execute pane will be displayed + * in hexadecimal format. + * + * @param value True to display values in hexadecimal, false for decimal. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.DISPLAY_VALUES_IN_HEX) + */ + @Deprecated + public void setDisplayValuesInHex(boolean value) { + internalSetBooleanSetting(DISPLAY_VALUES_IN_HEX, value); + } + + /** + * Setting for whether the assemble operation applies only to the file currently open in + * the editor or whether it applies to all files in that file's directory (primitive project + * capability). If the "assemble on open" setting is set, this "assemble all" setting will + * be applied as soon as the file is opened. + * + * @return true if all files are to be assembled, false if only the file open in editor. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.ASSEMBLE_ALL_ENABLED) + */ + @Deprecated + public boolean getAssembleAllEnabled() { + return booleanSettingsValues[ASSEMBLE_ALL_ENABLED]; + } + + /** + * Establish setting for whether a file will be assembled by itself (false) or along + * with all other files in its directory (true). This permits multi-file programs + * and a primitive "project" capability. If setting changes, + * new setting will be written to properties file. + * + * @param value True to assemble all, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.ASSEMBLE_ALL_ENABLED) + */ + @Deprecated + public void setAssembleAllEnabled(boolean value) { + internalSetBooleanSetting(ASSEMBLE_ALL_ENABLED, value); + } + + /** + * Setting for whether the currently selected exception handler + * (a MIPS source file) will be automatically included in each + * assemble operation. + * + * @return true if exception handler is to be included in assemble, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.EXCEPTION_HANDLER_ENABLED) + */ + @Deprecated + public boolean getExceptionHandlerEnabled() { + return booleanSettingsValues[EXCEPTION_HANDLER_ENABLED]; + } + + /** + * Establish setting for whether the currently selected exception handler + * (a MIPS source file) will be automatically included in each + * assemble operation. If setting changes, new setting will be written + * to properties file. + * + * @param value True to assemble exception handler, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.EXCEPTION_HANDLER_ENABLED) + */ + @Deprecated + public void setExceptionHandlerEnabled(boolean value) { + internalSetBooleanSetting(EXCEPTION_HANDLER_ENABLED, value); + } + + /** + * Setting for whether delayed branching will be applied during MIPS + * program execution. If enabled, the statement following a successful + * branch will be executed and then the branch is taken! This simulates + * pipelining and all MIPS processors do it. However it is confusing to + * assembly language students so is disabled by default. SPIM does same thing. + * + * @return true if delayed branching is enabled, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.DELAYED_BRANCHING_ENABLED) + */ + @Deprecated + public boolean getDelayedBranchingEnabled() { + return booleanSettingsValues[DELAYED_BRANCHING_ENABLED]; + } + + /** + * Establish setting for whether delayed branching will be applied during + * MIPS program execution. If enabled, the statement following a successful + * branch will be executed and then the branch is taken! This simulates + * pipelining and all MIPS processors do it. However it is confusing to + * assembly language students so is disabled by default. SPIM does same thing. + * + * @param value True to enable delayed branching, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.DELAYED_BRANCHING_ENABLED) + */ + @Deprecated + public void setDelayedBranchingEnabled(boolean value) { + internalSetBooleanSetting(DELAYED_BRANCHING_ENABLED, value); + } + + /** + * Setting concerning whether or not to display the Labels Window -- symbol table. + * + * @return true if label window is to be displayed, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.LABEL_WINDOW_VISIBILITY) + */ + @Deprecated + public boolean getLabelWindowVisibility() { + return booleanSettingsValues[LABEL_WINDOW_VISIBILITY]; + } + + /** + * Establish setting for whether the labels window (i.e. symbol table) will + * be displayed as part of the Text Segment display. If setting changes, + * new setting will be written to properties file. + * + * @param value True to dispay labels window, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.LABEL_WINDOW_VISIBILITY) + */ + @Deprecated + public void setLabelWindowVisibility(boolean value) { + internalSetBooleanSetting(LABEL_WINDOW_VISIBILITY, value); + } + + /** + * Setting concerning whether or not the editor will display line numbers. + * + * @return true if line numbers are to be displayed, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.EDITOR_LINE_NUMBERS_DISPLAYED) + */ + @Deprecated + public boolean getEditorLineNumbersDisplayed() { + return booleanSettingsValues[EDITOR_LINE_NUMBERS_DISPLAYED]; + } + + /** + * Establish setting for whether line numbers will be displayed by the + * text editor. + * + * @param value True to display line numbers, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.EDITOR_LINE_NUMBERS_DISPLAYED) + */ + @Deprecated + public void setEditorLineNumbersDisplayed(boolean value) { + internalSetBooleanSetting(EDITOR_LINE_NUMBERS_DISPLAYED, value); + } + + /** + * Setting concerning whether or not assembler will consider warnings to be errors. + * + * @return true if warnings are considered errors, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.WARNINGS_ARE_ERRORS) + */ + @Deprecated + public boolean getWarningsAreErrors() { + return booleanSettingsValues[WARNINGS_ARE_ERRORS]; + } + + /** + * Establish setting for whether assembler warnings will be considered errors. + * + * @param value True to consider warnings to be errors, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.WARNINGS_ARE_ERRORS) + */ + @Deprecated + public void setWarningsAreErrors(boolean value) { + internalSetBooleanSetting(WARNINGS_ARE_ERRORS, value); + } + + /** + * Setting concerning whether or not program arguments can be entered and used. + * + * @return true if program arguments can be entered/used, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.PROGRAM_ARGUMENTS) + */ + @Deprecated + public boolean getProgramArguments() { + return booleanSettingsValues[PROGRAM_ARGUMENTS]; + } + + /** + * Establish setting for whether program arguments can be ented/used. + * + * @param value True if program arguments can be entered/used, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.PROGRAM_ARGUMENTS) + */ + @Deprecated + public void setProgramArguments(boolean value) { + internalSetBooleanSetting(PROGRAM_ARGUMENTS, value); + } + + /** + * Setting concerning whether or not highlighting is applied to Data Segment window. + * + * @return true if highlighting is to be applied, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.DATA_SEGMENT_HIGHLIGHTING) + */ + @Deprecated + public boolean getDataSegmentHighlighting() { + return booleanSettingsValues[DATA_SEGMENT_HIGHLIGHTING]; + } + + /** + * Establish setting for whether highlighting is to be applied to + * Data Segment window. + * + * @param value True if highlighting is to be applied, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.DATA_SEGMENT_HIGHLIGHTING) + */ + @Deprecated + public void setDataSegmentHighlighting(boolean value) { + internalSetBooleanSetting(DATA_SEGMENT_HIGHLIGHTING, value); + } + + /** + * Setting concerning whether or not highlighting is applied to Registers, + * Coprocessor0, and Coprocessor1 windows. + * + * @return true if highlighting is to be applied, false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.REGISTERS_HIGHLIGHTING) + */ + @Deprecated + public boolean getRegistersHighlighting() { + return booleanSettingsValues[REGISTERS_HIGHLIGHTING]; + } + + /** + * Establish setting for whether highlighting is to be applied to + * Registers, Coprocessor0 and Coprocessor1 windows. + * + * @param value True if highlighting is to be applied, false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.REGISTERS_HIGHLIGHTING) + */ + @Deprecated + public void setRegistersHighlighting(boolean value) { + internalSetBooleanSetting(REGISTERS_HIGHLIGHTING, value); + } + + /** + * Setting concerning whether or not assembler will automatically initialize + * the program counter to address of statement labeled 'main' if defined. + * + * @return true if it initializes to 'main', false otherwise. + * @deprecated Use getBooleanSetting(int id) with the appropriate boolean setting ID + * (e.g. Settings.START_AT_MAIN) + */ + @Deprecated + public boolean getStartAtMain() { + return booleanSettingsValues[START_AT_MAIN]; + } + + /** + * Establish setting for whether assembler will automatically initialize + * program counter to address of statement labeled 'main' if defined. + * + * @param value True if PC set to address of 'main', false otherwise. + * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.START_AT_MAIN) + */ + @Deprecated + public void setStartAtMain(boolean value) { + internalSetBooleanSetting(START_AT_MAIN, value); + } + + /** + * Name of currently selected exception handler file. + * + * @return String pathname of current exception handler file, empty if none. + */ + public String getExceptionHandler() { + return stringSettingsValues[EXCEPTION_HANDLER]; + } + + + //////////////////////////////////////////////////////////////////////// + // Setting Setters + //////////////////////////////////////////////////////////////////////// + + /** + * Set name of exception handler file and write it to persistent storage. + * + * @param newFilename name of exception handler file + */ + public void setExceptionHandler(String newFilename) { + setStringSetting(EXCEPTION_HANDLER, newFilename); + } + + /** + * Returns identifier of current built-in memory configuration. + * + * @return String identifier of current built-in memory configuration, empty if none. + */ + public String getMemoryConfiguration() { + return stringSettingsValues[MEMORY_CONFIGURATION]; + } + + /** + * Store the identifier of the memory configuration. + * + * @param config A string that identifies the current built-in memory configuration + */ + + public void setMemoryConfiguration(String config) { + setStringSetting(MEMORY_CONFIGURATION, config); + } + + /** + * Current editor font. Retained for compatibility but replaced + * by: getFontByPosition(Settings.EDITOR_FONT) + * + * @return Font object for current editor font. + */ + public Font getEditorFont() { + return getFontByPosition(EDITOR_FONT); + } + + /** + * Set editor font to the specified Font object and write it to persistent storage. + * This method retained for compatibility but replaced by: + * setFontByPosition(Settings.EDITOR_FONT, font) + * + * @param font Font object to be used by text editor. + */ + public void setEditorFont(Font font) { + setFontByPosition(EDITOR_FONT, font); + } + + /** + * Retrieve a Font setting + * + * @param fontSettingPosition constant that identifies which item + * @return Font object for given item + */ + public Font getFontByPosition(int fontSettingPosition) { + if (fontSettingPosition >= 0 && fontSettingPosition < fontFamilySettingsValues.length) { + return EditorFont.createFontFromStringValues(fontFamilySettingsValues[fontSettingPosition], fontStyleSettingsValues[fontSettingPosition], fontSizeSettingsValues[fontSettingPosition]); + } else { return null; - } - } - - - /** - * Retrieve a default Font setting - * @param fontSettingPosition constant that identifies which item - * @return Font object for given item - */ - public Font getDefaultFontByPosition(int fontSettingPosition) { - if (fontSettingPosition >=0 && fontSettingPosition < defaultFontFamilySettingsValues.length) { - return EditorFont.createFontFromStringValues(defaultFontFamilySettingsValues[fontSettingPosition], - defaultFontStyleSettingsValues[fontSettingPosition], - defaultFontSizeSettingsValues[fontSettingPosition]); - } - else { + } + } + + /** + * Retrieve a default Font setting + * + * @param fontSettingPosition constant that identifies which item + * @return Font object for given item + */ + public Font getDefaultFontByPosition(int fontSettingPosition) { + if (fontSettingPosition >= 0 && fontSettingPosition < defaultFontFamilySettingsValues.length) { + return EditorFont.createFontFromStringValues(defaultFontFamilySettingsValues[fontSettingPosition], defaultFontStyleSettingsValues[fontSettingPosition], defaultFontSizeSettingsValues[fontSettingPosition]); + } else { return null; - } - } - - /** - * Order of text segment display columns (there are 5, numbered 0 to 4). - * @return Array of int indicating the order. Original order is 0 1 2 3 4. - */ - public int[] getTextColumnOrder() { - return getTextSegmentColumnOrder(stringSettingsValues[TEXT_COLUMN_ORDER]); - } - - /** - * Retrieve the caret blink rate in milliseconds. Blink rate of 0 means - * do not blink. - * @return int blink rate in milliseconds - */ - - public int getCaretBlinkRate() { - int rate = 500; - try { + } + } + + /** + * Order of text segment display columns (there are 5, numbered 0 to 4). + * + * @return Array of int indicating the order. Original order is 0 1 2 3 4. + */ + public int[] getTextColumnOrder() { + return getTextSegmentColumnOrder(stringSettingsValues[TEXT_COLUMN_ORDER]); + } + + /** + * Store the current order of Text Segment window table columns, so the ordering + * can be preserved and restored. + * + * @param columnOrder An array of int indicating column order. + */ + + public void setTextColumnOrder(int[] columnOrder) { + String stringifiedOrder = ""; + for (int j : columnOrder) { + stringifiedOrder += j + " "; + } + setStringSetting(TEXT_COLUMN_ORDER, stringifiedOrder); + } + + /** + * Retrieve the caret blink rate in milliseconds. Blink rate of 0 means + * do not blink. + * + * @return int blink rate in milliseconds + */ + + public int getCaretBlinkRate() { + int rate = 500; + try { rate = Integer.parseInt(stringSettingsValues[CARET_BLINK_RATE]); - } - catch (NumberFormatException nfe) { - rate = Integer.parseInt(defaultStringSettingsValues[CARET_BLINK_RATE]); - } - return rate; - } - - - /** - * Get the tab size in characters. - * @return tab size in characters. - */ - public int getEditorTabSize() { - int size = 8; - try { + } catch (NumberFormatException nfe) { + rate = Integer.parseInt(defaultStringSettingsValues[CARET_BLINK_RATE]); + } + return rate; + } + + /** + * Set the caret blinking rate in milliseconds. Rate of 0 means no blinking. + * + * @param rate blink rate in milliseconds + */ + public void setCaretBlinkRate(int rate) { + setStringSetting(CARET_BLINK_RATE, "" + rate); + } + + /** + * Get the tab size in characters. + * + * @return tab size in characters. + */ + public int getEditorTabSize() { + int size = 8; + try { size = Integer.parseInt(stringSettingsValues[EDITOR_TAB_SIZE]); - } - catch (NumberFormatException nfe) { - size = getDefaultEditorTabSize(); - } - return size; - } - - - /** - * Get number of letters to be matched by editor's instruction guide before popup generated (if popup enabled). - * Should be 1 or 2. If 1, the popup will be generated after first letter typed, based on all matches; if 2, - * the popup will be generated after second letter typed. - * @return number of letters (should be 1 or 2). - */ - public int getEditorPopupPrefixLength() { - int length = 2; - try { + } catch (NumberFormatException nfe) { + size = getDefaultEditorTabSize(); + } + return size; + } + + /** + * Set the tab size in characters. + * + * @param size tab size in characters. + */ + public void setEditorTabSize(int size) { + setStringSetting(EDITOR_TAB_SIZE, "" + size); + } + + /** + * Get number of letters to be matched by editor's instruction guide before popup generated (if popup enabled). + * Should be 1 or 2. If 1, the popup will be generated after first letter typed, based on all matches; if 2, + * the popup will be generated after second letter typed. + * + * @return number of letters (should be 1 or 2). + */ + public int getEditorPopupPrefixLength() { + int length = 2; + try { length = Integer.parseInt(stringSettingsValues[EDITOR_POPUP_PREFIX_LENGTH]); - } - catch (NumberFormatException nfe) { - - } - return length; - } - - - /** - * Get the text editor default tab size in characters - * @return tab size in characters - */ - public int getDefaultEditorTabSize() { - return Integer.parseInt(defaultStringSettingsValues[EDITOR_TAB_SIZE]); - } - - /** - * Get the saved state of the Labels Window sorting (can sort by either - * label or address and either ascending or descending order). - * Default state is 0, by ascending addresses. - * @return State value 0-7, as a String. - */ - public String getLabelSortState() { - return stringSettingsValues[LABEL_SORT_STATE]; - } - - /** - * Get Color object for specified settings key. - * Returns null if key is not found or its value is not a valid color encoding. - * @param key the Setting key - * @return corresponding Color, or null if key not found or value not valid color - */ - public Color getColorSettingByKey(String key) { - return getColorValueByKey(key, colorSettingsValues); - } - - /** - * Get default Color value for specified settings key. - * Returns null if key is not found or its value is not a valid color encoding. - * @param key the Setting key - * @return corresponding default Color, or null if key not found or value not valid color - */ - public Color getDefaultColorSettingByKey(String key) { - return getColorValueByKey(key, defaultColorSettingsValues); - } - - - /** - * Get Color object for specified settings name (a static constant). - * Returns null if argument invalid or its value is not a valid color encoding. - * @param position the Setting name (see list of static constants) - * @return corresponding Color, or null if argument invalid or value not valid color - */ - public Color getColorSettingByPosition(int position) { - return getColorValueByPosition(position, colorSettingsValues); - } - - /** - * Get default Color object for specified settings name (a static constant). - * Returns null if argument invalid or its value is not a valid color encoding. - * @param position the Setting name (see list of static constants) - * @return corresponding default Color, or null if argument invalid or value not valid color - */ - public Color getDefaultColorSettingByPosition(int position) { - return getColorValueByPosition(position, defaultColorSettingsValues); - } - - - - - //////////////////////////////////////////////////////////////////////// - // Setting Setters - //////////////////////////////////////////////////////////////////////// - - - /** - * Set value of a boolean setting given its id and the value. - * @param id int containing the setting's identifier (constants listed above) - * @param value boolean value to store - * @throws IllegalArgumentException if identifier is not valid. - */ - public void setBooleanSetting(int id, boolean value) { - if (id >=0 && id < booleanSettingsValues.length) { + } catch (NumberFormatException ignored) { + + } + return length; + } + + /** + * Set number of letters to be matched by editor's instruction guide before popup generated (if popup enabled). + * Should be 1 or 2. If 1, the popup will be generated after first letter typed, based on all matches; if 2, + * the popup will be generated after second letter typed. + * + * @param length number of letters (should be 1 or 2). + */ + public void setEditorPopupPrefixLength(int length) { + setStringSetting(EDITOR_POPUP_PREFIX_LENGTH, "" + length); + } + + /** + * Get the text editor default tab size in characters + * + * @return tab size in characters + */ + public int getDefaultEditorTabSize() { + return Integer.parseInt(defaultStringSettingsValues[EDITOR_TAB_SIZE]); + } + + /** + * Get the saved state of the Labels Window sorting (can sort by either + * label or address and either ascending or descending order). + * Default state is 0, by ascending addresses. + * + * @return State value 0-7, as a String. + */ + public String getLabelSortState() { + return stringSettingsValues[LABEL_SORT_STATE]; + } + + /** + * Store the current state of the Labels Window sorter. There are 8 possible states as described in + * LabelsWindow.java + * + * @param state The current labels window sorting state, as a String. + */ + + public void setLabelSortState(String state) { + setStringSetting(LABEL_SORT_STATE, state); + } + + /** + * Get Color object for specified settings key. + * Returns null if key is not found or its value is not a valid color encoding. + * + * @param key the Setting key + * @return corresponding Color, or null if key not found or value not valid color + */ + public Color getColorSettingByKey(String key) { + return getColorValueByKey(key, colorSettingsValues); + } + + /** + * Get default Color value for specified settings key. + * Returns null if key is not found or its value is not a valid color encoding. + * + * @param key the Setting key + * @return corresponding default Color, or null if key not found or value not valid color + */ + public Color getDefaultColorSettingByKey(String key) { + return getColorValueByKey(key, defaultColorSettingsValues); + } + + /** + * Get Color object for specified settings name (a static constant). + * Returns null if argument invalid or its value is not a valid color encoding. + * + * @param position the Setting name (see list of static constants) + * @return corresponding Color, or null if argument invalid or value not valid color + */ + public Color getColorSettingByPosition(int position) { + return getColorValueByPosition(position, colorSettingsValues); + } + + /** + * Get default Color object for specified settings name (a static constant). + * Returns null if argument invalid or its value is not a valid color encoding. + * + * @param position the Setting name (see list of static constants) + * @return corresponding default Color, or null if argument invalid or value not valid color + */ + public Color getDefaultColorSettingByPosition(int position) { + return getColorValueByPosition(position, defaultColorSettingsValues); + } + + /** + * Set value of a boolean setting given its id and the value. + * + * @param id int containing the setting's identifier (constants listed above) + * @param value boolean value to store + * @throws IllegalArgumentException if identifier is not valid. + */ + public void setBooleanSetting(int id, boolean value) { + if (id >= 0 && id < booleanSettingsValues.length) { internalSetBooleanSetting(id, value); - } - else { + } else { throw new IllegalArgumentException("Invalid boolean setting ID"); - } - } - - - /** - * Establish setting for whether or not pseudo-instructions and formats are permitted - * in user programs. User can change this setting via the IDE. If setting changes, - * new setting will be written to properties file. - * @param value True to permit, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.EXTENDED_ASSEMBLER_ENABLED) - */ - public void setExtendedAssemblerEnabled(boolean value) { - internalSetBooleanSetting(EXTENDED_ASSEMBLER_ENABLED, value); - } - - /** - * Establish setting for whether a file will be automatically assembled as soon as it - * is opened. This is handy for those using an external text editor such as Mipster. - * If setting changes, new setting will be written to properties file. - * @param value True to automatically assemble, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.ASSEMBLE_ON_OPEN_ENABLED) - */ - public void setAssembleOnOpenEnabled(boolean value) { - internalSetBooleanSetting(ASSEMBLE_ON_OPEN_ENABLED, value); - } - - /** - * Establish setting for whether a file will be assembled by itself (false) or along - * with all other files in its directory (true). This permits multi-file programs - * and a primitive "project" capability. If setting changes, - * new setting will be written to properties file. - * @param value True to assemble all, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.ASSEMBLE_ALL_ENABLED) - */ - public void setAssembleAllEnabled(boolean value) { - internalSetBooleanSetting(ASSEMBLE_ALL_ENABLED, value); - } - - /** - * Establish setting for whether addresses in the Execute pane will be displayed - * in hexadecimal format. - * @param value True to display addresses in hexadecimal, false for decimal. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.DISPLAY_ADDRESSES_IN_HEX) - */ - public void setDisplayAddressesInHex(boolean value) { - internalSetBooleanSetting(DISPLAY_ADDRESSES_IN_HEX, value); - } - - /** - * Establish setting for whether values in the Execute pane will be displayed - * in hexadecimal format. - * @param value True to display values in hexadecimal, false for decimal. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.DISPLAY_VALUES_IN_HEX) - */ - public void setDisplayValuesInHex(boolean value) { - internalSetBooleanSetting(DISPLAY_VALUES_IN_HEX, value); - } - - /** - * Establish setting for whether the labels window (i.e. symbol table) will - * be displayed as part of the Text Segment display. If setting changes, - * new setting will be written to properties file. - * @param value True to dispay labels window, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.LABEL_WINDOW_VISIBILITY) - */ - public void setLabelWindowVisibility(boolean value) { - internalSetBooleanSetting(LABEL_WINDOW_VISIBILITY, value); - } - - /** - * Establish setting for whether the currently selected exception handler - * (a MIPS source file) will be automatically included in each - * assemble operation. If setting changes, new setting will be written - * to properties file. - * @param value True to assemble exception handler, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.EXCEPTION_HANDLER_ENABLED) - */ - public void setExceptionHandlerEnabled(boolean value) { - internalSetBooleanSetting(EXCEPTION_HANDLER_ENABLED, value); - } - - /** - * Establish setting for whether delayed branching will be applied during - * MIPS program execution. If enabled, the statement following a successful - * branch will be executed and then the branch is taken! This simulates - * pipelining and all MIPS processors do it. However it is confusing to - * assembly language students so is disabled by default. SPIM does same thing. - * @param value True to enable delayed branching, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.DELAYED_BRANCHING_ENABLED) - */ - - public void setDelayedBranchingEnabled(boolean value) { - internalSetBooleanSetting(DELAYED_BRANCHING_ENABLED, value); - } - - /** - * Establish setting for whether line numbers will be displayed by the - * text editor. - * @param value True to display line numbers, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.EDITOR_LINE_NUMBERS_DISPLAYED) - */ - public void setEditorLineNumbersDisplayed(boolean value) { - internalSetBooleanSetting(EDITOR_LINE_NUMBERS_DISPLAYED, value); - } - - /** - * Establish setting for whether assembler warnings will be considered errors. - * @param value True to consider warnings to be errors, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.WARNINGS_ARE_ERRORS) - */ - public void setWarningsAreErrors(boolean value) { - internalSetBooleanSetting(WARNINGS_ARE_ERRORS, value); - } - - - /** - * Establish setting for whether program arguments can be ented/used. - * @param value True if program arguments can be entered/used, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.PROGRAM_ARGUMENTS) - */ - public void setProgramArguments(boolean value) { - internalSetBooleanSetting(PROGRAM_ARGUMENTS, value); - } - - /** - * Establish setting for whether highlighting is to be applied to - * Data Segment window. - * @param value True if highlighting is to be applied, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.DATA_SEGMENT_HIGHLIGHTING) - */ - public void setDataSegmentHighlighting(boolean value) { - internalSetBooleanSetting(DATA_SEGMENT_HIGHLIGHTING, value); - } - - - /** - * Establish setting for whether highlighting is to be applied to - * Registers, Coprocessor0 and Coprocessor1 windows. - * @param value True if highlighting is to be applied, false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.REGISTERS_HIGHLIGHTING) - */ - public void setRegistersHighlighting(boolean value) { - internalSetBooleanSetting(REGISTERS_HIGHLIGHTING, value); - } - - - /** - * Establish setting for whether assembler will automatically initialize - * program counter to address of statement labeled 'main' if defined. - * @param value True if PC set to address of 'main', false otherwise. - * @deprecated Use setBooleanSetting(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.START_AT_MAIN) - */ - public void setStartAtMain(boolean value) { - internalSetBooleanSetting(START_AT_MAIN, value); - } - + } + } - /** - * Temporarily establish boolean setting. This setting will NOT be written to persisent - * store! Currently this is used only when running MARS from the command line - * @param id setting identifier. These are defined for this class as static final int. - * @param value True to enable the setting, false otherwise. - */ - public void setBooleanSettingNonPersistent(int id, boolean value) { - if (id >=0 && id < booleanSettingsValues.length) { + /** + * Temporarily establish boolean setting. This setting will NOT be written to persisent + * store! Currently this is used only when running MARS from the command line + * + * @param id setting identifier. These are defined for this class as static final int. + * @param value True to enable the setting, false otherwise. + */ + public void setBooleanSettingNonPersistent(int id, boolean value) { + if (id >= 0 && id < booleanSettingsValues.length) { booleanSettingsValues[id] = value; - } - else { + } else { throw new IllegalArgumentException("Invalid boolean setting ID"); - } - } - - - /** - * Establish setting for whether delayed branching will be applied during - * MIPS program execution. This setting will NOT be written to persisent - * store! This method should be called only to temporarily set this - * setting -- currently this is needed only when running MARS from the - * command line. - * @param value True to enabled delayed branching, false otherwise. - * @deprecated Use setBooleanSettingNonPersistent(int id, boolean value) with the appropriate boolean setting ID - * (e.g. Settings.DELAYED_BRANCHING_ENABLED) - */ - public void setDelayedBranchingEnabledNonPersistent(boolean value) { - // Note: Doing assignment to array results in non-persistent - // setting (lost when MARS terminates). For persistent, use - // the internalSetBooleanSetting() method instead. - booleanSettingsValues[DELAYED_BRANCHING_ENABLED] = value; - } + } + } - - /** - * Set name of exception handler file and write it to persistent storage. - * @param newFilename name of exception handler file - */ - public void setExceptionHandler(String newFilename) { - setStringSetting(EXCEPTION_HANDLER, newFilename); - } - - /** - * Store the identifier of the memory configuration. - * @param config A string that identifies the current built-in memory configuration - */ - - public void setMemoryConfiguration(String config) { - setStringSetting(MEMORY_CONFIGURATION, config); - } - - /** - * Set the caret blinking rate in milliseconds. Rate of 0 means no blinking. - * @param rate blink rate in milliseconds - */ - public void setCaretBlinkRate(int rate) { - setStringSetting(CARET_BLINK_RATE, ""+rate); - } - - /** - * Set the tab size in characters. - * @param size tab size in characters. - */ - public void setEditorTabSize(int size) { - setStringSetting(EDITOR_TAB_SIZE, ""+size); - } - - /** - * Set number of letters to be matched by editor's instruction guide before popup generated (if popup enabled). - * Should be 1 or 2. If 1, the popup will be generated after first letter typed, based on all matches; if 2, - * the popup will be generated after second letter typed. - * @param number of letters (should be 1 or 2). - */ - public void setEditorPopupPrefixLength(int length) { - setStringSetting(EDITOR_POPUP_PREFIX_LENGTH, ""+length); - } - - /** - * Set editor font to the specified Font object and write it to persistent storage. - * This method retained for compatibility but replaced by: - * setFontByPosition(Settings.EDITOR_FONT, font) - * @param font Font object to be used by text editor. - */ - public void setEditorFont(Font font) { - setFontByPosition(EDITOR_FONT, font); - } - - /** - * Store a Font setting - * @param fontSettingPosition Constant that identifies the item the font goes with - * @font The font to set that item to - */ - public void setFontByPosition(int fontSettingPosition, Font font) { - if (fontSettingPosition >=0 && fontSettingPosition < fontFamilySettingsValues.length) { + /** + * Establish setting for whether delayed branching will be applied during + * MIPS program execution. This setting will NOT be written to persisent + * store! This method should be called only to temporarily set this + * setting -- currently this is needed only when running MARS from the + * command line. + * + * @param value True to enabled delayed branching, false otherwise. + * @deprecated Use setBooleanSettingNonPersistent(int id, boolean value) with the appropriate boolean setting ID + * (e.g. Settings.DELAYED_BRANCHING_ENABLED) + */ + @Deprecated + public void setDelayedBranchingEnabledNonPersistent(boolean value) { + // Note: Doing assignment to array results in non-persistent + // setting (lost when MARS terminates). For persistent, use + // the internalSetBooleanSetting() method instead. + booleanSettingsValues[DELAYED_BRANCHING_ENABLED] = value; + } + + /** + * Store a Font setting + * + * @param fontSettingPosition Constant that identifies the item the font goes with + * @param font The font to set that item to + */ + public void setFontByPosition(int fontSettingPosition, Font font) { + if (fontSettingPosition >= 0 && fontSettingPosition < fontFamilySettingsValues.length) { fontFamilySettingsValues[fontSettingPosition] = font.getFamily(); fontStyleSettingsValues[fontSettingPosition] = EditorFont.styleIntToStyleString(font.getStyle()); fontSizeSettingsValues[fontSettingPosition] = EditorFont.sizeIntToSizeString(font.getSize()); saveFontSetting(fontSettingPosition, fontFamilySettingsKeys, fontFamilySettingsValues); saveFontSetting(fontSettingPosition, fontStyleSettingsKeys, fontStyleSettingsValues); saveFontSetting(fontSettingPosition, fontSizeSettingsKeys, fontSizeSettingsValues); - } - if (fontSettingPosition == EDITOR_FONT) { + } + if (fontSettingPosition == EDITOR_FONT) { setChanged(); notifyObservers(); - } - } - - - - /** - * Store the current order of Text Segment window table columns, so the ordering - * can be preserved and restored. - * @param columnOrder An array of int indicating column order. - */ - - public void setTextColumnOrder(int[] columnOrder) { - String stringifiedOrder = new String(); - for (int i=0; i= 0 && position < colorSettingsKeys.length) { + } + } + + /** + * Set Color object for specified settings name (a static constant). Has no effect if invalid. + * + * @param position the Setting name (see list of static constants) + * @param color the Color to save + */ + public void setColorSettingByPosition(int position, Color color) { + if (position >= 0 && position < colorSettingsKeys.length) { setColorSetting(position, color); - } - } - - ///////////////////////////////////////////////////////////////////////// - // - // PRIVATE HELPER METHODS TO DO THE REAL WORK - // - ///////////////////////////////////////////////////////////////////////// - - // Initialize settings to default values. - // Strategy: First set from properties file. - // If that fails, set from array. - // In either case, use these values as defaults in call to Preferences. - - private void initialize() { - applyDefaultSettings(); - if (!readSettingsFromPropertiesFile(settingsFile)) { + } + } + + ///////////////////////////////////////////////////////////////////////// + // + // PRIVATE HELPER METHODS TO DO THE REAL WORK + // + ///////////////////////////////////////////////////////////////////////// + + // Initialize settings to default values. + // Strategy: First set from properties file. + // If that fails, set from array. + // In either case, use these values as defaults in call to Preferences. + + private void initialize() { + applyDefaultSettings(); + if (!readSettingsFromPropertiesFile(settingsFile)) { System.out.println("MARS System error: unable to read Settings.properties defaults. Using built-in defaults."); - } - getSettingsFromPreferences(); - } - - // Default values. Will be replaced if available from property file or Preferences object. - private void applyDefaultSettings() { - for (int i=0; i= 0 && position < colorSettingsKeys.length) { + } + return null; + } + + // Get Color object for this key array position. Get it from values array provided as argument (could be either + // the current or the default settings array). + private Color getColorValueByPosition(int position, String[] values) { + Color color = null; + if (position >= 0 && position < colorSettingsKeys.length) { try { - color = Color.decode(values[position]); - } - catch (NumberFormatException nfe) { - color = null; - } - } - return color; - } - - - // Maybe someday I'll convert the whole shebang to use Maps. In the meantime, we use - // linear search of array. Not a huge deal as settings are little-used. - // Returns index or -1 if not found. - private int getIndexOfKey(String key, String[] array) { - int index = -1; - for (int i=0; i0){ - CounterValue--; - } - else{ - CounterValue=CounterValueMax; - if((Coprocessor0.getValue(Coprocessor0.STATUS) & 2)==0){ - mars.simulator.Simulator.externalInterruptingDevice = /*Exceptions.*/EXTERNAL_INTERRUPT_TIMER; - } - } - } - protected void reset(){ - sevenSegPanel.resetSevenSegment(); - hexaKeyPanel.resetHexaKeyboard(); - SecondCounter.resetOneSecondCounter(); - } - protected JComponent buildMainDisplayArea() { - panelTools=new JPanel(new GridLayout(1,2)); - sevenSegPanel=new SevenSegmentPanel(); - panelTools.add(sevenSegPanel); - hexaKeyPanel = new HexaKeyboard(); - panelTools.add(hexaKeyPanel); - SecondCounter= new OneSecondCounter(); - return panelTools; - } - private synchronized void updateMMIOControlAndData(int dataAddr, int dataValue) { - if (!this.isBeingUsedAsAMarsTool || (this.isBeingUsedAsAMarsTool && connectButton.isConnected())) { - synchronized (Globals.memoryAndRegistersLock) { - try { - Globals.memory.setByte(dataAddr, dataValue); - } - catch (AddressErrorException aee) { - System.out.println("Tool author specified incorrect MMIO address!"+aee); - System.exit(0); - } - } - if (Globals.getGui() != null && Globals.getGui().getMainPane().getExecutePane().getTextSegmentWindow().getCodeHighlighting() ) { - Globals.getGui().getMainPane().getExecutePane().getDataSegmentWindow().updateValues(); - } - } - } - protected JComponent getHelpComponent() { - final String helpContent = - " This tool is composed of 3 parts : two seven-segment displays, an hexadecimal keyboard and counter \n"+ - "Seven segment display\n"+ - " Byte value at address 0xFFFF0010 : command right seven segment display \n "+ - " Byte value at address 0xFFFF0011 : command left seven segment display \n "+ - " Each bit of these two bytes are connected to segments (bit 0 for a segment, 1 for b segment and 7 for point \n \n"+ - "Hexadecimal keyboard\n"+ - " Byte value at address 0xFFFF0012 : command row number of hexadecimal keyboard (bit 0 to 3) and enable keyboard interrupt (bit 7) \n" + - " Byte value at address 0xFFFF0014 : receive row and column of the key pressed, 0 if not key pressed \n"+ - " The mips program have to scan, one by one, each row (send 1,2,4,8...)"+ - " and then observe if a key is pressed (that mean byte value at adresse 0xFFFF0014 is different from zero). "+ - " This byte value is composed of row number (4 left bits) and column number (4 right bits)"+ - " Here you'll find the code for each key : 0x11,0x21,0x41,0x81,0x12,0x22,0x42,0x82,0x14,0x24,0x44,0x84,0x18,0x28,0x48,0x88. \n"+ - " For exemple key number 2 return 0x41, that mean the key is on column 3 and row 1. \n"+ - " If keyboard interruption is enable, an exception is started, with cause register bit number 11 set.\n \n"+ - "Counter\n"+ - " Byte value at address 0xFFFF0013 : If one bit of this byte is set, the counter interruption is enable.\n"+ - " If counter interruption is enable, every 30 instructions, an exception is started with cause register bit number 10.\n" + - " (contributed by Didier Teifreto, dteifreto@lifc.univ-fcomte.fr)" - ; - JButton help = new JButton("Help"); - help.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e) { - JTextArea ja = new JTextArea(helpContent); - ja.setRows(20); - ja.setColumns(60); - ja.setLineWrap(true); - ja.setWrapStyleWord(true); - JOptionPane.showMessageDialog(theWindow, new JScrollPane(ja), - "Simulating the Hexa Keyboard and Seven segment display", JOptionPane.INFORMATION_MESSAGE); - } - }); - return help; - }/* ....................Seven Segment display start here................................... */ - /* ...........................Seven segment display start here ..............................*/ - public void updateSevenSegment(int number,char value) { - sevenSegPanel.display[number].modifyDisplay(value); - } - public class SevenSegmentDisplay extends JComponent { - public char aff; - public SevenSegmentDisplay(char aff){ - this.aff=aff; - this.setPreferredSize(new Dimension(60,80)); - } - public void modifyDisplay(char val){ - aff=val; - this.repaint(); - } - public void SwitchSegment(Graphics g,char segment){ - switch(segment){ - case 'a': //a segment - int[]pxa1={12,9,12}; - int[]pxa2={36,39,36}; - int[]pya={5,8,11}; - g.fillPolygon(pxa1,pya, 3); - g.fillPolygon(pxa2,pya, 3); - g.fillRect(12,5,24,6); - break; - case 'b': //b segment - int[]pxb={37,40,43}; - int[]pyb1={12,9,12}; - int[]pyb2={36,39,36}; - g.fillPolygon(pxb,pyb1, 3); - g.fillPolygon(pxb,pyb2, 3); - g.fillRect(37,12,6,24); - break; - case 'c': // c segment - int[]pxc={37,40,43}; - int[]pyc1={44,41,44}; - int[]pyc2={68,71,68}; - g.fillPolygon(pxc,pyc1, 3); - g.fillPolygon(pxc,pyc2, 3); - g.fillRect(37,44,6,24); - break; - case 'd': // d segment - int[]pxd1={12,9,12}; - int[]pxd2={36,39,36}; - int[]pyd={69,72,75}; - g.fillPolygon(pxd1,pyd, 3); - g.fillPolygon(pxd2,pyd, 3); - g.fillRect(12,69,24,6); - break; - case 'e': // e segment - int[]pxe={5,8,11}; - int[]pye1={44,41,44}; - int[]pye2={68,71,68}; - g.fillPolygon(pxe,pye1, 3); - g.fillPolygon(pxe,pye2, 3); - g.fillRect(5,44,6,24); - break; - case 'f': // f segment - int[]pxf={5,8,11}; - int[]pyf1={12,9,12}; - int[]pyf2={36,39,36}; - g.fillPolygon(pxf,pyf1, 3); - g.fillPolygon(pxf,pyf2, 3); - g.fillRect(5,12,6,24); - break; - case 'g': // g segment - int[]pxg1={12,9,12}; - int[]pxg2={36,39,36}; - int[]pyg={37,40,43}; - g.fillPolygon(pxg1,pyg, 3); - g.fillPolygon(pxg2,pyg, 3); - g.fillRect(12,37,24,6); - break; - case 'h': // decimal point - g.fillOval(49,68,8,8); - break; - } - } - public void paint(Graphics g) { - char c='a'; - while(c<='h'){ - if ((aff & 0x1) == 1) - g.setColor(Color.RED); - else - g.setColor(Color.LIGHT_GRAY); - SwitchSegment(g,c); - aff = (char)(aff >>>1); - c++; - } - } - } - public class SevenSegmentPanel extends JPanel { - public SevenSegmentDisplay[] display; - public SevenSegmentPanel(){ - int i; - FlowLayout fl= new FlowLayout(); - this.setLayout(fl); - display= new SevenSegmentDisplay[2]; - for (i=0;i<2;i++){ - display[i]= new SevenSegmentDisplay((char)(0)); - this.add(display[i]); - } - } - public void modifyDisplay(int num,char val){ - display[num].modifyDisplay(val); - display[num].repaint(); - } - public void resetSevenSegment() { - int i; - for (i=0;i<2;i++) - modifyDisplay(i, (char)0); - } - } - /* ...........................Seven segment display end here ..............................*/ -/* ....................Hexa Keyboard start here................................... */ - public void updateHexaKeyboard(char row) { - int key = KeyBoardValueButtonClick; - if ((key !=-1)&& ((1 << (key / 4))==(row & 0xF))){ - updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD, - (char)(1 << (key / 4)) | (1 << (4+(key%4)))); - } - else{ - updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD, 0); - } - if ((row & 0xF0) != 0) - KeyboardInterruptOnOff = true; - else - KeyboardInterruptOnOff = false; - } - public class HexaKeyboard extends JPanel{ - public JButton[] button; - public HexaKeyboard(){ - int i; - GridLayout layout = new GridLayout(4,4); - this.setLayout(layout); - button = new JButton[16]; - for (i=0;i<16;i++){ - button[i]= new JButton(Integer.toHexString(i)); - button[i].setBackground(Color.WHITE); - button[i].setMargin(new Insets(10,10,10,10)); - button[i].addMouseListener(new EcouteurClick(i)); - this.add(button[i]); - } - } - public void resetHexaKeyboard(){ - int i; - KeyBoardValueButtonClick=-1; - for(i=0;i<16;i++){ - button[i].setBackground(Color.WHITE); - } - } - public class EcouteurClick implements MouseListener{ - private int buttonValue; - public EcouteurClick(int val){ - buttonValue=val; - } - public void mouseEntered(MouseEvent arg0) { } - public void mouseExited(MouseEvent arg0) {} - public void mousePressed(MouseEvent arg0) {} - public void mouseReleased(MouseEvent arg0) {} - public void mouseClicked(MouseEvent arg0) { - int i; - if(KeyBoardValueButtonClick!=-1){//Button already pressed -> now realease - KeyBoardValueButtonClick = -1; - updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD,0); - for(i=0;i<16;i++) - button[i].setBackground(Color.WHITE); - } - else{ // new button pressed - KeyBoardValueButtonClick = buttonValue; - button[KeyBoardValueButtonClick].setBackground(Color.GREEN); - if( KeyboardInterruptOnOff && (Coprocessor0.getValue(Coprocessor0.STATUS) & 2)==0){ - mars.simulator.Simulator.externalInterruptingDevice = /*Exceptions.*/EXTERNAL_INTERRUPT_HEXA_KEYBOARD; - } - } - } - } - } -/* ....................Hexa Keyboard end here................................... */ -/* ....................Timer start here................................... */ - public void updateOneSecondCounter(char value) { - if (value !=0){ - CounterInterruptOnOff=true; - CounterValue=CounterValueMax; - } - else{ - CounterInterruptOnOff=false; - } - } - public class OneSecondCounter{ - public OneSecondCounter(){ - CounterInterruptOnOff=false; - } - public void resetOneSecondCounter(){ - CounterInterruptOnOff=false; - CounterValue=CounterValueMax; - } - } -} \ No newline at end of file +package mars.tools; + +import mars.Globals; +import mars.mips.hardware.AddressErrorException; +import mars.mips.hardware.Coprocessor0; +import mars.mips.hardware.Memory; +import mars.mips.hardware.MemoryAccessNotice; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Observable; +@SuppressWarnings("serial") +/* Add these two lines in exceptions.java file + * public static final int EXTERNAL_INTERRUPT_TIMER = 0x00000100; //Add for digital Lab Sim + * public static final int EXTERNAL_INTERRUPT_HEXA_KEYBOARD = 0x00000200;// Add for digital Lab Sim +*/ + +/* + * Didier Teifreto LIFC Université de franche-Comté www.lifc.univ-fcomte.fr/~teifreto + * didier.teifreto@univ-fcomte.fr + */ +public class DigitalLabSim extends AbstractMarsToolAndApplication { + private static String heading = "Digital Lab Sim"; + private static String version = " Version 1.0 (Didier Teifreto)"; + private static final int IN_ADRESS_DISPLAY_1=Memory.memoryMapBaseAddress+0x10; + private static final int IN_ADRESS_DISPLAY_2=Memory.memoryMapBaseAddress+0x11; + private static final int IN_ADRESS_HEXA_KEYBOARD=Memory.memoryMapBaseAddress+0x12; + private static final int IN_ADRESS_COUNTER=Memory.memoryMapBaseAddress+0x13; + private static final int OUT_ADRESS_HEXA_KEYBOARD=Memory.memoryMapBaseAddress+0x14; + + public static final int EXTERNAL_INTERRUPT_TIMER = 0x00000100; //Add for digital Lab Sim + public static final int EXTERNAL_INTERRUPT_HEXA_KEYBOARD = 0x00000200;// Add for digital Lab Sim + + // GUI Interface. + private static JPanel panelTools; + // Seven Segment display + private SevenSegmentPanel sevenSegPanel; + // Keyboard + private static int KeyBoardValueButtonClick=-1; // -1 no button click + private HexaKeyboard hexaKeyPanel; + private static boolean KeyboardInterruptOnOff=false; + // Counter + private static int CounterValueMax=30; + private static int CounterValue=CounterValueMax; + private static boolean CounterInterruptOnOff=false; + private static OneSecondCounter SecondCounter; + + public DigitalLabSim(String title, String heading) { + super(title,heading); + } + public DigitalLabSim() { + super (heading+", "+version, heading); + } + public static void main(String[] args) { + new DigitalLabSim(heading+", "+version,heading).go(); + } + public String getName() { + return "Digital Lab Sim"; + } + protected void addAsObserver(){ + addAsObserver(IN_ADRESS_DISPLAY_1, IN_ADRESS_DISPLAY_1); + addAsObserver(Memory.textBaseAddress, Memory.textLimitAddress); + } + public void update(Observable ressource, Object accessNotice){ + MemoryAccessNotice notice = (MemoryAccessNotice) accessNotice; + int address=notice.getAddress(); + char value=(char)notice.getValue(); + if(address == IN_ADRESS_DISPLAY_1) + updateSevenSegment(1, value); + else + if (address == IN_ADRESS_DISPLAY_2) + updateSevenSegment(0, value); + else + if (address == IN_ADRESS_HEXA_KEYBOARD) + updateHexaKeyboard(value); + else + if (address == IN_ADRESS_COUNTER) + updateOneSecondCounter(value); + if (CounterInterruptOnOff) + if (CounterValue >0){ + CounterValue--; + } + else{ + CounterValue=CounterValueMax; + if((Coprocessor0.getValue(Coprocessor0.STATUS) & 2)==0){ + mars.simulator.Simulator.externalInterruptingDevice = /*Exceptions.*/EXTERNAL_INTERRUPT_TIMER; + } + } + } + protected void reset(){ + sevenSegPanel.resetSevenSegment(); + hexaKeyPanel.resetHexaKeyboard(); + SecondCounter.resetOneSecondCounter(); + } + protected JComponent buildMainDisplayArea() { + panelTools=new JPanel(new GridLayout(1,2)); + sevenSegPanel=new SevenSegmentPanel(); + panelTools.add(sevenSegPanel); + hexaKeyPanel = new HexaKeyboard(); + panelTools.add(hexaKeyPanel); + SecondCounter= new OneSecondCounter(); + return panelTools; + } + private synchronized void updateMMIOControlAndData(int dataAddr, int dataValue) { + if (!this.isBeingUsedAsAMarsTool || (this.isBeingUsedAsAMarsTool && connectButton.isConnected())) { + synchronized (Globals.memoryAndRegistersLock) { + try { + Globals.memory.setByte(dataAddr, dataValue); + } + catch (AddressErrorException aee) { + System.out.println("Tool author specified incorrect MMIO address!"+aee); + System.exit(0); + } + } + if (Globals.getGui() != null && Globals.getGui().getMainPane().getExecutePane().getTextSegmentWindow().getCodeHighlighting() ) { + Globals.getGui().getMainPane().getExecutePane().getDataSegmentWindow().updateValues(); + } + } + } + protected JComponent getHelpComponent() { + final String helpContent = + " This tool is composed of 3 parts : two seven-segment displays, an hexadecimal keyboard and counter \n"+ + "Seven segment display\n"+ + " Byte value at address 0xFFFF0010 : command right seven segment display \n "+ + " Byte value at address 0xFFFF0011 : command left seven segment display \n "+ + " Each bit of these two bytes are connected to segments (bit 0 for a segment, 1 for b segment and 7 for point \n \n"+ + "Hexadecimal keyboard\n"+ + " Byte value at address 0xFFFF0012 : command row number of hexadecimal keyboard (bit 0 to 3) and enable keyboard interrupt (bit 7) \n" + + " Byte value at address 0xFFFF0014 : receive row and column of the key pressed, 0 if not key pressed \n"+ + " The mips program have to scan, one by one, each row (send 1,2,4,8...)"+ + " and then observe if a key is pressed (that mean byte value at adresse 0xFFFF0014 is different from zero). "+ + " This byte value is composed of row number (4 left bits) and column number (4 right bits)"+ + " Here you'll find the code for each key : 0x11,0x21,0x41,0x81,0x12,0x22,0x42,0x82,0x14,0x24,0x44,0x84,0x18,0x28,0x48,0x88. \n"+ + " For exemple key number 2 return 0x41, that mean the key is on column 3 and row 1. \n"+ + " If keyboard interruption is enable, an exception is started, with cause register bit number 11 set.\n \n"+ + "Counter\n"+ + " Byte value at address 0xFFFF0013 : If one bit of this byte is set, the counter interruption is enable.\n"+ + " If counter interruption is enable, every 30 instructions, an exception is started with cause register bit number 10.\n" + + " (contributed by Didier Teifreto, dteifreto@lifc.univ-fcomte.fr)" + ; + JButton help = new JButton("Help"); + help.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + JTextArea ja = new JTextArea(helpContent); + ja.setRows(20); + ja.setColumns(60); + ja.setLineWrap(true); + ja.setWrapStyleWord(true); + JOptionPane.showMessageDialog(theWindow, new JScrollPane(ja), + "Simulating the Hexa Keyboard and Seven segment display", JOptionPane.INFORMATION_MESSAGE); + } + }); + return help; + }/* ....................Seven Segment display start here................................... */ + /* ...........................Seven segment display start here ..............................*/ + public void updateSevenSegment(int number,char value) { + sevenSegPanel.display[number].modifyDisplay(value); + } + public class SevenSegmentDisplay extends JComponent { + public char aff; + public SevenSegmentDisplay(char aff){ + this.aff=aff; + this.setPreferredSize(new Dimension(60,80)); + } + public void modifyDisplay(char val){ + aff=val; + this.repaint(); + } + public void SwitchSegment(Graphics g,char segment){ + switch(segment){ + case 'a': //a segment + int[]pxa1={12,9,12}; + int[]pxa2={36,39,36}; + int[]pya={5,8,11}; + g.fillPolygon(pxa1,pya, 3); + g.fillPolygon(pxa2,pya, 3); + g.fillRect(12,5,24,6); + break; + case 'b': //b segment + int[]pxb={37,40,43}; + int[]pyb1={12,9,12}; + int[]pyb2={36,39,36}; + g.fillPolygon(pxb,pyb1, 3); + g.fillPolygon(pxb,pyb2, 3); + g.fillRect(37,12,6,24); + break; + case 'c': // c segment + int[]pxc={37,40,43}; + int[]pyc1={44,41,44}; + int[]pyc2={68,71,68}; + g.fillPolygon(pxc,pyc1, 3); + g.fillPolygon(pxc,pyc2, 3); + g.fillRect(37,44,6,24); + break; + case 'd': // d segment + int[]pxd1={12,9,12}; + int[]pxd2={36,39,36}; + int[]pyd={69,72,75}; + g.fillPolygon(pxd1,pyd, 3); + g.fillPolygon(pxd2,pyd, 3); + g.fillRect(12,69,24,6); + break; + case 'e': // e segment + int[]pxe={5,8,11}; + int[]pye1={44,41,44}; + int[]pye2={68,71,68}; + g.fillPolygon(pxe,pye1, 3); + g.fillPolygon(pxe,pye2, 3); + g.fillRect(5,44,6,24); + break; + case 'f': // f segment + int[]pxf={5,8,11}; + int[]pyf1={12,9,12}; + int[]pyf2={36,39,36}; + g.fillPolygon(pxf,pyf1, 3); + g.fillPolygon(pxf,pyf2, 3); + g.fillRect(5,12,6,24); + break; + case 'g': // g segment + int[]pxg1={12,9,12}; + int[]pxg2={36,39,36}; + int[]pyg={37,40,43}; + g.fillPolygon(pxg1,pyg, 3); + g.fillPolygon(pxg2,pyg, 3); + g.fillRect(12,37,24,6); + break; + case 'h': // decimal point + g.fillOval(49,68,8,8); + break; + } + } + public void paint(Graphics g) { + char c='a'; + while(c<='h'){ + if ((aff & 0x1) == 1) + g.setColor(Color.RED); + else + g.setColor(Color.LIGHT_GRAY); + SwitchSegment(g,c); + aff = (char)(aff >>>1); + c++; + } + } + } + public class SevenSegmentPanel extends JPanel { + public SevenSegmentDisplay[] display; + public SevenSegmentPanel(){ + int i; + FlowLayout fl= new FlowLayout(); + this.setLayout(fl); + display= new SevenSegmentDisplay[2]; + for (i=0;i<2;i++){ + display[i]= new SevenSegmentDisplay((char)(0)); + this.add(display[i]); + } + } + public void modifyDisplay(int num,char val){ + display[num].modifyDisplay(val); + display[num].repaint(); + } + public void resetSevenSegment() { + int i; + for (i=0;i<2;i++) + modifyDisplay(i, (char)0); + } + } + /* ...........................Seven segment display end here ..............................*/ +/* ....................Hexa Keyboard start here................................... */ + public void updateHexaKeyboard(char row) { + int key = KeyBoardValueButtonClick; + if ((key !=-1)&& ((1 << (key / 4))==(row & 0xF))){ + updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD, + (char)(1 << (key / 4)) | (1 << (4+(key%4)))); + } + else{ + updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD, 0); + } + if ((row & 0xF0) != 0) + KeyboardInterruptOnOff = true; + else + KeyboardInterruptOnOff = false; + } + public class HexaKeyboard extends JPanel{ + public JButton[] button; + public HexaKeyboard(){ + int i; + GridLayout layout = new GridLayout(4,4); + this.setLayout(layout); + button = new JButton[16]; + for (i=0;i<16;i++){ + button[i]= new JButton(Integer.toHexString(i)); + button[i].setBackground(Color.WHITE); + button[i].setMargin(new Insets(10,10,10,10)); + button[i].addMouseListener(new EcouteurClick(i)); + this.add(button[i]); + } + } + public void resetHexaKeyboard(){ + int i; + KeyBoardValueButtonClick=-1; + for(i=0;i<16;i++){ + button[i].setBackground(Color.WHITE); + } + } + public class EcouteurClick implements MouseListener{ + private int buttonValue; + public EcouteurClick(int val){ + buttonValue=val; + } + public void mouseEntered(MouseEvent arg0) { } + public void mouseExited(MouseEvent arg0) {} + public void mousePressed(MouseEvent arg0) {} + public void mouseReleased(MouseEvent arg0) {} + public void mouseClicked(MouseEvent arg0) { + int i; + if(KeyBoardValueButtonClick!=-1){//Button already pressed -> now realease + KeyBoardValueButtonClick = -1; + updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD,0); + for(i=0;i<16;i++) + button[i].setBackground(Color.WHITE); + } + else{ // new button pressed + KeyBoardValueButtonClick = buttonValue; + button[KeyBoardValueButtonClick].setBackground(Color.GREEN); + if( KeyboardInterruptOnOff && (Coprocessor0.getValue(Coprocessor0.STATUS) & 2)==0){ + mars.simulator.Simulator.externalInterruptingDevice = /*Exceptions.*/EXTERNAL_INTERRUPT_HEXA_KEYBOARD; + } + } + } + } + } +/* ....................Hexa Keyboard end here................................... */ +/* ....................Timer start here................................... */ + public void updateOneSecondCounter(char value) { + if (value !=0){ + CounterInterruptOnOff=true; + CounterValue=CounterValueMax; + } + else{ + CounterInterruptOnOff=false; + } + } + public class OneSecondCounter{ + public OneSecondCounter(){ + CounterInterruptOnOff=false; + } + public void resetOneSecondCounter(){ + CounterInterruptOnOff=false; + CounterValue=CounterValueMax; + } + } +} diff --git a/src/main/java/mars/tools/MipsXray.java b/src/main/java/mars/tools/MipsXray.java index 9410338..01e2f52 100644 --- a/src/main/java/mars/tools/MipsXray.java +++ b/src/main/java/mars/tools/MipsXray.java @@ -1,1498 +1,1459 @@ -package mars.tools; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; -import java.awt.GraphicsEnvironment; -import java.awt.GridBagLayout; -import java.awt.Image; -import java.awt.MouseInfo; -import java.awt.Point; -import java.awt.PointerInfo; -import java.awt.RenderingHints; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.font.FontRenderContext; -import java.awt.font.TextLayout; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Observable; -import java.util.Vector; - -import javax.imageio.ImageIO; -import javax.swing.Action; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JToolBar; -import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; -import javax.swing.Timer; -import javax.swing.UIManager; -//import java.util.Timer; -import javax.swing.event.InternalFrameEvent; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import mars.Globals; -import mars.ProgramStatement; -import mars.mips.hardware.AccessNotice; -import mars.mips.hardware.AddressErrorException; -import mars.mips.hardware.Memory; -import mars.mips.hardware.MemoryAccessNotice; -import mars.mips.instructions.BasicInstruction; -import mars.mips.instructions.BasicInstructionFormat; -import mars.venus.RunAssembleAction; -import mars.venus.RunBackstepAction; -import mars.venus.RunStepAction; -import mars.venus.VenusUI; - -public class MipsXray extends AbstractMarsToolAndApplication{ - private static final long serialVersionUID = -1L; - private static String heading = "MIPS X-Ray - Animation of MIPS Datapath"; - private static String version = " Version 2.0"; - - protected Graphics g; - protected int lastAddress = -1; //address of instruction in memory - protected JLabel label; - private Container painel = this.getContentPane(); - private DatapathAnimation datapathAnimation; //class panel that runs datapath animation. - - private GraphicsConfiguration gc; - private BufferedImage datapath; - private String instructionBinary; - - //Components to add menu bar in the plugin window. - private JButton Assemble, Step, runBackStep; - private Action runAssembleAction, runStepAction, runBackstepAction; - - private VenusUI mainUI; - private JToolBar toolbar; - private Timer time; - - public MipsXray(String title, String heading) { - super(title,heading); - } - - /** - * Simple constructor, likely used by the MipsXray menu mechanism - */ - public MipsXray() { - super (heading+", "+version, heading); - } - - - /** - * Required method to return Tool name. - * @return Tool name. MARS will display this in menu item. - */ - public String getName() { - return "MIPS X-Ray"; - } - - /** - * Overrides default method, to provide a Help button for this tool/app. - */ - protected JComponent getHelpComponent() { - final String helpContent = - "This plugin is used to visualizate the behavior of mips processor using the default datapath. \n"+ - "It reads the source code instruction and generates an animation representing the inputs and \n"+ - "outputs of functional blocks and the interconnection between them. The basic signals \n"+ - "represented are, control signals, opcode bits and data of functional blocks.\n"+ - "\n"+ - "Besides the datapath representation, information for each instruction is displayed below\n"+ - "the datapath. That display includes opcode value, with the correspondent colors used to\n"+ - "represent the signals in datapath, mnemonic of the instruction processed at the moment, registers\n"+ - "used in the instruction and a label that indicates the color code used to represent control signals\n" + - "\n"+ - "To see the datapath of register bank and control units click inside the functional unit.\n\n" + - "Version 2.0\n" + - "Developed by Márcio Roberto, Guilherme Sales, Fabrício Vivas, Flávio Cardeal and Fábio Lúcio\n" + - "Contact Marcio Roberto at marcio.rdaraujo@gmail.com with questions or comments.\n" - ; - JButton help = new JButton("Help"); - help.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(theWindow, helpContent); - } - }); - return help; - } - /** - * Implementation of the inherited abstract method to build the main - * display area of the GUI. It will be placed in the CENTER area of a - * BorderLayout. The title is in the NORTH area, and the controls are - * in the SOUTH area. - */ - protected JComponent buildAnimationSequence(){ - JPanel image = new JPanel(new GridBagLayout()); - return image; - } - - // Insert image in the panel and configure the parameters to run animation. - protected JComponent buildMainDisplayArea() { - mainUI = Globals.getGui(); - this.createActionObjects(); - toolbar= this.setUpToolBar(); - -// JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); - try { - BufferedImage im = ImageIO.read( - getClass().getResource(Globals.imagesPath+"datapath.png") ); - - int transparency = im.getColorModel().getTransparency(); - datapath = gc.createCompatibleImage( im.getWidth(), im.getHeight(), - transparency ); - - Graphics2D g2d = datapath.createGraphics(); // graphics context - g2d.drawImage(im,0,0,null); - g2d.dispose(); - - } - catch(IOException e) { - System.out.println("Load Image error for " + - getClass().getResource(Globals.imagesPath+"datapath.png") + ":\n" + e); - e.printStackTrace(); - } - System.setProperty("sun.java2d.translaccel", "true"); - ImageIcon icon = new ImageIcon(getClass().getResource(Globals.imagesPath+"datapath.png")); - Image im = icon.getImage(); - icon = new ImageIcon(im); - - JLabel label = new JLabel(icon); - painel.add(label, BorderLayout.WEST); - painel.add(toolbar, BorderLayout.NORTH); - this.setResizable(false); - return (JComponent) painel; - } - - protected JComponent buildMainDisplayArea(String figure) { - mainUI = Globals.getGui(); - this.createActionObjects(); - toolbar= this.setUpToolBar(); - -// JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); - try { - BufferedImage im = ImageIO.read( - getClass().getResource(Globals.imagesPath+figure) ); - - int transparency = im.getColorModel().getTransparency(); - datapath = gc.createCompatibleImage( im.getWidth(), im.getHeight(), - transparency ); - - Graphics2D g2d = datapath.createGraphics(); // graphics context - g2d.drawImage(im,0,0,null); - g2d.dispose(); - - } - catch(IOException e) { - System.out.println("Load Image error for " + - getClass().getResource(Globals.imagesPath+figure) + ":\n" + e); - e.printStackTrace(); - } - System.setProperty("sun.java2d.translaccel", "true"); - ImageIcon icon = new ImageIcon(getClass().getResource(Globals.imagesPath+figure)); - Image im = icon.getImage(); - icon = new ImageIcon(im); - - JLabel label = new JLabel(icon); - painel.add(label, BorderLayout.WEST); - painel.add(toolbar, BorderLayout.NORTH); - this.setResizable(false); - return (JComponent) painel; - } - - protected void addAsObserver() { - addAsObserver(Memory.textBaseAddress, Memory.textLimitAddress); - } - - //Function that gets the current instruction in memory and start animation with the selected instruction. - protected void processMIPSUpdate(Observable resource, AccessNotice notice) { - - if (!notice.accessIsFromMIPS()) return; - if (notice.getAccessType() != AccessNotice.READ) return; - MemoryAccessNotice man = (MemoryAccessNotice) notice; - int currentAdress = man.getAddress(); - - if (currentAdress == lastAddress) return; - lastAddress = currentAdress; - ProgramStatement stmt; - - try { - BasicInstruction instr = null; - stmt = Memory.getInstance().getStatement(currentAdress); - if(stmt == null){ - return; - } - - instr = (BasicInstruction) stmt.getInstruction(); - instructionBinary = stmt.getMachineStatement(); - BasicInstructionFormat format = instr.getInstructionFormat(); - - painel.removeAll(); - datapathAnimation = new DatapathAnimation(instructionBinary); - this.createActionObjects(); - toolbar= this.setUpToolBar(); - painel.add(toolbar, BorderLayout.NORTH); - painel.add(datapathAnimation, BorderLayout.WEST); - datapathAnimation.startAnimation(instructionBinary ); - - } catch (AddressErrorException e) { - e.printStackTrace(); - } - - - } - - public void updateDisplay(){ - this.repaint(); - } - - //set the tool bar that controls the step in a time instruction running. - private JToolBar setUpToolBar() { - JToolBar toolBar = new JToolBar(); - Assemble = new JButton(runAssembleAction); - Assemble.setText(""); - runBackStep = new JButton(runBackstepAction); - runBackStep.setText(""); - - Step = new JButton(runStepAction); - Step.setText(""); - toolBar.add(Assemble); - toolBar.add(Step); - - return toolBar; - } - - //set action in the menu bar. - private void createActionObjects() { - Toolkit tk = Toolkit.getDefaultToolkit(); - Class cs = this.getClass(); - try{ - runAssembleAction = new RunAssembleAction("Assemble", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Assemble22.png"))), - "Assemble the current file and clear breakpoints", new Integer(KeyEvent.VK_A), - KeyStroke.getKeyStroke( KeyEvent.VK_F3, 0), - mainUI); - - runStepAction = new RunStepAction("Step", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepForward22.png"))), - "Run one step at a time", new Integer(KeyEvent.VK_T), - KeyStroke.getKeyStroke( KeyEvent.VK_F7, 0), - mainUI); - runBackstepAction = new RunBackstepAction("Backstep", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepBack22.png"))), - "Undo the last step", new Integer(KeyEvent.VK_B), - KeyStroke.getKeyStroke( KeyEvent.VK_F8, 0), - mainUI); - } - catch(Exception e){ - System.out.println("Internal Error: images folder not found, or other null pointer exception while creating Action objects"); - e.printStackTrace(); - System.exit(0); - } - } - - -class Vertex { - private int numIndex; - private int init; - private int end; - private int current; - private String name; - public static final int movingUpside = 1; - public static final int movingDownside = 2; - public static final int movingLeft = 3; - public static final int movingRight = 4; - public int direction; - public int oppositeAxis; - private boolean isMovingXaxis; - private Color color; - private boolean first_interaction; - private boolean active; - private boolean isText; - private ArrayList targetVertex; - - public Vertex(int index, int init, int end, String name, int oppositeAxis, boolean isMovingXaxis, - String listOfColors, String listTargetVertex, boolean isText){ - this.numIndex = index; - this.init = init; - this.current = this.init; - this.end = end; - this.name = name; - this.oppositeAxis = oppositeAxis; - this.isMovingXaxis = isMovingXaxis; - this.first_interaction = true; - this.active = false; - this.isText = isText; - this.color = new Color(0,153,0); - if(isMovingXaxis == true){ - if( init < end) - direction = movingLeft; - else - direction = movingRight; - - } - else{ - if( init < end) - direction = movingUpside; - else - direction = movingDownside; - } - String[] list = listTargetVertex.split("#"); - targetVertex = new ArrayList(); - for(int i = 0; i < list.length; i++){ - targetVertex.add(Integer.parseInt(list[i])); - // System.out.println("Adding " + i + " " + Integer.parseInt(list[i])+ " in target"); - } - String[] listColor = listOfColors.split("#"); - this.color = new Color(Integer.parseInt(listColor[0]) , Integer.parseInt(listColor[1]), Integer.parseInt(listColor[2]) ); - } - - public int getDirection(){ - return direction; - } - - public boolean isText(){ - return this.isText; - } - - - public ArrayList getTargetVertex() { - return targetVertex; - } - - public int getNumIndex() { - return numIndex; - } - public void setNumIndex(int numIndex) { - this.numIndex = numIndex; - } - public int getInit() { - return init; - } - public void setInit(int init) { - this.init = init; - } - public int getEnd() { - return end; - } - public void setEnd(int end) { - this.end = end; - } - public int getCurrent() { - return current; - } - public void setCurrent(int current) { - this.current = current; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public int getOppositeAxis() { - return oppositeAxis; - } - public void setOppositeAxis(int oppositeAxis) { - this.oppositeAxis = oppositeAxis; - } - public boolean isMovingXaxis() { - return isMovingXaxis; - } - public void setMovingXaxis(boolean isMovingXaxis) { - this.isMovingXaxis = isMovingXaxis; - } - public Color getColor() { - return color; - } - public void setColor(Color color) { - this.color = color; - } - public boolean isFirst_interaction() { - return first_interaction; - } - public void setFirst_interaction(boolean first_interaction) { - this.first_interaction = first_interaction; - } - public boolean isActive() { - return active; - } - public void setActive(boolean active) { - this.active = active; - } -} - - -//Internal class that set the parameters value, control the basic behavior of the animation , and execute the animation of the -//selected instruction in memory. -class DatapathAnimation extends JPanel - implements ActionListener, MouseListener { - /** - * - */ - private static final long serialVersionUID = -2681757800180958534L; - - //config variables - private int PERIOD = 5; // velocity of frames in ms - private static final int PWIDTH = 1000; // size of this panel - private static final int PHEIGHT = 574; - private GraphicsConfiguration gc; - private GraphicsDevice gd; // for reporting accl. memory usage - private int accelMemory; - private DecimalFormat df; - - private int counter; //verify then remove. - private boolean justStarted; //flag to start movement - - - private int indexX; //counter of screen position - private int indexY; - private boolean xIsMoving, yIsMoving; //flag for mouse movement. - - - -// private Vertex[][] inputGraph; - private Vector> outputGraph; - private ArrayList vertexList; - private ArrayList vertexTraversed; - //Screen Label variables - - private HashMap opcodeEquivalenceTable; - private HashMap functionEquivalenceTable; - private HashMap registerEquivalenceTable; - - private String instructionCode; - - private int countRegLabel; - private int countALULabel; - private int countPCLabel; - - //Colors variables - private Color green1 = new Color(0,153,0); - private Color green2 = new Color( 0,77,0); - private Color yellow2 = new Color(185,182,42); - private Color orange1 = new Color(255,102,0); - private Color orange = new Color(119,34,34); - private Color blue2 = new Color(0,153,255); - - private int register = 1; - private int control = 2; - private int aluControl = 3; - private int alu = 4; - private int currentUnit; - private Graphics2D g2d; - - - private BufferedImage datapath; - - public void mousePressed(MouseEvent e) { - PointerInfo a = MouseInfo.getPointerInfo(); - // System.out.println("olha, capturado x=" + a.getLocation().getX() + " y = " + a.getLocation().getY()); - } - - public DatapathAnimation(String instructionBinary) - { - df = new DecimalFormat("0.0"); // 1 dp - GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - gd = ge.getDefaultScreenDevice(); - gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); - - accelMemory = gd.getAvailableAcceleratedMemory(); // in bytes - setBackground(Color.white); - setPreferredSize( new Dimension(PWIDTH, PHEIGHT) ); - - // load and initialise the images - initImages(); - - vertexList = new ArrayList(); - counter = 0; - justStarted = true; - instructionCode = instructionBinary; - - //declaration of labels definition. - opcodeEquivalenceTable = new HashMap(); - functionEquivalenceTable = new HashMap(); - registerEquivalenceTable = new HashMap(); - - countRegLabel = 400; - countALULabel = 380; - countPCLabel = 380; - loadHashMapValues(); - addMouseListener(this); - - - - } // end of ImagesTests() - - //set the binnary opcode value of the basic instructions of MIPS instruction set - public void loadHashMapValues(){ - importXmlStringData("/MipsXRayOpcode.xml",opcodeEquivalenceTable, "equivalence", "bits", "mnemonic"); - importXmlStringData("/MipsXRayOpcode.xml", functionEquivalenceTable, "function_equivalence", "bits", "mnemonic"); - importXmlStringData("/MipsXRayOpcode.xml", registerEquivalenceTable, "register_equivalence", "bits", "mnemonic"); - importXmlDatapathMap("/MipsXRayOpcode.xml", "datapath_map"); - } - - //import the list of opcodes of mips set of instructions - public void importXmlStringData(String xmlName, HashMap table, String elementTree, String tagId, String tagData){ - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(false); - DocumentBuilder docBuilder; - try { - //System.out.println(); - docBuilder = dbf.newDocumentBuilder(); - Document doc = docBuilder.parse(getClass().getResource(xmlName).toString()); - Element root = doc.getDocumentElement(); - Element equivalenceItem; - NodeList bitsList, mnemonic; - NodeList equivalenceList = root.getElementsByTagName(elementTree); - for(int i = 0; i < equivalenceList.getLength(); i++){ - equivalenceItem = (Element)equivalenceList.item(i); - bitsList = equivalenceItem.getElementsByTagName(tagId); - mnemonic = equivalenceItem.getElementsByTagName(tagData); - for(int j= 0; j < bitsList.getLength(); j++){ - table.put(bitsList.item(j).getTextContent(),mnemonic.item(j).getTextContent()); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - } - - //import the parameters of the animation on datapath - public void importXmlDatapathMap(String xmlName, String elementTree){ - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(false); - DocumentBuilder docBuilder; - try { - docBuilder = dbf.newDocumentBuilder(); - Document doc = docBuilder.parse(getClass().getResource(xmlName).toString()); - Element root = doc.getDocumentElement(); - Element datapath_mapItem; - NodeList index_vertex, name, init, end,color, other_axis, isMovingXaxis, targetVertex, sourceVertex, isText ; - NodeList datapath_mapList = root.getElementsByTagName(elementTree); - for(int i = 0; i < datapath_mapList.getLength(); i++){ //extract the vertex of the xml input and encapsulate into the vertex object - datapath_mapItem = (Element)datapath_mapList.item(i); - index_vertex = datapath_mapItem.getElementsByTagName("num_vertex"); - name = datapath_mapItem.getElementsByTagName("name"); - init = datapath_mapItem.getElementsByTagName("init"); - end = datapath_mapItem.getElementsByTagName("end"); - //definition of colors line - if(instructionCode.substring(0,6).equals("000000")){//R-type instructions - color = datapath_mapItem.getElementsByTagName("color_Rtype"); - //System.out.println("rtype"); - } - else if(instructionCode.substring(0,6).matches("00001[0-1]")){ //J-type instructions - color = datapath_mapItem.getElementsByTagName("color_Jtype"); - //System.out.println("jtype"); - } - else if(instructionCode.substring(0,6).matches("100[0-1][0-1][0-1]")){ //LOAD type instructions - color = datapath_mapItem.getElementsByTagName("color_LOADtype"); - //System.out.println("load type"); - } - else if(instructionCode.substring(0,6).matches("101[0-1][0-1][0-1]")){ //LOAD type instructions - color = datapath_mapItem.getElementsByTagName("color_STOREtype"); - //System.out.println("store type"); - } - else if(instructionCode.substring(0,6).matches("0001[0-1][0-1]")){ //BRANCH type instructions - color = datapath_mapItem.getElementsByTagName("color_BRANCHtype"); - //System.out.println("branch type"); - } - else{ //BRANCH type instructions - color = datapath_mapItem.getElementsByTagName("color_Itype"); - //System.out.println("immediate type"); - } - - other_axis = datapath_mapItem.getElementsByTagName("other_axis"); - isMovingXaxis = datapath_mapItem.getElementsByTagName("isMovingXaxis"); - targetVertex = datapath_mapItem.getElementsByTagName("target_vertex"); - isText = datapath_mapItem.getElementsByTagName("is_text"); - - for(int j= 0; j < index_vertex.getLength(); j++){ - Vertex vert = new Vertex(Integer.parseInt(index_vertex.item(j).getTextContent()), Integer.parseInt(init.item(j).getTextContent()), - Integer.parseInt(end.item(j).getTextContent()), name.item(j).getTextContent(), Integer.parseInt(other_axis.item(j).getTextContent()), - Boolean.parseBoolean(isMovingXaxis.item(j).getTextContent()), color.item(j).getTextContent(), targetVertex.item(j).getTextContent(), Boolean.parseBoolean(isText.item(j).getTextContent())); - vertexList.add(vert); - } - } - //loading matrix of control of vertex. - outputGraph = new Vector>(); - vertexTraversed = new ArrayList(); - int size = vertexList.size(); - Vertex vertex; - ArrayList targetList; - for(int i = 0; i < vertexList.size(); i++){ - vertex = vertexList.get(i); - targetList = vertex.getTargetVertex(); - Vector vertexOfTargets = new Vector(); - for(int k = 0; k < targetList.size(); k++){ - vertexOfTargets.add(vertexList.get(targetList.get(k))); - } - outputGraph.add(vertexOfTargets); - } - for(int i=0; i< outputGraph.size(); i++){ - Vector vert = outputGraph.get(i); - } - - vertexList.get(0).setActive(true); - vertexTraversed.add(vertexList.get(0)); - } - catch (Exception e) { - e.printStackTrace(); - } - - } - - //Set up the information showed in the screen of the current instruction. - public void setUpInstructionInfo( Graphics2D g2d){ - - FontRenderContext frc = g2d.getFontRenderContext(); - Font font = new Font("Digital-7", Font.PLAIN, 15); - Font fontTitle = new Font("Verdana", Font.PLAIN, 10); - - TextLayout textVariable; - if(instructionCode.substring(0,6).equals("000000")){ //R-type instructions description on screen definition. - textVariable = new TextLayout("REGISTER TYPE INSTRUCTION", new Font("Arial", Font.BOLD, 25), frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 280, 30); - //opcode label - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 530); - - //initialize of opcode - textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); - g2d.setColor(Color.magenta); - textVariable.draw(g2d, 25, 550); - - //rs label - textVariable = new TextLayout("rs", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 90, 530); - - //initialize of rs - textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); - g2d.setColor(Color.green); - textVariable.draw(g2d, 90, 550); - - //rt label - textVariable = new TextLayout("rt", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 150, 530); - - //initialize of rt - textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); - g2d.setColor(Color.blue); - textVariable.draw(g2d, 150, 550); - - // rd label - textVariable = new TextLayout("rd", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 210, 530); - - //initialize of rd - textVariable = new TextLayout(instructionCode.substring(16,21), font, frc); - g2d.setColor(Color.cyan); - textVariable.draw(g2d, 210, 550); - - //shamt label - textVariable = new TextLayout("shamt", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 270, 530); - - //initialize of shamt - textVariable = new TextLayout(instructionCode.substring(21,26), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 270, 550); - - //function label - textVariable = new TextLayout("function", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 330, 530); - - //initialize of function - textVariable = new TextLayout(instructionCode.substring(26,32), font, frc); - g2d.setColor(orange1); - textVariable.draw(g2d, 330, 550); - - - //instruction mnemonic - textVariable = new TextLayout("Instruction", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 480); - - //instruction name - textVariable = new TextLayout(functionEquivalenceTable.get(instructionCode.substring(26,32)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 25, 500); - - //register in RS - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 65, 500); - - //register in RT - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(16,21)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 105, 500); - - //register in RD - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(11,16)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 145, 500); - } - - else if(instructionCode.substring(0,6).matches("00001[0-1]")){ //jump intructions - textVariable = new TextLayout("JUMP TYPE INSTRUCTION", new Font("Verdana", Font.BOLD, 25), frc); //description of instruction code type for jump. - g2d.setColor(Color.black); - textVariable.draw(g2d, 280, 30); - - // label opcode - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 530); - - //initialize of opcode - textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); - g2d.setColor(Color.magenta); - textVariable.draw(g2d, 25, 550); - - //label address - textVariable = new TextLayout("address", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 95, 530); - - textVariable = new TextLayout("Instruction", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 480); - - //initialize of adress - textVariable = new TextLayout(instructionCode.substring(6,32), font, frc); - g2d.setColor(Color.orange); - textVariable.draw(g2d, 95, 550); - - //instruction mnemonic - textVariable= new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); - g2d.setColor(Color.cyan); - textVariable.draw(g2d, 65, 500); - - //instruction immediate - textVariable = new TextLayout("LABEL", font, frc); - g2d.setColor(Color.cyan); - textVariable.draw(g2d, 105, 500); - } - - else if(instructionCode.substring(0,6).matches("100[0-1][0-1][0-1]")){//load instruction - textVariable = new TextLayout("LOAD TYPE INSTRUCTION", new Font("Verdana", Font.BOLD, 25), frc); //description of instruction code type for load. - g2d.setColor(Color.black); - textVariable.draw(g2d, 280, 30); - //opcode label - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 530); - - //initialize of opcode - textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); - g2d.setColor(Color.magenta); - textVariable.draw(g2d, 25, 550); - - //rs label - textVariable = new TextLayout("rs", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 90, 530); - - //initialize of rs - textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); - g2d.setColor(Color.green); - textVariable.draw(g2d, 90, 550); - - //rt label - textVariable = new TextLayout("rt", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 145, 530); - - //initialize of rt - textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); - g2d.setColor(Color.blue); - textVariable.draw(g2d, 145, 550); - - // rd label - textVariable = new TextLayout("Immediate", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 200, 530); - - //initialize of rd - textVariable = new TextLayout(instructionCode.substring(16,32), font, frc); - g2d.setColor(orange1); - textVariable.draw(g2d, 200, 550); - - //instruction mnemonic - textVariable = new TextLayout("Instruction", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 480); - - textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 25, 500); - - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 65, 500); - - textVariable = new TextLayout("M[ "+ registerEquivalenceTable.get(instructionCode.substring(16,21)) + " + " + parseBinToInt(instructionCode.substring(6,32))+ " ]", font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 105, 500); - - //implement co-processors instruction - } - - else if(instructionCode.substring(0,6).matches("101[0-1][0-1][0-1]")){//store instruction - textVariable = new TextLayout("STORE TYPE INSTRUCTION", new Font("Verdana", Font.BOLD, 25), frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 280, 30); - //opcode label - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 530); - - //initialize of opcode - textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); - g2d.setColor(Color.magenta); - textVariable.draw(g2d, 25, 550); - - //rs label - textVariable = new TextLayout("rs", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 90, 530); - - //initialize of rs - textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); - g2d.setColor(Color.green); - textVariable.draw(g2d, 90, 550); - - //rt label - textVariable = new TextLayout("rt", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 145, 530); - - //initialize of rt - textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); - g2d.setColor(Color.blue); - textVariable.draw(g2d, 145, 550); - - // rd label - textVariable = new TextLayout("Immediate", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 200, 530); - - //initialize of rd - textVariable = new TextLayout(instructionCode.substring(16,32), font, frc); - g2d.setColor(orange1); - textVariable.draw(g2d, 200, 550); - - //instruction mnemonic - textVariable= new TextLayout("Instruction", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 480); - - textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 25, 500); - - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 65, 500); - - textVariable = new TextLayout("M[ "+ registerEquivalenceTable.get(instructionCode.substring(16,21)) + " + " + parseBinToInt(instructionCode.substring(6,32))+ " ]", font, frc); - g2d.setColor(Color.BLACK); - textVariable.draw(g2d, 105, 500); - - } - - else if(instructionCode.substring(0,6).matches("0100[0-1][0-1]")){ - //implement co-processors instruction - } - - else if(instructionCode.substring(0,6).matches("0001[0-1][0-1]")){ //branch instruction - textVariable = new TextLayout("BRANCH TYPE INSTRUCTION",new Font("Verdana", Font.BOLD, 25), frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 250, 30); - - //label opcode - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 440); - - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 530); - - //initialize of opcode - textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); - g2d.setColor(Color.magenta); - textVariable.draw(g2d, 25, 550); - - //rs label - textVariable = new TextLayout("rs", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 90, 530); - - //initialize of rs - textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); - g2d.setColor(Color.green); - textVariable.draw(g2d, 90, 550); - - //rt label - textVariable = new TextLayout("rt", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 145, 530); - - //initialize of rt - textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); - g2d.setColor(Color.blue); - textVariable.draw(g2d, 145, 550); - - // rd label - textVariable = new TextLayout("Immediate", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 200, 530); - - - //initialize of immediate - textVariable= new TextLayout(instructionCode.substring(16,32), font, frc); - g2d.setColor(Color.cyan); - textVariable.draw(g2d, 200, 550); - - //instruction mnemonic - textVariable = new TextLayout("Instruction", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 480); - - textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 25, 500); - - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 105, 500); - - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(11,16)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 65, 500); - - textVariable = new TextLayout(parseBinToInt(instructionCode.substring(16,32)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 155, 500); - } - else{ //imediate instructions - textVariable = new TextLayout("IMMEDIATE TYPE INSTRUCTION",new Font("Verdana", Font.BOLD, 25), frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 250, 30); - - //label opcode - textVariable = new TextLayout("opcode", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 530); - - //initialize of opcode - textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); - g2d.setColor(Color.magenta); - textVariable.draw(g2d, 25, 550); - - //rs label - textVariable = new TextLayout("rs", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 90, 530); - - //initialize of rs - textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); - g2d.setColor(Color.green); - textVariable.draw(g2d, 90, 550); - - //rt label - textVariable = new TextLayout("rt", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 145, 530); - - //initialize of rt - textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); - g2d.setColor(Color.blue); - textVariable.draw(g2d, 145, 550); - - // rd label - textVariable = new TextLayout("Immediate", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 200, 530); - - //initialize of immediate - textVariable= new TextLayout(instructionCode.substring(16,32), font, frc); - g2d.setColor(Color.cyan); - textVariable.draw(g2d, 200, 550); - - //instruction mnemonic - textVariable = new TextLayout("Instruction", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 480); - textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 25, 500); - - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 105, 500); - - textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(11,16)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 65, 500); - - textVariable = new TextLayout(parseBinToInt(instructionCode.substring(16,32)), font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 155, 500); - } - - //Type of control signal labels - textVariable = new TextLayout("Control Signals", fontTitle, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 440); - - textVariable = new TextLayout("Active", font, frc); - g2d.setColor(Color.red); - textVariable.draw(g2d, 25, 455); - - textVariable = new TextLayout("Inactive", font, frc); - g2d.setColor(Color.gray); - textVariable.draw(g2d, 75, 455); - - textVariable = new TextLayout("To see details of control units and register bank click inside the functional block", font, frc); - g2d.setColor(Color.black); - textVariable.draw(g2d, 400, 550); - } - //end of instruction subtitle... - - - //set the initial state of the variables that controls the animation, and start the timer that triggers the animation. - public void startAnimation(String codeInstruction){ - instructionCode = codeInstruction; - time = new Timer(PERIOD, this); // start timer - time.start(); - // this.repaint(); - } - - //initialize the image of datapath. - private void initImages(){ - try { - BufferedImage im = ImageIO.read( - getClass().getResource(Globals.imagesPath+"datapath.png") ); - - int transparency = im.getColorModel().getTransparency(); - datapath = gc.createCompatibleImage( - im.getWidth(), im.getHeight(), - transparency ); - g2d = datapath.createGraphics(); - g2d.drawImage(im,0,0,null); - g2d.dispose(); - } - catch(IOException e) { - System.out.println("Load Image error for " + - getClass().getResource(Globals.imagesPath+"datapath.png") + ":\n" + e); - } - } - - - public void actionPerformed(ActionEvent e) - // triggered by the timer: update, repaint - { - if (justStarted) - justStarted = false; - if(xIsMoving) - indexX++; - if(yIsMoving) - indexY--; - repaint(); - } - - - public void paintComponent(Graphics g) - { - super.paintComponent(g); - g2d = (Graphics2D)g; - // use antialiasing - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - // smoother (and slower) image transformations (e.g. for resizing) - g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, - RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2d = (Graphics2D)g; - drawImage(g2d, datapath, 0,0,null); - executeAnimation(g); - counter = (counter + 1)% 100; - g2d.dispose(); - - } - - private void drawImage(Graphics2D g2d, BufferedImage im, int x, int y,Color c){ - if (im == null) { - g2d.setColor(c); - g2d.fillOval(x, y, 20, 20); - g2d.setColor(Color.black); - g2d.drawString(" ", x, y); - } - else - g2d.drawImage(im, x, y, this); - } - - //draw lines. - //method to draw the lines that run from left to right. - public void printTrackLtoR(Vertex v){ - int size; - int[] track; - size = v.getEnd() - v.getInit(); - track = new int[size]; - for(int i = 0; i < size; i++) - track[i] = v.getInit()+i; - if(v.isActive() == true){ - v.setFirst_interaction(false); - for(int i = 0; i < size; i++){ - if(track[i] <= v.getCurrent()){ - g2d.setColor(v.getColor()); - g2d.fillRect(track[i], v.getOppositeAxis(), 3, 3); - } - } - if (v.getCurrent() == track[size-1]) - v.setActive(false); - v.setCurrent(v.getCurrent()+1); - } - else if(v.isFirst_interaction() == false){ - for(int i = 0; i < size ; i++){ - g2d.setColor(v.getColor()); - g2d.fillRect(track[i],v.getOppositeAxis(), 3, 3); - } - } - - } - - //method to draw the lines that run from right to left. - //public boolean printTrackRtoL(int init, int end ,int currentIndex, Graphics2D g2d, Color color, int otherAxis, - // boolean active, boolean firstInteraction){ - public void printTrackRtoL(Vertex v){ - int size; - int[] track; - size = v.getInit() - v.getEnd(); - track = new int[size]; - - for(int i = 0; i < size; i++) - track[i] = v.getInit()-i; - - if(v.isActive() == true){ - v.setFirst_interaction(false); - for(int i = 0; i < size; i++){ - if(track[i] >= v.getCurrent()){ - g2d.setColor(v.getColor()); - g2d.fillRect(track[i], v.getOppositeAxis(), 3, 3); - } - } - if (v.getCurrent() == track[size-1]) - v.setActive(false); - - v.setCurrent(v.getCurrent()-1); - } - else if(v.isFirst_interaction() == false){ - for(int i = 0; i < size ; i++){ - g2d.setColor(v.getColor()); - g2d.fillRect(track[i],v.getOppositeAxis(), 3, 3); - } - } - } - - //method to draw the lines that run from down to top. - // public boolean printTrackDtoU(int init, int end ,int currentIndex, Graphics2D g2d, Color color, int otherAxis, - // boolean active, boolean firstInteraction){ - public void printTrackDtoU(Vertex v){ - int size; - int[] track; - - if(v.getInit() > v.getEnd()){ - size = v.getInit() - v.getEnd(); - track = new int[size]; - for(int i = 0; i < size; i++) - track[i] = v.getInit()-i; - } - else{ - size = v.getEnd() - v.getInit(); - track = new int[size]; - for(int i = 0; i < size; i++) - track[i] = v.getInit()+i; - } - - if(v.isActive() == true){ - v.setFirst_interaction(false); - for(int i = 0; i < size; i++){ - if(track[i] >= v.getCurrent()){ - g2d.setColor(v.getColor()); - g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); - } - } - if (v.getCurrent() == track[size-1]) - v.setActive(false); - v.setCurrent(v.getCurrent()-1); - - } - else if(v.isFirst_interaction() == false){ - for(int i = 0; i < size; i++){ - g2d.setColor(v.getColor()); - g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); - } - } - } - //method to draw the lines that run from top to down. - // public boolean printTrackUtoD(int init, int end ,int currentIndex, Graphics2D g2d, Color color, int otherAxis, - // boolean active, boolean firstInteraction){ - public void printTrackUtoD(Vertex v){ - - int size; - int[] track; - size = v.getEnd() - v.getInit(); - track = new int[size]; - - for(int i = 0; i < size; i++) - track[i] = v.getInit()+i; - - if(v.isActive() == true){ - v.setFirst_interaction(false); - for(int i = 0; i < size; i++){ - if(track[i] <= v.getCurrent()){ - g2d.setColor(v.getColor()); - g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); - } - - } - if (v.getCurrent() == track[size-1]) - v.setActive(false); - v.setCurrent(v.getCurrent()+1); - } - else if(v.isFirst_interaction() == false){ - for(int i = 0; i < size; i++){ - g2d.setColor(v.getColor()); - g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); - } - } - } - - public void printTextDtoU(Vertex v){ - int size; - int[] track; - FontRenderContext frc = g2d.getFontRenderContext(); - - TextLayout actionInFunctionalBlock = new TextLayout(v.getName(), new Font("Verdana", Font.BOLD, 13), frc); - g2d.setColor(Color.RED); - - if(instructionCode.substring(0,6).matches("101[0-1][0-1][0-1]") - &&!instructionCode.substring(0,6).matches("0001[0-1][0-1]") - &&!instructionCode.substring(0,6).matches("00001[0-1]")){//load instruction - actionInFunctionalBlock = new TextLayout(" ", new Font("Verdana", Font.BOLD, 13), frc); - } - if(v.getName().equals("ALUVALUE")){ - if( instructionCode.substring(0,6).equals("000000"))//R-type instruction - actionInFunctionalBlock = new TextLayout(functionEquivalenceTable.get(instructionCode.substring(26,32)), new Font("Verdana", Font.BOLD, 13), frc); - else //other instructions - actionInFunctionalBlock = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), new Font("Verdana", Font.BOLD, 13), frc); - } - - if(instructionCode.substring(0,6).matches("0001[0-1][0-1]")&& v.getName().equals("CP+4")) //branch code - actionInFunctionalBlock = new TextLayout("PC+OFFSET", new Font("Verdana", Font.BOLD, 13), frc); - - if(v.getName().equals("WRITING")){ - if(!instructionCode.substring(0,6).matches("100[0-1][0-1][0-1]")) - actionInFunctionalBlock = new TextLayout(" ", new Font("Verdana", Font.BOLD, 13), frc); - } - if(v.isActive() == true){ - v.setFirst_interaction(false); - actionInFunctionalBlock.draw(g2d, v.getOppositeAxis(), v.getCurrent()); - if (v.getCurrent() == v.getEnd()) - v.setActive(false); - v.setCurrent(v.getCurrent()-1); - } - - - } - - //convert binnary value to integer. - public String parseBinToInt(String code){ - int value = 0; - - for(int i =code.length()-1; i >= 0; i--){ - if("1".equals(code.substring(i,i+1))){ - value = value + (int)Math.pow(2,code.length()-i-1); - } - } - - return Integer.toString(value); - } - - //set and execute the information about the current position of each line of information in the animation, - //verifies the previous status of the animation and increment the position of each line that interconnect the unit function. - private void executeAnimation(Graphics g){ - g2d = (Graphics2D)g; - setUpInstructionInfo(g2d); - Vertex vert; - for(int i = 0; i < vertexTraversed.size(); i++){ - vert = vertexTraversed.get(i); - if(vert.isMovingXaxis == true){ - if(vert.getDirection() == vert.movingLeft){ - printTrackLtoR(vert); - if(vert.isActive() == false){ - int j = vert.getTargetVertex().size(); - Vertex tempVertex; - for(int k = 0; k < j; k++){ - tempVertex = outputGraph.get(vert.getNumIndex()).get(k); - Boolean hasThisVertex = false; - for(int m = 0 ; m < vertexTraversed.size(); m++){ - if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) - hasThisVertex = true; - } - if(hasThisVertex == false){ - outputGraph.get(vert.getNumIndex()).get(k).setActive(true); - vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); - } - } - } - } - else{ - printTrackRtoL(vert); - if(vert.isActive() == false){ - int j = vert.getTargetVertex().size(); - Vertex tempVertex; - for(int k = 0; k < j; k++){ - tempVertex = outputGraph.get(vert.getNumIndex()).get(k); - Boolean hasThisVertex = false; - for(int m = 0 ; m < vertexTraversed.size(); m++){ - if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) - hasThisVertex = true; - } - if(hasThisVertex == false){ - outputGraph.get(vert.getNumIndex()).get(k).setActive(true); - vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); - } - } - } - } - } //end of condition of X axis - else{ - if(vert.getDirection() == vert.movingDownside){ - if(vert.isText == true) - printTextDtoU(vert); - else - printTrackDtoU(vert); - - if(vert.isActive() == false){ - int j = vert.getTargetVertex().size(); - Vertex tempVertex; - for(int k = 0; k < j; k++){ - tempVertex = outputGraph.get(vert.getNumIndex()).get(k); - Boolean hasThisVertex = false; - for(int m = 0 ; m < vertexTraversed.size(); m++){ - if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) - hasThisVertex = true; - } - if(hasThisVertex == false){ - outputGraph.get(vert.getNumIndex()).get(k).setActive(true); - vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); - } - } - } - - } - else{ - - printTrackUtoD(vert); - if(vert.isActive() == false){ - int j = vert.getTargetVertex().size(); - Vertex tempVertex; - for(int k = 0; k < j; k++){ - tempVertex = outputGraph.get(vert.getNumIndex()).get(k); - Boolean hasThisVertex = false; - for(int m = 0 ; m < vertexTraversed.size(); m++){ - if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) - hasThisVertex = true; - } - if(hasThisVertex == false){ - outputGraph.get(vert.getNumIndex()).get(k).setActive(true); - vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); - } - } - } - } - } - } - } - - @Override - public void mouseClicked(MouseEvent e) { - - PointerInfo a = MouseInfo.getPointerInfo(); - //limpar a imagem do painel e iniciar o detalhe da unidade funcional. - - - if(e.getPoint().getX() > 425 && e.getPoint().getX() < 520 && e.getPoint().getY() > 300 && e.getPoint().getY() < 425){ - buildMainDisplayArea("register.png"); - FunctionUnitVisualization fu = new FunctionUnitVisualization(instructionBinary, register); - fu.run(); - } - - if(e.getPoint().getX() > 355 && e.getPoint().getX() < 415 && e.getPoint().getY() > 180 && e.getPoint().getY() < 280){ - buildMainDisplayArea("control.png"); - FunctionUnitVisualization fu = new FunctionUnitVisualization(instructionBinary, control); - fu.run(); - } - - if(e.getPoint().getX() > 560 && e.getPoint().getX() < 620 && e.getPoint().getY() > 450 && e.getPoint().getY() < 520){ - buildMainDisplayArea("ALUcontrol.png"); - FunctionUnitVisualization fu = new FunctionUnitVisualization(instructionBinary, aluControl); - fu.run(); - } - - } - - @Override - public void mouseEntered(MouseEvent e) { - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public void mouseReleased(MouseEvent e) { - } - } -} +package mars.tools; + +import mars.Globals; +import mars.ProgramStatement; +import mars.mips.hardware.AccessNotice; +import mars.mips.hardware.AddressErrorException; +import mars.mips.hardware.Memory; +import mars.mips.hardware.MemoryAccessNotice; +import mars.mips.instructions.BasicInstruction; +import mars.mips.instructions.BasicInstructionFormat; +import mars.venus.RunAssembleAction; +import mars.venus.RunBackstepAction; +import mars.venus.RunStepAction; +import mars.venus.VenusUI; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import javax.imageio.ImageIO; +import javax.swing.*; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.awt.*; +import java.awt.event.*; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Observable; +import java.util.Vector; + +public class MipsXray extends AbstractMarsToolAndApplication{ + private static final long serialVersionUID = -1L; + private static String heading = "MIPS X-Ray - Animation of MIPS Datapath"; + private static String version = " Version 2.0"; + + protected Graphics g; + protected int lastAddress = -1; //address of instruction in memory + protected JLabel label; + private Container painel = this.getContentPane(); + private DatapathAnimation datapathAnimation; //class panel that runs datapath animation. + + private GraphicsConfiguration gc; + private BufferedImage datapath; + private String instructionBinary; + + //Components to add menu bar in the plugin window. + private JButton Assemble, Step, runBackStep; + private Action runAssembleAction, runStepAction, runBackstepAction; + + private VenusUI mainUI; + private JToolBar toolbar; + private Timer time; + + public MipsXray(String title, String heading) { + super(title,heading); + } + + /** + * Simple constructor, likely used by the MipsXray menu mechanism + */ + public MipsXray() { + super (heading+", "+version, heading); + } + + + /** + * Required method to return Tool name. + * @return Tool name. MARS will display this in menu item. + */ + public String getName() { + return "MIPS X-Ray"; + } + + /** + * Overrides default method, to provide a Help button for this tool/app. + */ + protected JComponent getHelpComponent() { + final String helpContent = + "This plugin is used to visualizate the behavior of mips processor using the default datapath. \n" + + "It reads the source code instruction and generates an animation representing the inputs and \n" + + "outputs of functional blocks and the interconnection between them. The basic signals \n" + + "represented are, control signals, opcode bits and data of functional blocks.\n" + + "\n" + + "Besides the datapath representation, information for each instruction is displayed below\n" + + "the datapath. That display includes opcode value, with the correspondent colors used to\n" + + "represent the signals in datapath, mnemonic of the instruction processed at the moment, registers\n" + + "used in the instruction and a label that indicates the color code used to represent control signals\n" + + "\n" + + "To see the datapath of register bank and control units click inside the functional unit.\n\n" + + "Version 2.0\n" + + "Developed by Márcio Roberto, Guilherme Sales, Fabrício Vivas, Flávio Cardeal and Fábio Lúcio\n" + + "Contact Marcio Roberto at marcio.rdaraujo@gmail.com with questions or comments.\n"; + JButton help = new JButton("Help"); + help.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + JOptionPane.showMessageDialog(theWindow, helpContent); + } + }); + return help; + } + /** + * Implementation of the inherited abstract method to build the main + * display area of the GUI. It will be placed in the CENTER area of a + * BorderLayout. The title is in the NORTH area, and the controls are + * in the SOUTH area. + */ + protected JComponent buildAnimationSequence(){ + JPanel image = new JPanel(new GridBagLayout()); + return image; + } + + // Insert image in the panel and configure the parameters to run animation. + protected JComponent buildMainDisplayArea() { + mainUI = Globals.getGui(); + this.createActionObjects(); + toolbar= this.setUpToolBar(); + +// JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); + try { + BufferedImage im = ImageIO.read( + getClass().getResource(Globals.imagesPath+"datapath.png") ); + + int transparency = im.getColorModel().getTransparency(); + datapath = gc.createCompatibleImage( im.getWidth(), im.getHeight(), + transparency ); + + Graphics2D g2d = datapath.createGraphics(); // graphics context + g2d.drawImage(im,0,0,null); + g2d.dispose(); + + } + catch(IOException e) { + System.out.println("Load Image error for " + + getClass().getResource(Globals.imagesPath+"datapath.png") + ":\n" + e); + e.printStackTrace(); + } + System.setProperty("sun.java2d.translaccel", "true"); + ImageIcon icon = new ImageIcon(getClass().getResource(Globals.imagesPath+"datapath.png")); + Image im = icon.getImage(); + icon = new ImageIcon(im); + + JLabel label = new JLabel(icon); + painel.add(label, BorderLayout.WEST); + painel.add(toolbar, BorderLayout.NORTH); + this.setResizable(false); + return (JComponent) painel; + } + + protected JComponent buildMainDisplayArea(String figure) { + mainUI = Globals.getGui(); + this.createActionObjects(); + toolbar= this.setUpToolBar(); + +// JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); + try { + BufferedImage im = ImageIO.read( + getClass().getResource(Globals.imagesPath+figure) ); + + int transparency = im.getColorModel().getTransparency(); + datapath = gc.createCompatibleImage( im.getWidth(), im.getHeight(), + transparency ); + + Graphics2D g2d = datapath.createGraphics(); // graphics context + g2d.drawImage(im,0,0,null); + g2d.dispose(); + + } + catch(IOException e) { + System.out.println("Load Image error for " + + getClass().getResource(Globals.imagesPath+figure) + ":\n" + e); + e.printStackTrace(); + } + System.setProperty("sun.java2d.translaccel", "true"); + ImageIcon icon = new ImageIcon(getClass().getResource(Globals.imagesPath+figure)); + Image im = icon.getImage(); + icon = new ImageIcon(im); + + JLabel label = new JLabel(icon); + painel.add(label, BorderLayout.WEST); + painel.add(toolbar, BorderLayout.NORTH); + this.setResizable(false); + return (JComponent) painel; + } + + protected void addAsObserver() { + addAsObserver(Memory.textBaseAddress, Memory.textLimitAddress); + } + + //Function that gets the current instruction in memory and start animation with the selected instruction. + protected void processMIPSUpdate(Observable resource, AccessNotice notice) { + + if (!notice.accessIsFromMIPS()) return; + if (notice.getAccessType() != AccessNotice.READ) return; + MemoryAccessNotice man = (MemoryAccessNotice) notice; + int currentAdress = man.getAddress(); + + if (currentAdress == lastAddress) return; + lastAddress = currentAdress; + ProgramStatement stmt; + + try { + BasicInstruction instr = null; + stmt = Memory.getInstance().getStatement(currentAdress); + if(stmt == null){ + return; + } + + instr = (BasicInstruction) stmt.getInstruction(); + instructionBinary = stmt.getMachineStatement(); + BasicInstructionFormat format = instr.getInstructionFormat(); + + painel.removeAll(); + datapathAnimation = new DatapathAnimation(instructionBinary); + this.createActionObjects(); + toolbar= this.setUpToolBar(); + painel.add(toolbar, BorderLayout.NORTH); + painel.add(datapathAnimation, BorderLayout.WEST); + datapathAnimation.startAnimation(instructionBinary ); + + } catch (AddressErrorException e) { + e.printStackTrace(); + } + + + } + + public void updateDisplay(){ + this.repaint(); + } + + //set the tool bar that controls the step in a time instruction running. + private JToolBar setUpToolBar() { + JToolBar toolBar = new JToolBar(); + Assemble = new JButton(runAssembleAction); + Assemble.setText(""); + runBackStep = new JButton(runBackstepAction); + runBackStep.setText(""); + + Step = new JButton(runStepAction); + Step.setText(""); + toolBar.add(Assemble); + toolBar.add(Step); + + return toolBar; + } + + //set action in the menu bar. + private void createActionObjects() { + Toolkit tk = Toolkit.getDefaultToolkit(); + Class cs = this.getClass(); + try{ + runAssembleAction = new RunAssembleAction("Assemble", + new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Assemble22.png"))), + "Assemble the current file and clear breakpoints", new Integer(KeyEvent.VK_A), + KeyStroke.getKeyStroke( KeyEvent.VK_F3, 0), + mainUI); + + runStepAction = new RunStepAction("Step", + new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepForward22.png"))), + "Run one step at a time", new Integer(KeyEvent.VK_T), + KeyStroke.getKeyStroke( KeyEvent.VK_F7, 0), + mainUI); + runBackstepAction = new RunBackstepAction("Backstep", + new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepBack22.png"))), + "Undo the last step", new Integer(KeyEvent.VK_B), + KeyStroke.getKeyStroke( KeyEvent.VK_F8, 0), + mainUI); + } + catch(Exception e){ + System.out.println("Internal Error: images folder not found, or other null pointer exception while creating Action objects"); + e.printStackTrace(); + System.exit(0); + } + } + + +class Vertex { + private int numIndex; + private int init; + private int end; + private int current; + private String name; + public static final int movingUpside = 1; + public static final int movingDownside = 2; + public static final int movingLeft = 3; + public static final int movingRight = 4; + public int direction; + public int oppositeAxis; + private boolean isMovingXaxis; + private Color color; + private boolean first_interaction; + private boolean active; + private boolean isText; + private ArrayList targetVertex; + + public Vertex(int index, int init, int end, String name, int oppositeAxis, boolean isMovingXaxis, + String listOfColors, String listTargetVertex, boolean isText){ + this.numIndex = index; + this.init = init; + this.current = this.init; + this.end = end; + this.name = name; + this.oppositeAxis = oppositeAxis; + this.isMovingXaxis = isMovingXaxis; + this.first_interaction = true; + this.active = false; + this.isText = isText; + this.color = new Color(0,153,0); + if(isMovingXaxis == true){ + if( init < end) + direction = movingLeft; + else + direction = movingRight; + + } + else{ + if( init < end) + direction = movingUpside; + else + direction = movingDownside; + } + String[] list = listTargetVertex.split("#"); + targetVertex = new ArrayList(); + for(int i = 0; i < list.length; i++){ + targetVertex.add(Integer.parseInt(list[i])); + // System.out.println("Adding " + i + " " + Integer.parseInt(list[i])+ " in target"); + } + String[] listColor = listOfColors.split("#"); + this.color = new Color(Integer.parseInt(listColor[0]) , Integer.parseInt(listColor[1]), Integer.parseInt(listColor[2]) ); + } + + public int getDirection(){ + return direction; + } + + public boolean isText(){ + return this.isText; + } + + + public ArrayList getTargetVertex() { + return targetVertex; + } + + public int getNumIndex() { + return numIndex; + } + public void setNumIndex(int numIndex) { + this.numIndex = numIndex; + } + public int getInit() { + return init; + } + public void setInit(int init) { + this.init = init; + } + public int getEnd() { + return end; + } + public void setEnd(int end) { + this.end = end; + } + public int getCurrent() { + return current; + } + public void setCurrent(int current) { + this.current = current; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public int getOppositeAxis() { + return oppositeAxis; + } + public void setOppositeAxis(int oppositeAxis) { + this.oppositeAxis = oppositeAxis; + } + public boolean isMovingXaxis() { + return isMovingXaxis; + } + public void setMovingXaxis(boolean isMovingXaxis) { + this.isMovingXaxis = isMovingXaxis; + } + public Color getColor() { + return color; + } + public void setColor(Color color) { + this.color = color; + } + public boolean isFirst_interaction() { + return first_interaction; + } + public void setFirst_interaction(boolean first_interaction) { + this.first_interaction = first_interaction; + } + public boolean isActive() { + return active; + } + public void setActive(boolean active) { + this.active = active; + } +} + + +//Internal class that set the parameters value, control the basic behavior of the animation , and execute the animation of the +//selected instruction in memory. +class DatapathAnimation extends JPanel + implements ActionListener, MouseListener { + /** + * + */ + private static final long serialVersionUID = -2681757800180958534L; + + //config variables + private int PERIOD = 5; // velocity of frames in ms + private static final int PWIDTH = 1000; // size of this panel + private static final int PHEIGHT = 574; + private GraphicsConfiguration gc; + private GraphicsDevice gd; // for reporting accl. memory usage + private int accelMemory; + private DecimalFormat df; + + private int counter; //verify then remove. + private boolean justStarted; //flag to start movement + + + private int indexX; //counter of screen position + private int indexY; + private boolean xIsMoving, yIsMoving; //flag for mouse movement. + + + +// private Vertex[][] inputGraph; + private Vector> outputGraph; + private ArrayList vertexList; + private ArrayList vertexTraversed; + //Screen Label variables + + private HashMap opcodeEquivalenceTable; + private HashMap functionEquivalenceTable; + private HashMap registerEquivalenceTable; + + private String instructionCode; + + private int countRegLabel; + private int countALULabel; + private int countPCLabel; + + //Colors variables + private Color green1 = new Color(0,153,0); + private Color green2 = new Color( 0,77,0); + private Color yellow2 = new Color(185,182,42); + private Color orange1 = new Color(255,102,0); + private Color orange = new Color(119,34,34); + private Color blue2 = new Color(0,153,255); + + private int register = 1; + private int control = 2; + private int aluControl = 3; + private int alu = 4; + private int currentUnit; + private Graphics2D g2d; + + + private BufferedImage datapath; + + public void mousePressed(MouseEvent e) { + PointerInfo a = MouseInfo.getPointerInfo(); + // System.out.println("olha, capturado x=" + a.getLocation().getX() + " y = " + a.getLocation().getY()); + } + + public DatapathAnimation(String instructionBinary) + { + df = new DecimalFormat("0.0"); // 1 dp + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + gd = ge.getDefaultScreenDevice(); + gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); + + accelMemory = gd.getAvailableAcceleratedMemory(); // in bytes + setBackground(Color.white); + setPreferredSize( new Dimension(PWIDTH, PHEIGHT) ); + + // load and initialise the images + initImages(); + + vertexList = new ArrayList(); + counter = 0; + justStarted = true; + instructionCode = instructionBinary; + + //declaration of labels definition. + opcodeEquivalenceTable = new HashMap(); + functionEquivalenceTable = new HashMap(); + registerEquivalenceTable = new HashMap(); + + countRegLabel = 400; + countALULabel = 380; + countPCLabel = 380; + loadHashMapValues(); + addMouseListener(this); + + + + } // end of ImagesTests() + + //set the binnary opcode value of the basic instructions of MIPS instruction set + public void loadHashMapValues(){ + importXmlStringData("/MipsXRayOpcode.xml",opcodeEquivalenceTable, "equivalence", "bits", "mnemonic"); + importXmlStringData("/MipsXRayOpcode.xml", functionEquivalenceTable, "function_equivalence", "bits", "mnemonic"); + importXmlStringData("/MipsXRayOpcode.xml", registerEquivalenceTable, "register_equivalence", "bits", "mnemonic"); + importXmlDatapathMap("/MipsXRayOpcode.xml", "datapath_map"); + } + + //import the list of opcodes of mips set of instructions + public void importXmlStringData(String xmlName, HashMap table, String elementTree, String tagId, String tagData){ + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(false); + DocumentBuilder docBuilder; + try { + //System.out.println(); + docBuilder = dbf.newDocumentBuilder(); + Document doc = docBuilder.parse(getClass().getResource(xmlName).toString()); + Element root = doc.getDocumentElement(); + Element equivalenceItem; + NodeList bitsList, mnemonic; + NodeList equivalenceList = root.getElementsByTagName(elementTree); + for(int i = 0; i < equivalenceList.getLength(); i++){ + equivalenceItem = (Element)equivalenceList.item(i); + bitsList = equivalenceItem.getElementsByTagName(tagId); + mnemonic = equivalenceItem.getElementsByTagName(tagData); + for(int j= 0; j < bitsList.getLength(); j++){ + table.put(bitsList.item(j).getTextContent(),mnemonic.item(j).getTextContent()); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + //import the parameters of the animation on datapath + public void importXmlDatapathMap(String xmlName, String elementTree){ + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(false); + DocumentBuilder docBuilder; + try { + docBuilder = dbf.newDocumentBuilder(); + Document doc = docBuilder.parse(getClass().getResource(xmlName).toString()); + Element root = doc.getDocumentElement(); + Element datapath_mapItem; + NodeList index_vertex, name, init, end,color, other_axis, isMovingXaxis, targetVertex, sourceVertex, isText ; + NodeList datapath_mapList = root.getElementsByTagName(elementTree); + for(int i = 0; i < datapath_mapList.getLength(); i++){ //extract the vertex of the xml input and encapsulate into the vertex object + datapath_mapItem = (Element)datapath_mapList.item(i); + index_vertex = datapath_mapItem.getElementsByTagName("num_vertex"); + name = datapath_mapItem.getElementsByTagName("name"); + init = datapath_mapItem.getElementsByTagName("init"); + end = datapath_mapItem.getElementsByTagName("end"); + //definition of colors line + if(instructionCode.substring(0,6).equals("000000")){//R-type instructions + color = datapath_mapItem.getElementsByTagName("color_Rtype"); + //System.out.println("rtype"); + } + else if(instructionCode.substring(0,6).matches("00001[0-1]")){ //J-type instructions + color = datapath_mapItem.getElementsByTagName("color_Jtype"); + //System.out.println("jtype"); + } + else if(instructionCode.substring(0,6).matches("100[0-1][0-1][0-1]")){ //LOAD type instructions + color = datapath_mapItem.getElementsByTagName("color_LOADtype"); + //System.out.println("load type"); + } + else if(instructionCode.substring(0,6).matches("101[0-1][0-1][0-1]")){ //LOAD type instructions + color = datapath_mapItem.getElementsByTagName("color_STOREtype"); + //System.out.println("store type"); + } + else if(instructionCode.substring(0,6).matches("0001[0-1][0-1]")){ //BRANCH type instructions + color = datapath_mapItem.getElementsByTagName("color_BRANCHtype"); + //System.out.println("branch type"); + } + else{ //BRANCH type instructions + color = datapath_mapItem.getElementsByTagName("color_Itype"); + //System.out.println("immediate type"); + } + + other_axis = datapath_mapItem.getElementsByTagName("other_axis"); + isMovingXaxis = datapath_mapItem.getElementsByTagName("isMovingXaxis"); + targetVertex = datapath_mapItem.getElementsByTagName("target_vertex"); + isText = datapath_mapItem.getElementsByTagName("is_text"); + + for(int j= 0; j < index_vertex.getLength(); j++){ + Vertex vert = new Vertex(Integer.parseInt(index_vertex.item(j).getTextContent()), Integer.parseInt(init.item(j).getTextContent()), + Integer.parseInt(end.item(j).getTextContent()), name.item(j).getTextContent(), Integer.parseInt(other_axis.item(j).getTextContent()), + Boolean.parseBoolean(isMovingXaxis.item(j).getTextContent()), color.item(j).getTextContent(), targetVertex.item(j).getTextContent(), Boolean.parseBoolean(isText.item(j).getTextContent())); + vertexList.add(vert); + } + } + //loading matrix of control of vertex. + outputGraph = new Vector>(); + vertexTraversed = new ArrayList(); + int size = vertexList.size(); + Vertex vertex; + ArrayList targetList; + for(int i = 0; i < vertexList.size(); i++){ + vertex = vertexList.get(i); + targetList = vertex.getTargetVertex(); + Vector vertexOfTargets = new Vector(); + for(int k = 0; k < targetList.size(); k++){ + vertexOfTargets.add(vertexList.get(targetList.get(k))); + } + outputGraph.add(vertexOfTargets); + } + for(int i=0; i< outputGraph.size(); i++){ + Vector vert = outputGraph.get(i); + } + + vertexList.get(0).setActive(true); + vertexTraversed.add(vertexList.get(0)); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + //Set up the information showed in the screen of the current instruction. + public void setUpInstructionInfo( Graphics2D g2d){ + + FontRenderContext frc = g2d.getFontRenderContext(); + Font font = new Font("Digital-7", Font.PLAIN, 15); + Font fontTitle = new Font("Verdana", Font.PLAIN, 10); + + TextLayout textVariable; + if(instructionCode.substring(0,6).equals("000000")){ //R-type instructions description on screen definition. + textVariable = new TextLayout("REGISTER TYPE INSTRUCTION", new Font("Arial", Font.BOLD, 25), frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 280, 30); + //opcode label + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 530); + + //initialize of opcode + textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); + g2d.setColor(Color.magenta); + textVariable.draw(g2d, 25, 550); + + //rs label + textVariable = new TextLayout("rs", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 90, 530); + + //initialize of rs + textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); + g2d.setColor(Color.green); + textVariable.draw(g2d, 90, 550); + + //rt label + textVariable = new TextLayout("rt", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 150, 530); + + //initialize of rt + textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); + g2d.setColor(Color.blue); + textVariable.draw(g2d, 150, 550); + + // rd label + textVariable = new TextLayout("rd", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 210, 530); + + //initialize of rd + textVariable = new TextLayout(instructionCode.substring(16,21), font, frc); + g2d.setColor(Color.cyan); + textVariable.draw(g2d, 210, 550); + + //shamt label + textVariable = new TextLayout("shamt", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 270, 530); + + //initialize of shamt + textVariable = new TextLayout(instructionCode.substring(21,26), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 270, 550); + + //function label + textVariable = new TextLayout("function", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 330, 530); + + //initialize of function + textVariable = new TextLayout(instructionCode.substring(26,32), font, frc); + g2d.setColor(orange1); + textVariable.draw(g2d, 330, 550); + + + //instruction mnemonic + textVariable = new TextLayout("Instruction", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 480); + + //instruction name + textVariable = new TextLayout(functionEquivalenceTable.get(instructionCode.substring(26,32)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 25, 500); + + //register in RS + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 65, 500); + + //register in RT + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(16,21)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 105, 500); + + //register in RD + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(11,16)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 145, 500); + } + + else if(instructionCode.substring(0,6).matches("00001[0-1]")){ //jump intructions + textVariable = new TextLayout("JUMP TYPE INSTRUCTION", new Font("Verdana", Font.BOLD, 25), frc); //description of instruction code type for jump. + g2d.setColor(Color.black); + textVariable.draw(g2d, 280, 30); + + // label opcode + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 530); + + //initialize of opcode + textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); + g2d.setColor(Color.magenta); + textVariable.draw(g2d, 25, 550); + + //label address + textVariable = new TextLayout("address", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 95, 530); + + textVariable = new TextLayout("Instruction", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 480); + + //initialize of adress + textVariable = new TextLayout(instructionCode.substring(6,32), font, frc); + g2d.setColor(Color.orange); + textVariable.draw(g2d, 95, 550); + + //instruction mnemonic + textVariable= new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); + g2d.setColor(Color.cyan); + textVariable.draw(g2d, 65, 500); + + //instruction immediate + textVariable = new TextLayout("LABEL", font, frc); + g2d.setColor(Color.cyan); + textVariable.draw(g2d, 105, 500); + } + + else if(instructionCode.substring(0,6).matches("100[0-1][0-1][0-1]")){//load instruction + textVariable = new TextLayout("LOAD TYPE INSTRUCTION", new Font("Verdana", Font.BOLD, 25), frc); //description of instruction code type for load. + g2d.setColor(Color.black); + textVariable.draw(g2d, 280, 30); + //opcode label + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 530); + + //initialize of opcode + textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); + g2d.setColor(Color.magenta); + textVariable.draw(g2d, 25, 550); + + //rs label + textVariable = new TextLayout("rs", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 90, 530); + + //initialize of rs + textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); + g2d.setColor(Color.green); + textVariable.draw(g2d, 90, 550); + + //rt label + textVariable = new TextLayout("rt", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 145, 530); + + //initialize of rt + textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); + g2d.setColor(Color.blue); + textVariable.draw(g2d, 145, 550); + + // rd label + textVariable = new TextLayout("Immediate", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 200, 530); + + //initialize of rd + textVariable = new TextLayout(instructionCode.substring(16,32), font, frc); + g2d.setColor(orange1); + textVariable.draw(g2d, 200, 550); + + //instruction mnemonic + textVariable = new TextLayout("Instruction", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 480); + + textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 25, 500); + + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 65, 500); + + textVariable = new TextLayout("M[ "+ registerEquivalenceTable.get(instructionCode.substring(16,21)) + " + " + parseBinToInt(instructionCode.substring(6,32))+ " ]", font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 105, 500); + + //implement co-processors instruction + } + + else if(instructionCode.substring(0,6).matches("101[0-1][0-1][0-1]")){//store instruction + textVariable = new TextLayout("STORE TYPE INSTRUCTION", new Font("Verdana", Font.BOLD, 25), frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 280, 30); + //opcode label + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 530); + + //initialize of opcode + textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); + g2d.setColor(Color.magenta); + textVariable.draw(g2d, 25, 550); + + //rs label + textVariable = new TextLayout("rs", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 90, 530); + + //initialize of rs + textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); + g2d.setColor(Color.green); + textVariable.draw(g2d, 90, 550); + + //rt label + textVariable = new TextLayout("rt", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 145, 530); + + //initialize of rt + textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); + g2d.setColor(Color.blue); + textVariable.draw(g2d, 145, 550); + + // rd label + textVariable = new TextLayout("Immediate", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 200, 530); + + //initialize of rd + textVariable = new TextLayout(instructionCode.substring(16,32), font, frc); + g2d.setColor(orange1); + textVariable.draw(g2d, 200, 550); + + //instruction mnemonic + textVariable= new TextLayout("Instruction", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 480); + + textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 25, 500); + + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 65, 500); + + textVariable = new TextLayout("M[ "+ registerEquivalenceTable.get(instructionCode.substring(16,21)) + " + " + parseBinToInt(instructionCode.substring(6,32))+ " ]", font, frc); + g2d.setColor(Color.BLACK); + textVariable.draw(g2d, 105, 500); + + } + + else if(instructionCode.substring(0,6).matches("0100[0-1][0-1]")){ + //implement co-processors instruction + } + + else if(instructionCode.substring(0,6).matches("0001[0-1][0-1]")){ //branch instruction + textVariable = new TextLayout("BRANCH TYPE INSTRUCTION",new Font("Verdana", Font.BOLD, 25), frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 250, 30); + + //label opcode + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 440); + + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 530); + + //initialize of opcode + textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); + g2d.setColor(Color.magenta); + textVariable.draw(g2d, 25, 550); + + //rs label + textVariable = new TextLayout("rs", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 90, 530); + + //initialize of rs + textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); + g2d.setColor(Color.green); + textVariable.draw(g2d, 90, 550); + + //rt label + textVariable = new TextLayout("rt", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 145, 530); + + //initialize of rt + textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); + g2d.setColor(Color.blue); + textVariable.draw(g2d, 145, 550); + + // rd label + textVariable = new TextLayout("Immediate", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 200, 530); + + + //initialize of immediate + textVariable= new TextLayout(instructionCode.substring(16,32), font, frc); + g2d.setColor(Color.cyan); + textVariable.draw(g2d, 200, 550); + + //instruction mnemonic + textVariable = new TextLayout("Instruction", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 480); + + textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 25, 500); + + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 105, 500); + + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(11,16)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 65, 500); + + textVariable = new TextLayout(parseBinToInt(instructionCode.substring(16,32)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 155, 500); + } + else{ //imediate instructions + textVariable = new TextLayout("IMMEDIATE TYPE INSTRUCTION",new Font("Verdana", Font.BOLD, 25), frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 250, 30); + + //label opcode + textVariable = new TextLayout("opcode", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 530); + + //initialize of opcode + textVariable = new TextLayout(instructionCode.substring(0,6), font, frc); + g2d.setColor(Color.magenta); + textVariable.draw(g2d, 25, 550); + + //rs label + textVariable = new TextLayout("rs", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 90, 530); + + //initialize of rs + textVariable = new TextLayout(instructionCode.substring(6,11), font, frc); + g2d.setColor(Color.green); + textVariable.draw(g2d, 90, 550); + + //rt label + textVariable = new TextLayout("rt", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 145, 530); + + //initialize of rt + textVariable = new TextLayout(instructionCode.substring(11,16), font, frc); + g2d.setColor(Color.blue); + textVariable.draw(g2d, 145, 550); + + // rd label + textVariable = new TextLayout("Immediate", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 200, 530); + + //initialize of immediate + textVariable= new TextLayout(instructionCode.substring(16,32), font, frc); + g2d.setColor(Color.cyan); + textVariable.draw(g2d, 200, 550); + + //instruction mnemonic + textVariable = new TextLayout("Instruction", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 480); + textVariable = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 25, 500); + + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(6,11)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 105, 500); + + textVariable = new TextLayout(registerEquivalenceTable.get(instructionCode.substring(11,16)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 65, 500); + + textVariable = new TextLayout(parseBinToInt(instructionCode.substring(16,32)), font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 155, 500); + } + + //Type of control signal labels + textVariable = new TextLayout("Control Signals", fontTitle, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 440); + + textVariable = new TextLayout("Active", font, frc); + g2d.setColor(Color.red); + textVariable.draw(g2d, 25, 455); + + textVariable = new TextLayout("Inactive", font, frc); + g2d.setColor(Color.gray); + textVariable.draw(g2d, 75, 455); + + textVariable = new TextLayout("To see details of control units and register bank click inside the functional block", font, frc); + g2d.setColor(Color.black); + textVariable.draw(g2d, 400, 550); + } + //end of instruction subtitle... + + + //set the initial state of the variables that controls the animation, and start the timer that triggers the animation. + public void startAnimation(String codeInstruction){ + instructionCode = codeInstruction; + time = new Timer(PERIOD, this); // start timer + time.start(); + // this.repaint(); + } + + //initialize the image of datapath. + private void initImages(){ + try { + BufferedImage im = ImageIO.read( + getClass().getResource(Globals.imagesPath+"datapath.png") ); + + int transparency = im.getColorModel().getTransparency(); + datapath = gc.createCompatibleImage( + im.getWidth(), im.getHeight(), + transparency ); + g2d = datapath.createGraphics(); + g2d.drawImage(im,0,0,null); + g2d.dispose(); + } + catch(IOException e) { + System.out.println("Load Image error for " + + getClass().getResource(Globals.imagesPath+"datapath.png") + ":\n" + e); + } + } + + + public void actionPerformed(ActionEvent e) + // triggered by the timer: update, repaint + { + if (justStarted) + justStarted = false; + if(xIsMoving) + indexX++; + if(yIsMoving) + indexY--; + repaint(); + } + + + public void paintComponent(Graphics g) + { + super.paintComponent(g); + g2d = (Graphics2D)g; + // use antialiasing + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + // smoother (and slower) image transformations (e.g. for resizing) + g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + g2d = (Graphics2D)g; + drawImage(g2d, datapath, 0,0,null); + executeAnimation(g); + counter = (counter + 1)% 100; + g2d.dispose(); + + } + + private void drawImage(Graphics2D g2d, BufferedImage im, int x, int y,Color c){ + if (im == null) { + g2d.setColor(c); + g2d.fillOval(x, y, 20, 20); + g2d.setColor(Color.black); + g2d.drawString(" ", x, y); + } + else + g2d.drawImage(im, x, y, this); + } + + //draw lines. + //method to draw the lines that run from left to right. + public void printTrackLtoR(Vertex v){ + int size; + int[] track; + size = v.getEnd() - v.getInit(); + track = new int[size]; + for(int i = 0; i < size; i++) + track[i] = v.getInit()+i; + if(v.isActive() == true){ + v.setFirst_interaction(false); + for(int i = 0; i < size; i++){ + if(track[i] <= v.getCurrent()){ + g2d.setColor(v.getColor()); + g2d.fillRect(track[i], v.getOppositeAxis(), 3, 3); + } + } + if (v.getCurrent() == track[size-1]) + v.setActive(false); + v.setCurrent(v.getCurrent()+1); + } + else if(v.isFirst_interaction() == false){ + for(int i = 0; i < size ; i++){ + g2d.setColor(v.getColor()); + g2d.fillRect(track[i],v.getOppositeAxis(), 3, 3); + } + } + + } + + //method to draw the lines that run from right to left. + //public boolean printTrackRtoL(int init, int end ,int currentIndex, Graphics2D g2d, Color color, int otherAxis, + // boolean active, boolean firstInteraction){ + public void printTrackRtoL(Vertex v){ + int size; + int[] track; + size = v.getInit() - v.getEnd(); + track = new int[size]; + + for(int i = 0; i < size; i++) + track[i] = v.getInit()-i; + + if(v.isActive() == true){ + v.setFirst_interaction(false); + for(int i = 0; i < size; i++){ + if(track[i] >= v.getCurrent()){ + g2d.setColor(v.getColor()); + g2d.fillRect(track[i], v.getOppositeAxis(), 3, 3); + } + } + if (v.getCurrent() == track[size-1]) + v.setActive(false); + + v.setCurrent(v.getCurrent()-1); + } + else if(v.isFirst_interaction() == false){ + for(int i = 0; i < size ; i++){ + g2d.setColor(v.getColor()); + g2d.fillRect(track[i],v.getOppositeAxis(), 3, 3); + } + } + } + + //method to draw the lines that run from down to top. + // public boolean printTrackDtoU(int init, int end ,int currentIndex, Graphics2D g2d, Color color, int otherAxis, + // boolean active, boolean firstInteraction){ + public void printTrackDtoU(Vertex v){ + int size; + int[] track; + + if(v.getInit() > v.getEnd()){ + size = v.getInit() - v.getEnd(); + track = new int[size]; + for(int i = 0; i < size; i++) + track[i] = v.getInit()-i; + } + else{ + size = v.getEnd() - v.getInit(); + track = new int[size]; + for(int i = 0; i < size; i++) + track[i] = v.getInit()+i; + } + + if(v.isActive() == true){ + v.setFirst_interaction(false); + for(int i = 0; i < size; i++){ + if(track[i] >= v.getCurrent()){ + g2d.setColor(v.getColor()); + g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); + } + } + if (v.getCurrent() == track[size-1]) + v.setActive(false); + v.setCurrent(v.getCurrent()-1); + + } + else if(v.isFirst_interaction() == false){ + for(int i = 0; i < size; i++){ + g2d.setColor(v.getColor()); + g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); + } + } + } + //method to draw the lines that run from top to down. + // public boolean printTrackUtoD(int init, int end ,int currentIndex, Graphics2D g2d, Color color, int otherAxis, + // boolean active, boolean firstInteraction){ + public void printTrackUtoD(Vertex v){ + + int size; + int[] track; + size = v.getEnd() - v.getInit(); + track = new int[size]; + + for(int i = 0; i < size; i++) + track[i] = v.getInit()+i; + + if(v.isActive() == true){ + v.setFirst_interaction(false); + for(int i = 0; i < size; i++){ + if(track[i] <= v.getCurrent()){ + g2d.setColor(v.getColor()); + g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); + } + + } + if (v.getCurrent() == track[size-1]) + v.setActive(false); + v.setCurrent(v.getCurrent()+1); + } + else if(v.isFirst_interaction() == false){ + for(int i = 0; i < size; i++){ + g2d.setColor(v.getColor()); + g2d.fillRect(v.getOppositeAxis(), track[i], 3, 3); + } + } + } + + public void printTextDtoU(Vertex v){ + int size; + int[] track; + FontRenderContext frc = g2d.getFontRenderContext(); + + TextLayout actionInFunctionalBlock = new TextLayout(v.getName(), new Font("Verdana", Font.BOLD, 13), frc); + g2d.setColor(Color.RED); + + if(instructionCode.substring(0,6).matches("101[0-1][0-1][0-1]") + &&!instructionCode.substring(0,6).matches("0001[0-1][0-1]") + &&!instructionCode.substring(0,6).matches("00001[0-1]")){//load instruction + actionInFunctionalBlock = new TextLayout(" ", new Font("Verdana", Font.BOLD, 13), frc); + } + if(v.getName().equals("ALUVALUE")){ + if( instructionCode.substring(0,6).equals("000000"))//R-type instruction + actionInFunctionalBlock = new TextLayout(functionEquivalenceTable.get(instructionCode.substring(26,32)), new Font("Verdana", Font.BOLD, 13), frc); + else //other instructions + actionInFunctionalBlock = new TextLayout(opcodeEquivalenceTable.get(instructionCode.substring(0,6)), new Font("Verdana", Font.BOLD, 13), frc); + } + + if(instructionCode.substring(0,6).matches("0001[0-1][0-1]")&& v.getName().equals("CP+4")) //branch code + actionInFunctionalBlock = new TextLayout("PC+OFFSET", new Font("Verdana", Font.BOLD, 13), frc); + + if(v.getName().equals("WRITING")){ + if(!instructionCode.substring(0,6).matches("100[0-1][0-1][0-1]")) + actionInFunctionalBlock = new TextLayout(" ", new Font("Verdana", Font.BOLD, 13), frc); + } + if(v.isActive() == true){ + v.setFirst_interaction(false); + actionInFunctionalBlock.draw(g2d, v.getOppositeAxis(), v.getCurrent()); + if (v.getCurrent() == v.getEnd()) + v.setActive(false); + v.setCurrent(v.getCurrent()-1); + } + + + } + + //convert binnary value to integer. + public String parseBinToInt(String code){ + int value = 0; + + for(int i =code.length()-1; i >= 0; i--){ + if("1".equals(code.substring(i,i+1))){ + value = value + (int)Math.pow(2,code.length()-i-1); + } + } + + return Integer.toString(value); + } + + //set and execute the information about the current position of each line of information in the animation, + //verifies the previous status of the animation and increment the position of each line that interconnect the unit function. + private void executeAnimation(Graphics g){ + g2d = (Graphics2D)g; + setUpInstructionInfo(g2d); + Vertex vert; + for(int i = 0; i < vertexTraversed.size(); i++){ + vert = vertexTraversed.get(i); + if(vert.isMovingXaxis == true){ + if(vert.getDirection() == vert.movingLeft){ + printTrackLtoR(vert); + if(vert.isActive() == false){ + int j = vert.getTargetVertex().size(); + Vertex tempVertex; + for(int k = 0; k < j; k++){ + tempVertex = outputGraph.get(vert.getNumIndex()).get(k); + Boolean hasThisVertex = false; + for(int m = 0 ; m < vertexTraversed.size(); m++){ + if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) + hasThisVertex = true; + } + if(hasThisVertex == false){ + outputGraph.get(vert.getNumIndex()).get(k).setActive(true); + vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); + } + } + } + } + else{ + printTrackRtoL(vert); + if(vert.isActive() == false){ + int j = vert.getTargetVertex().size(); + Vertex tempVertex; + for(int k = 0; k < j; k++){ + tempVertex = outputGraph.get(vert.getNumIndex()).get(k); + Boolean hasThisVertex = false; + for(int m = 0 ; m < vertexTraversed.size(); m++){ + if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) + hasThisVertex = true; + } + if(hasThisVertex == false){ + outputGraph.get(vert.getNumIndex()).get(k).setActive(true); + vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); + } + } + } + } + } //end of condition of X axis + else{ + if(vert.getDirection() == vert.movingDownside){ + if(vert.isText == true) + printTextDtoU(vert); + else + printTrackDtoU(vert); + + if(vert.isActive() == false){ + int j = vert.getTargetVertex().size(); + Vertex tempVertex; + for(int k = 0; k < j; k++){ + tempVertex = outputGraph.get(vert.getNumIndex()).get(k); + Boolean hasThisVertex = false; + for(int m = 0 ; m < vertexTraversed.size(); m++){ + if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) + hasThisVertex = true; + } + if(hasThisVertex == false){ + outputGraph.get(vert.getNumIndex()).get(k).setActive(true); + vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); + } + } + } + + } + else{ + + printTrackUtoD(vert); + if(vert.isActive() == false){ + int j = vert.getTargetVertex().size(); + Vertex tempVertex; + for(int k = 0; k < j; k++){ + tempVertex = outputGraph.get(vert.getNumIndex()).get(k); + Boolean hasThisVertex = false; + for(int m = 0 ; m < vertexTraversed.size(); m++){ + if(tempVertex.getNumIndex() == vertexTraversed.get(m).getNumIndex()) + hasThisVertex = true; + } + if(hasThisVertex == false){ + outputGraph.get(vert.getNumIndex()).get(k).setActive(true); + vertexTraversed.add( outputGraph.get(vert.getNumIndex()).get(k)); + } + } + } + } + } + } + } + + @Override + public void mouseClicked(MouseEvent e) { + + PointerInfo a = MouseInfo.getPointerInfo(); + //limpar a imagem do painel e iniciar o detalhe da unidade funcional. + + + if(e.getPoint().getX() > 425 && e.getPoint().getX() < 520 && e.getPoint().getY() > 300 && e.getPoint().getY() < 425){ + buildMainDisplayArea("register.png"); + FunctionUnitVisualization fu = new FunctionUnitVisualization(instructionBinary, register); + fu.run(); + } + + if(e.getPoint().getX() > 355 && e.getPoint().getX() < 415 && e.getPoint().getY() > 180 && e.getPoint().getY() < 280){ + buildMainDisplayArea("control.png"); + FunctionUnitVisualization fu = new FunctionUnitVisualization(instructionBinary, control); + fu.run(); + } + + if(e.getPoint().getX() > 560 && e.getPoint().getX() < 620 && e.getPoint().getY() > 450 && e.getPoint().getY() < 520){ + buildMainDisplayArea("ALUcontrol.png"); + FunctionUnitVisualization fu = new FunctionUnitVisualization(instructionBinary, aluControl); + fu.run(); + } + + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void mouseReleased(MouseEvent e) { + } + } +} diff --git a/src/main/java/mars/venus/MessagesPane.java b/src/main/java/mars/venus/MessagesPane.java index 69aff31..373612e 100644 --- a/src/main/java/mars/venus/MessagesPane.java +++ b/src/main/java/mars/venus/MessagesPane.java @@ -1,501 +1,509 @@ - package mars.venus; - import mars.*; - import javax.swing.*; - import javax.swing.text.*; - import java.awt.*; - import java.awt.event.*; - import java.util.concurrent.ArrayBlockingQueue; - import javax.swing.event.DocumentListener; - import javax.swing.undo.UndoableEdit; - import mars.simulator.Simulator; - import javax.swing.event.DocumentEvent; - import javax.swing.text.Position.Bias; - -/* -Copyright (c) 2003-2010, Pete Sanderson and Kenneth Vollmar - -Developed by Pete Sanderson (psanderson@otterbein.edu) -and Kenneth Vollmar (kenvollmar@missouristate.edu) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject -to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -(MIT license, http://www.opensource.org/licenses/mit-license.html) - */ - -/** - * Creates the message window at the bottom of the UI. - * @author Team JSpim - **/ - - public class MessagesPane extends JTabbedPane{ - JTextArea assemble, run; - JPanel assembleTab, runTab; - // These constants are designed to keep scrolled contents of the - // two message areas from becoming overwhelmingly large (which - // seems to slow things down as new text is appended). Once it - // reaches MAXIMUM_SCROLLED_CHARACTERS in length then cut off - // the first NUMBER_OF_CHARACTERS_TO_CUT characters. The latter - // must obviously be smaller than the former. - public static final int MAXIMUM_SCROLLED_CHARACTERS = Globals.maximumMessageCharacters; - public static final int NUMBER_OF_CHARACTERS_TO_CUT = Globals.maximumMessageCharacters/10 ; // 10% - - /** - * Constructor for the class, sets up two fresh tabbed text areas for program feedback. - **/ - - public MessagesPane() { - super(); - this.setMinimumSize(new Dimension(0,0)); - assemble= new JTextArea(); - run= new JTextArea(); - assemble.setEditable(false); - run.setEditable(false); - // Set both text areas to mono font. For assemble - // pane, will make messages more readable. For run - // pane, will allow properly aligned "text graphics" - // DPS 15 Dec 2008 - Font monoFont = new Font(Font.MONOSPACED, Font.PLAIN, 12); - assemble.setFont(monoFont); - run.setFont(monoFont); - - JButton assembleTabClearButton = new JButton("Clear"); - assembleTabClearButton.setToolTipText("Clear the Mars Messages area"); - assembleTabClearButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e){ - assemble.setText(""); - } - }); - assembleTab = new JPanel(new BorderLayout()); - assembleTab.add(createBoxForButton(assembleTabClearButton),BorderLayout.WEST); - assembleTab.add(new JScrollPane(assemble, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, - ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); - assemble.addMouseListener( - new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - String text; - int lineStart = 0; - int lineEnd = 0; - try { - int line = assemble.getLineOfOffset(assemble.viewToModel(e.getPoint())); - lineStart = assemble.getLineStartOffset(line); - lineEnd = assemble.getLineEndOffset(line); - text = assemble.getText(lineStart, lineEnd-lineStart); - } - catch (BadLocationException ble) { - text = ""; - } - if (text.length() > 0) { - // If error or warning, parse out the line and column number. - if (text.startsWith(ErrorList.ERROR_MESSAGE_PREFIX) || text.startsWith(ErrorList.WARNING_MESSAGE_PREFIX)) { - assemble.select(lineStart,lineEnd); - assemble.setSelectionColor(Color.YELLOW); - assemble.repaint(); - int separatorPosition = text.indexOf(ErrorList.MESSAGE_SEPARATOR); - if (separatorPosition >= 0) { - text = text.substring(0,separatorPosition); - } - String[] stringTokens = text.split("\\s"); // tokenize with whitespace delimiter - String lineToken = ErrorList.LINE_PREFIX.trim(); - String columnToken = ErrorList.POSITION_PREFIX.trim(); - String lineString = ""; - String columnString = ""; - for (int i=0; i= ErrorList.FILENAME_PREFIX.length()) { - fileName = text.substring(fileNameStart, fileNameEnd).trim(); - } - if (fileName != null && fileName.length() > 0) { - selectEditorTextLine(fileName, line, column); - selectErrorMessage(fileName, line, column); - } - } - } - } - }); - - JButton runTabClearButton = new JButton("Clear"); - runTabClearButton.setToolTipText("Clear the Run I/O area"); - runTabClearButton.addActionListener( - new ActionListener() { - public void actionPerformed(ActionEvent e){ - run.setText(""); - } - }); - runTab = new JPanel(new BorderLayout()); - runTab.add(createBoxForButton(runTabClearButton),BorderLayout.WEST); - runTab.add(new JScrollPane(run, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, - ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); - this.addTab("Mars Messages", assembleTab); - this.addTab("Run I/O", runTab); - this.setToolTipTextAt(0,"Messages produced by Run menu. Click on assemble error message to select erroneous line"); - this.setToolTipTextAt(1,"Simulated MIPS console input and output"); - } - - // Center given button in a box, centered vertically and 6 pixels on left and right - private Box createBoxForButton(JButton button) { - Box buttonRow = Box.createHorizontalBox(); - buttonRow.add(Box.createHorizontalStrut(6)); - buttonRow.add(button); - buttonRow.add(Box.createHorizontalStrut(6)); - Box buttonBox = Box.createVerticalBox(); - buttonBox.add(Box.createVerticalGlue()); - buttonBox.add(buttonRow); - buttonBox.add(Box.createVerticalGlue()); - return buttonBox; - } - - /** - * Will select the Mars Messages tab error message that matches the given - * specifications, if it is found. Matching is done by constructing - * a string using the parameter values and searching the text area for the last - * occurrance of that string. - * @param fileName A String containing the file path name. - * @param line Line number for error message - * @param column Column number for error message - */ - public void selectErrorMessage(String fileName, int line, int column) { - String errorReportSubstring = new java.io.File(fileName).getName() + ErrorList.LINE_PREFIX + line + ErrorList.POSITION_PREFIX + column; - int textPosition = assemble.getText().lastIndexOf(errorReportSubstring); - if (textPosition >= 0) { - int textLine = 0; - int lineStart = 0; - int lineEnd = 0; - try { - textLine = assemble.getLineOfOffset(textPosition); - lineStart = assemble.getLineStartOffset(textLine); - lineEnd = assemble.getLineEndOffset(textLine); - assemble.setSelectionColor(Color.YELLOW); - assemble.select(lineStart,lineEnd); - assemble.getCaret().setSelectionVisible(true); - assemble.repaint(); - } - catch (BadLocationException ble) { - // If there is a problem, simply skip the selection - } - } - } - - - /** - * Will select the specified line in an editor tab. If the file is open - * but not current, its tab will be made current. If the file is not open, - * it will be opened in a new tab and made current, however the line will - * not be selected (apparent apparent problem with JEditTextArea). - * @param fileName A String containing the file path name. - * @param line Line number for error message - * @param column Column number for error message - */ - public void selectEditorTextLine(String fileName, int line, int column) { - EditTabbedPane editTabbedPane = (EditTabbedPane) Globals.getGui().getMainPane().getEditTabbedPane(); - EditPane editPane, currentPane = null; - editPane = editTabbedPane.getEditPaneForFile(new java.io.File(fileName).getPath()); - if (editPane != null) { - if (editPane != editTabbedPane.getCurrentEditTab()) { - editTabbedPane.setCurrentEditTab(editPane); - } - currentPane = editPane; - } - else { // file is not open. Try to open it. - if (editTabbedPane.openFile(new java.io.File(fileName))) { - currentPane = editTabbedPane.getCurrentEditTab(); - } - } - // If editPane == null, it means the desired file was not open. Line selection - // does not properly with the JEditTextArea editor in this situation (it works - // fine for the original generic editor). So we just won't do it. DPS 9-Aug-2010 - if (editPane != null && currentPane != null) { - currentPane.selectLine(line, column); - } - } - - /** - * Returns component used to display assembler messages - * - * @return assembler message text component - */ - public JTextArea getAssembleTextArea() { - return assemble; - } - /** - * Returns component used to display runtime messages - * - * @return runtime message text component - */ - public JTextArea getRunTextArea() { - return run; - } - - /** - * Post a message to the assembler display - * - * @param message String to append to assembler display text - */ - public void postMarsMessage(String message) { - assemble.append(message); - // can do some crude cutting here. If the document gets "very large", - // let's cut off the oldest text. This will limit scrolling but the limit - // can be set reasonably high. - if (assemble.getDocument().getLength() > MAXIMUM_SCROLLED_CHARACTERS) { - try { - assemble.getDocument().remove(0, NUMBER_OF_CHARACTERS_TO_CUT); - } - catch (BadLocationException ble) { - // only if NUMBER_OF_CHARACTERS_TO_CUT > MAXIMUM_SCROLLED_CHARACTERS - } - } - assemble.setCaretPosition(assemble.getDocument().getLength()); - setSelectedComponent(assembleTab); - } - - /** - * Post a message to the runtime display - * - * @param message String to append to runtime display text - */ - // The work of this method is done by "invokeLater" because - // its JTextArea is maintained by the main event thread - // but also used, via this method, by the execution thread for - // "print" syscalls. "invokeLater" schedules the code to be - // run under the event-processing thread no matter what. - // DPS, 23 Aug 2005. - public void postRunMessage(String message) { - final String mess = message; - SwingUtilities.invokeLater( - new Runnable() { - public void run() { - setSelectedComponent(runTab); - run.append(mess); - // can do some crude cutting here. If the document gets "very large", - // let's cut off the oldest text. This will limit scrolling but the limit - // can be set reasonably high. - if (run.getDocument().getLength() > MAXIMUM_SCROLLED_CHARACTERS) { - try { - run.getDocument().remove(0, NUMBER_OF_CHARACTERS_TO_CUT); - } - catch (BadLocationException ble) { - // only if NUMBER_OF_CHARACTERS_TO_CUT > MAXIMUM_SCROLLED_CHARACTERS - } - } - } - }); - } - - /** - * Make the assembler message tab current (up front) - */ - public void selectMarsMessageTab() { - setSelectedComponent(assembleTab); - } - /** - * Make the runtime message tab current (up front) - */ - public void selectRunMessageTab() { - setSelectedComponent(runTab); - } - - /** - * Method used by the SystemIO class to get interactive user input - * requested by a running MIPS program (e.g. syscall #5 to read an - * integer). SystemIO knows whether simulator is being run at - * command line by the user, or by the GUI. If run at command line, - * it gets input from System.in rather than here. - * - * This is an overloaded method. This version, with the String parameter, - * is used to get input from a popup dialog. - * - * @param prompt Prompt to display to the user. - * @return User input. - */ - public String getInputString(String prompt) { - String input; - JOptionPane pane = new JOptionPane(prompt,JOptionPane.QUESTION_MESSAGE,JOptionPane.DEFAULT_OPTION); - pane.setWantsInput(true); - JDialog dialog = pane.createDialog(Globals.getGui(), "MIPS Keyboard Input"); - dialog.setVisible(true); - input = (String) pane.getInputValue(); - this.postRunMessage(Globals.userInputAlert+input+"\n"); - return input; - } - - /** - * Method used by the SystemIO class to get interactive user input - * requested by a running MIPS program (e.g. syscall #5 to read an - * integer). SystemIO knows whether simulator is being run at - * command line by the user, or by the GUI. If run at command line, - * it gets input from System.in rather than here. - * - * This is an overloaded method. This version, with the int parameter, - * is used to get input from the MARS Run I/O window. - * - * @param maxLen: maximum length of input. This method returns when maxLen characters have been read. Use -1 for no length restrictions. - * @return User input. - */ - public String getInputString(int maxLen) { - Asker asker = new Asker(maxLen); // Asker defined immediately below. - return asker.response(); - } - - //////////////////////////////////////////////////////////////////////////// - // Thread class for obtaining user input in the Run I/O window (MessagesPane) - // Written by Ricardo Fernández Pascual [rfernandez@ditec.um.es] December 2009. - class Asker implements Runnable { - ArrayBlockingQueue resultQueue = new ArrayBlockingQueue(1); - int initialPos; - int maxLen; - Asker(int maxLen) { - this.maxLen = maxLen; - // initialPos will be set in run() - } - final DocumentListener listener = - new DocumentListener() { - public void insertUpdate(final DocumentEvent e) { - EventQueue.invokeLater( - new Runnable() { - public void run() { - try { - String inserted = e.getDocument().getText(e.getOffset(), e.getLength()); - int i = inserted.indexOf('\n'); - if (i >= 0) { - int offset = e.getOffset() + i; - if (offset + 1 == e.getDocument().getLength()) { - returnResponse(); - } - else { - // remove the '\n' and put it at the end - e.getDocument().remove(offset, 1); - e.getDocument().insertString(e.getDocument().getLength(), "\n", null); - // insertUpdate will be called again, since we have inserted the '\n' at the end - } - } - else if (maxLen >= 0 && e.getDocument().getLength() - initialPos >= maxLen) { - returnResponse(); - } - } - catch (BadLocationException ex) { - returnResponse(); - } - } - }); - } - public void removeUpdate(final DocumentEvent e) { - EventQueue.invokeLater( - new Runnable() { - public void run() { - if ((e.getDocument().getLength() < initialPos || e.getOffset() < initialPos) && e instanceof UndoableEdit) { - ((UndoableEdit) e).undo(); - run.setCaretPosition(e.getOffset() + e.getLength()); - } - } - }); - } - public void changedUpdate(DocumentEvent e) { } - }; - final NavigationFilter navigationFilter = - new NavigationFilter() { - public void moveDot(FilterBypass fb, int dot, Bias bias) { - if (dot < initialPos) { - dot = Math.min(initialPos, run.getDocument().getLength()); - } - fb.moveDot(dot, bias); - } - public void setDot(FilterBypass fb, int dot, Bias bias) { - if (dot < initialPos) { - dot = Math.min(initialPos, run.getDocument().getLength()); - } - fb.setDot(dot, bias); - } - }; - final Simulator.StopListener stopListener = - new Simulator.StopListener() { - public void stopped(Simulator s) { - returnResponse(); - } - }; - public void run() { // must be invoked from the GUI thread - setSelectedComponent(runTab); - run.setEditable(true); - run.requestFocusInWindow(); - run.setCaretPosition(run.getDocument().getLength()); - initialPos = run.getCaretPosition(); - run.setNavigationFilter(navigationFilter); - run.getDocument().addDocumentListener(listener); - Simulator.getInstance().addStopListener(stopListener); - } - void cleanup() { // not required to be called from the GUI thread - EventQueue.invokeLater( - new Runnable() { - public void run() { - run.getDocument().removeDocumentListener(listener); - run.setEditable(false); - run.setNavigationFilter(null); - run.setCaretPosition(run.getDocument().getLength()); - Simulator.getInstance().removeStopListener(stopListener); - } - }); - } - void returnResponse() { - try { - int p = Math.min(initialPos, run.getDocument().getLength()); - int l = Math.min(run.getDocument().getLength() - p, maxLen >= 0 ? maxLen : Integer.MAX_VALUE); - resultQueue.offer(run.getText(p, l)); - } - catch (BadLocationException ex) { - // this cannot happen - resultQueue.offer(""); - } - } - String response() { - EventQueue.invokeLater(this); - try { - return resultQueue.take(); - } - catch (InterruptedException ex) { - return null; - } - finally { - cleanup(); - } - } - } // Asker class - //////////////////////////////////////////////////////////////////////////// - } +package mars.venus; + +import mars.ErrorList; +import mars.Globals; +import mars.simulator.Simulator; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.BadLocationException; +import javax.swing.text.NavigationFilter; +import javax.swing.text.Position.Bias; +import javax.swing.undo.UndoableEdit; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.concurrent.ArrayBlockingQueue; + +/* +Copyright (c) 2003-2010, Pete Sanderson and Kenneth Vollmar + +Developed by Pete Sanderson (psanderson@otterbein.edu) +and Kenneth Vollmar (kenvollmar@missouristate.edu) + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject +to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(MIT license, http://www.opensource.org/licenses/mit-license.html) + */ + +/** + * Creates the message window at the bottom of the UI. + * @author Team JSpim + **/ + + public class MessagesPane extends JTabbedPane{ + JTextArea assemble, run; + JPanel assembleTab, runTab; + // These constants are designed to keep scrolled contents of the + // two message areas from becoming overwhelmingly large (which + // seems to slow things down as new text is appended). Once it + // reaches MAXIMUM_SCROLLED_CHARACTERS in length then cut off + // the first NUMBER_OF_CHARACTERS_TO_CUT characters. The latter + // must obviously be smaller than the former. + public static final int MAXIMUM_SCROLLED_CHARACTERS = Globals.maximumMessageCharacters; + public static final int NUMBER_OF_CHARACTERS_TO_CUT = Globals.maximumMessageCharacters/10 ; // 10% + + /** + * Constructor for the class, sets up two fresh tabbed text areas for program feedback. + **/ + + public MessagesPane() { + super(); + this.setMinimumSize(new Dimension(0,0)); + assemble= new JTextArea(); + run= new JTextArea(); + assemble.setEditable(false); + run.setEditable(false); + // Set both text areas to mono font. For assemble + // pane, will make messages more readable. For run + // pane, will allow properly aligned "text graphics" + // DPS 15 Dec 2008 + Font monoFont = new Font(Font.MONOSPACED, Font.PLAIN, 12); + assemble.setFont(monoFont); + run.setFont(monoFont); + + JButton assembleTabClearButton = new JButton("Clear"); + assembleTabClearButton.setToolTipText("Clear the Mars Messages area"); + assembleTabClearButton.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e){ + assemble.setText(""); + } + }); + assembleTab = new JPanel(new BorderLayout()); + assembleTab.add(createBoxForButton(assembleTabClearButton),BorderLayout.WEST); + assembleTab.add(new JScrollPane(assemble, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); + assemble.addMouseListener( + new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + String text; + int lineStart = 0; + int lineEnd = 0; + try { + int line = assemble.getLineOfOffset(assemble.viewToModel(e.getPoint())); + lineStart = assemble.getLineStartOffset(line); + lineEnd = assemble.getLineEndOffset(line); + text = assemble.getText(lineStart, lineEnd-lineStart); + } + catch (BadLocationException ble) { + text = ""; + } + if (text.length() > 0) { + // If error or warning, parse out the line and column number. + if (text.startsWith(ErrorList.ERROR_MESSAGE_PREFIX) || text.startsWith(ErrorList.WARNING_MESSAGE_PREFIX)) { + assemble.select(lineStart,lineEnd); + assemble.setSelectionColor(Color.YELLOW); + assemble.repaint(); + int separatorPosition = text.indexOf(ErrorList.MESSAGE_SEPARATOR); + if (separatorPosition >= 0) { + text = text.substring(0,separatorPosition); + } + String[] stringTokens = text.split("\\s"); // tokenize with whitespace delimiter + String lineToken = ErrorList.LINE_PREFIX.trim(); + String columnToken = ErrorList.POSITION_PREFIX.trim(); + String lineString = ""; + String columnString = ""; + for (int i=0; i= ErrorList.FILENAME_PREFIX.length()) { + fileName = text.substring(fileNameStart, fileNameEnd).trim(); + } + if (fileName != null && fileName.length() > 0) { + selectEditorTextLine(fileName, line, column); + selectErrorMessage(fileName, line, column); + } + } + } + } + }); + + JButton runTabClearButton = new JButton("Clear"); + runTabClearButton.setToolTipText("Clear the Run I/O area"); + runTabClearButton.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e){ + run.setText(""); + } + }); + runTab = new JPanel(new BorderLayout()); + runTab.add(createBoxForButton(runTabClearButton),BorderLayout.WEST); + runTab.add(new JScrollPane(run, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, + ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); + this.addTab("Mars Messages", assembleTab); + this.addTab("Run I/O", runTab); + this.setToolTipTextAt(0,"Messages produced by Run menu. Click on assemble error message to select erroneous line"); + this.setToolTipTextAt(1,"Simulated MIPS console input and output"); + } + + // Center given button in a box, centered vertically and 6 pixels on left and right + private Box createBoxForButton(JButton button) { + Box buttonRow = Box.createHorizontalBox(); + buttonRow.add(Box.createHorizontalStrut(6)); + buttonRow.add(button); + buttonRow.add(Box.createHorizontalStrut(6)); + Box buttonBox = Box.createVerticalBox(); + buttonBox.add(Box.createVerticalGlue()); + buttonBox.add(buttonRow); + buttonBox.add(Box.createVerticalGlue()); + return buttonBox; + } + + /** + * Will select the Mars Messages tab error message that matches the given + * specifications, if it is found. Matching is done by constructing + * a string using the parameter values and searching the text area for the last + * occurrance of that string. + * @param fileName A String containing the file path name. + * @param line Line number for error message + * @param column Column number for error message + */ + public void selectErrorMessage(String fileName, int line, int column) { + String errorReportSubstring = new java.io.File(fileName).getName() + ErrorList.LINE_PREFIX + line + ErrorList.POSITION_PREFIX + column; + int textPosition = assemble.getText().lastIndexOf(errorReportSubstring); + if (textPosition >= 0) { + int textLine = 0; + int lineStart = 0; + int lineEnd = 0; + try { + textLine = assemble.getLineOfOffset(textPosition); + lineStart = assemble.getLineStartOffset(textLine); + lineEnd = assemble.getLineEndOffset(textLine); + assemble.setSelectionColor(Color.YELLOW); + assemble.select(lineStart,lineEnd); + assemble.getCaret().setSelectionVisible(true); + assemble.repaint(); + } + catch (BadLocationException ble) { + // If there is a problem, simply skip the selection + } + } + } + + + /** + * Will select the specified line in an editor tab. If the file is open + * but not current, its tab will be made current. If the file is not open, + * it will be opened in a new tab and made current, however the line will + * not be selected (apparent apparent problem with JEditTextArea). + * @param fileName A String containing the file path name. + * @param line Line number for error message + * @param column Column number for error message + */ + public void selectEditorTextLine(String fileName, int line, int column) { + EditTabbedPane editTabbedPane = (EditTabbedPane) Globals.getGui().getMainPane().getEditTabbedPane(); + EditPane editPane, currentPane = null; + editPane = editTabbedPane.getEditPaneForFile(new java.io.File(fileName).getPath()); + if (editPane != null) { + if (editPane != editTabbedPane.getCurrentEditTab()) { + editTabbedPane.setCurrentEditTab(editPane); + } + currentPane = editPane; + } + else { // file is not open. Try to open it. + if (editTabbedPane.openFile(new java.io.File(fileName))) { + currentPane = editTabbedPane.getCurrentEditTab(); + } + } + // If editPane == null, it means the desired file was not open. Line selection + // does not properly with the JEditTextArea editor in this situation (it works + // fine for the original generic editor). So we just won't do it. DPS 9-Aug-2010 + if (editPane != null && currentPane != null) { + currentPane.selectLine(line, column); + } + } + + /** + * Returns component used to display assembler messages + * + * @return assembler message text component + */ + public JTextArea getAssembleTextArea() { + return assemble; + } + /** + * Returns component used to display runtime messages + * + * @return runtime message text component + */ + public JTextArea getRunTextArea() { + return run; + } + + /** + * Post a message to the assembler display + * + * @param message String to append to assembler display text + */ + public void postMarsMessage(String message) { + assemble.append(message); + // can do some crude cutting here. If the document gets "very large", + // let's cut off the oldest text. This will limit scrolling but the limit + // can be set reasonably high. + if (assemble.getDocument().getLength() > MAXIMUM_SCROLLED_CHARACTERS) { + try { + assemble.getDocument().remove(0, NUMBER_OF_CHARACTERS_TO_CUT); + } + catch (BadLocationException ble) { + // only if NUMBER_OF_CHARACTERS_TO_CUT > MAXIMUM_SCROLLED_CHARACTERS + } + } + assemble.setCaretPosition(assemble.getDocument().getLength()); + setSelectedComponent(assembleTab); + } + + /** + * Post a message to the runtime display + * + * @param message String to append to runtime display text + */ + // The work of this method is done by "invokeLater" because + // its JTextArea is maintained by the main event thread + // but also used, via this method, by the execution thread for + // "print" syscalls. "invokeLater" schedules the code to be + // run under the event-processing thread no matter what. + // DPS, 23 Aug 2005. + public void postRunMessage(String message) { + final String mess = message; + SwingUtilities.invokeLater( + new Runnable() { + public void run() { + setSelectedComponent(runTab); + run.append(mess); + // can do some crude cutting here. If the document gets "very large", + // let's cut off the oldest text. This will limit scrolling but the limit + // can be set reasonably high. + if (run.getDocument().getLength() > MAXIMUM_SCROLLED_CHARACTERS) { + try { + run.getDocument().remove(0, NUMBER_OF_CHARACTERS_TO_CUT); + } + catch (BadLocationException ble) { + // only if NUMBER_OF_CHARACTERS_TO_CUT > MAXIMUM_SCROLLED_CHARACTERS + } + } + } + }); + } + + /** + * Make the assembler message tab current (up front) + */ + public void selectMarsMessageTab() { + setSelectedComponent(assembleTab); + } + /** + * Make the runtime message tab current (up front) + */ + public void selectRunMessageTab() { + setSelectedComponent(runTab); + } + + /** + * Method used by the SystemIO class to get interactive user input + * requested by a running MIPS program (e.g. syscall #5 to read an + * integer). SystemIO knows whether simulator is being run at + * command line by the user, or by the GUI. If run at command line, + * it gets input from System.in rather than here. + * + * This is an overloaded method. This version, with the String parameter, + * is used to get input from a popup dialog. + * + * @param prompt Prompt to display to the user. + * @return User input. + */ + public String getInputString(String prompt) { + String input; + JOptionPane pane = new JOptionPane(prompt,JOptionPane.QUESTION_MESSAGE,JOptionPane.DEFAULT_OPTION); + pane.setWantsInput(true); + JDialog dialog = pane.createDialog(Globals.getGui(), "MIPS Keyboard Input"); + dialog.setVisible(true); + input = (String) pane.getInputValue(); + this.postRunMessage(Globals.userInputAlert+input+"\n"); + return input; + } + + /** + * Method used by the SystemIO class to get interactive user input + * requested by a running MIPS program (e.g. syscall #5 to read an + * integer). SystemIO knows whether simulator is being run at + * command line by the user, or by the GUI. If run at command line, + * it gets input from System.in rather than here. + * + * This is an overloaded method. This version, with the int parameter, + * is used to get input from the MARS Run I/O window. + * + * @param maxLen: maximum length of input. This method returns when maxLen characters have been read. Use -1 for no length restrictions. + * @return User input. + */ + public String getInputString(int maxLen) { + Asker asker = new Asker(maxLen); // Asker defined immediately below. + return asker.response(); + } + + //////////////////////////////////////////////////////////////////////////// + // Thread class for obtaining user input in the Run I/O window (MessagesPane) + // Written by Ricardo Fernández Pascual [rfernandez@ditec.um.es] December 2009. + class Asker implements Runnable { + ArrayBlockingQueue resultQueue = new ArrayBlockingQueue(1); + int initialPos; + int maxLen; + final DocumentListener listener = + new DocumentListener() { + public void insertUpdate(final DocumentEvent e) { + EventQueue.invokeLater( + new Runnable() { + public void run() { + try { + String inserted = e.getDocument().getText(e.getOffset(), e.getLength()); + int i = inserted.indexOf('\n'); + if (i >= 0) { + int offset = e.getOffset() + i; + if (offset + 1 == e.getDocument().getLength()) { + returnResponse(); + } + else { + // remove the '\n' and put it at the end + e.getDocument().remove(offset, 1); + e.getDocument().insertString(e.getDocument().getLength(), "\n", null); + // insertUpdate will be called again, since we have inserted the '\n' at the end + } + } + else if (maxLen >= 0 && e.getDocument().getLength() - initialPos >= maxLen) { + returnResponse(); + } + } + catch (BadLocationException ex) { + returnResponse(); + } + } + }); + } + public void removeUpdate(final DocumentEvent e) { + EventQueue.invokeLater( + new Runnable() { + public void run() { + if ((e.getDocument().getLength() < initialPos || e.getOffset() < initialPos) && e instanceof UndoableEdit) { + ((UndoableEdit) e).undo(); + run.setCaretPosition(e.getOffset() + e.getLength()); + } + } + }); + } + public void changedUpdate(DocumentEvent e) { } + }; + + Asker(int maxLen) { + this.maxLen = maxLen; + // initialPos will be set in run() + } + final NavigationFilter navigationFilter = + new NavigationFilter() { + public void moveDot(FilterBypass fb, int dot, Bias bias) { + if (dot < initialPos) { + dot = Math.min(initialPos, run.getDocument().getLength()); + } + fb.moveDot(dot, bias); + } + public void setDot(FilterBypass fb, int dot, Bias bias) { + if (dot < initialPos) { + dot = Math.min(initialPos, run.getDocument().getLength()); + } + fb.setDot(dot, bias); + } + }; + final Simulator.StopListener stopListener = + new Simulator.StopListener() { + public void stopped(Simulator s) { + returnResponse(); + } + }; + public void run() { // must be invoked from the GUI thread + setSelectedComponent(runTab); + run.setEditable(true); + run.requestFocusInWindow(); + run.setCaretPosition(run.getDocument().getLength()); + initialPos = run.getCaretPosition(); + run.setNavigationFilter(navigationFilter); + run.getDocument().addDocumentListener(listener); + Simulator.getInstance().addStopListener(stopListener); + } + void cleanup() { // not required to be called from the GUI thread + EventQueue.invokeLater( + new Runnable() { + public void run() { + run.getDocument().removeDocumentListener(listener); + run.setEditable(false); + run.setNavigationFilter(null); + run.setCaretPosition(run.getDocument().getLength()); + Simulator.getInstance().removeStopListener(stopListener); + } + }); + } + void returnResponse() { + try { + int p = Math.min(initialPos, run.getDocument().getLength()); + int l = Math.min(run.getDocument().getLength() - p, maxLen >= 0 ? maxLen : Integer.MAX_VALUE); + resultQueue.offer(run.getText(p, l)); + } + catch (BadLocationException ex) { + // this cannot happen + resultQueue.offer(""); + } + } + String response() { + EventQueue.invokeLater(this); + try { + return resultQueue.take(); + } + catch (InterruptedException ex) { + return null; + } + finally { + cleanup(); + } + } + } // Asker class + //////////////////////////////////////////////////////////////////////////// + } diff --git a/src/main/java/mars/venus/VenusUI.java b/src/main/java/mars/venus/VenusUI.java index b24e5a7..b042bbe 100644 --- a/src/main/java/mars/venus/VenusUI.java +++ b/src/main/java/mars/venus/VenusUI.java @@ -1,12 +1,15 @@ - package mars.venus; - import mars.*; - import mars.mips.dump.*; - import javax.swing.*; - import java.awt.*; - import java.awt.event.*; - import javax.swing.event.*; - import java.io.*; - import java.net.*; +package mars.venus; + +import mars.Globals; +import mars.Settings; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URL; /* Copyright (c) 2003-2013, Pete Sanderson and Kenneth Vollmar @@ -36,701 +39,201 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. (MIT license, http://www.opensource.org/licenses/mit-license.html) */ - /** - * Top level container for Venus GUI. - * @author Sanderson and Team JSpim - **/ - - /* Heavily modified by Pete Sanderson, July 2004, to incorporate JSPIMMenu and JSPIMToolbar - * not as subclasses of JMenuBar and JToolBar, but as instances of them. They are both - * here primarily so both can share the Action objects. - */ - - public class VenusUI extends JFrame{ - VenusUI mainUI; - public JMenuBar menu; - JToolBar toolbar; - MainPane mainPane; - RegistersPane registersPane; - RegistersWindow registersTab; - Coprocessor1Window coprocessor1Tab; - Coprocessor0Window coprocessor0Tab; - MessagesPane messagesPane; - JSplitPane splitter, horizonSplitter; - JPanel north; - - private int frameState; // see windowActivated() and windowDeactivated() - private static int menuState = FileStatus.NO_FILE; - - // PLEASE PUT THESE TWO (& THEIR METHODS) SOMEWHERE THEY BELONG, NOT HERE - private static boolean reset= true; // registers/memory reset for execution - private static boolean started = false; // started execution - Editor editor; - - // components of the menubar - private JMenu file, run, window, help, edit, settings; - private JMenuItem fileNew, fileOpen, fileClose, fileCloseAll, fileSave, fileSaveAs, fileSaveAll, fileDumpMemory, filePrint, fileExit; - private JMenuItem editUndo, editRedo, editCut, editCopy, editPaste, editFindReplace, editSelectAll; - private JMenuItem runGo, runStep, runBackstep, runReset, runAssemble, runStop, runPause, runClearBreakpoints, runToggleBreakpoints; - private JCheckBoxMenuItem settingsLabel, settingsPopupInput, settingsValueDisplayBase, settingsAddressDisplayBase, - settingsExtended, settingsAssembleOnOpen, settingsAssembleAll, settingsWarningsAreErrors, settingsStartAtMain, - settingsDelayedBranching, settingsProgramArguments, settingsSelfModifyingCode; - private JMenuItem settingsExceptionHandler, settingsEditor, settingsHighlighting, settingsMemoryConfiguration; - private JMenuItem helpHelp, helpAbout; - - // components of the toolbar - private JButton Undo, Redo, Cut, Copy, Paste, FindReplace, SelectAll; - private JButton New, Open, Save, SaveAs, SaveAll, DumpMemory, Print; - private JButton Run, Assemble, Reset, Step, Backstep, Stop, Pause; - private JButton Help; - - // The "action" objects, which include action listeners. One of each will be created then - // shared between a menu item and its corresponding toolbar button. This is a very cool - // technique because it relates the button and menu item so closely - - private Action fileNewAction, fileOpenAction, fileCloseAction, fileCloseAllAction, fileSaveAction; - private Action fileSaveAsAction, fileSaveAllAction, fileDumpMemoryAction, filePrintAction, fileExitAction; - EditUndoAction editUndoAction; - EditRedoAction editRedoAction; - private Action editCutAction, editCopyAction, editPasteAction, editFindReplaceAction, editSelectAllAction; - private Action runAssembleAction, runGoAction, runStepAction, runBackstepAction, runResetAction, - runStopAction, runPauseAction, runClearBreakpointsAction, runToggleBreakpointsAction; - private Action settingsLabelAction, settingsPopupInputAction, settingsValueDisplayBaseAction, settingsAddressDisplayBaseAction, - settingsExtendedAction, settingsAssembleOnOpenAction, settingsAssembleAllAction, - settingsWarningsAreErrorsAction, settingsStartAtMainAction, settingsProgramArgumentsAction, - settingsDelayedBranchingAction, settingsExceptionHandlerAction, settingsEditorAction, - settingsHighlightingAction, settingsMemoryConfigurationAction, settingsSelfModifyingCodeAction; - private Action helpHelpAction, helpAboutAction; - - +/** + * Top level container for Venus GUI. + * + * @author Sanderson and Team JSpim + **/ + +/* Heavily modified by Pete Sanderson, July 2004, to incorporate JSPIMMenu and JSPIMToolbar + * not as subclasses of JMenuBar and JToolBar, but as instances of them. They are both + * here primarily so both can share the Action objects. + */ + +public class VenusUI extends JFrame { + private static int menuState = FileStatus.NO_FILE; + // PLEASE PUT THESE TWO (& THEIR METHODS) SOMEWHERE THEY BELONG, NOT HERE + private static boolean reset = true; // registers/memory reset for execution + private static boolean started = false; // started execution + public JMenuBar menu; + VenusUI mainUI; + JToolBar toolbar; + MainPane mainPane; + RegistersPane registersPane; + RegistersWindow registersTab; + Coprocessor1Window coprocessor1Tab; + Coprocessor0Window coprocessor0Tab; + MessagesPane messagesPane; + JSplitPane splitter, horizonSplitter; + JPanel north; + Editor editor; + EditUndoAction editUndoAction; + EditRedoAction editRedoAction; + private int frameState; // see windowActivated() and windowDeactivated() + // components of the menubar + private JMenu file, run, window, help, edit, settings; + private JMenuItem fileNew, fileOpen, fileClose, fileCloseAll, fileSave, fileSaveAs, fileSaveAll, fileDumpMemory, filePrint, fileExit; + private JMenuItem editUndo, editRedo, editCut, editCopy, editPaste, editFindReplace, editSelectAll; + private JMenuItem runGo, runStep, runBackstep, runReset, runAssemble, runStop, runPause, runClearBreakpoints, runToggleBreakpoints; + private JCheckBoxMenuItem settingsLabel, settingsPopupInput, settingsValueDisplayBase, settingsAddressDisplayBase, settingsExtended, settingsAssembleOnOpen, settingsAssembleAll, settingsWarningsAreErrors, settingsStartAtMain, settingsDelayedBranching, settingsProgramArguments, settingsSelfModifyingCode; + private JMenuItem settingsExceptionHandler, settingsEditor, settingsHighlighting, settingsMemoryConfiguration; + private JMenuItem helpHelp, helpAbout; + // components of the toolbar + private JButton Undo, Redo, Cut, Copy, Paste, FindReplace, SelectAll; + private JButton New, Open, Save, SaveAs, SaveAll, DumpMemory, Print; + + // The "action" objects, which include action listeners. One of each will be created then + // shared between a menu item and its corresponding toolbar button. This is a very cool + // technique because it relates the button and menu item so closely + private JButton Run, Assemble, Reset, Step, Backstep, Stop, Pause; + private JButton Help; + private Action fileNewAction, fileOpenAction, fileCloseAction, fileCloseAllAction, fileSaveAction; + private Action fileSaveAsAction, fileSaveAllAction, fileDumpMemoryAction, filePrintAction, fileExitAction; + private Action editCutAction, editCopyAction, editPasteAction, editFindReplaceAction, editSelectAllAction; + private Action runAssembleAction, runGoAction, runStepAction, runBackstepAction, runResetAction, runStopAction, runPauseAction, runClearBreakpointsAction, runToggleBreakpointsAction; + private Action settingsLabelAction, settingsPopupInputAction, settingsValueDisplayBaseAction, settingsAddressDisplayBaseAction, settingsExtendedAction, settingsAssembleOnOpenAction, settingsAssembleAllAction, settingsWarningsAreErrorsAction, settingsStartAtMainAction, settingsProgramArgumentsAction, settingsDelayedBranchingAction, settingsExceptionHandlerAction, settingsEditorAction, settingsHighlightingAction, settingsMemoryConfigurationAction, settingsSelfModifyingCodeAction; + private Action helpHelpAction, helpAboutAction; + + /** - * Constructor for the Class. Sets up a window object for the UI - * @param s Name of the window to be created. - **/ - - public VenusUI(String s) { - super(s); - mainUI = this; - Globals.setGui(this); - this.editor = new Editor(this); - - double screenWidth = Toolkit.getDefaultToolkit().getScreenSize().getWidth(); - double screenHeight = Toolkit.getDefaultToolkit().getScreenSize().getHeight(); - // basically give up some screen space if running at 800 x 600 - double messageWidthPct = (screenWidth<1000.0)? 0.67 : 0.73; - double messageHeightPct = (screenWidth<1000.0)? 0.12 : 0.15; - double mainWidthPct = (screenWidth<1000.0)? 0.67 : 0.73; - double mainHeightPct = (screenWidth<1000.0)? 0.60 : 0.65; - double registersWidthPct = (screenWidth<1000.0)? 0.18 : 0.22; - double registersHeightPct = (screenWidth<1000.0)? 0.72 : 0.80; - - Dimension messagesPanePreferredSize = new Dimension((int)(screenWidth*messageWidthPct),(int)(screenHeight*messageHeightPct)); - Dimension mainPanePreferredSize = new Dimension((int)(screenWidth*mainWidthPct),(int)(screenHeight*mainHeightPct)); - Dimension registersPanePreferredSize = new Dimension((int)(screenWidth*registersWidthPct),(int)(screenHeight*registersHeightPct)); - - // the "restore" size (window control button that toggles with maximize) - // I want to keep it large, with enough room for user to get handles - //this.setSize((int)(screenWidth*.8),(int)(screenHeight*.8)); - - Globals.initialize(true); - - // image courtesy of NASA/JPL. - URL im = this.getClass().getResource(Globals.imagesPath+"RedMars16.gif"); - if (im == null) { + * Constructor for the Class. Sets up a window object for the UI + * + * @param s Name of the window to be created. + **/ + + public VenusUI(String s) { + super(s); + mainUI = this; + Globals.setGui(this); + this.editor = new Editor(this); + + double screenWidth = Toolkit.getDefaultToolkit().getScreenSize().getWidth(); + double screenHeight = Toolkit.getDefaultToolkit().getScreenSize().getHeight(); + // basically give up some screen space if running at 800 x 600 + double messageWidthPct = (screenWidth < 1000.0) ? 0.67 : 0.73; + double messageHeightPct = (screenWidth < 1000.0) ? 0.12 : 0.15; + double mainWidthPct = (screenWidth < 1000.0) ? 0.67 : 0.73; + double mainHeightPct = (screenWidth < 1000.0) ? 0.60 : 0.65; + double registersWidthPct = (screenWidth < 1000.0) ? 0.18 : 0.22; + double registersHeightPct = (screenWidth < 1000.0) ? 0.72 : 0.80; + + Dimension messagesPanePreferredSize = new Dimension((int) (screenWidth * messageWidthPct), (int) (screenHeight * messageHeightPct)); + Dimension mainPanePreferredSize = new Dimension((int) (screenWidth * mainWidthPct), (int) (screenHeight * mainHeightPct)); + Dimension registersPanePreferredSize = new Dimension((int) (screenWidth * registersWidthPct), (int) (screenHeight * registersHeightPct)); + + // the "restore" size (window control button that toggles with maximize) + // I want to keep it large, with enough room for user to get handles + //this.setSize((int)(screenWidth*.8),(int)(screenHeight*.8)); + + Globals.initialize(true); + + // image courtesy of NASA/JPL. + URL im = this.getClass().getResource(Globals.imagesPath + "RedMars16.gif"); + if (im == null) { System.out.println("Internal Error: images folder or file not found"); System.exit(0); - } - Image mars = Toolkit.getDefaultToolkit().getImage(im); - this.setIconImage(mars); - // Everything in frame will be arranged on JPanel "center", which is only frame component. - // "center" has BorderLayout and 2 major components: - // -- panel (jp) on North with 2 components - // 1. toolbar - // 2. run speed slider. - // -- split pane (horizonSplitter) in center with 2 components side-by-side - // 1. split pane (splitter) with 2 components stacked - // a. main pane, with 2 tabs (edit, execute) - // b. messages pane with 2 tabs (mars, run I/O) - // 2. registers pane with 3 tabs (register file, coproc 0, coproc 1) - // I should probably run this breakdown out to full detail. The components are created - // roughly in bottom-up order; some are created in component constructors and thus are - // not visible here. - - registersTab = new RegistersWindow(); - coprocessor1Tab = new Coprocessor1Window(); - coprocessor0Tab = new Coprocessor0Window(); - registersPane = new RegistersPane(mainUI, registersTab,coprocessor1Tab, coprocessor0Tab); - registersPane.setPreferredSize(registersPanePreferredSize); - - //Insets defaultTabInsets = (Insets)UIManager.get("TabbedPane.tabInsets"); - //UIManager.put("TabbedPane.tabInsets", new Insets(1, 1, 1, 1)); - mainPane = new MainPane(mainUI, editor, registersTab, coprocessor1Tab, coprocessor0Tab); - //UIManager.put("TabbedPane.tabInsets", defaultTabInsets); - - mainPane.setPreferredSize(mainPanePreferredSize); - messagesPane= new MessagesPane(); - messagesPane.setPreferredSize(messagesPanePreferredSize); - splitter= new JSplitPane(JSplitPane.VERTICAL_SPLIT, mainPane, messagesPane); - splitter.setOneTouchExpandable(true); - splitter.resetToPreferredSizes(); - horizonSplitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitter, registersPane); - horizonSplitter.setOneTouchExpandable(true); - horizonSplitter.resetToPreferredSizes(); - - // due to dependencies, do not set up menu/toolbar until now. - this.createActionObjects(); - menu= this.setUpMenuBar(); - this.setJMenuBar(menu); - - toolbar= this.setUpToolBar(); - - JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); - jp.add(toolbar); - jp.add(RunSpeedPanel.getInstance()); - JPanel center= new JPanel(new BorderLayout()); - center.add(jp, BorderLayout.NORTH); - center.add(horizonSplitter); - - - - this.getContentPane().add(center); - - FileStatus.reset(); - // The following has side effect of establishing menu state - FileStatus.set(FileStatus.NO_FILE); - - // This is invoked when opening the app. It will set the app to - // appear at full screen size. - this.addWindowListener( - new WindowAdapter() { - public void windowOpened(WindowEvent e) { - mainUI.setExtendedState(JFrame.MAXIMIZED_BOTH); - } - }); - + } + Image mars = Toolkit.getDefaultToolkit().getImage(im); + this.setIconImage(mars); + // Everything in frame will be arranged on JPanel "center", which is only frame component. + // "center" has BorderLayout and 2 major components: + // -- panel (jp) on North with 2 components + // 1. toolbar + // 2. run speed slider. + // -- split pane (horizonSplitter) in center with 2 components side-by-side + // 1. split pane (splitter) with 2 components stacked + // a. main pane, with 2 tabs (edit, execute) + // b. messages pane with 2 tabs (mars, run I/O) + // 2. registers pane with 3 tabs (register file, coproc 0, coproc 1) + // I should probably run this breakdown out to full detail. The components are created + // roughly in bottom-up order; some are created in component constructors and thus are + // not visible here. + + registersTab = new RegistersWindow(); + coprocessor1Tab = new Coprocessor1Window(); + coprocessor0Tab = new Coprocessor0Window(); + registersPane = new RegistersPane(mainUI, registersTab, coprocessor1Tab, coprocessor0Tab); + registersPane.setPreferredSize(registersPanePreferredSize); + + //Insets defaultTabInsets = (Insets)UIManager.get("TabbedPane.tabInsets"); + //UIManager.put("TabbedPane.tabInsets", new Insets(1, 1, 1, 1)); + mainPane = new MainPane(mainUI, editor, registersTab, coprocessor1Tab, coprocessor0Tab); + //UIManager.put("TabbedPane.tabInsets", defaultTabInsets); + + mainPane.setPreferredSize(mainPanePreferredSize); + messagesPane = new MessagesPane(); + messagesPane.setPreferredSize(messagesPanePreferredSize); + splitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mainPane, messagesPane); + splitter.setOneTouchExpandable(true); + splitter.resetToPreferredSizes(); + horizonSplitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitter, registersPane); + horizonSplitter.setOneTouchExpandable(true); + horizonSplitter.resetToPreferredSizes(); + + // due to dependencies, do not set up menu/toolbar until now. + this.createActionObjects(); + menu = this.setUpMenuBar(); + this.setJMenuBar(menu); + + toolbar = this.setUpToolBar(); + + JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT)); + jp.add(toolbar); + jp.add(RunSpeedPanel.getInstance()); + JPanel center = new JPanel(new BorderLayout()); + center.add(jp, BorderLayout.NORTH); + center.add(horizonSplitter); + + + this.getContentPane().add(center); + + FileStatus.reset(); + // The following has side effect of establishing menu state + FileStatus.set(FileStatus.NO_FILE); + + // This is invoked when opening the app. It will set the app to + // appear at full screen size. + this.addWindowListener(new WindowAdapter() { + public void windowOpened(WindowEvent e) { + mainUI.setExtendedState(JFrame.MAXIMIZED_BOTH); + } + }); + // This is invoked when exiting the app through the X icon. It will in turn // check for unsaved edits before exiting. - this.addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent e) { - if (mainUI.editor.closeAll()) { - System.exit(0); - } - } - }); - - // The following will handle the windowClosing event properly in the - // situation where user Cancels out of "save edits?" dialog. By default, - // the GUI frame will be hidden but I want it to do nothing. - this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - - this.pack(); - this.setVisible(true); - } - - - /* - * Action objects are used instead of action listeners because one can be easily shared between - * a menu item and a toolbar button. Does nice things like disable both if the action is - * disabled, etc. - */ - private void createActionObjects() { - Toolkit tk = Toolkit.getDefaultToolkit(); - Class cs = this.getClass(); - try { - fileNewAction = new FileNewAction("New", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"New22.png"))), - "Create a new file for editing", new Integer(KeyEvent.VK_N), - KeyStroke.getKeyStroke( KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - fileOpenAction = new FileOpenAction("Open ...", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Open22.png"))), - "Open a file for editing", new Integer(KeyEvent.VK_O), - KeyStroke.getKeyStroke( KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - fileCloseAction = new FileCloseAction("Close", null, - "Close the current file", new Integer(KeyEvent.VK_C), - KeyStroke.getKeyStroke( KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - fileCloseAllAction = new FileCloseAllAction("Close All", null, - "Close all open files", new Integer(KeyEvent.VK_L), - null, mainUI); - fileSaveAction = new FileSaveAction("Save", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Save22.png"))), - "Save the current file", new Integer(KeyEvent.VK_S), - KeyStroke.getKeyStroke( KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - fileSaveAsAction = new FileSaveAsAction("Save as ...", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"SaveAs22.png"))), - "Save current file with different name", new Integer(KeyEvent.VK_A), - null, mainUI); - fileSaveAllAction = new FileSaveAllAction("Save All", null, - "Save all open files", new Integer(KeyEvent.VK_V), - null, mainUI); - fileDumpMemoryAction = new FileDumpMemoryAction("Dump Memory ...", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Dump22.png"))), - "Dump machine code or data in an available format", new Integer(KeyEvent.VK_D), - KeyStroke.getKeyStroke( KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - filePrintAction = new FilePrintAction("Print ...", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Print22.gif"))), - "Print current file", new Integer(KeyEvent.VK_P), - null, mainUI); - fileExitAction = new FileExitAction("Exit", null, - "Exit Mars", new Integer(KeyEvent.VK_X), - null, mainUI); - editUndoAction = new EditUndoAction("Undo", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Undo22.png"))), - "Undo last edit", new Integer(KeyEvent.VK_U), - KeyStroke.getKeyStroke( KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - editRedoAction = new EditRedoAction("Redo", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Redo22.png"))), - "Redo last edit", new Integer(KeyEvent.VK_R), - KeyStroke.getKeyStroke( KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - editCutAction = new EditCutAction("Cut", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Cut22.gif"))), - "Cut", new Integer(KeyEvent.VK_C), - KeyStroke.getKeyStroke( KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - editCopyAction = new EditCopyAction("Copy", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Copy22.png"))), - "Copy", new Integer(KeyEvent.VK_O), - KeyStroke.getKeyStroke( KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - editPasteAction = new EditPasteAction("Paste", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Paste22.png"))), - "Paste", new Integer(KeyEvent.VK_P), - KeyStroke.getKeyStroke( KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - editFindReplaceAction = new EditFindReplaceAction("Find/Replace", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Find22.png"))), - "Find/Replace", new Integer(KeyEvent.VK_F), - KeyStroke.getKeyStroke( KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - editSelectAllAction = new EditSelectAllAction("Select All", - null, //new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Find22.png"))), - "Select All", new Integer(KeyEvent.VK_A), - KeyStroke.getKeyStroke( KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - runAssembleAction = new RunAssembleAction("Assemble", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Assemble22.png"))), - "Assemble the current file and clear breakpoints", new Integer(KeyEvent.VK_A), - KeyStroke.getKeyStroke( KeyEvent.VK_F3, 0), - mainUI); - runGoAction = new RunGoAction("Go", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Play22.png"))), - "Run the current program", new Integer(KeyEvent.VK_G), - KeyStroke.getKeyStroke( KeyEvent.VK_F5, 0), - mainUI); - runStepAction = new RunStepAction("Step", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepForward22.png"))), - "Run one step at a time", new Integer(KeyEvent.VK_T), - KeyStroke.getKeyStroke( KeyEvent.VK_F7, 0), - mainUI); - runBackstepAction = new RunBackstepAction("Backstep", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepBack22.png"))), - "Undo the last step", new Integer(KeyEvent.VK_B), - KeyStroke.getKeyStroke( KeyEvent.VK_F8, 0), - mainUI); - runPauseAction = new RunPauseAction("Pause", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Pause22.png"))), - "Pause the currently running program", new Integer(KeyEvent.VK_P), - KeyStroke.getKeyStroke( KeyEvent.VK_F9, 0), - mainUI); - runStopAction = new RunStopAction("Stop", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Stop22.png"))), - "Stop the currently running program", new Integer(KeyEvent.VK_S), - KeyStroke.getKeyStroke( KeyEvent.VK_F11, 0), - mainUI); - runResetAction = new RunResetAction("Reset", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Reset22.png"))), - "Reset MIPS memory and registers", new Integer(KeyEvent.VK_R), - KeyStroke.getKeyStroke( KeyEvent.VK_F12,0), - mainUI); - runClearBreakpointsAction = new RunClearBreakpointsAction("Clear all breakpoints", - null, - "Clears all execution breakpoints set since the last assemble.", - new Integer(KeyEvent.VK_K), - KeyStroke.getKeyStroke( KeyEvent.VK_K, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - runToggleBreakpointsAction = new RunToggleBreakpointsAction("Toggle all breakpoints", - null, - "Disable/enable all breakpoints without clearing (can also click Bkpt column header)", - new Integer(KeyEvent.VK_T), - KeyStroke.getKeyStroke( KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), - mainUI); - settingsLabelAction = new SettingsLabelAction("Show Labels Window (symbol table)", - null, - "Toggle visibility of Labels window (symbol table) in the Execute tab", - null,null, - mainUI); - settingsPopupInputAction = new SettingsPopupInputAction("Popup dialog for input syscalls (5,6,7,8,12)", - null, - "If set, use popup dialog for input syscalls (5,6,7,8,12) instead of cursor in Run I/O window", - null,null, - mainUI); - - settingsValueDisplayBaseAction = new SettingsValueDisplayBaseAction("Values displayed in hexadecimal", - null, - "Toggle between hexadecimal and decimal display of memory/register values", - null,null, - mainUI); - settingsAddressDisplayBaseAction = new SettingsAddressDisplayBaseAction("Addresses displayed in hexadecimal", - null, - "Toggle between hexadecimal and decimal display of memory addresses", - null,null, - mainUI); - settingsExtendedAction = new SettingsExtendedAction("Permit extended (pseudo) instructions and formats", - null, - "If set, MIPS extended (pseudo) instructions are formats are permitted.", - null,null, - mainUI); - settingsAssembleOnOpenAction = new SettingsAssembleOnOpenAction("Assemble file upon opening", - null, - "If set, a file will be automatically assembled as soon as it is opened. File Open dialog will show most recently opened file.", - null,null, - mainUI); - settingsAssembleAllAction = new SettingsAssembleAllAction("Assemble all files in directory", - null, - "If set, all files in current directory will be assembled when Assemble operation is selected.", - null,null, - mainUI); - settingsWarningsAreErrorsAction = new SettingsWarningsAreErrorsAction("Assembler warnings are considered errors", - null, - "If set, assembler warnings will be interpreted as errors and prevent successful assembly.", - null,null, - mainUI); - settingsStartAtMainAction = new SettingsStartAtMainAction("Initialize Program Counter to global 'main' if defined", - null, - "If set, assembler will initialize Program Counter to text address globally labeled 'main', if defined.", - null,null, - mainUI); - settingsProgramArgumentsAction = new SettingsProgramArgumentsAction("Program arguments provided to MIPS program", - null, - "If set, program arguments for MIPS program can be entered in border of Text Segment window.", - null,null, - mainUI); - settingsDelayedBranchingAction = new SettingsDelayedBranchingAction("Delayed branching", - null, - "If set, delayed branching will occur during MIPS execution.", - null,null, - mainUI); - settingsSelfModifyingCodeAction = new SettingsSelfModifyingCodeAction("Self-modifying code", - null, - "If set, the MIPS program can write and branch to both text and data segments.", - null,null, - mainUI); - settingsEditorAction = new SettingsEditorAction("Editor...", - null, - "View and modify text editor settings.", - null,null, - mainUI); - settingsHighlightingAction = new SettingsHighlightingAction("Highlighting...", - null, - "View and modify Execute Tab highlighting colors", - null,null, - mainUI); - settingsExceptionHandlerAction = new SettingsExceptionHandlerAction("Exception Handler...", - null, - "If set, the specified exception handler file will be included in all Assemble operations.", - null,null, - mainUI); - settingsMemoryConfigurationAction = new SettingsMemoryConfigurationAction("Memory Configuration...", - null, - "View and modify memory segment base addresses for simulated MIPS.", - null,null, - mainUI); - helpHelpAction = new HelpHelpAction("Help", - new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Help22.png"))), - "Help", new Integer(KeyEvent.VK_H), - KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), - mainUI); - helpAboutAction = new HelpAboutAction("About ...",null, - "Information about Mars", null,null, mainUI); - } - catch (NullPointerException e) { - System.out.println("Internal Error: images folder not found, or other null pointer exception while creating Action objects"); - e.printStackTrace(); - System.exit(0); + this.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + if (mainUI.editor.closeAll()) { + System.exit(0); + } } - } - + }); + + // The following will handle the windowClosing event properly in the + // situation where user Cancels out of "save edits?" dialog. By default, + // the GUI frame will be hidden but I want it to do nothing. + this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + + this.pack(); + this.setVisible(true); + } + + /** + * Get current menu state. State values are constants in FileStatus class. DPS 23 July 2008 + * + * @return current menu state. + **/ + + public static int getMenuState() { + return menuState; + } + /* * build the menus and connect them to action objects (which serve as action listeners * shared between menu item and corresponding toolbar icon). */ - - private JMenuBar setUpMenuBar() { - - Toolkit tk = Toolkit.getDefaultToolkit(); - Class cs = this.getClass(); - JMenuBar menuBar = new JMenuBar(); - file=new JMenu("File"); - file.setMnemonic(KeyEvent.VK_F); - edit = new JMenu("Edit"); - edit.setMnemonic(KeyEvent.VK_E); - run=new JMenu("Run"); - run.setMnemonic(KeyEvent.VK_R); - //window = new JMenu("Window"); - //window.setMnemonic(KeyEvent.VK_W); - settings = new JMenu("Settings"); - settings.setMnemonic(KeyEvent.VK_S); - help = new JMenu("Help"); - help.setMnemonic(KeyEvent.VK_H); - // slight bug: user typing alt-H activates help menu item directly, not help menu - - fileNew = new JMenuItem(fileNewAction); - fileNew.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"New16.png")))); - fileOpen = new JMenuItem(fileOpenAction); - fileOpen.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Open16.png")))); - fileClose = new JMenuItem(fileCloseAction); - fileClose.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - fileCloseAll = new JMenuItem(fileCloseAllAction); - fileCloseAll.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - fileSave = new JMenuItem(fileSaveAction); - fileSave.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Save16.png")))); - fileSaveAs = new JMenuItem(fileSaveAsAction); - fileSaveAs.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"SaveAs16.png")))); - fileSaveAll = new JMenuItem(fileSaveAllAction); - fileSaveAll.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - fileDumpMemory = new JMenuItem(fileDumpMemoryAction); - fileDumpMemory.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Dump16.png")))); - filePrint = new JMenuItem(filePrintAction); - filePrint.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Print16.gif")))); - fileExit = new JMenuItem(fileExitAction); - fileExit.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - file.add(fileNew); - file.add(fileOpen); - file.add(fileClose); - file.add(fileCloseAll); - file.addSeparator(); - file.add(fileSave); - file.add(fileSaveAs); - file.add(fileSaveAll); - if (new mars.mips.dump.DumpFormatLoader().loadDumpFormats().size() > 0) { - file.add(fileDumpMemory); - } - file.addSeparator(); - file.add(filePrint); - file.addSeparator(); - file.add(fileExit); - - editUndo = new JMenuItem(editUndoAction); - editUndo.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Undo16.png"))));//"Undo16.gif")))); - editRedo = new JMenuItem(editRedoAction); - editRedo.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Redo16.png"))));//"Redo16.gif")))); - editCut = new JMenuItem(editCutAction); - editCut.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Cut16.gif")))); - editCopy = new JMenuItem(editCopyAction); - editCopy.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Copy16.png"))));//"Copy16.gif")))); - editPaste = new JMenuItem(editPasteAction); - editPaste.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Paste16.png"))));//"Paste16.gif")))); - editFindReplace = new JMenuItem(editFindReplaceAction); - editFindReplace.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Find16.png"))));//"Paste16.gif")))); - editSelectAll = new JMenuItem(editSelectAllAction); - editSelectAll.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - edit.add(editUndo); - edit.add(editRedo); - edit.addSeparator(); - edit.add(editCut); - edit.add(editCopy); - edit.add(editPaste); - edit.addSeparator(); - edit.add(editFindReplace); - edit.add(editSelectAll); - - runAssemble = new JMenuItem(runAssembleAction); - runAssemble.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Assemble16.png"))));//"MyAssemble16.gif")))); - runGo = new JMenuItem(runGoAction); - runGo.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Play16.png"))));//"Play16.gif")))); - runStep = new JMenuItem(runStepAction); - runStep.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepForward16.png"))));//"MyStepForward16.gif")))); - runBackstep = new JMenuItem(runBackstepAction); - runBackstep.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"StepBack16.png"))));//"MyStepBack16.gif")))); - runReset = new JMenuItem(runResetAction); - runReset.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Reset16.png"))));//"MyReset16.gif")))); - runStop = new JMenuItem(runStopAction); - runStop.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Stop16.png"))));//"Stop16.gif")))); - runPause = new JMenuItem(runPauseAction); - runPause.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Pause16.png"))));//"Pause16.gif")))); - runClearBreakpoints = new JMenuItem(runClearBreakpointsAction); - runClearBreakpoints.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - runToggleBreakpoints = new JMenuItem(runToggleBreakpointsAction); - runToggleBreakpoints.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - - run.add(runAssemble); - run.add(runGo); - run.add(runStep); - run.add(runBackstep); - run.add(runPause); - run.add(runStop); - run.add(runReset); - run.addSeparator(); - run.add(runClearBreakpoints); - run.add(runToggleBreakpoints); - - settingsLabel = new JCheckBoxMenuItem(settingsLabelAction); - settingsLabel.setSelected(Globals.getSettings().getLabelWindowVisibility()); - settingsPopupInput = new JCheckBoxMenuItem(settingsPopupInputAction); - settingsPopupInput.setSelected(Globals.getSettings().getBooleanSetting(Settings.POPUP_SYSCALL_INPUT)); - settingsValueDisplayBase = new JCheckBoxMenuItem(settingsValueDisplayBaseAction); - settingsValueDisplayBase.setSelected(Globals.getSettings().getDisplayValuesInHex());//mainPane.getExecutePane().getValueDisplayBaseChooser().isSelected()); - // Tell the corresponding JCheckBox in the Execute Pane about me -- it has already been created. - mainPane.getExecutePane().getValueDisplayBaseChooser().setSettingsMenuItem(settingsValueDisplayBase); - settingsAddressDisplayBase = new JCheckBoxMenuItem(settingsAddressDisplayBaseAction); - settingsAddressDisplayBase.setSelected(Globals.getSettings().getDisplayAddressesInHex());//mainPane.getExecutePane().getValueDisplayBaseChooser().isSelected()); - // Tell the corresponding JCheckBox in the Execute Pane about me -- it has already been created. - mainPane.getExecutePane().getAddressDisplayBaseChooser().setSettingsMenuItem(settingsAddressDisplayBase); - settingsExtended = new JCheckBoxMenuItem(settingsExtendedAction); - settingsExtended.setSelected(Globals.getSettings().getExtendedAssemblerEnabled()); - settingsDelayedBranching = new JCheckBoxMenuItem(settingsDelayedBranchingAction); - settingsDelayedBranching.setSelected(Globals.getSettings().getDelayedBranchingEnabled()); - settingsSelfModifyingCode = new JCheckBoxMenuItem(settingsSelfModifyingCodeAction); - settingsSelfModifyingCode.setSelected(Globals.getSettings().getBooleanSetting(Settings.SELF_MODIFYING_CODE_ENABLED)); - settingsAssembleOnOpen = new JCheckBoxMenuItem(settingsAssembleOnOpenAction); - settingsAssembleOnOpen.setSelected(Globals.getSettings().getAssembleOnOpenEnabled()); - settingsAssembleAll = new JCheckBoxMenuItem(settingsAssembleAllAction); - settingsAssembleAll.setSelected(Globals.getSettings().getAssembleAllEnabled()); - settingsWarningsAreErrors = new JCheckBoxMenuItem(settingsWarningsAreErrorsAction); - settingsWarningsAreErrors.setSelected(Globals.getSettings().getWarningsAreErrors()); - settingsStartAtMain = new JCheckBoxMenuItem(settingsStartAtMainAction); - settingsStartAtMain.setSelected(Globals.getSettings().getStartAtMain()); - settingsProgramArguments = new JCheckBoxMenuItem(settingsProgramArgumentsAction); - settingsProgramArguments.setSelected(Globals.getSettings().getProgramArguments()); - settingsEditor = new JMenuItem(settingsEditorAction); - settingsHighlighting = new JMenuItem(settingsHighlightingAction); - settingsExceptionHandler = new JMenuItem(settingsExceptionHandlerAction); - settingsMemoryConfiguration = new JMenuItem(settingsMemoryConfigurationAction); - - settings.add(settingsLabel); - settings.add(settingsProgramArguments); - settings.add(settingsPopupInput); - settings.add(settingsAddressDisplayBase); - settings.add(settingsValueDisplayBase); - settings.addSeparator(); - settings.add(settingsAssembleOnOpen); - settings.add(settingsAssembleAll); - settings.add(settingsWarningsAreErrors); - settings.add(settingsStartAtMain); - settings.addSeparator(); - settings.add(settingsExtended); - settings.add(settingsDelayedBranching); - settings.add(settingsSelfModifyingCode); - settings.addSeparator(); - settings.add(settingsEditor); - settings.add(settingsHighlighting); - settings.add(settingsExceptionHandler); - settings.add(settingsMemoryConfiguration); - - helpHelp = new JMenuItem(helpHelpAction); - helpHelp.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Help16.png"))));//"Help16.gif")))); - helpAbout = new JMenuItem(helpAboutAction); - helpAbout.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"MyBlank16.gif")))); - help.add(helpHelp); - help.addSeparator(); - help.add(helpAbout); - - menuBar.add(file); - menuBar.add(edit); - menuBar.add(run); - menuBar.add(settings); - JMenu toolMenu = new ToolLoader().buildToolsMenu(); - if (toolMenu != null) menuBar.add(toolMenu); - menuBar.add(help); - - // experiment with popup menu for settings. 3 Aug 2006 PS - //setupPopupMenu(); - - return menuBar; - } - - /* - * build the toolbar and connect items to action objects (which serve as action listeners - * shared between toolbar icon and corresponding menu item). - */ - - JToolBar setUpToolBar() { - JToolBar toolBar = new JToolBar(); - - New = new JButton(fileNewAction); - New.setText(""); - Open = new JButton(fileOpenAction); - Open.setText(""); - Save = new JButton(fileSaveAction); - Save.setText(""); - SaveAs = new JButton(fileSaveAsAction); - SaveAs.setText(""); - DumpMemory = new JButton(fileDumpMemoryAction); - DumpMemory.setText(""); - Print= new JButton(filePrintAction); - Print.setText(""); - - Undo = new JButton(editUndoAction); - Undo.setText(""); - Redo = new JButton(editRedoAction); - Redo.setText(""); - Cut= new JButton(editCutAction); - Cut.setText(""); - Copy= new JButton(editCopyAction); - Copy.setText(""); - Paste= new JButton(editPasteAction); - Paste.setText(""); - FindReplace = new JButton(editFindReplaceAction); - FindReplace.setText(""); - SelectAll = new JButton(editSelectAllAction); - SelectAll.setText(""); - - Run = new JButton(runGoAction); - Run.setText(""); - Assemble = new JButton(runAssembleAction); - Assemble.setText(""); - Step = new JButton(runStepAction); - Step.setText(""); - Backstep = new JButton(runBackstepAction); - Backstep.setText(""); - Reset = new JButton(runResetAction); - Reset.setText(""); - Stop = new JButton(runStopAction); - Stop.setText(""); - Pause = new JButton(runPauseAction); - Pause.setText(""); - Help= new JButton(helpHelpAction); - Help.setText(""); - - toolBar.add(New); - toolBar.add(Open); - toolBar.add(Save); - toolBar.add(SaveAs); - if (new mars.mips.dump.DumpFormatLoader().loadDumpFormats().size() > 0) { - toolBar.add(DumpMemory); - } - toolBar.add(Print); - toolBar.add(new JToolBar.Separator()); - toolBar.add(Undo); - toolBar.add(Redo); - toolBar.add(Cut); - toolBar.add(Copy); - toolBar.add(Paste); - toolBar.add(FindReplace); - toolBar.add(new JToolBar.Separator()); - toolBar.add(Assemble); - toolBar.add(Run); - toolBar.add(Step); - toolBar.add(Backstep); - toolBar.add(Pause); - toolBar.add(Stop); - toolBar.add(Reset); - toolBar.add(new JToolBar.Separator()); - toolBar.add(Help); - toolBar.add(new JToolBar.Separator()); - - return toolBar; - } - - - /* Determine from FileStatus what the menu state (enabled/disabled)should + + /* Determine from FileStatus what the menu state (enabled/disabled)should * be then call the appropriate method to set it. Current states are: * * setMenuStateInitial: set upon startup and after File->Close @@ -740,103 +243,470 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * setMenuStateRunning: set upon Run->Go * setMenuStateTerminated: set upon completion of simulated execution */ - void setMenuState(int status) { - menuState = status; - switch (status) { + void setMenuState(int status) { + menuState = status; + switch (status) { case FileStatus.NO_FILE: - setMenuStateInitial(); - break; + setMenuStateInitial(); + break; case FileStatus.NEW_NOT_EDITED: - setMenuStateEditingNew(); - break; + setMenuStateEditingNew(); + break; case FileStatus.NEW_EDITED: - setMenuStateEditingNew(); - break; + setMenuStateEditingNew(); + break; case FileStatus.NOT_EDITED: - setMenuStateNotEdited(); // was MenuStateEditing. DPS 9-Aug-2011 - break; + setMenuStateNotEdited(); // was MenuStateEditing. DPS 9-Aug-2011 + break; case FileStatus.EDITED: - setMenuStateEditing(); - break; + setMenuStateEditing(); + break; case FileStatus.RUNNABLE: - setMenuStateRunnable(); - break; + setMenuStateRunnable(); + break; case FileStatus.RUNNING: - setMenuStateRunning(); - break; + setMenuStateRunning(); + break; case FileStatus.TERMINATED: - setMenuStateTerminated(); - break; + setMenuStateTerminated(); + break; case FileStatus.OPENING:// This is a temporary state. DPS 9-Aug-2011 - break; + break; default: - System.out.println("Invalid File Status: "+status); - break; - } - } - - - void setMenuStateInitial() { - fileNewAction.setEnabled(true); - fileOpenAction.setEnabled(true); - fileCloseAction.setEnabled(false); - fileCloseAllAction.setEnabled(false); - fileSaveAction.setEnabled(false); - fileSaveAsAction.setEnabled(false); - fileSaveAllAction.setEnabled(false); - fileDumpMemoryAction.setEnabled(false); - filePrintAction.setEnabled(false); - fileExitAction.setEnabled(true); - editUndoAction.setEnabled(false); - editRedoAction.setEnabled(false); - editCutAction.setEnabled(false); - editCopyAction.setEnabled(false); - editPasteAction.setEnabled(false); - editFindReplaceAction.setEnabled(false); - editSelectAllAction.setEnabled(false); - settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 - settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 - runAssembleAction.setEnabled(false); - runGoAction.setEnabled(false); - runStepAction.setEnabled(false); - runBackstepAction.setEnabled(false); - runResetAction.setEnabled(false); - runStopAction.setEnabled(false); - runPauseAction.setEnabled(false); - runClearBreakpointsAction.setEnabled(false); - runToggleBreakpointsAction.setEnabled(false); - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.updateUndoState(); - editRedoAction.updateRedoState(); - } - - /* Added DPS 9-Aug-2011, for newly-opened files. Retain - existing Run menu state (except Assemble, which is always true). - Thus if there was a valid assembly it is retained. */ - void setMenuStateNotEdited() { - /* Note: undo and redo are handled separately by the undo manager*/ - fileNewAction.setEnabled(true); - fileOpenAction.setEnabled(true); - fileCloseAction.setEnabled(true); - fileCloseAllAction.setEnabled(true); - fileSaveAction.setEnabled(true); - fileSaveAsAction.setEnabled(true); - fileSaveAllAction.setEnabled(true); - fileDumpMemoryAction.setEnabled(false); - filePrintAction.setEnabled(true); - fileExitAction.setEnabled(true); - editCutAction.setEnabled(true); - editCopyAction.setEnabled(true); - editPasteAction.setEnabled(true); - editFindReplaceAction.setEnabled(true); - editSelectAllAction.setEnabled(true); - settingsDelayedBranchingAction.setEnabled(true); - settingsMemoryConfigurationAction.setEnabled(true); - runAssembleAction.setEnabled(true); - // If assemble-all, allow previous Run menu settings to remain. - // Otherwise, clear them out. DPS 9-Aug-2011 - if (!Globals.getSettings().getBooleanSetting(mars.Settings.ASSEMBLE_ALL_ENABLED)) { + System.out.println("Invalid File Status: " + status); + break; + } + } + + /* + * build the toolbar and connect items to action objects (which serve as action listeners + * shared between toolbar icon and corresponding menu item). + */ + + /** + * To find out whether the register values are reset. + * + * @return Boolean true if the register values have been reset. + **/ + + public static boolean getReset() { + return reset; + } + + /** + * To set whether the register values are reset. + * + * @param b Boolean true if the register values have been reset. + **/ + + public static void setReset(boolean b) { + reset = b; + } + + /** + * To find out whether MIPS program is currently executing. + * + * @return true if MIPS program is currently executing. + **/ + public static boolean getStarted() { + return started; + } + + /** + * To set whether MIPS program execution has started. + * + * @param b true if the MIPS program execution has started. + **/ + + public static void setStarted(boolean b) { + started = b; + } + + /* + * Action objects are used instead of action listeners because one can be easily shared between + * a menu item and a toolbar button. Does nice things like disable both if the action is + * disabled, etc. + */ + private void createActionObjects() { + Toolkit tk = Toolkit.getDefaultToolkit(); + Class cs = this.getClass(); + try { + fileNewAction = new FileNewAction("New", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "New22.png"))), "Create a new file for editing", KeyEvent.VK_N, KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + fileOpenAction = new FileOpenAction("Open ...", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Open22.png"))), "Open a file for editing", KeyEvent.VK_O, KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + fileCloseAction = new FileCloseAction("Close", null, "Close the current file", KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + fileCloseAllAction = new FileCloseAllAction("Close All", null, "Close all open files", KeyEvent.VK_L, null, mainUI); + fileSaveAction = new FileSaveAction("Save", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Save22.png"))), "Save the current file", KeyEvent.VK_S, KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + fileSaveAsAction = new FileSaveAsAction("Save as ...", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "SaveAs22.png"))), "Save current file with different name", KeyEvent.VK_A, null, mainUI); + fileSaveAllAction = new FileSaveAllAction("Save All", null, "Save all open files", KeyEvent.VK_V, null, mainUI); + fileDumpMemoryAction = new FileDumpMemoryAction("Dump Memory ...", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Dump22.png"))), "Dump machine code or data in an available format", KeyEvent.VK_D, KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + filePrintAction = new FilePrintAction("Print ...", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Print22.gif"))), "Print current file", KeyEvent.VK_P, null, mainUI); + fileExitAction = new FileExitAction("Exit", null, "Exit Mars", KeyEvent.VK_X, null, mainUI); + editUndoAction = new EditUndoAction("Undo", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Undo22.png"))), "Undo last edit", KeyEvent.VK_U, KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + editRedoAction = new EditRedoAction("Redo", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Redo22.png"))), "Redo last edit", KeyEvent.VK_R, KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + editCutAction = new EditCutAction("Cut", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Cut22.gif"))), "Cut", KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + editCopyAction = new EditCopyAction("Copy", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Copy22.png"))), "Copy", KeyEvent.VK_O, KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + editPasteAction = new EditPasteAction("Paste", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Paste22.png"))), "Paste", KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + editFindReplaceAction = new EditFindReplaceAction("Find/Replace", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Find22.png"))), "Find/Replace", KeyEvent.VK_F, KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + editSelectAllAction = new EditSelectAllAction("Select All", null, //new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath+"Find22.png"))), + "Select All", KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + runAssembleAction = new RunAssembleAction("Assemble", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Assemble22.png"))), "Assemble the current file and clear breakpoints", KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0), mainUI); + runGoAction = new RunGoAction("Go", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Play22.png"))), "Run the current program", KeyEvent.VK_G, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), mainUI); + runStepAction = new RunStepAction("Step", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "StepForward22.png"))), "Run one step at a time", KeyEvent.VK_T, KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0), mainUI); + runBackstepAction = new RunBackstepAction("Backstep", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "StepBack22.png"))), "Undo the last step", KeyEvent.VK_B, KeyStroke.getKeyStroke(KeyEvent.VK_F8, 0), mainUI); + runPauseAction = new RunPauseAction("Pause", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Pause22.png"))), "Pause the currently running program", KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0), mainUI); + runStopAction = new RunStopAction("Stop", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Stop22.png"))), "Stop the currently running program", KeyEvent.VK_S, KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0), mainUI); + runResetAction = new RunResetAction("Reset", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Reset22.png"))), "Reset MIPS memory and registers", KeyEvent.VK_R, KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0), mainUI); + runClearBreakpointsAction = new RunClearBreakpointsAction("Clear all breakpoints", null, "Clears all execution breakpoints set since the last assemble.", KeyEvent.VK_K, KeyStroke.getKeyStroke(KeyEvent.VK_K, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + runToggleBreakpointsAction = new RunToggleBreakpointsAction("Toggle all breakpoints", null, "Disable/enable all breakpoints without clearing (can also click Bkpt column header)", KeyEvent.VK_T, KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), mainUI); + settingsLabelAction = new SettingsLabelAction("Show Labels Window (symbol table)", null, "Toggle visibility of Labels window (symbol table) in the Execute tab", null, null, mainUI); + settingsPopupInputAction = new SettingsPopupInputAction("Popup dialog for input syscalls (5,6,7,8,12)", null, "If set, use popup dialog for input syscalls (5,6,7,8,12) instead of cursor in Run I/O window", null, null, mainUI); + + settingsValueDisplayBaseAction = new SettingsValueDisplayBaseAction("Values displayed in hexadecimal", null, "Toggle between hexadecimal and decimal display of memory/register values", null, null, mainUI); + settingsAddressDisplayBaseAction = new SettingsAddressDisplayBaseAction("Addresses displayed in hexadecimal", null, "Toggle between hexadecimal and decimal display of memory addresses", null, null, mainUI); + settingsExtendedAction = new SettingsExtendedAction("Permit extended (pseudo) instructions and formats", null, "If set, MIPS extended (pseudo) instructions are formats are permitted.", null, null, mainUI); + settingsAssembleOnOpenAction = new SettingsAssembleOnOpenAction("Assemble file upon opening", null, "If set, a file will be automatically assembled as soon as it is opened. File Open dialog will show most recently opened file.", null, null, mainUI); + settingsAssembleAllAction = new SettingsAssembleAllAction("Assemble all files in directory", null, "If set, all files in current directory will be assembled when Assemble operation is selected.", null, null, mainUI); + settingsWarningsAreErrorsAction = new SettingsWarningsAreErrorsAction("Assembler warnings are considered errors", null, "If set, assembler warnings will be interpreted as errors and prevent successful assembly.", null, null, mainUI); + settingsStartAtMainAction = new SettingsStartAtMainAction("Initialize Program Counter to global 'main' if defined", null, "If set, assembler will initialize Program Counter to text address globally labeled 'main', if defined.", null, null, mainUI); + settingsProgramArgumentsAction = new SettingsProgramArgumentsAction("Program arguments provided to MIPS program", null, "If set, program arguments for MIPS program can be entered in border of Text Segment window.", null, null, mainUI); + settingsDelayedBranchingAction = new SettingsDelayedBranchingAction("Delayed branching", null, "If set, delayed branching will occur during MIPS execution.", null, null, mainUI); + settingsSelfModifyingCodeAction = new SettingsSelfModifyingCodeAction("Self-modifying code", null, "If set, the MIPS program can write and branch to both text and data segments.", null, null, mainUI); + settingsEditorAction = new SettingsEditorAction("Editor...", null, "View and modify text editor settings.", null, null, mainUI); + settingsHighlightingAction = new SettingsHighlightingAction("Highlighting...", null, "View and modify Execute Tab highlighting colors", null, null, mainUI); + settingsExceptionHandlerAction = new SettingsExceptionHandlerAction("Exception Handler...", null, "If set, the specified exception handler file will be included in all Assemble operations.", null, null, mainUI); + settingsMemoryConfigurationAction = new SettingsMemoryConfigurationAction("Memory Configuration...", null, "View and modify memory segment base addresses for simulated MIPS.", null, null, mainUI); + helpHelpAction = new HelpHelpAction("Help", new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Help22.png"))), "Help", KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), mainUI); + helpAboutAction = new HelpAboutAction("About ...", null, "Information about Mars", null, null, mainUI); + } catch (NullPointerException e) { + System.out.println("Internal Error: images folder not found, or other null pointer exception while creating Action objects"); + e.printStackTrace(); + System.exit(0); + } + } + + private JMenuBar setUpMenuBar() { + + Toolkit tk = Toolkit.getDefaultToolkit(); + Class cs = this.getClass(); + JMenuBar menuBar = new JMenuBar(); + file = new JMenu("File"); + file.setMnemonic(KeyEvent.VK_F); + edit = new JMenu("Edit"); + edit.setMnemonic(KeyEvent.VK_E); + run = new JMenu("Run"); + run.setMnemonic(KeyEvent.VK_R); + //window = new JMenu("Window"); + //window.setMnemonic(KeyEvent.VK_W); + settings = new JMenu("Settings"); + settings.setMnemonic(KeyEvent.VK_S); + help = new JMenu("Help"); + help.setMnemonic(KeyEvent.VK_H); + // slight bug: user typing alt-H activates help menu item directly, not help menu + + fileNew = new JMenuItem(fileNewAction); + fileNew.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "New16.png")))); + fileOpen = new JMenuItem(fileOpenAction); + fileOpen.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Open16.png")))); + fileClose = new JMenuItem(fileCloseAction); + fileClose.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + fileCloseAll = new JMenuItem(fileCloseAllAction); + fileCloseAll.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + fileSave = new JMenuItem(fileSaveAction); + fileSave.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Save16.png")))); + fileSaveAs = new JMenuItem(fileSaveAsAction); + fileSaveAs.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "SaveAs16.png")))); + fileSaveAll = new JMenuItem(fileSaveAllAction); + fileSaveAll.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + fileDumpMemory = new JMenuItem(fileDumpMemoryAction); + fileDumpMemory.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Dump16.png")))); + filePrint = new JMenuItem(filePrintAction); + filePrint.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Print16.gif")))); + fileExit = new JMenuItem(fileExitAction); + fileExit.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + file.add(fileNew); + file.add(fileOpen); + file.add(fileClose); + file.add(fileCloseAll); + file.addSeparator(); + file.add(fileSave); + file.add(fileSaveAs); + file.add(fileSaveAll); + if (new mars.mips.dump.DumpFormatLoader().loadDumpFormats().size() > 0) { + file.add(fileDumpMemory); + } + file.addSeparator(); + file.add(filePrint); + file.addSeparator(); + file.add(fileExit); + + editUndo = new JMenuItem(editUndoAction); + editUndo.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Undo16.png"))));//"Undo16.gif")))); + editRedo = new JMenuItem(editRedoAction); + editRedo.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Redo16.png"))));//"Redo16.gif")))); + editCut = new JMenuItem(editCutAction); + editCut.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Cut16.gif")))); + editCopy = new JMenuItem(editCopyAction); + editCopy.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Copy16.png"))));//"Copy16.gif")))); + editPaste = new JMenuItem(editPasteAction); + editPaste.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Paste16.png"))));//"Paste16.gif")))); + editFindReplace = new JMenuItem(editFindReplaceAction); + editFindReplace.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Find16.png"))));//"Paste16.gif")))); + editSelectAll = new JMenuItem(editSelectAllAction); + editSelectAll.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + edit.add(editUndo); + edit.add(editRedo); + edit.addSeparator(); + edit.add(editCut); + edit.add(editCopy); + edit.add(editPaste); + edit.addSeparator(); + edit.add(editFindReplace); + edit.add(editSelectAll); + + runAssemble = new JMenuItem(runAssembleAction); + runAssemble.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Assemble16.png"))));//"MyAssemble16.gif")))); + runGo = new JMenuItem(runGoAction); + runGo.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Play16.png"))));//"Play16.gif")))); + runStep = new JMenuItem(runStepAction); + runStep.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "StepForward16.png"))));//"MyStepForward16.gif")))); + runBackstep = new JMenuItem(runBackstepAction); + runBackstep.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "StepBack16.png"))));//"MyStepBack16.gif")))); + runReset = new JMenuItem(runResetAction); + runReset.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Reset16.png"))));//"MyReset16.gif")))); + runStop = new JMenuItem(runStopAction); + runStop.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Stop16.png"))));//"Stop16.gif")))); + runPause = new JMenuItem(runPauseAction); + runPause.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Pause16.png"))));//"Pause16.gif")))); + runClearBreakpoints = new JMenuItem(runClearBreakpointsAction); + runClearBreakpoints.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + runToggleBreakpoints = new JMenuItem(runToggleBreakpointsAction); + runToggleBreakpoints.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + + run.add(runAssemble); + run.add(runGo); + run.add(runStep); + run.add(runBackstep); + run.add(runPause); + run.add(runStop); + run.add(runReset); + run.addSeparator(); + run.add(runClearBreakpoints); + run.add(runToggleBreakpoints); + + settingsLabel = new JCheckBoxMenuItem(settingsLabelAction); + settingsLabel.setSelected(Globals.getSettings().getLabelWindowVisibility()); + settingsPopupInput = new JCheckBoxMenuItem(settingsPopupInputAction); + settingsPopupInput.setSelected(Globals.getSettings().getBooleanSetting(Settings.POPUP_SYSCALL_INPUT)); + settingsValueDisplayBase = new JCheckBoxMenuItem(settingsValueDisplayBaseAction); + settingsValueDisplayBase.setSelected(Globals.getSettings().getDisplayValuesInHex());//mainPane.getExecutePane().getValueDisplayBaseChooser().isSelected()); + // Tell the corresponding JCheckBox in the Execute Pane about me -- it has already been created. + mainPane.getExecutePane().getValueDisplayBaseChooser().setSettingsMenuItem(settingsValueDisplayBase); + settingsAddressDisplayBase = new JCheckBoxMenuItem(settingsAddressDisplayBaseAction); + settingsAddressDisplayBase.setSelected(Globals.getSettings().getDisplayAddressesInHex());//mainPane.getExecutePane().getValueDisplayBaseChooser().isSelected()); + // Tell the corresponding JCheckBox in the Execute Pane about me -- it has already been created. + mainPane.getExecutePane().getAddressDisplayBaseChooser().setSettingsMenuItem(settingsAddressDisplayBase); + settingsExtended = new JCheckBoxMenuItem(settingsExtendedAction); + settingsExtended.setSelected(Globals.getSettings().getExtendedAssemblerEnabled()); + settingsDelayedBranching = new JCheckBoxMenuItem(settingsDelayedBranchingAction); + settingsDelayedBranching.setSelected(Globals.getSettings().getDelayedBranchingEnabled()); + settingsSelfModifyingCode = new JCheckBoxMenuItem(settingsSelfModifyingCodeAction); + settingsSelfModifyingCode.setSelected(Globals.getSettings().getBooleanSetting(Settings.SELF_MODIFYING_CODE_ENABLED)); + settingsAssembleOnOpen = new JCheckBoxMenuItem(settingsAssembleOnOpenAction); + settingsAssembleOnOpen.setSelected(Globals.getSettings().getAssembleOnOpenEnabled()); + settingsAssembleAll = new JCheckBoxMenuItem(settingsAssembleAllAction); + settingsAssembleAll.setSelected(Globals.getSettings().getAssembleAllEnabled()); + settingsWarningsAreErrors = new JCheckBoxMenuItem(settingsWarningsAreErrorsAction); + settingsWarningsAreErrors.setSelected(Globals.getSettings().getWarningsAreErrors()); + settingsStartAtMain = new JCheckBoxMenuItem(settingsStartAtMainAction); + settingsStartAtMain.setSelected(Globals.getSettings().getStartAtMain()); + settingsProgramArguments = new JCheckBoxMenuItem(settingsProgramArgumentsAction); + settingsProgramArguments.setSelected(Globals.getSettings().getProgramArguments()); + settingsEditor = new JMenuItem(settingsEditorAction); + settingsHighlighting = new JMenuItem(settingsHighlightingAction); + settingsExceptionHandler = new JMenuItem(settingsExceptionHandlerAction); + settingsMemoryConfiguration = new JMenuItem(settingsMemoryConfigurationAction); + + settings.add(settingsLabel); + settings.add(settingsProgramArguments); + settings.add(settingsPopupInput); + settings.add(settingsAddressDisplayBase); + settings.add(settingsValueDisplayBase); + settings.addSeparator(); + settings.add(settingsAssembleOnOpen); + settings.add(settingsAssembleAll); + settings.add(settingsWarningsAreErrors); + settings.add(settingsStartAtMain); + settings.addSeparator(); + settings.add(settingsExtended); + settings.add(settingsDelayedBranching); + settings.add(settingsSelfModifyingCode); + settings.addSeparator(); + settings.add(settingsEditor); + settings.add(settingsHighlighting); + settings.add(settingsExceptionHandler); + settings.add(settingsMemoryConfiguration); + + helpHelp = new JMenuItem(helpHelpAction); + helpHelp.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "Help16.png"))));//"Help16.gif")))); + helpAbout = new JMenuItem(helpAboutAction); + helpAbout.setIcon(new ImageIcon(tk.getImage(cs.getResource(Globals.imagesPath + "MyBlank16.gif")))); + help.add(helpHelp); + help.addSeparator(); + help.add(helpAbout); + + menuBar.add(file); + menuBar.add(edit); + menuBar.add(run); + menuBar.add(settings); + JMenu toolMenu = new ToolLoader().buildToolsMenu(); + if (toolMenu != null) menuBar.add(toolMenu); + menuBar.add(help); + + // experiment with popup menu for settings. 3 Aug 2006 PS + //setupPopupMenu(); + + return menuBar; + } + + JToolBar setUpToolBar() { + JToolBar toolBar = new JToolBar(); + + New = new JButton(fileNewAction); + New.setText(""); + Open = new JButton(fileOpenAction); + Open.setText(""); + Save = new JButton(fileSaveAction); + Save.setText(""); + SaveAs = new JButton(fileSaveAsAction); + SaveAs.setText(""); + DumpMemory = new JButton(fileDumpMemoryAction); + DumpMemory.setText(""); + Print = new JButton(filePrintAction); + Print.setText(""); + + Undo = new JButton(editUndoAction); + Undo.setText(""); + Redo = new JButton(editRedoAction); + Redo.setText(""); + Cut = new JButton(editCutAction); + Cut.setText(""); + Copy = new JButton(editCopyAction); + Copy.setText(""); + Paste = new JButton(editPasteAction); + Paste.setText(""); + FindReplace = new JButton(editFindReplaceAction); + FindReplace.setText(""); + SelectAll = new JButton(editSelectAllAction); + SelectAll.setText(""); + + Run = new JButton(runGoAction); + Run.setText(""); + Assemble = new JButton(runAssembleAction); + Assemble.setText(""); + Step = new JButton(runStepAction); + Step.setText(""); + Backstep = new JButton(runBackstepAction); + Backstep.setText(""); + Reset = new JButton(runResetAction); + Reset.setText(""); + Stop = new JButton(runStopAction); + Stop.setText(""); + Pause = new JButton(runPauseAction); + Pause.setText(""); + Help = new JButton(helpHelpAction); + Help.setText(""); + + toolBar.add(New); + toolBar.add(Open); + toolBar.add(Save); + toolBar.add(SaveAs); + if (new mars.mips.dump.DumpFormatLoader().loadDumpFormats().size() > 0) { + toolBar.add(DumpMemory); + } + toolBar.add(Print); + toolBar.add(new JToolBar.Separator()); + toolBar.add(Undo); + toolBar.add(Redo); + toolBar.add(Cut); + toolBar.add(Copy); + toolBar.add(Paste); + toolBar.add(FindReplace); + toolBar.add(new JToolBar.Separator()); + toolBar.add(Assemble); + toolBar.add(Run); + toolBar.add(Step); + toolBar.add(Backstep); + toolBar.add(Pause); + toolBar.add(Stop); + toolBar.add(Reset); + toolBar.add(new JToolBar.Separator()); + toolBar.add(Help); + toolBar.add(new JToolBar.Separator()); + + return toolBar; + } + + void setMenuStateInitial() { + fileNewAction.setEnabled(true); + fileOpenAction.setEnabled(true); + fileCloseAction.setEnabled(false); + fileCloseAllAction.setEnabled(false); + fileSaveAction.setEnabled(false); + fileSaveAsAction.setEnabled(false); + fileSaveAllAction.setEnabled(false); + fileDumpMemoryAction.setEnabled(false); + filePrintAction.setEnabled(false); + fileExitAction.setEnabled(true); + editUndoAction.setEnabled(false); + editRedoAction.setEnabled(false); + editCutAction.setEnabled(false); + editCopyAction.setEnabled(false); + editPasteAction.setEnabled(false); + editFindReplaceAction.setEnabled(false); + editSelectAllAction.setEnabled(false); + settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 + settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 + runAssembleAction.setEnabled(false); + runGoAction.setEnabled(false); + runStepAction.setEnabled(false); + runBackstepAction.setEnabled(false); + runResetAction.setEnabled(false); + runStopAction.setEnabled(false); + runPauseAction.setEnabled(false); + runClearBreakpointsAction.setEnabled(false); + runToggleBreakpointsAction.setEnabled(false); + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.updateUndoState(); + editRedoAction.updateRedoState(); + } + + /* Added DPS 9-Aug-2011, for newly-opened files. Retain + existing Run menu state (except Assemble, which is always true). + Thus if there was a valid assembly it is retained. */ + void setMenuStateNotEdited() { + /* Note: undo and redo are handled separately by the undo manager*/ + fileNewAction.setEnabled(true); + fileOpenAction.setEnabled(true); + fileCloseAction.setEnabled(true); + fileCloseAllAction.setEnabled(true); + fileSaveAction.setEnabled(true); + fileSaveAsAction.setEnabled(true); + fileSaveAllAction.setEnabled(true); + fileDumpMemoryAction.setEnabled(false); + filePrintAction.setEnabled(true); + fileExitAction.setEnabled(true); + editCutAction.setEnabled(true); + editCopyAction.setEnabled(true); + editPasteAction.setEnabled(true); + editFindReplaceAction.setEnabled(true); + editSelectAllAction.setEnabled(true); + settingsDelayedBranchingAction.setEnabled(true); + settingsMemoryConfigurationAction.setEnabled(true); + runAssembleAction.setEnabled(true); + // If assemble-all, allow previous Run menu settings to remain. + // Otherwise, clear them out. DPS 9-Aug-2011 + if (!Globals.getSettings().getBooleanSetting(mars.Settings.ASSEMBLE_ALL_ENABLED)) { runGoAction.setEnabled(false); runStepAction.setEnabled(false); runBackstepAction.setEnabled(false); @@ -845,330 +715,289 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. runPauseAction.setEnabled(false); runClearBreakpointsAction.setEnabled(false); runToggleBreakpointsAction.setEnabled(false); - } - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.updateUndoState(); - editRedoAction.updateRedoState(); - } - - - - - void setMenuStateEditing() { - /* Note: undo and redo are handled separately by the undo manager*/ - fileNewAction.setEnabled(true); - fileOpenAction.setEnabled(true); - fileCloseAction.setEnabled(true); - fileCloseAllAction.setEnabled(true); - fileSaveAction.setEnabled(true); - fileSaveAsAction.setEnabled(true); - fileSaveAllAction.setEnabled(true); - fileDumpMemoryAction.setEnabled(false); - filePrintAction.setEnabled(true); - fileExitAction.setEnabled(true); - editCutAction.setEnabled(true); - editCopyAction.setEnabled(true); - editPasteAction.setEnabled(true); - editFindReplaceAction.setEnabled(true); - editSelectAllAction.setEnabled(true); - settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 - settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 - runAssembleAction.setEnabled(true); - runGoAction.setEnabled(false); - runStepAction.setEnabled(false); - runBackstepAction.setEnabled(false); - runResetAction.setEnabled(false); - runStopAction.setEnabled(false); - runPauseAction.setEnabled(false); - runClearBreakpointsAction.setEnabled(false); - runToggleBreakpointsAction.setEnabled(false); - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.updateUndoState(); - editRedoAction.updateRedoState(); - } - - /* Use this when "File -> New" is used - */ - void setMenuStateEditingNew() { - /* Note: undo and redo are handled separately by the undo manager*/ - fileNewAction.setEnabled(true); - fileOpenAction.setEnabled(true); - fileCloseAction.setEnabled(true); - fileCloseAllAction.setEnabled(true); - fileSaveAction.setEnabled(true); - fileSaveAsAction.setEnabled(true); - fileSaveAllAction.setEnabled(true); - fileDumpMemoryAction.setEnabled(false); - filePrintAction.setEnabled(true); - fileExitAction.setEnabled(true); - editCutAction.setEnabled(true); - editCopyAction.setEnabled(true); - editPasteAction.setEnabled(true); - editFindReplaceAction.setEnabled(true); - editSelectAllAction.setEnabled(true); - settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 - settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 - runAssembleAction.setEnabled(false); - runGoAction.setEnabled(false); - runStepAction.setEnabled(false); - runBackstepAction.setEnabled(false); - runResetAction.setEnabled(false); - runStopAction.setEnabled(false); - runPauseAction.setEnabled(false); - runClearBreakpointsAction.setEnabled(false); - runToggleBreakpointsAction.setEnabled(false); - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.updateUndoState(); - editRedoAction.updateRedoState(); - } - - /* Use this upon successful assemble or reset - */ - void setMenuStateRunnable() { - /* Note: undo and redo are handled separately by the undo manager */ - fileNewAction.setEnabled(true); - fileOpenAction.setEnabled(true); - fileCloseAction.setEnabled(true); - fileCloseAllAction.setEnabled(true); - fileSaveAction.setEnabled(true); - fileSaveAsAction.setEnabled(true); - fileSaveAllAction.setEnabled(true); - fileDumpMemoryAction.setEnabled(true); - filePrintAction.setEnabled(true); - fileExitAction.setEnabled(true); - editCutAction.setEnabled(true); - editCopyAction.setEnabled(true); - editPasteAction.setEnabled(true); - editFindReplaceAction.setEnabled(true); - editSelectAllAction.setEnabled(true); - settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 - settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 - runAssembleAction.setEnabled(true); - runGoAction.setEnabled(true); - runStepAction.setEnabled(true); - runBackstepAction.setEnabled( - (Globals.getSettings().getBackSteppingEnabled()&& !Globals.program.getBackStepper().empty()) - ? true : false); - runResetAction.setEnabled(true); - runStopAction.setEnabled(false); - runPauseAction.setEnabled(false); - runToggleBreakpointsAction.setEnabled(true); - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.updateUndoState(); - editRedoAction.updateRedoState(); - } - - /* Use this while program is running - */ - void setMenuStateRunning() { - /* Note: undo and redo are handled separately by the undo manager */ - fileNewAction.setEnabled(false); - fileOpenAction.setEnabled(false); - fileCloseAction.setEnabled(false); - fileCloseAllAction.setEnabled(false); - fileSaveAction.setEnabled(false); - fileSaveAsAction.setEnabled(false); - fileSaveAllAction.setEnabled(false); - fileDumpMemoryAction.setEnabled(false); - filePrintAction.setEnabled(false); - fileExitAction.setEnabled(false); - editCutAction.setEnabled(false); - editCopyAction.setEnabled(false); - editPasteAction.setEnabled(false); - editFindReplaceAction.setEnabled(false); - editSelectAllAction.setEnabled(false); - settingsDelayedBranchingAction.setEnabled(false); // added 25 June 2007 - settingsMemoryConfigurationAction.setEnabled(false); // added 21 July 2009 - runAssembleAction.setEnabled(false); - runGoAction.setEnabled(false); - runStepAction.setEnabled(false); - runBackstepAction.setEnabled(false); - runResetAction.setEnabled(false); - runStopAction.setEnabled(true); - runPauseAction.setEnabled(true); - runToggleBreakpointsAction.setEnabled(false); - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.setEnabled(false);//updateUndoState(); // DPS 10 Jan 2008 - editRedoAction.setEnabled(false);//updateRedoState(); // DPS 10 Jan 2008 - } - /* Use this upon completion of execution - */ - void setMenuStateTerminated() { - /* Note: undo and redo are handled separately by the undo manager */ - fileNewAction.setEnabled(true); - fileOpenAction.setEnabled(true); - fileCloseAction.setEnabled(true); - fileCloseAllAction.setEnabled(true); - fileSaveAction.setEnabled(true); - fileSaveAsAction.setEnabled(true); - fileSaveAllAction.setEnabled(true); - fileDumpMemoryAction.setEnabled(true); - filePrintAction.setEnabled(true); - fileExitAction.setEnabled(true); - editCutAction.setEnabled(true); - editCopyAction.setEnabled(true); - editPasteAction.setEnabled(true); - editFindReplaceAction.setEnabled(true); - editSelectAllAction.setEnabled(true); - settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 - settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 - runAssembleAction.setEnabled(true); - runGoAction.setEnabled(false); - runStepAction.setEnabled(false); - runBackstepAction.setEnabled( - (Globals.getSettings().getBackSteppingEnabled()&& !Globals.program.getBackStepper().empty()) - ? true : false); - runResetAction.setEnabled(true); - runStopAction.setEnabled(false); - runPauseAction.setEnabled(false); - runToggleBreakpointsAction.setEnabled(true); - helpHelpAction.setEnabled(true); - helpAboutAction.setEnabled(true); - editUndoAction.updateUndoState(); - editRedoAction.updateRedoState(); - } - - + } + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.updateUndoState(); + editRedoAction.updateRedoState(); + } + + void setMenuStateEditing() { + /* Note: undo and redo are handled separately by the undo manager*/ + fileNewAction.setEnabled(true); + fileOpenAction.setEnabled(true); + fileCloseAction.setEnabled(true); + fileCloseAllAction.setEnabled(true); + fileSaveAction.setEnabled(true); + fileSaveAsAction.setEnabled(true); + fileSaveAllAction.setEnabled(true); + fileDumpMemoryAction.setEnabled(false); + filePrintAction.setEnabled(true); + fileExitAction.setEnabled(true); + editCutAction.setEnabled(true); + editCopyAction.setEnabled(true); + editPasteAction.setEnabled(true); + editFindReplaceAction.setEnabled(true); + editSelectAllAction.setEnabled(true); + settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 + settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 + runAssembleAction.setEnabled(true); + runGoAction.setEnabled(false); + runStepAction.setEnabled(false); + runBackstepAction.setEnabled(false); + runResetAction.setEnabled(false); + runStopAction.setEnabled(false); + runPauseAction.setEnabled(false); + runClearBreakpointsAction.setEnabled(false); + runToggleBreakpointsAction.setEnabled(false); + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.updateUndoState(); + editRedoAction.updateRedoState(); + } + + /* Use this when "File -> New" is used + */ + void setMenuStateEditingNew() { + /* Note: undo and redo are handled separately by the undo manager*/ + fileNewAction.setEnabled(true); + fileOpenAction.setEnabled(true); + fileCloseAction.setEnabled(true); + fileCloseAllAction.setEnabled(true); + fileSaveAction.setEnabled(true); + fileSaveAsAction.setEnabled(true); + fileSaveAllAction.setEnabled(true); + fileDumpMemoryAction.setEnabled(false); + filePrintAction.setEnabled(true); + fileExitAction.setEnabled(true); + editCutAction.setEnabled(true); + editCopyAction.setEnabled(true); + editPasteAction.setEnabled(true); + editFindReplaceAction.setEnabled(true); + editSelectAllAction.setEnabled(true); + settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 + settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 + runAssembleAction.setEnabled(false); + runGoAction.setEnabled(false); + runStepAction.setEnabled(false); + runBackstepAction.setEnabled(false); + runResetAction.setEnabled(false); + runStopAction.setEnabled(false); + runPauseAction.setEnabled(false); + runClearBreakpointsAction.setEnabled(false); + runToggleBreakpointsAction.setEnabled(false); + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.updateUndoState(); + editRedoAction.updateRedoState(); + } + + /* Use this upon successful assemble or reset + */ + void setMenuStateRunnable() { + /* Note: undo and redo are handled separately by the undo manager */ + fileNewAction.setEnabled(true); + fileOpenAction.setEnabled(true); + fileCloseAction.setEnabled(true); + fileCloseAllAction.setEnabled(true); + fileSaveAction.setEnabled(true); + fileSaveAsAction.setEnabled(true); + fileSaveAllAction.setEnabled(true); + fileDumpMemoryAction.setEnabled(true); + filePrintAction.setEnabled(true); + fileExitAction.setEnabled(true); + editCutAction.setEnabled(true); + editCopyAction.setEnabled(true); + editPasteAction.setEnabled(true); + editFindReplaceAction.setEnabled(true); + editSelectAllAction.setEnabled(true); + settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 + settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 + runAssembleAction.setEnabled(true); + runGoAction.setEnabled(true); + runStepAction.setEnabled(true); + runBackstepAction.setEnabled(Globals.getSettings().getBackSteppingEnabled() && !Globals.program.getBackStepper().empty()); + runResetAction.setEnabled(true); + runStopAction.setEnabled(false); + runPauseAction.setEnabled(false); + runToggleBreakpointsAction.setEnabled(true); + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.updateUndoState(); + editRedoAction.updateRedoState(); + } + + /* Use this while program is running + */ + void setMenuStateRunning() { + /* Note: undo and redo are handled separately by the undo manager */ + fileNewAction.setEnabled(false); + fileOpenAction.setEnabled(false); + fileCloseAction.setEnabled(false); + fileCloseAllAction.setEnabled(false); + fileSaveAction.setEnabled(false); + fileSaveAsAction.setEnabled(false); + fileSaveAllAction.setEnabled(false); + fileDumpMemoryAction.setEnabled(false); + filePrintAction.setEnabled(false); + fileExitAction.setEnabled(false); + editCutAction.setEnabled(false); + editCopyAction.setEnabled(false); + editPasteAction.setEnabled(false); + editFindReplaceAction.setEnabled(false); + editSelectAllAction.setEnabled(false); + settingsDelayedBranchingAction.setEnabled(false); // added 25 June 2007 + settingsMemoryConfigurationAction.setEnabled(false); // added 21 July 2009 + runAssembleAction.setEnabled(false); + runGoAction.setEnabled(false); + runStepAction.setEnabled(false); + runBackstepAction.setEnabled(false); + runResetAction.setEnabled(false); + runStopAction.setEnabled(true); + runPauseAction.setEnabled(true); + runToggleBreakpointsAction.setEnabled(false); + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.setEnabled(false);//updateUndoState(); // DPS 10 Jan 2008 + editRedoAction.setEnabled(false);//updateRedoState(); // DPS 10 Jan 2008 + } + + /* Use this upon completion of execution + */ + void setMenuStateTerminated() { + /* Note: undo and redo are handled separately by the undo manager */ + fileNewAction.setEnabled(true); + fileOpenAction.setEnabled(true); + fileCloseAction.setEnabled(true); + fileCloseAllAction.setEnabled(true); + fileSaveAction.setEnabled(true); + fileSaveAsAction.setEnabled(true); + fileSaveAllAction.setEnabled(true); + fileDumpMemoryAction.setEnabled(true); + filePrintAction.setEnabled(true); + fileExitAction.setEnabled(true); + editCutAction.setEnabled(true); + editCopyAction.setEnabled(true); + editPasteAction.setEnabled(true); + editFindReplaceAction.setEnabled(true); + editSelectAllAction.setEnabled(true); + settingsDelayedBranchingAction.setEnabled(true); // added 25 June 2007 + settingsMemoryConfigurationAction.setEnabled(true); // added 21 July 2009 + runAssembleAction.setEnabled(true); + runGoAction.setEnabled(false); + runStepAction.setEnabled(false); + runBackstepAction.setEnabled(Globals.getSettings().getBackSteppingEnabled() && !Globals.program.getBackStepper().empty()); + runResetAction.setEnabled(true); + runStopAction.setEnabled(false); + runPauseAction.setEnabled(false); + runToggleBreakpointsAction.setEnabled(true); + helpHelpAction.setEnabled(true); + helpAboutAction.setEnabled(true); + editUndoAction.updateUndoState(); + editRedoAction.updateRedoState(); + } + /** - * Get current menu state. State values are constants in FileStatus class. DPS 23 July 2008 - * @return current menu state. + * Get reference to Editor object associated with this GUI. + * + * @return Editor for the GUI. **/ - - public static int getMenuState() { - return menuState; - } - - /** - * To set whether the register values are reset. - * @param b Boolean true if the register values have been reset. - **/ - - public static void setReset(boolean b){ - reset=b; - } - - /** - * To set whether MIPS program execution has started. - * @param b true if the MIPS program execution has started. - **/ - - public static void setStarted(boolean b){ - started=b; - } - /** - * To find out whether the register values are reset. - * @return Boolean true if the register values have been reset. - **/ - - public static boolean getReset(){ - return reset; - } - - /** - * To find out whether MIPS program is currently executing. - * @return true if MIPS program is currently executing. - **/ - public static boolean getStarted(){ - return started; - } - - /** - * Get reference to Editor object associated with this GUI. - * @return Editor for the GUI. - **/ - - public Editor getEditor() { - return editor; - } - - /** - * Get reference to messages pane associated with this GUI. - * @return MessagesPane object associated with the GUI. - **/ - - public MainPane getMainPane() { - return mainPane; - } /** - * Get reference to messages pane associated with this GUI. - * @return MessagesPane object associated with the GUI. - **/ - - public MessagesPane getMessagesPane() { - return messagesPane; - } - - /** - * Get reference to registers pane associated with this GUI. - * @return RegistersPane object associated with the GUI. - **/ - - public RegistersPane getRegistersPane() { - return registersPane; - } - - /** - * Get reference to settings menu item for display base of memory/register values. - * @return the menu item - **/ - - public JCheckBoxMenuItem getValueDisplayBaseMenuItem() { - return settingsValueDisplayBase; - } - - /** - * Get reference to settings menu item for display base of memory/register values. - * @return the menu item - **/ - - public JCheckBoxMenuItem getAddressDisplayBaseMenuItem() { - return settingsAddressDisplayBase; - } - - /** - * Return reference tothe Run->Assemble item's action. Needed by File->Open in case - * assemble-upon-open flag is set. - * @return the Action object for the Run->Assemble operation. - */ - public Action getRunAssembleAction() { - return runAssembleAction; - } - - /** - * Have the menu request keyboard focus. DPS 5-4-10 - */ - public void haveMenuRequestFocus() { - this.menu.requestFocus(); - } - - /** - * Send keyboard event to menu for possible processing. DPS 5-4-10 - * @param evt KeyEvent for menu component to consider for processing. - */ - public void dispatchEventToMenu(KeyEvent evt) { - this.menu.dispatchEvent(evt); - } - - // pop up menu experiment 3 Aug 2006. Keep for possible later revival. - private void setupPopupMenu() { - JPopupMenu popup; - popup = new JPopupMenu(); - // cannot put the same menu item object on two different menus. - // If you want to duplicate functionality, need a different item. - // Should be able to share listeners, but if both menu items are - // JCheckBoxMenuItem, how to keep their checked status in synch? - // If you popup this menu and check the box, the right action occurs - // but its counterpart on the regular menu is not checked. - popup.add(new JCheckBoxMenuItem(settingsLabelAction)); - //Add listener to components that can bring up popup menus. - MouseListener popupListener = new PopupListener(popup); - this.addMouseListener(popupListener); - } - - - - } \ No newline at end of file + + public Editor getEditor() { + return editor; + } + + /** + * Get reference to messages pane associated with this GUI. + * + * @return MessagesPane object associated with the GUI. + **/ + + public MainPane getMainPane() { + return mainPane; + } + + /** + * Get reference to messages pane associated with this GUI. + * + * @return MessagesPane object associated with the GUI. + **/ + + public MessagesPane getMessagesPane() { + return messagesPane; + } + + /** + * Get reference to registers pane associated with this GUI. + * + * @return RegistersPane object associated with the GUI. + **/ + + public RegistersPane getRegistersPane() { + return registersPane; + } + + /** + * Get reference to settings menu item for display base of memory/register values. + * + * @return the menu item + **/ + + public JCheckBoxMenuItem getValueDisplayBaseMenuItem() { + return settingsValueDisplayBase; + } + + /** + * Get reference to settings menu item for display base of memory/register values. + * + * @return the menu item + **/ + + public JCheckBoxMenuItem getAddressDisplayBaseMenuItem() { + return settingsAddressDisplayBase; + } + + /** + * Return reference tothe Run->Assemble item's action. Needed by File->Open in case + * assemble-upon-open flag is set. + * + * @return the Action object for the Run->Assemble operation. + */ + public Action getRunAssembleAction() { + return runAssembleAction; + } + + /** + * Have the menu request keyboard focus. DPS 5-4-10 + */ + public void haveMenuRequestFocus() { + this.menu.requestFocus(); + } + + /** + * Send keyboard event to menu for possible processing. DPS 5-4-10 + * + * @param evt KeyEvent for menu component to consider for processing. + */ + public void dispatchEventToMenu(KeyEvent evt) { + this.menu.dispatchEvent(evt); + } + + // pop up menu experiment 3 Aug 2006. Keep for possible later revival. + private void setupPopupMenu() { + JPopupMenu popup; + popup = new JPopupMenu(); + // cannot put the same menu item object on two different menus. + // If you want to duplicate functionality, need a different item. + // Should be able to share listeners, but if both menu items are + // JCheckBoxMenuItem, how to keep their checked status in synch? + // If you popup this menu and check the box, the right action occurs + // but its counterpart on the regular menu is not checked. + popup.add(new JCheckBoxMenuItem(settingsLabelAction)); + //Add listener to components that can bring up popup menus. + MouseListener popupListener = new PopupListener(popup); + this.addMouseListener(popupListener); + } + + +} diff --git a/src/main/java/ALUcontrolDatapath.xml b/src/main/resources/ALUcontrolDatapath.xml similarity index 100% rename from src/main/java/ALUcontrolDatapath.xml rename to src/main/resources/ALUcontrolDatapath.xml diff --git a/src/main/java/Config.properties b/src/main/resources/Config.properties similarity index 100% rename from src/main/java/Config.properties rename to src/main/resources/Config.properties diff --git a/src/main/java/MARSlicense.txt b/src/main/resources/MARSlicense.txt similarity index 100% rename from src/main/java/MARSlicense.txt rename to src/main/resources/MARSlicense.txt diff --git a/src/main/java/MipsXRayOpcode.xml b/src/main/resources/MipsXRayOpcode.xml similarity index 100% rename from src/main/java/MipsXRayOpcode.xml rename to src/main/resources/MipsXRayOpcode.xml diff --git a/src/main/java/PseudoOps.txt b/src/main/resources/PseudoOps.txt similarity index 100% rename from src/main/java/PseudoOps.txt rename to src/main/resources/PseudoOps.txt diff --git a/src/main/java/Settings.properties b/src/main/resources/Settings.properties similarity index 100% rename from src/main/java/Settings.properties rename to src/main/resources/Settings.properties diff --git a/src/main/java/Syscall.properties b/src/main/resources/Syscall.properties similarity index 100% rename from src/main/java/Syscall.properties rename to src/main/resources/Syscall.properties diff --git a/src/main/java/controlDatapath.xml b/src/main/resources/controlDatapath.xml similarity index 100% rename from src/main/java/controlDatapath.xml rename to src/main/resources/controlDatapath.xml diff --git a/src/main/java/docs/Mars.html b/src/main/resources/docs/Mars.html similarity index 100% rename from src/main/java/docs/Mars.html rename to src/main/resources/docs/Mars.html diff --git a/src/main/java/docs/allclasses-frame.html b/src/main/resources/docs/allclasses-frame.html similarity index 100% rename from src/main/java/docs/allclasses-frame.html rename to src/main/resources/docs/allclasses-frame.html diff --git a/src/main/java/docs/allclasses-noframe.html b/src/main/resources/docs/allclasses-noframe.html similarity index 100% rename from src/main/java/docs/allclasses-noframe.html rename to src/main/resources/docs/allclasses-noframe.html diff --git a/src/main/java/docs/constant-values.html b/src/main/resources/docs/constant-values.html similarity index 100% rename from src/main/java/docs/constant-values.html rename to src/main/resources/docs/constant-values.html diff --git a/src/main/java/docs/deprecated-list.html b/src/main/resources/docs/deprecated-list.html similarity index 100% rename from src/main/java/docs/deprecated-list.html rename to src/main/resources/docs/deprecated-list.html diff --git a/src/main/java/docs/help-doc.html b/src/main/resources/docs/help-doc.html similarity index 100% rename from src/main/java/docs/help-doc.html rename to src/main/resources/docs/help-doc.html diff --git a/src/main/java/docs/index-all.html b/src/main/resources/docs/index-all.html similarity index 100% rename from src/main/java/docs/index-all.html rename to src/main/resources/docs/index-all.html diff --git a/src/main/java/docs/index.html b/src/main/resources/docs/index.html similarity index 100% rename from src/main/java/docs/index.html rename to src/main/resources/docs/index.html diff --git a/src/main/java/docs/mars/ErrorList.html b/src/main/resources/docs/mars/ErrorList.html similarity index 100% rename from src/main/java/docs/mars/ErrorList.html rename to src/main/resources/docs/mars/ErrorList.html diff --git a/src/main/java/docs/mars/ErrorMessage.html b/src/main/resources/docs/mars/ErrorMessage.html similarity index 100% rename from src/main/java/docs/mars/ErrorMessage.html rename to src/main/resources/docs/mars/ErrorMessage.html diff --git a/src/main/java/docs/mars/Globals.html b/src/main/resources/docs/mars/Globals.html similarity index 100% rename from src/main/java/docs/mars/Globals.html rename to src/main/resources/docs/mars/Globals.html diff --git a/src/main/java/docs/mars/MIPSprogram.html b/src/main/resources/docs/mars/MIPSprogram.html similarity index 100% rename from src/main/java/docs/mars/MIPSprogram.html rename to src/main/resources/docs/mars/MIPSprogram.html diff --git a/src/main/java/docs/mars/MarsLaunch.html b/src/main/resources/docs/mars/MarsLaunch.html similarity index 100% rename from src/main/java/docs/mars/MarsLaunch.html rename to src/main/resources/docs/mars/MarsLaunch.html diff --git a/src/main/java/docs/mars/MarsSplashScreen.html b/src/main/resources/docs/mars/MarsSplashScreen.html similarity index 100% rename from src/main/java/docs/mars/MarsSplashScreen.html rename to src/main/resources/docs/mars/MarsSplashScreen.html diff --git a/src/main/java/docs/mars/ProcessingException.html b/src/main/resources/docs/mars/ProcessingException.html similarity index 100% rename from src/main/java/docs/mars/ProcessingException.html rename to src/main/resources/docs/mars/ProcessingException.html diff --git a/src/main/java/docs/mars/ProgramStatement.html b/src/main/resources/docs/mars/ProgramStatement.html similarity index 100% rename from src/main/java/docs/mars/ProgramStatement.html rename to src/main/resources/docs/mars/ProgramStatement.html diff --git a/src/main/java/docs/mars/Settings.html b/src/main/resources/docs/mars/Settings.html similarity index 100% rename from src/main/java/docs/mars/Settings.html rename to src/main/resources/docs/mars/Settings.html diff --git a/src/main/java/docs/mars/assembler/Assembler.html b/src/main/resources/docs/mars/assembler/Assembler.html similarity index 100% rename from src/main/java/docs/mars/assembler/Assembler.html rename to src/main/resources/docs/mars/assembler/Assembler.html diff --git a/src/main/java/docs/mars/assembler/DataTypes.html b/src/main/resources/docs/mars/assembler/DataTypes.html similarity index 100% rename from src/main/java/docs/mars/assembler/DataTypes.html rename to src/main/resources/docs/mars/assembler/DataTypes.html diff --git a/src/main/java/docs/mars/assembler/Directives.html b/src/main/resources/docs/mars/assembler/Directives.html similarity index 100% rename from src/main/java/docs/mars/assembler/Directives.html rename to src/main/resources/docs/mars/assembler/Directives.html diff --git a/src/main/java/docs/mars/assembler/Macro.html b/src/main/resources/docs/mars/assembler/Macro.html similarity index 100% rename from src/main/java/docs/mars/assembler/Macro.html rename to src/main/resources/docs/mars/assembler/Macro.html diff --git a/src/main/java/docs/mars/assembler/MacroPool.html b/src/main/resources/docs/mars/assembler/MacroPool.html similarity index 100% rename from src/main/java/docs/mars/assembler/MacroPool.html rename to src/main/resources/docs/mars/assembler/MacroPool.html diff --git a/src/main/java/docs/mars/assembler/OperandFormat.html b/src/main/resources/docs/mars/assembler/OperandFormat.html similarity index 100% rename from src/main/java/docs/mars/assembler/OperandFormat.html rename to src/main/resources/docs/mars/assembler/OperandFormat.html diff --git a/src/main/java/docs/mars/assembler/SourceLine.html b/src/main/resources/docs/mars/assembler/SourceLine.html similarity index 100% rename from src/main/java/docs/mars/assembler/SourceLine.html rename to src/main/resources/docs/mars/assembler/SourceLine.html diff --git a/src/main/java/docs/mars/assembler/Symbol.html b/src/main/resources/docs/mars/assembler/Symbol.html similarity index 100% rename from src/main/java/docs/mars/assembler/Symbol.html rename to src/main/resources/docs/mars/assembler/Symbol.html diff --git a/src/main/java/docs/mars/assembler/SymbolTable.html b/src/main/resources/docs/mars/assembler/SymbolTable.html similarity index 100% rename from src/main/java/docs/mars/assembler/SymbolTable.html rename to src/main/resources/docs/mars/assembler/SymbolTable.html diff --git a/src/main/java/docs/mars/assembler/Token.html b/src/main/resources/docs/mars/assembler/Token.html similarity index 100% rename from src/main/java/docs/mars/assembler/Token.html rename to src/main/resources/docs/mars/assembler/Token.html diff --git a/src/main/java/docs/mars/assembler/TokenList.html b/src/main/resources/docs/mars/assembler/TokenList.html similarity index 100% rename from src/main/java/docs/mars/assembler/TokenList.html rename to src/main/resources/docs/mars/assembler/TokenList.html diff --git a/src/main/java/docs/mars/assembler/TokenTypes.html b/src/main/resources/docs/mars/assembler/TokenTypes.html similarity index 100% rename from src/main/java/docs/mars/assembler/TokenTypes.html rename to src/main/resources/docs/mars/assembler/TokenTypes.html diff --git a/src/main/java/docs/mars/assembler/Tokenizer.html b/src/main/resources/docs/mars/assembler/Tokenizer.html similarity index 100% rename from src/main/java/docs/mars/assembler/Tokenizer.html rename to src/main/resources/docs/mars/assembler/Tokenizer.html diff --git a/src/main/java/docs/mars/assembler/TranslationCode.html b/src/main/resources/docs/mars/assembler/TranslationCode.html similarity index 100% rename from src/main/java/docs/mars/assembler/TranslationCode.html rename to src/main/resources/docs/mars/assembler/TranslationCode.html diff --git a/src/main/java/docs/mars/assembler/package-frame.html b/src/main/resources/docs/mars/assembler/package-frame.html similarity index 100% rename from src/main/java/docs/mars/assembler/package-frame.html rename to src/main/resources/docs/mars/assembler/package-frame.html diff --git a/src/main/java/docs/mars/assembler/package-summary.html b/src/main/resources/docs/mars/assembler/package-summary.html similarity index 100% rename from src/main/java/docs/mars/assembler/package-summary.html rename to src/main/resources/docs/mars/assembler/package-summary.html diff --git a/src/main/java/docs/mars/assembler/package-tree.html b/src/main/resources/docs/mars/assembler/package-tree.html similarity index 100% rename from src/main/java/docs/mars/assembler/package-tree.html rename to src/main/resources/docs/mars/assembler/package-tree.html diff --git a/src/main/java/docs/mars/mips/dump/AbstractDumpFormat.html b/src/main/resources/docs/mars/mips/dump/AbstractDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/AbstractDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/AbstractDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/AsciiTextDumpFormat.html b/src/main/resources/docs/mars/mips/dump/AsciiTextDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/AsciiTextDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/AsciiTextDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/BinaryDumpFormat.html b/src/main/resources/docs/mars/mips/dump/BinaryDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/BinaryDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/BinaryDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/BinaryTextDumpFormat.html b/src/main/resources/docs/mars/mips/dump/BinaryTextDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/BinaryTextDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/BinaryTextDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/DumpFormat.html b/src/main/resources/docs/mars/mips/dump/DumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/DumpFormat.html rename to src/main/resources/docs/mars/mips/dump/DumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/DumpFormatLoader.html b/src/main/resources/docs/mars/mips/dump/DumpFormatLoader.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/DumpFormatLoader.html rename to src/main/resources/docs/mars/mips/dump/DumpFormatLoader.html diff --git a/src/main/java/docs/mars/mips/dump/HexTextDumpFormat.html b/src/main/resources/docs/mars/mips/dump/HexTextDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/HexTextDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/HexTextDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/IntelHexDumpFormat.html b/src/main/resources/docs/mars/mips/dump/IntelHexDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/IntelHexDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/IntelHexDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/MIFDumpFormat.html b/src/main/resources/docs/mars/mips/dump/MIFDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/MIFDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/MIFDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/SegmentWindowDumpFormat.html b/src/main/resources/docs/mars/mips/dump/SegmentWindowDumpFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/SegmentWindowDumpFormat.html rename to src/main/resources/docs/mars/mips/dump/SegmentWindowDumpFormat.html diff --git a/src/main/java/docs/mars/mips/dump/package-frame.html b/src/main/resources/docs/mars/mips/dump/package-frame.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/package-frame.html rename to src/main/resources/docs/mars/mips/dump/package-frame.html diff --git a/src/main/java/docs/mars/mips/dump/package-summary.html b/src/main/resources/docs/mars/mips/dump/package-summary.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/package-summary.html rename to src/main/resources/docs/mars/mips/dump/package-summary.html diff --git a/src/main/java/docs/mars/mips/dump/package-tree.html b/src/main/resources/docs/mars/mips/dump/package-tree.html similarity index 100% rename from src/main/java/docs/mars/mips/dump/package-tree.html rename to src/main/resources/docs/mars/mips/dump/package-tree.html diff --git a/src/main/java/docs/mars/mips/hardware/AccessNotice.html b/src/main/resources/docs/mars/mips/hardware/AccessNotice.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/AccessNotice.html rename to src/main/resources/docs/mars/mips/hardware/AccessNotice.html diff --git a/src/main/java/docs/mars/mips/hardware/AddressErrorException.html b/src/main/resources/docs/mars/mips/hardware/AddressErrorException.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/AddressErrorException.html rename to src/main/resources/docs/mars/mips/hardware/AddressErrorException.html diff --git a/src/main/java/docs/mars/mips/hardware/Coprocessor0.html b/src/main/resources/docs/mars/mips/hardware/Coprocessor0.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/Coprocessor0.html rename to src/main/resources/docs/mars/mips/hardware/Coprocessor0.html diff --git a/src/main/java/docs/mars/mips/hardware/Coprocessor1.html b/src/main/resources/docs/mars/mips/hardware/Coprocessor1.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/Coprocessor1.html rename to src/main/resources/docs/mars/mips/hardware/Coprocessor1.html diff --git a/src/main/java/docs/mars/mips/hardware/InvalidRegisterAccessException.html b/src/main/resources/docs/mars/mips/hardware/InvalidRegisterAccessException.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/InvalidRegisterAccessException.html rename to src/main/resources/docs/mars/mips/hardware/InvalidRegisterAccessException.html diff --git a/src/main/java/docs/mars/mips/hardware/Memory.html b/src/main/resources/docs/mars/mips/hardware/Memory.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/Memory.html rename to src/main/resources/docs/mars/mips/hardware/Memory.html diff --git a/src/main/java/docs/mars/mips/hardware/MemoryAccessNotice.html b/src/main/resources/docs/mars/mips/hardware/MemoryAccessNotice.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/MemoryAccessNotice.html rename to src/main/resources/docs/mars/mips/hardware/MemoryAccessNotice.html diff --git a/src/main/java/docs/mars/mips/hardware/MemoryConfiguration.html b/src/main/resources/docs/mars/mips/hardware/MemoryConfiguration.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/MemoryConfiguration.html rename to src/main/resources/docs/mars/mips/hardware/MemoryConfiguration.html diff --git a/src/main/java/docs/mars/mips/hardware/MemoryConfigurations.html b/src/main/resources/docs/mars/mips/hardware/MemoryConfigurations.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/MemoryConfigurations.html rename to src/main/resources/docs/mars/mips/hardware/MemoryConfigurations.html diff --git a/src/main/java/docs/mars/mips/hardware/Register.html b/src/main/resources/docs/mars/mips/hardware/Register.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/Register.html rename to src/main/resources/docs/mars/mips/hardware/Register.html diff --git a/src/main/java/docs/mars/mips/hardware/RegisterAccessNotice.html b/src/main/resources/docs/mars/mips/hardware/RegisterAccessNotice.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/RegisterAccessNotice.html rename to src/main/resources/docs/mars/mips/hardware/RegisterAccessNotice.html diff --git a/src/main/java/docs/mars/mips/hardware/RegisterFile.html b/src/main/resources/docs/mars/mips/hardware/RegisterFile.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/RegisterFile.html rename to src/main/resources/docs/mars/mips/hardware/RegisterFile.html diff --git a/src/main/java/docs/mars/mips/hardware/package-frame.html b/src/main/resources/docs/mars/mips/hardware/package-frame.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/package-frame.html rename to src/main/resources/docs/mars/mips/hardware/package-frame.html diff --git a/src/main/java/docs/mars/mips/hardware/package-summary.html b/src/main/resources/docs/mars/mips/hardware/package-summary.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/package-summary.html rename to src/main/resources/docs/mars/mips/hardware/package-summary.html diff --git a/src/main/java/docs/mars/mips/hardware/package-tree.html b/src/main/resources/docs/mars/mips/hardware/package-tree.html similarity index 100% rename from src/main/java/docs/mars/mips/hardware/package-tree.html rename to src/main/resources/docs/mars/mips/hardware/package-tree.html diff --git a/src/main/java/docs/mars/mips/instructions/BasicInstruction.html b/src/main/resources/docs/mars/mips/instructions/BasicInstruction.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/BasicInstruction.html rename to src/main/resources/docs/mars/mips/instructions/BasicInstruction.html diff --git a/src/main/java/docs/mars/mips/instructions/BasicInstructionFormat.html b/src/main/resources/docs/mars/mips/instructions/BasicInstructionFormat.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/BasicInstructionFormat.html rename to src/main/resources/docs/mars/mips/instructions/BasicInstructionFormat.html diff --git a/src/main/java/docs/mars/mips/instructions/ExtendedInstruction.html b/src/main/resources/docs/mars/mips/instructions/ExtendedInstruction.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/ExtendedInstruction.html rename to src/main/resources/docs/mars/mips/instructions/ExtendedInstruction.html diff --git a/src/main/java/docs/mars/mips/instructions/Instruction.html b/src/main/resources/docs/mars/mips/instructions/Instruction.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/Instruction.html rename to src/main/resources/docs/mars/mips/instructions/Instruction.html diff --git a/src/main/java/docs/mars/mips/instructions/InstructionSet.html b/src/main/resources/docs/mars/mips/instructions/InstructionSet.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/InstructionSet.html rename to src/main/resources/docs/mars/mips/instructions/InstructionSet.html diff --git a/src/main/java/docs/mars/mips/instructions/SimulationCode.html b/src/main/resources/docs/mars/mips/instructions/SimulationCode.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/SimulationCode.html rename to src/main/resources/docs/mars/mips/instructions/SimulationCode.html diff --git a/src/main/java/docs/mars/mips/instructions/package-frame.html b/src/main/resources/docs/mars/mips/instructions/package-frame.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/package-frame.html rename to src/main/resources/docs/mars/mips/instructions/package-frame.html diff --git a/src/main/java/docs/mars/mips/instructions/package-summary.html b/src/main/resources/docs/mars/mips/instructions/package-summary.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/package-summary.html rename to src/main/resources/docs/mars/mips/instructions/package-summary.html diff --git a/src/main/java/docs/mars/mips/instructions/package-tree.html b/src/main/resources/docs/mars/mips/instructions/package-tree.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/package-tree.html rename to src/main/resources/docs/mars/mips/instructions/package-tree.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/AbstractSyscall.html b/src/main/resources/docs/mars/mips/instructions/syscalls/AbstractSyscall.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/AbstractSyscall.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/AbstractSyscall.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/RandomStreams.html b/src/main/resources/docs/mars/mips/instructions/syscalls/RandomStreams.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/RandomStreams.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/RandomStreams.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/Syscall.html b/src/main/resources/docs/mars/mips/instructions/syscalls/Syscall.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/Syscall.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/Syscall.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallClose.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallClose.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallClose.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallClose.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallConfirmDialog.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallConfirmDialog.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallConfirmDialog.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallConfirmDialog.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallExit.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallExit.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallExit.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallExit.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallExit2.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallExit2.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallExit2.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallExit2.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogDouble.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogDouble.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogDouble.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogDouble.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogFloat.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogFloat.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogFloat.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogFloat.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogInt.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogInt.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogInt.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogInt.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogString.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogString.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallInputDialogString.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallInputDialogString.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialog.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialog.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialog.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialog.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogDouble.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogDouble.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogDouble.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogDouble.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogFloat.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogFloat.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogFloat.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogFloat.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogInt.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogInt.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogInt.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogInt.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogString.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogString.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMessageDialogString.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMessageDialogString.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMidiOut.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMidiOut.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMidiOut.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMidiOut.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallMidiOutSync.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMidiOutSync.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallMidiOutSync.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallMidiOutSync.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallNumberOverride.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallNumberOverride.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallNumberOverride.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallNumberOverride.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallOpen.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallOpen.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallOpen.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallOpen.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintChar.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintChar.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintChar.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintChar.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintDouble.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintDouble.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintDouble.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintDouble.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintFloat.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintFloat.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintFloat.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintFloat.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintInt.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintInt.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintInt.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintInt.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintIntBinary.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintIntBinary.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintIntBinary.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintIntBinary.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintIntHex.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintIntHex.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintIntHex.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintIntHex.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintIntUnsigned.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintIntUnsigned.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintIntUnsigned.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintIntUnsigned.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintString.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintString.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallPrintString.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallPrintString.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandDouble.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandDouble.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandDouble.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandDouble.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandFloat.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandFloat.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandFloat.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandFloat.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandInt.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandInt.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandInt.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandInt.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandIntRange.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandIntRange.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandIntRange.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandIntRange.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandSeed.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandSeed.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallRandSeed.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRandSeed.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallRead.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRead.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallRead.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallRead.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadChar.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadChar.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadChar.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadChar.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadDouble.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadDouble.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadDouble.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadDouble.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadFloat.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadFloat.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadFloat.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadFloat.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadInt.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadInt.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadInt.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadInt.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadString.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadString.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallReadString.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallReadString.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallSbrk.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallSbrk.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallSbrk.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallSbrk.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallSleep.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallSleep.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallSleep.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallSleep.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallTime.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallTime.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallTime.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallTime.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/SyscallWrite.html b/src/main/resources/docs/mars/mips/instructions/syscalls/SyscallWrite.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/SyscallWrite.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/SyscallWrite.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/package-frame.html b/src/main/resources/docs/mars/mips/instructions/syscalls/package-frame.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/package-frame.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/package-frame.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/package-summary.html b/src/main/resources/docs/mars/mips/instructions/syscalls/package-summary.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/package-summary.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/package-summary.html diff --git a/src/main/java/docs/mars/mips/instructions/syscalls/package-tree.html b/src/main/resources/docs/mars/mips/instructions/syscalls/package-tree.html similarity index 100% rename from src/main/java/docs/mars/mips/instructions/syscalls/package-tree.html rename to src/main/resources/docs/mars/mips/instructions/syscalls/package-tree.html diff --git a/src/main/java/docs/mars/package-frame.html b/src/main/resources/docs/mars/package-frame.html similarity index 100% rename from src/main/java/docs/mars/package-frame.html rename to src/main/resources/docs/mars/package-frame.html diff --git a/src/main/java/docs/mars/package-summary.html b/src/main/resources/docs/mars/package-summary.html similarity index 100% rename from src/main/java/docs/mars/package-summary.html rename to src/main/resources/docs/mars/package-summary.html diff --git a/src/main/java/docs/mars/package-tree.html b/src/main/resources/docs/mars/package-tree.html similarity index 100% rename from src/main/java/docs/mars/package-tree.html rename to src/main/resources/docs/mars/package-tree.html diff --git a/src/main/java/docs/mars/simulator/BackStepper.html b/src/main/resources/docs/mars/simulator/BackStepper.html similarity index 100% rename from src/main/java/docs/mars/simulator/BackStepper.html rename to src/main/resources/docs/mars/simulator/BackStepper.html diff --git a/src/main/java/docs/mars/simulator/DelayedBranch.html b/src/main/resources/docs/mars/simulator/DelayedBranch.html similarity index 100% rename from src/main/java/docs/mars/simulator/DelayedBranch.html rename to src/main/resources/docs/mars/simulator/DelayedBranch.html diff --git a/src/main/java/docs/mars/simulator/Exceptions.html b/src/main/resources/docs/mars/simulator/Exceptions.html similarity index 100% rename from src/main/java/docs/mars/simulator/Exceptions.html rename to src/main/resources/docs/mars/simulator/Exceptions.html diff --git a/src/main/java/docs/mars/simulator/ProgramArgumentList.html b/src/main/resources/docs/mars/simulator/ProgramArgumentList.html similarity index 100% rename from src/main/java/docs/mars/simulator/ProgramArgumentList.html rename to src/main/resources/docs/mars/simulator/ProgramArgumentList.html diff --git a/src/main/java/docs/mars/simulator/Simulator.StopListener.html b/src/main/resources/docs/mars/simulator/Simulator.StopListener.html similarity index 100% rename from src/main/java/docs/mars/simulator/Simulator.StopListener.html rename to src/main/resources/docs/mars/simulator/Simulator.StopListener.html diff --git a/src/main/java/docs/mars/simulator/Simulator.html b/src/main/resources/docs/mars/simulator/Simulator.html similarity index 100% rename from src/main/java/docs/mars/simulator/Simulator.html rename to src/main/resources/docs/mars/simulator/Simulator.html diff --git a/src/main/java/docs/mars/simulator/SimulatorNotice.html b/src/main/resources/docs/mars/simulator/SimulatorNotice.html similarity index 100% rename from src/main/java/docs/mars/simulator/SimulatorNotice.html rename to src/main/resources/docs/mars/simulator/SimulatorNotice.html diff --git a/src/main/java/docs/mars/simulator/SwingWorker.html b/src/main/resources/docs/mars/simulator/SwingWorker.html similarity index 100% rename from src/main/java/docs/mars/simulator/SwingWorker.html rename to src/main/resources/docs/mars/simulator/SwingWorker.html diff --git a/src/main/java/docs/mars/simulator/package-frame.html b/src/main/resources/docs/mars/simulator/package-frame.html similarity index 100% rename from src/main/java/docs/mars/simulator/package-frame.html rename to src/main/resources/docs/mars/simulator/package-frame.html diff --git a/src/main/java/docs/mars/simulator/package-summary.html b/src/main/resources/docs/mars/simulator/package-summary.html similarity index 100% rename from src/main/java/docs/mars/simulator/package-summary.html rename to src/main/resources/docs/mars/simulator/package-summary.html diff --git a/src/main/java/docs/mars/simulator/package-tree.html b/src/main/resources/docs/mars/simulator/package-tree.html similarity index 100% rename from src/main/java/docs/mars/simulator/package-tree.html rename to src/main/resources/docs/mars/simulator/package-tree.html diff --git a/src/main/java/docs/mars/tools/AbstractMarsToolAndApplication.ConnectButton.html b/src/main/resources/docs/mars/tools/AbstractMarsToolAndApplication.ConnectButton.html similarity index 100% rename from src/main/java/docs/mars/tools/AbstractMarsToolAndApplication.ConnectButton.html rename to src/main/resources/docs/mars/tools/AbstractMarsToolAndApplication.ConnectButton.html diff --git a/src/main/java/docs/mars/tools/AbstractMarsToolAndApplication.EnterKeyListener.html b/src/main/resources/docs/mars/tools/AbstractMarsToolAndApplication.EnterKeyListener.html similarity index 100% rename from src/main/java/docs/mars/tools/AbstractMarsToolAndApplication.EnterKeyListener.html rename to src/main/resources/docs/mars/tools/AbstractMarsToolAndApplication.EnterKeyListener.html diff --git a/src/main/java/docs/mars/tools/AbstractMarsToolAndApplication.html b/src/main/resources/docs/mars/tools/AbstractMarsToolAndApplication.html similarity index 100% rename from src/main/java/docs/mars/tools/AbstractMarsToolAndApplication.html rename to src/main/resources/docs/mars/tools/AbstractMarsToolAndApplication.html diff --git a/src/main/java/docs/mars/tools/BHTEntry.html b/src/main/resources/docs/mars/tools/BHTEntry.html similarity index 100% rename from src/main/java/docs/mars/tools/BHTEntry.html rename to src/main/resources/docs/mars/tools/BHTEntry.html diff --git a/src/main/java/docs/mars/tools/BHTSimGUI.html b/src/main/resources/docs/mars/tools/BHTSimGUI.html similarity index 100% rename from src/main/java/docs/mars/tools/BHTSimGUI.html rename to src/main/resources/docs/mars/tools/BHTSimGUI.html diff --git a/src/main/java/docs/mars/tools/BHTSimulator.html b/src/main/resources/docs/mars/tools/BHTSimulator.html similarity index 100% rename from src/main/java/docs/mars/tools/BHTSimulator.html rename to src/main/resources/docs/mars/tools/BHTSimulator.html diff --git a/src/main/java/docs/mars/tools/BHTableModel.html b/src/main/resources/docs/mars/tools/BHTableModel.html similarity index 100% rename from src/main/java/docs/mars/tools/BHTableModel.html rename to src/main/resources/docs/mars/tools/BHTableModel.html diff --git a/src/main/java/docs/mars/tools/BitmapDisplay.html b/src/main/resources/docs/mars/tools/BitmapDisplay.html similarity index 100% rename from src/main/java/docs/mars/tools/BitmapDisplay.html rename to src/main/resources/docs/mars/tools/BitmapDisplay.html diff --git a/src/main/java/docs/mars/tools/CacheSimulator.html b/src/main/resources/docs/mars/tools/CacheSimulator.html similarity index 100% rename from src/main/java/docs/mars/tools/CacheSimulator.html rename to src/main/resources/docs/mars/tools/CacheSimulator.html diff --git a/src/main/java/docs/mars/tools/DigitalLabSim.HexaKeyboard.EcouteurClick.html b/src/main/resources/docs/mars/tools/DigitalLabSim.HexaKeyboard.EcouteurClick.html similarity index 100% rename from src/main/java/docs/mars/tools/DigitalLabSim.HexaKeyboard.EcouteurClick.html rename to src/main/resources/docs/mars/tools/DigitalLabSim.HexaKeyboard.EcouteurClick.html diff --git a/src/main/java/docs/mars/tools/DigitalLabSim.HexaKeyboard.html b/src/main/resources/docs/mars/tools/DigitalLabSim.HexaKeyboard.html similarity index 100% rename from src/main/java/docs/mars/tools/DigitalLabSim.HexaKeyboard.html rename to src/main/resources/docs/mars/tools/DigitalLabSim.HexaKeyboard.html diff --git a/src/main/java/docs/mars/tools/DigitalLabSim.OneSecondCounter.html b/src/main/resources/docs/mars/tools/DigitalLabSim.OneSecondCounter.html similarity index 100% rename from src/main/java/docs/mars/tools/DigitalLabSim.OneSecondCounter.html rename to src/main/resources/docs/mars/tools/DigitalLabSim.OneSecondCounter.html diff --git a/src/main/java/docs/mars/tools/DigitalLabSim.SevenSegmentDisplay.html b/src/main/resources/docs/mars/tools/DigitalLabSim.SevenSegmentDisplay.html similarity index 100% rename from src/main/java/docs/mars/tools/DigitalLabSim.SevenSegmentDisplay.html rename to src/main/resources/docs/mars/tools/DigitalLabSim.SevenSegmentDisplay.html diff --git a/src/main/java/docs/mars/tools/DigitalLabSim.SevenSegmentPanel.html b/src/main/resources/docs/mars/tools/DigitalLabSim.SevenSegmentPanel.html similarity index 100% rename from src/main/java/docs/mars/tools/DigitalLabSim.SevenSegmentPanel.html rename to src/main/resources/docs/mars/tools/DigitalLabSim.SevenSegmentPanel.html diff --git a/src/main/java/docs/mars/tools/DigitalLabSim.html b/src/main/resources/docs/mars/tools/DigitalLabSim.html similarity index 100% rename from src/main/java/docs/mars/tools/DigitalLabSim.html rename to src/main/resources/docs/mars/tools/DigitalLabSim.html diff --git a/src/main/java/docs/mars/tools/FloatRepresentation.html b/src/main/resources/docs/mars/tools/FloatRepresentation.html similarity index 100% rename from src/main/java/docs/mars/tools/FloatRepresentation.html rename to src/main/resources/docs/mars/tools/FloatRepresentation.html diff --git a/src/main/java/docs/mars/tools/InstructionCounter.html b/src/main/resources/docs/mars/tools/InstructionCounter.html similarity index 100% rename from src/main/java/docs/mars/tools/InstructionCounter.html rename to src/main/resources/docs/mars/tools/InstructionCounter.html diff --git a/src/main/java/docs/mars/tools/InstructionStatistics.html b/src/main/resources/docs/mars/tools/InstructionStatistics.html similarity index 100% rename from src/main/java/docs/mars/tools/InstructionStatistics.html rename to src/main/resources/docs/mars/tools/InstructionStatistics.html diff --git a/src/main/java/docs/mars/tools/IntroToTools.html b/src/main/resources/docs/mars/tools/IntroToTools.html similarity index 100% rename from src/main/java/docs/mars/tools/IntroToTools.html rename to src/main/resources/docs/mars/tools/IntroToTools.html diff --git a/src/main/java/docs/mars/tools/KeyboardAndDisplaySimulator.html b/src/main/resources/docs/mars/tools/KeyboardAndDisplaySimulator.html similarity index 100% rename from src/main/java/docs/mars/tools/KeyboardAndDisplaySimulator.html rename to src/main/resources/docs/mars/tools/KeyboardAndDisplaySimulator.html diff --git a/src/main/java/docs/mars/tools/MarsBot.html b/src/main/resources/docs/mars/tools/MarsBot.html similarity index 100% rename from src/main/java/docs/mars/tools/MarsBot.html rename to src/main/resources/docs/mars/tools/MarsBot.html diff --git a/src/main/java/docs/mars/tools/MarsTool.html b/src/main/resources/docs/mars/tools/MarsTool.html similarity index 100% rename from src/main/java/docs/mars/tools/MarsTool.html rename to src/main/resources/docs/mars/tools/MarsTool.html diff --git a/src/main/java/docs/mars/tools/MemoryReferenceVisualization.html b/src/main/resources/docs/mars/tools/MemoryReferenceVisualization.html similarity index 100% rename from src/main/java/docs/mars/tools/MemoryReferenceVisualization.html rename to src/main/resources/docs/mars/tools/MemoryReferenceVisualization.html diff --git a/src/main/java/docs/mars/tools/ScavengerHunt.html b/src/main/resources/docs/mars/tools/ScavengerHunt.html similarity index 100% rename from src/main/java/docs/mars/tools/ScavengerHunt.html rename to src/main/resources/docs/mars/tools/ScavengerHunt.html diff --git a/src/main/java/docs/mars/tools/ScreenMagnifier.html b/src/main/resources/docs/mars/tools/ScreenMagnifier.html similarity index 100% rename from src/main/java/docs/mars/tools/ScreenMagnifier.html rename to src/main/resources/docs/mars/tools/ScreenMagnifier.html diff --git a/src/main/java/docs/mars/tools/package-frame.html b/src/main/resources/docs/mars/tools/package-frame.html similarity index 100% rename from src/main/java/docs/mars/tools/package-frame.html rename to src/main/resources/docs/mars/tools/package-frame.html diff --git a/src/main/java/docs/mars/tools/package-summary.html b/src/main/resources/docs/mars/tools/package-summary.html similarity index 100% rename from src/main/java/docs/mars/tools/package-summary.html rename to src/main/resources/docs/mars/tools/package-summary.html diff --git a/src/main/java/docs/mars/tools/package-tree.html b/src/main/resources/docs/mars/tools/package-tree.html similarity index 100% rename from src/main/java/docs/mars/tools/package-tree.html rename to src/main/resources/docs/mars/tools/package-tree.html diff --git a/src/main/java/docs/mars/util/Binary.html b/src/main/resources/docs/mars/util/Binary.html similarity index 100% rename from src/main/java/docs/mars/util/Binary.html rename to src/main/resources/docs/mars/util/Binary.html diff --git a/src/main/java/docs/mars/util/EditorFont.html b/src/main/resources/docs/mars/util/EditorFont.html similarity index 100% rename from src/main/java/docs/mars/util/EditorFont.html rename to src/main/resources/docs/mars/util/EditorFont.html diff --git a/src/main/java/docs/mars/util/FilenameFinder.html b/src/main/resources/docs/mars/util/FilenameFinder.html similarity index 100% rename from src/main/java/docs/mars/util/FilenameFinder.html rename to src/main/resources/docs/mars/util/FilenameFinder.html diff --git a/src/main/java/docs/mars/util/MemoryDump.html b/src/main/resources/docs/mars/util/MemoryDump.html similarity index 100% rename from src/main/java/docs/mars/util/MemoryDump.html rename to src/main/resources/docs/mars/util/MemoryDump.html diff --git a/src/main/java/docs/mars/util/PropertiesFile.html b/src/main/resources/docs/mars/util/PropertiesFile.html similarity index 100% rename from src/main/java/docs/mars/util/PropertiesFile.html rename to src/main/resources/docs/mars/util/PropertiesFile.html diff --git a/src/main/java/docs/mars/util/SystemIO.html b/src/main/resources/docs/mars/util/SystemIO.html similarity index 100% rename from src/main/java/docs/mars/util/SystemIO.html rename to src/main/resources/docs/mars/util/SystemIO.html diff --git a/src/main/java/docs/mars/util/package-frame.html b/src/main/resources/docs/mars/util/package-frame.html similarity index 100% rename from src/main/java/docs/mars/util/package-frame.html rename to src/main/resources/docs/mars/util/package-frame.html diff --git a/src/main/java/docs/mars/util/package-summary.html b/src/main/resources/docs/mars/util/package-summary.html similarity index 100% rename from src/main/java/docs/mars/util/package-summary.html rename to src/main/resources/docs/mars/util/package-summary.html diff --git a/src/main/java/docs/mars/util/package-tree.html b/src/main/resources/docs/mars/util/package-tree.html similarity index 100% rename from src/main/java/docs/mars/util/package-tree.html rename to src/main/resources/docs/mars/util/package-tree.html diff --git a/src/main/java/docs/mars/venus/AbstractFontSettingDialog.html b/src/main/resources/docs/mars/venus/AbstractFontSettingDialog.html similarity index 100% rename from src/main/java/docs/mars/venus/AbstractFontSettingDialog.html rename to src/main/resources/docs/mars/venus/AbstractFontSettingDialog.html diff --git a/src/main/java/docs/mars/venus/Coprocessor0Window.html b/src/main/resources/docs/mars/venus/Coprocessor0Window.html similarity index 100% rename from src/main/java/docs/mars/venus/Coprocessor0Window.html rename to src/main/resources/docs/mars/venus/Coprocessor0Window.html diff --git a/src/main/java/docs/mars/venus/Coprocessor1Window.html b/src/main/resources/docs/mars/venus/Coprocessor1Window.html similarity index 100% rename from src/main/java/docs/mars/venus/Coprocessor1Window.html rename to src/main/resources/docs/mars/venus/Coprocessor1Window.html diff --git a/src/main/java/docs/mars/venus/DataSegmentWindow.html b/src/main/resources/docs/mars/venus/DataSegmentWindow.html similarity index 100% rename from src/main/java/docs/mars/venus/DataSegmentWindow.html rename to src/main/resources/docs/mars/venus/DataSegmentWindow.html diff --git a/src/main/java/docs/mars/venus/EditCopyAction.html b/src/main/resources/docs/mars/venus/EditCopyAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditCopyAction.html rename to src/main/resources/docs/mars/venus/EditCopyAction.html diff --git a/src/main/java/docs/mars/venus/EditCutAction.html b/src/main/resources/docs/mars/venus/EditCutAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditCutAction.html rename to src/main/resources/docs/mars/venus/EditCutAction.html diff --git a/src/main/java/docs/mars/venus/EditFindReplaceAction.html b/src/main/resources/docs/mars/venus/EditFindReplaceAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditFindReplaceAction.html rename to src/main/resources/docs/mars/venus/EditFindReplaceAction.html diff --git a/src/main/java/docs/mars/venus/EditPane.html b/src/main/resources/docs/mars/venus/EditPane.html similarity index 100% rename from src/main/java/docs/mars/venus/EditPane.html rename to src/main/resources/docs/mars/venus/EditPane.html diff --git a/src/main/java/docs/mars/venus/EditPasteAction.html b/src/main/resources/docs/mars/venus/EditPasteAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditPasteAction.html rename to src/main/resources/docs/mars/venus/EditPasteAction.html diff --git a/src/main/java/docs/mars/venus/EditRedoAction.html b/src/main/resources/docs/mars/venus/EditRedoAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditRedoAction.html rename to src/main/resources/docs/mars/venus/EditRedoAction.html diff --git a/src/main/java/docs/mars/venus/EditSelectAllAction.html b/src/main/resources/docs/mars/venus/EditSelectAllAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditSelectAllAction.html rename to src/main/resources/docs/mars/venus/EditSelectAllAction.html diff --git a/src/main/java/docs/mars/venus/EditTabbedPane.html b/src/main/resources/docs/mars/venus/EditTabbedPane.html similarity index 100% rename from src/main/java/docs/mars/venus/EditTabbedPane.html rename to src/main/resources/docs/mars/venus/EditTabbedPane.html diff --git a/src/main/java/docs/mars/venus/EditUndoAction.html b/src/main/resources/docs/mars/venus/EditUndoAction.html similarity index 100% rename from src/main/java/docs/mars/venus/EditUndoAction.html rename to src/main/resources/docs/mars/venus/EditUndoAction.html diff --git a/src/main/java/docs/mars/venus/Editor.html b/src/main/resources/docs/mars/venus/Editor.html similarity index 100% rename from src/main/java/docs/mars/venus/Editor.html rename to src/main/resources/docs/mars/venus/Editor.html diff --git a/src/main/java/docs/mars/venus/ExecutePane.html b/src/main/resources/docs/mars/venus/ExecutePane.html similarity index 100% rename from src/main/java/docs/mars/venus/ExecutePane.html rename to src/main/resources/docs/mars/venus/ExecutePane.html diff --git a/src/main/java/docs/mars/venus/FileCloseAction.html b/src/main/resources/docs/mars/venus/FileCloseAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileCloseAction.html rename to src/main/resources/docs/mars/venus/FileCloseAction.html diff --git a/src/main/java/docs/mars/venus/FileCloseAllAction.html b/src/main/resources/docs/mars/venus/FileCloseAllAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileCloseAllAction.html rename to src/main/resources/docs/mars/venus/FileCloseAllAction.html diff --git a/src/main/java/docs/mars/venus/FileDumpMemoryAction.html b/src/main/resources/docs/mars/venus/FileDumpMemoryAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileDumpMemoryAction.html rename to src/main/resources/docs/mars/venus/FileDumpMemoryAction.html diff --git a/src/main/java/docs/mars/venus/FileExitAction.html b/src/main/resources/docs/mars/venus/FileExitAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileExitAction.html rename to src/main/resources/docs/mars/venus/FileExitAction.html diff --git a/src/main/java/docs/mars/venus/FileNewAction.html b/src/main/resources/docs/mars/venus/FileNewAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileNewAction.html rename to src/main/resources/docs/mars/venus/FileNewAction.html diff --git a/src/main/java/docs/mars/venus/FileOpenAction.html b/src/main/resources/docs/mars/venus/FileOpenAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileOpenAction.html rename to src/main/resources/docs/mars/venus/FileOpenAction.html diff --git a/src/main/java/docs/mars/venus/FilePrintAction.html b/src/main/resources/docs/mars/venus/FilePrintAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FilePrintAction.html rename to src/main/resources/docs/mars/venus/FilePrintAction.html diff --git a/src/main/java/docs/mars/venus/FileSaveAction.html b/src/main/resources/docs/mars/venus/FileSaveAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileSaveAction.html rename to src/main/resources/docs/mars/venus/FileSaveAction.html diff --git a/src/main/java/docs/mars/venus/FileSaveAllAction.html b/src/main/resources/docs/mars/venus/FileSaveAllAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileSaveAllAction.html rename to src/main/resources/docs/mars/venus/FileSaveAllAction.html diff --git a/src/main/java/docs/mars/venus/FileSaveAsAction.html b/src/main/resources/docs/mars/venus/FileSaveAsAction.html similarity index 100% rename from src/main/java/docs/mars/venus/FileSaveAsAction.html rename to src/main/resources/docs/mars/venus/FileSaveAsAction.html diff --git a/src/main/java/docs/mars/venus/FileStatus.html b/src/main/resources/docs/mars/venus/FileStatus.html similarity index 100% rename from src/main/java/docs/mars/venus/FileStatus.html rename to src/main/resources/docs/mars/venus/FileStatus.html diff --git a/src/main/java/docs/mars/venus/GuiAction.html b/src/main/resources/docs/mars/venus/GuiAction.html similarity index 100% rename from src/main/java/docs/mars/venus/GuiAction.html rename to src/main/resources/docs/mars/venus/GuiAction.html diff --git a/src/main/java/docs/mars/venus/HardcopyWriter.PrintCanceledException.html b/src/main/resources/docs/mars/venus/HardcopyWriter.PrintCanceledException.html similarity index 100% rename from src/main/java/docs/mars/venus/HardcopyWriter.PrintCanceledException.html rename to src/main/resources/docs/mars/venus/HardcopyWriter.PrintCanceledException.html diff --git a/src/main/java/docs/mars/venus/HardcopyWriter.html b/src/main/resources/docs/mars/venus/HardcopyWriter.html similarity index 100% rename from src/main/java/docs/mars/venus/HardcopyWriter.html rename to src/main/resources/docs/mars/venus/HardcopyWriter.html diff --git a/src/main/java/docs/mars/venus/HelpAboutAction.html b/src/main/resources/docs/mars/venus/HelpAboutAction.html similarity index 100% rename from src/main/java/docs/mars/venus/HelpAboutAction.html rename to src/main/resources/docs/mars/venus/HelpAboutAction.html diff --git a/src/main/java/docs/mars/venus/HelpHelpAction.html b/src/main/resources/docs/mars/venus/HelpHelpAction.html similarity index 100% rename from src/main/java/docs/mars/venus/HelpHelpAction.html rename to src/main/resources/docs/mars/venus/HelpHelpAction.html diff --git a/src/main/java/docs/mars/venus/LabelsWindow.html b/src/main/resources/docs/mars/venus/LabelsWindow.html similarity index 100% rename from src/main/java/docs/mars/venus/LabelsWindow.html rename to src/main/resources/docs/mars/venus/LabelsWindow.html diff --git a/src/main/java/docs/mars/venus/MainPane.html b/src/main/resources/docs/mars/venus/MainPane.html similarity index 100% rename from src/main/java/docs/mars/venus/MainPane.html rename to src/main/resources/docs/mars/venus/MainPane.html diff --git a/src/main/java/docs/mars/venus/MessagesPane.html b/src/main/resources/docs/mars/venus/MessagesPane.html similarity index 100% rename from src/main/java/docs/mars/venus/MessagesPane.html rename to src/main/resources/docs/mars/venus/MessagesPane.html diff --git a/src/main/java/docs/mars/venus/NumberDisplayBaseChooser.html b/src/main/resources/docs/mars/venus/NumberDisplayBaseChooser.html similarity index 100% rename from src/main/java/docs/mars/venus/NumberDisplayBaseChooser.html rename to src/main/resources/docs/mars/venus/NumberDisplayBaseChooser.html diff --git a/src/main/java/docs/mars/venus/PopupListener.html b/src/main/resources/docs/mars/venus/PopupListener.html similarity index 100% rename from src/main/java/docs/mars/venus/PopupListener.html rename to src/main/resources/docs/mars/venus/PopupListener.html diff --git a/src/main/java/docs/mars/venus/RegistersPane.html b/src/main/resources/docs/mars/venus/RegistersPane.html similarity index 100% rename from src/main/java/docs/mars/venus/RegistersPane.html rename to src/main/resources/docs/mars/venus/RegistersPane.html diff --git a/src/main/java/docs/mars/venus/RegistersWindow.html b/src/main/resources/docs/mars/venus/RegistersWindow.html similarity index 100% rename from src/main/java/docs/mars/venus/RegistersWindow.html rename to src/main/resources/docs/mars/venus/RegistersWindow.html diff --git a/src/main/java/docs/mars/venus/RepeatButton.html b/src/main/resources/docs/mars/venus/RepeatButton.html similarity index 100% rename from src/main/java/docs/mars/venus/RepeatButton.html rename to src/main/resources/docs/mars/venus/RepeatButton.html diff --git a/src/main/java/docs/mars/venus/RunAssembleAction.html b/src/main/resources/docs/mars/venus/RunAssembleAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunAssembleAction.html rename to src/main/resources/docs/mars/venus/RunAssembleAction.html diff --git a/src/main/java/docs/mars/venus/RunBackstepAction.html b/src/main/resources/docs/mars/venus/RunBackstepAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunBackstepAction.html rename to src/main/resources/docs/mars/venus/RunBackstepAction.html diff --git a/src/main/java/docs/mars/venus/RunClearBreakpointsAction.html b/src/main/resources/docs/mars/venus/RunClearBreakpointsAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunClearBreakpointsAction.html rename to src/main/resources/docs/mars/venus/RunClearBreakpointsAction.html diff --git a/src/main/java/docs/mars/venus/RunGoAction.html b/src/main/resources/docs/mars/venus/RunGoAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunGoAction.html rename to src/main/resources/docs/mars/venus/RunGoAction.html diff --git a/src/main/java/docs/mars/venus/RunPauseAction.html b/src/main/resources/docs/mars/venus/RunPauseAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunPauseAction.html rename to src/main/resources/docs/mars/venus/RunPauseAction.html diff --git a/src/main/java/docs/mars/venus/RunResetAction.html b/src/main/resources/docs/mars/venus/RunResetAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunResetAction.html rename to src/main/resources/docs/mars/venus/RunResetAction.html diff --git a/src/main/java/docs/mars/venus/RunSpeedPanel.html b/src/main/resources/docs/mars/venus/RunSpeedPanel.html similarity index 100% rename from src/main/java/docs/mars/venus/RunSpeedPanel.html rename to src/main/resources/docs/mars/venus/RunSpeedPanel.html diff --git a/src/main/java/docs/mars/venus/RunStepAction.html b/src/main/resources/docs/mars/venus/RunStepAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunStepAction.html rename to src/main/resources/docs/mars/venus/RunStepAction.html diff --git a/src/main/java/docs/mars/venus/RunStopAction.html b/src/main/resources/docs/mars/venus/RunStopAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunStopAction.html rename to src/main/resources/docs/mars/venus/RunStopAction.html diff --git a/src/main/java/docs/mars/venus/RunToggleBreakpointsAction.html b/src/main/resources/docs/mars/venus/RunToggleBreakpointsAction.html similarity index 100% rename from src/main/java/docs/mars/venus/RunToggleBreakpointsAction.html rename to src/main/resources/docs/mars/venus/RunToggleBreakpointsAction.html diff --git a/src/main/java/docs/mars/venus/SettingsAddressDisplayBaseAction.html b/src/main/resources/docs/mars/venus/SettingsAddressDisplayBaseAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsAddressDisplayBaseAction.html rename to src/main/resources/docs/mars/venus/SettingsAddressDisplayBaseAction.html diff --git a/src/main/java/docs/mars/venus/SettingsAssembleAllAction.html b/src/main/resources/docs/mars/venus/SettingsAssembleAllAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsAssembleAllAction.html rename to src/main/resources/docs/mars/venus/SettingsAssembleAllAction.html diff --git a/src/main/java/docs/mars/venus/SettingsAssembleOnOpenAction.html b/src/main/resources/docs/mars/venus/SettingsAssembleOnOpenAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsAssembleOnOpenAction.html rename to src/main/resources/docs/mars/venus/SettingsAssembleOnOpenAction.html diff --git a/src/main/java/docs/mars/venus/SettingsDelayedBranchingAction.html b/src/main/resources/docs/mars/venus/SettingsDelayedBranchingAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsDelayedBranchingAction.html rename to src/main/resources/docs/mars/venus/SettingsDelayedBranchingAction.html diff --git a/src/main/java/docs/mars/venus/SettingsEditorAction.html b/src/main/resources/docs/mars/venus/SettingsEditorAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsEditorAction.html rename to src/main/resources/docs/mars/venus/SettingsEditorAction.html diff --git a/src/main/java/docs/mars/venus/SettingsExceptionHandlerAction.html b/src/main/resources/docs/mars/venus/SettingsExceptionHandlerAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsExceptionHandlerAction.html rename to src/main/resources/docs/mars/venus/SettingsExceptionHandlerAction.html diff --git a/src/main/java/docs/mars/venus/SettingsExtendedAction.html b/src/main/resources/docs/mars/venus/SettingsExtendedAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsExtendedAction.html rename to src/main/resources/docs/mars/venus/SettingsExtendedAction.html diff --git a/src/main/java/docs/mars/venus/SettingsHighlightingAction.html b/src/main/resources/docs/mars/venus/SettingsHighlightingAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsHighlightingAction.html rename to src/main/resources/docs/mars/venus/SettingsHighlightingAction.html diff --git a/src/main/java/docs/mars/venus/SettingsLabelAction.html b/src/main/resources/docs/mars/venus/SettingsLabelAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsLabelAction.html rename to src/main/resources/docs/mars/venus/SettingsLabelAction.html diff --git a/src/main/java/docs/mars/venus/SettingsMemoryConfigurationAction.html b/src/main/resources/docs/mars/venus/SettingsMemoryConfigurationAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsMemoryConfigurationAction.html rename to src/main/resources/docs/mars/venus/SettingsMemoryConfigurationAction.html diff --git a/src/main/java/docs/mars/venus/SettingsPopupInputAction.html b/src/main/resources/docs/mars/venus/SettingsPopupInputAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsPopupInputAction.html rename to src/main/resources/docs/mars/venus/SettingsPopupInputAction.html diff --git a/src/main/java/docs/mars/venus/SettingsProgramArgumentsAction.html b/src/main/resources/docs/mars/venus/SettingsProgramArgumentsAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsProgramArgumentsAction.html rename to src/main/resources/docs/mars/venus/SettingsProgramArgumentsAction.html diff --git a/src/main/java/docs/mars/venus/SettingsSelfModifyingCodeAction.html b/src/main/resources/docs/mars/venus/SettingsSelfModifyingCodeAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsSelfModifyingCodeAction.html rename to src/main/resources/docs/mars/venus/SettingsSelfModifyingCodeAction.html diff --git a/src/main/java/docs/mars/venus/SettingsStartAtMainAction.html b/src/main/resources/docs/mars/venus/SettingsStartAtMainAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsStartAtMainAction.html rename to src/main/resources/docs/mars/venus/SettingsStartAtMainAction.html diff --git a/src/main/java/docs/mars/venus/SettingsValueDisplayBaseAction.html b/src/main/resources/docs/mars/venus/SettingsValueDisplayBaseAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsValueDisplayBaseAction.html rename to src/main/resources/docs/mars/venus/SettingsValueDisplayBaseAction.html diff --git a/src/main/java/docs/mars/venus/SettingsWarningsAreErrorsAction.html b/src/main/resources/docs/mars/venus/SettingsWarningsAreErrorsAction.html similarity index 100% rename from src/main/java/docs/mars/venus/SettingsWarningsAreErrorsAction.html rename to src/main/resources/docs/mars/venus/SettingsWarningsAreErrorsAction.html diff --git a/src/main/java/docs/mars/venus/TextSegmentWindow.html b/src/main/resources/docs/mars/venus/TextSegmentWindow.html similarity index 100% rename from src/main/java/docs/mars/venus/TextSegmentWindow.html rename to src/main/resources/docs/mars/venus/TextSegmentWindow.html diff --git a/src/main/java/docs/mars/venus/ToolAction.html b/src/main/resources/docs/mars/venus/ToolAction.html similarity index 100% rename from src/main/java/docs/mars/venus/ToolAction.html rename to src/main/resources/docs/mars/venus/ToolAction.html diff --git a/src/main/java/docs/mars/venus/ToolLoader.html b/src/main/resources/docs/mars/venus/ToolLoader.html similarity index 100% rename from src/main/java/docs/mars/venus/ToolLoader.html rename to src/main/resources/docs/mars/venus/ToolLoader.html diff --git a/src/main/java/docs/mars/venus/VenusUI.html b/src/main/resources/docs/mars/venus/VenusUI.html similarity index 100% rename from src/main/java/docs/mars/venus/VenusUI.html rename to src/main/resources/docs/mars/venus/VenusUI.html diff --git a/src/main/java/docs/mars/venus/editors/MARSTextEditingArea.html b/src/main/resources/docs/mars/venus/editors/MARSTextEditingArea.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/MARSTextEditingArea.html rename to src/main/resources/docs/mars/venus/editors/MARSTextEditingArea.html diff --git a/src/main/java/docs/mars/venus/editors/generic/GenericTextArea.html b/src/main/resources/docs/mars/venus/editors/generic/GenericTextArea.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/generic/GenericTextArea.html rename to src/main/resources/docs/mars/venus/editors/generic/GenericTextArea.html diff --git a/src/main/java/docs/mars/venus/editors/generic/package-frame.html b/src/main/resources/docs/mars/venus/editors/generic/package-frame.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/generic/package-frame.html rename to src/main/resources/docs/mars/venus/editors/generic/package-frame.html diff --git a/src/main/java/docs/mars/venus/editors/generic/package-summary.html b/src/main/resources/docs/mars/venus/editors/generic/package-summary.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/generic/package-summary.html rename to src/main/resources/docs/mars/venus/editors/generic/package-summary.html diff --git a/src/main/java/docs/mars/venus/editors/generic/package-tree.html b/src/main/resources/docs/mars/venus/editors/generic/package-tree.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/generic/package-tree.html rename to src/main/resources/docs/mars/venus/editors/generic/package-tree.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/DefaultInputHandler.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/DefaultInputHandler.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/DefaultInputHandler.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/DefaultInputHandler.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.MacroRecorder.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.MacroRecorder.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.MacroRecorder.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.MacroRecorder.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRecordable.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRecordable.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRecordable.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRecordable.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRepeatable.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRepeatable.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRepeatable.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.NonRepeatable.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.Wrapper.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.Wrapper.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.Wrapper.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.Wrapper.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace_word.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace_word.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace_word.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.backspace_word.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_copy.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_copy.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_copy.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_copy.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_cut.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_cut.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_cut.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_cut.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_paste.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_paste.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_paste.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.clip_paste.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.delete.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.delete.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.delete.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.delete.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.delete_word.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.delete_word.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.delete_word.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.delete_word.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.document_end.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.document_end.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.document_end.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.document_end.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.document_home.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.document_home.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.document_home.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.document_home.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.end.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.end.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.end.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.end.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.home.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.home.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.home.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.home.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_break.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_break.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_break.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_break.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_char.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_char.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_char.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_char.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_tab.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_tab.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_tab.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.insert_tab.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_char.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_char.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_char.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_char.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_line.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_line.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_line.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_line.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_page.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_page.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_page.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_page.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_word.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_word.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.next_word.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.next_word.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.overwrite.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.overwrite.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.overwrite.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.overwrite.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_char.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_char.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_char.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_char.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_line.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_line.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_line.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_line.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_page.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_page.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_page.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_page.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_word.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_word.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_word.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.prev_word.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.repeat.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.repeat.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.repeat.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.repeat.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.select_all.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.select_all.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.select_all.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.select_all.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.toggle_rect.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.toggle_rect.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/InputHandler.toggle_rect.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/InputHandler.toggle_rect.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/JEditBasedTextArea.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/JEditBasedTextArea.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/JEditBasedTextArea.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/JEditBasedTextArea.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/JEditTextArea.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/JEditTextArea.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/JEditTextArea.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/JEditTextArea.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/KeywordMap.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/KeywordMap.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/KeywordMap.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/KeywordMap.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/PopupHelpItem.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/PopupHelpItem.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/PopupHelpItem.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/PopupHelpItem.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/SyntaxDocument.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/SyntaxDocument.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/SyntaxDocument.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/SyntaxDocument.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/SyntaxStyle.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/SyntaxStyle.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/SyntaxStyle.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/SyntaxStyle.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/SyntaxUtilities.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/SyntaxUtilities.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/SyntaxUtilities.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/SyntaxUtilities.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/TextAreaDefaults.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/TextAreaDefaults.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/TextAreaDefaults.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/TextAreaDefaults.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.Highlight.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.Highlight.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.Highlight.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.Highlight.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/TextAreaPainter.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/TextUtilities.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/TextUtilities.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/TextUtilities.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/TextUtilities.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/package-frame.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/package-frame.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/package-frame.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/package-frame.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/package-summary.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/package-summary.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/package-summary.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/package-summary.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/package-tree.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/package-tree.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/package-tree.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/package-tree.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/MIPSTokenMarker.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/MIPSTokenMarker.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/MIPSTokenMarker.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/MIPSTokenMarker.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/Token.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/Token.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/Token.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/Token.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.LineInfo.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.LineInfo.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.LineInfo.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.LineInfo.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-frame.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-frame.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-frame.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-frame.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-summary.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-summary.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-summary.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-summary.html diff --git a/src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-tree.html b/src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-tree.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-tree.html rename to src/main/resources/docs/mars/venus/editors/jeditsyntax/tokenmarker/package-tree.html diff --git a/src/main/java/docs/mars/venus/editors/package-frame.html b/src/main/resources/docs/mars/venus/editors/package-frame.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/package-frame.html rename to src/main/resources/docs/mars/venus/editors/package-frame.html diff --git a/src/main/java/docs/mars/venus/editors/package-summary.html b/src/main/resources/docs/mars/venus/editors/package-summary.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/package-summary.html rename to src/main/resources/docs/mars/venus/editors/package-summary.html diff --git a/src/main/java/docs/mars/venus/editors/package-tree.html b/src/main/resources/docs/mars/venus/editors/package-tree.html similarity index 100% rename from src/main/java/docs/mars/venus/editors/package-tree.html rename to src/main/resources/docs/mars/venus/editors/package-tree.html diff --git a/src/main/java/docs/mars/venus/package-frame.html b/src/main/resources/docs/mars/venus/package-frame.html similarity index 100% rename from src/main/java/docs/mars/venus/package-frame.html rename to src/main/resources/docs/mars/venus/package-frame.html diff --git a/src/main/java/docs/mars/venus/package-summary.html b/src/main/resources/docs/mars/venus/package-summary.html similarity index 100% rename from src/main/java/docs/mars/venus/package-summary.html rename to src/main/resources/docs/mars/venus/package-summary.html diff --git a/src/main/java/docs/mars/venus/package-tree.html b/src/main/resources/docs/mars/venus/package-tree.html similarity index 100% rename from src/main/java/docs/mars/venus/package-tree.html rename to src/main/resources/docs/mars/venus/package-tree.html diff --git a/src/main/java/docs/overview-frame.html b/src/main/resources/docs/overview-frame.html similarity index 100% rename from src/main/java/docs/overview-frame.html rename to src/main/resources/docs/overview-frame.html diff --git a/src/main/java/docs/overview-summary.html b/src/main/resources/docs/overview-summary.html similarity index 100% rename from src/main/java/docs/overview-summary.html rename to src/main/resources/docs/overview-summary.html diff --git a/src/main/java/docs/overview-tree.html b/src/main/resources/docs/overview-tree.html similarity index 100% rename from src/main/java/docs/overview-tree.html rename to src/main/resources/docs/overview-tree.html diff --git a/src/main/java/docs/package-frame.html b/src/main/resources/docs/package-frame.html similarity index 100% rename from src/main/java/docs/package-frame.html rename to src/main/resources/docs/package-frame.html diff --git a/src/main/java/docs/package-list b/src/main/resources/docs/package-list similarity index 100% rename from src/main/java/docs/package-list rename to src/main/resources/docs/package-list diff --git a/src/main/java/docs/package-summary.html b/src/main/resources/docs/package-summary.html similarity index 100% rename from src/main/java/docs/package-summary.html rename to src/main/resources/docs/package-summary.html diff --git a/src/main/java/docs/package-tree.html b/src/main/resources/docs/package-tree.html similarity index 100% rename from src/main/java/docs/package-tree.html rename to src/main/resources/docs/package-tree.html diff --git a/src/main/java/docs/resources/inherit.gif b/src/main/resources/docs/resources/inherit.gif similarity index 100% rename from src/main/java/docs/resources/inherit.gif rename to src/main/resources/docs/resources/inherit.gif diff --git a/src/main/java/docs/serialized-form.html b/src/main/resources/docs/serialized-form.html similarity index 100% rename from src/main/java/docs/serialized-form.html rename to src/main/resources/docs/serialized-form.html diff --git a/src/main/java/docs/stylesheet.css b/src/main/resources/docs/stylesheet.css similarity index 100% rename from src/main/java/docs/stylesheet.css rename to src/main/resources/docs/stylesheet.css diff --git a/src/main/java/help/Acknowledgements.html b/src/main/resources/help/Acknowledgements.html similarity index 100% rename from src/main/java/help/Acknowledgements.html rename to src/main/resources/help/Acknowledgements.html diff --git a/src/main/java/help/BugReportingHelp.html b/src/main/resources/help/BugReportingHelp.html similarity index 100% rename from src/main/java/help/BugReportingHelp.html rename to src/main/resources/help/BugReportingHelp.html diff --git a/src/main/java/help/ExceptionsHelp.html b/src/main/resources/help/ExceptionsHelp.html similarity index 100% rename from src/main/java/help/ExceptionsHelp.html rename to src/main/resources/help/ExceptionsHelp.html diff --git a/src/main/java/help/HTML_of_links_for_posting_to_MARS_website.html b/src/main/resources/help/HTML_of_links_for_posting_to_MARS_website.html similarity index 100% rename from src/main/java/help/HTML_of_links_for_posting_to_MARS_website.html rename to src/main/resources/help/HTML_of_links_for_posting_to_MARS_website.html diff --git a/src/main/java/help/MIPSInstructionSetSong.html b/src/main/resources/help/MIPSInstructionSetSong.html similarity index 100% rename from src/main/java/help/MIPSInstructionSetSong.html rename to src/main/resources/help/MIPSInstructionSetSong.html diff --git a/src/main/java/help/MacrosHelp.html b/src/main/resources/help/MacrosHelp.html similarity index 100% rename from src/main/java/help/MacrosHelp.html rename to src/main/resources/help/MacrosHelp.html diff --git a/src/main/java/help/MarsHelpCommand.html b/src/main/resources/help/MarsHelpCommand.html similarity index 100% rename from src/main/java/help/MarsHelpCommand.html rename to src/main/resources/help/MarsHelpCommand.html diff --git a/src/main/java/help/MarsHelpDebugging.html b/src/main/resources/help/MarsHelpDebugging.html similarity index 100% rename from src/main/java/help/MarsHelpDebugging.html rename to src/main/resources/help/MarsHelpDebugging.html diff --git a/src/main/java/help/MarsHelpHistory.html b/src/main/resources/help/MarsHelpHistory.html similarity index 100% rename from src/main/java/help/MarsHelpHistory.html rename to src/main/resources/help/MarsHelpHistory.html diff --git a/src/main/java/help/MarsHelpIDE.html b/src/main/resources/help/MarsHelpIDE.html similarity index 100% rename from src/main/java/help/MarsHelpIDE.html rename to src/main/resources/help/MarsHelpIDE.html diff --git a/src/main/java/help/MarsHelpIntro.html b/src/main/resources/help/MarsHelpIntro.html similarity index 100% rename from src/main/java/help/MarsHelpIntro.html rename to src/main/resources/help/MarsHelpIntro.html diff --git a/src/main/java/help/MarsHelpLimits.html b/src/main/resources/help/MarsHelpLimits.html similarity index 100% rename from src/main/java/help/MarsHelpLimits.html rename to src/main/resources/help/MarsHelpLimits.html diff --git a/src/main/java/help/MarsHelpSettings.html b/src/main/resources/help/MarsHelpSettings.html similarity index 100% rename from src/main/java/help/MarsHelpSettings.html rename to src/main/resources/help/MarsHelpSettings.html diff --git a/src/main/java/help/MarsHelpTools.html b/src/main/resources/help/MarsHelpTools.html similarity index 100% rename from src/main/java/help/MarsHelpTools.html rename to src/main/resources/help/MarsHelpTools.html diff --git a/src/main/java/help/SyscallHelp.html b/src/main/resources/help/SyscallHelp.html similarity index 100% rename from src/main/java/help/SyscallHelp.html rename to src/main/resources/help/SyscallHelp.html diff --git a/src/main/java/help/SyscallMessageDialogError.gif b/src/main/resources/help/SyscallMessageDialogError.gif similarity index 100% rename from src/main/java/help/SyscallMessageDialogError.gif rename to src/main/resources/help/SyscallMessageDialogError.gif diff --git a/src/main/java/help/SyscallMessageDialogInformation.gif b/src/main/resources/help/SyscallMessageDialogInformation.gif similarity index 100% rename from src/main/java/help/SyscallMessageDialogInformation.gif rename to src/main/resources/help/SyscallMessageDialogInformation.gif diff --git a/src/main/java/help/SyscallMessageDialogQuestion.gif b/src/main/resources/help/SyscallMessageDialogQuestion.gif similarity index 100% rename from src/main/java/help/SyscallMessageDialogQuestion.gif rename to src/main/resources/help/SyscallMessageDialogQuestion.gif diff --git a/src/main/java/help/SyscallMessageDialogWarning.gif b/src/main/resources/help/SyscallMessageDialogWarning.gif similarity index 100% rename from src/main/java/help/SyscallMessageDialogWarning.gif rename to src/main/resources/help/SyscallMessageDialogWarning.gif diff --git a/src/main/java/help/mipsref.pdf b/src/main/resources/help/mipsref.pdf similarity index 100% rename from src/main/java/help/mipsref.pdf rename to src/main/resources/help/mipsref.pdf diff --git a/src/main/java/images/ALUcontrol.png b/src/main/resources/images/ALUcontrol.png similarity index 100% rename from src/main/java/images/ALUcontrol.png rename to src/main/resources/images/ALUcontrol.png diff --git a/src/main/java/images/Assemble16.png b/src/main/resources/images/Assemble16.png similarity index 100% rename from src/main/java/images/Assemble16.png rename to src/main/resources/images/Assemble16.png diff --git a/src/main/java/images/Assemble22.png b/src/main/resources/images/Assemble22.png similarity index 100% rename from src/main/java/images/Assemble22.png rename to src/main/resources/images/Assemble22.png diff --git a/src/main/java/images/Copy16.png b/src/main/resources/images/Copy16.png similarity index 100% rename from src/main/java/images/Copy16.png rename to src/main/resources/images/Copy16.png diff --git a/src/main/java/images/Copy22.png b/src/main/resources/images/Copy22.png similarity index 100% rename from src/main/java/images/Copy22.png rename to src/main/resources/images/Copy22.png diff --git a/src/main/java/images/Cut16.gif b/src/main/resources/images/Cut16.gif similarity index 100% rename from src/main/java/images/Cut16.gif rename to src/main/resources/images/Cut16.gif diff --git a/src/main/java/images/Cut22.gif b/src/main/resources/images/Cut22.gif similarity index 100% rename from src/main/java/images/Cut22.gif rename to src/main/resources/images/Cut22.gif diff --git a/src/main/java/images/Cut24.gif b/src/main/resources/images/Cut24.gif similarity index 100% rename from src/main/java/images/Cut24.gif rename to src/main/resources/images/Cut24.gif diff --git a/src/main/java/images/Dump16.png b/src/main/resources/images/Dump16.png similarity index 100% rename from src/main/java/images/Dump16.png rename to src/main/resources/images/Dump16.png diff --git a/src/main/java/images/Dump22.png b/src/main/resources/images/Dump22.png similarity index 100% rename from src/main/java/images/Dump22.png rename to src/main/resources/images/Dump22.png diff --git a/src/main/java/images/Edit_tab.jpg b/src/main/resources/images/Edit_tab.jpg similarity index 100% rename from src/main/java/images/Edit_tab.jpg rename to src/main/resources/images/Edit_tab.jpg diff --git a/src/main/java/images/Execute_tab.jpg b/src/main/resources/images/Execute_tab.jpg similarity index 100% rename from src/main/java/images/Execute_tab.jpg rename to src/main/resources/images/Execute_tab.jpg diff --git a/src/main/java/images/Find16.png b/src/main/resources/images/Find16.png similarity index 100% rename from src/main/java/images/Find16.png rename to src/main/resources/images/Find16.png diff --git a/src/main/java/images/Find22.png b/src/main/resources/images/Find22.png similarity index 100% rename from src/main/java/images/Find22.png rename to src/main/resources/images/Find22.png diff --git a/src/main/java/images/Help16.png b/src/main/resources/images/Help16.png similarity index 100% rename from src/main/java/images/Help16.png rename to src/main/resources/images/Help16.png diff --git a/src/main/java/images/Help22.png b/src/main/resources/images/Help22.png similarity index 100% rename from src/main/java/images/Help22.png rename to src/main/resources/images/Help22.png diff --git a/src/main/java/images/MarsSurfacePathfinder.jpg b/src/main/resources/images/MarsSurfacePathfinder.jpg similarity index 100% rename from src/main/java/images/MarsSurfacePathfinder.jpg rename to src/main/resources/images/MarsSurfacePathfinder.jpg diff --git a/src/main/java/images/MarsThumbnail.gif b/src/main/resources/images/MarsThumbnail.gif similarity index 100% rename from src/main/java/images/MarsThumbnail.gif rename to src/main/resources/images/MarsThumbnail.gif diff --git a/src/main/java/images/MyBlank16.gif b/src/main/resources/images/MyBlank16.gif similarity index 100% rename from src/main/java/images/MyBlank16.gif rename to src/main/resources/images/MyBlank16.gif diff --git a/src/main/java/images/MyBlank24.gif b/src/main/resources/images/MyBlank24.gif similarity index 100% rename from src/main/java/images/MyBlank24.gif rename to src/main/resources/images/MyBlank24.gif diff --git a/src/main/java/images/New16.png b/src/main/resources/images/New16.png similarity index 100% rename from src/main/java/images/New16.png rename to src/main/resources/images/New16.png diff --git a/src/main/java/images/New22.png b/src/main/resources/images/New22.png similarity index 100% rename from src/main/java/images/New22.png rename to src/main/resources/images/New22.png diff --git a/src/main/java/images/Next22.png b/src/main/resources/images/Next22.png similarity index 100% rename from src/main/java/images/Next22.png rename to src/main/resources/images/Next22.png diff --git a/src/main/java/images/Open16.png b/src/main/resources/images/Open16.png similarity index 100% rename from src/main/java/images/Open16.png rename to src/main/resources/images/Open16.png diff --git a/src/main/java/images/Open22.png b/src/main/resources/images/Open22.png similarity index 100% rename from src/main/java/images/Open22.png rename to src/main/resources/images/Open22.png diff --git a/src/main/java/images/Paste16.png b/src/main/resources/images/Paste16.png similarity index 100% rename from src/main/java/images/Paste16.png rename to src/main/resources/images/Paste16.png diff --git a/src/main/java/images/Paste22.png b/src/main/resources/images/Paste22.png similarity index 100% rename from src/main/java/images/Paste22.png rename to src/main/resources/images/Paste22.png diff --git a/src/main/java/images/Pause16.png b/src/main/resources/images/Pause16.png similarity index 100% rename from src/main/java/images/Pause16.png rename to src/main/resources/images/Pause16.png diff --git a/src/main/java/images/Pause22.png b/src/main/resources/images/Pause22.png similarity index 100% rename from src/main/java/images/Pause22.png rename to src/main/resources/images/Pause22.png diff --git a/src/main/java/images/Play16.png b/src/main/resources/images/Play16.png similarity index 100% rename from src/main/java/images/Play16.png rename to src/main/resources/images/Play16.png diff --git a/src/main/java/images/Play22.png b/src/main/resources/images/Play22.png similarity index 100% rename from src/main/java/images/Play22.png rename to src/main/resources/images/Play22.png diff --git a/src/main/java/images/Previous22.png b/src/main/resources/images/Previous22.png similarity index 100% rename from src/main/java/images/Previous22.png rename to src/main/resources/images/Previous22.png diff --git a/src/main/java/images/Print16.gif b/src/main/resources/images/Print16.gif similarity index 100% rename from src/main/java/images/Print16.gif rename to src/main/resources/images/Print16.gif diff --git a/src/main/java/images/Print22.gif b/src/main/resources/images/Print22.gif similarity index 100% rename from src/main/java/images/Print22.gif rename to src/main/resources/images/Print22.gif diff --git a/src/main/java/images/Print24.gif b/src/main/resources/images/Print24.gif similarity index 100% rename from src/main/java/images/Print24.gif rename to src/main/resources/images/Print24.gif diff --git a/src/main/java/images/RedMars16.gif b/src/main/resources/images/RedMars16.gif similarity index 100% rename from src/main/java/images/RedMars16.gif rename to src/main/resources/images/RedMars16.gif diff --git a/src/main/java/images/RedMars32.GIF b/src/main/resources/images/RedMars32.GIF similarity index 100% rename from src/main/java/images/RedMars32.GIF rename to src/main/resources/images/RedMars32.GIF diff --git a/src/main/java/images/RedMars50.gif b/src/main/resources/images/RedMars50.gif similarity index 100% rename from src/main/java/images/RedMars50.gif rename to src/main/resources/images/RedMars50.gif diff --git a/src/main/java/images/Redo16.png b/src/main/resources/images/Redo16.png similarity index 100% rename from src/main/java/images/Redo16.png rename to src/main/resources/images/Redo16.png diff --git a/src/main/java/images/Redo22.png b/src/main/resources/images/Redo22.png similarity index 100% rename from src/main/java/images/Redo22.png rename to src/main/resources/images/Redo22.png diff --git a/src/main/java/images/Reset16.png b/src/main/resources/images/Reset16.png similarity index 100% rename from src/main/java/images/Reset16.png rename to src/main/resources/images/Reset16.png diff --git a/src/main/java/images/Reset22.png b/src/main/resources/images/Reset22.png similarity index 100% rename from src/main/java/images/Reset22.png rename to src/main/resources/images/Reset22.png diff --git a/src/main/java/images/Save16.png b/src/main/resources/images/Save16.png similarity index 100% rename from src/main/java/images/Save16.png rename to src/main/resources/images/Save16.png diff --git a/src/main/java/images/Save22.png b/src/main/resources/images/Save22.png similarity index 100% rename from src/main/java/images/Save22.png rename to src/main/resources/images/Save22.png diff --git a/src/main/java/images/SaveAs16.png b/src/main/resources/images/SaveAs16.png similarity index 100% rename from src/main/java/images/SaveAs16.png rename to src/main/resources/images/SaveAs16.png diff --git a/src/main/java/images/SaveAs22.png b/src/main/resources/images/SaveAs22.png similarity index 100% rename from src/main/java/images/SaveAs22.png rename to src/main/resources/images/SaveAs22.png diff --git a/src/main/java/images/StepBack16.png b/src/main/resources/images/StepBack16.png similarity index 100% rename from src/main/java/images/StepBack16.png rename to src/main/resources/images/StepBack16.png diff --git a/src/main/java/images/StepBack22.png b/src/main/resources/images/StepBack22.png similarity index 100% rename from src/main/java/images/StepBack22.png rename to src/main/resources/images/StepBack22.png diff --git a/src/main/java/images/StepForward16.png b/src/main/resources/images/StepForward16.png similarity index 100% rename from src/main/java/images/StepForward16.png rename to src/main/resources/images/StepForward16.png diff --git a/src/main/java/images/StepForward22.png b/src/main/resources/images/StepForward22.png similarity index 100% rename from src/main/java/images/StepForward22.png rename to src/main/resources/images/StepForward22.png diff --git a/src/main/java/images/Stop16.png b/src/main/resources/images/Stop16.png similarity index 100% rename from src/main/java/images/Stop16.png rename to src/main/resources/images/Stop16.png diff --git a/src/main/java/images/Stop22.png b/src/main/resources/images/Stop22.png similarity index 100% rename from src/main/java/images/Stop22.png rename to src/main/resources/images/Stop22.png diff --git a/src/main/java/images/Undo16.png b/src/main/resources/images/Undo16.png similarity index 100% rename from src/main/java/images/Undo16.png rename to src/main/resources/images/Undo16.png diff --git a/src/main/java/images/Undo22.png b/src/main/resources/images/Undo22.png similarity index 100% rename from src/main/java/images/Undo22.png rename to src/main/resources/images/Undo22.png diff --git a/src/main/java/images/control.png b/src/main/resources/images/control.png similarity index 100% rename from src/main/java/images/control.png rename to src/main/resources/images/control.png diff --git a/src/main/java/images/datapath.png b/src/main/resources/images/datapath.png similarity index 100% rename from src/main/java/images/datapath.png rename to src/main/resources/images/datapath.png diff --git a/src/main/java/images/mars.ico b/src/main/resources/images/mars.ico similarity index 100% rename from src/main/java/images/mars.ico rename to src/main/resources/images/mars.ico diff --git a/src/main/java/images/mars32.ico b/src/main/resources/images/mars32.ico similarity index 100% rename from src/main/java/images/mars32.ico rename to src/main/resources/images/mars32.ico diff --git a/src/main/java/images/register.png b/src/main/resources/images/register.png similarity index 100% rename from src/main/java/images/register.png rename to src/main/resources/images/register.png diff --git a/src/main/java/registerDatapath.xml b/src/main/resources/registerDatapath.xml similarity index 100% rename from src/main/java/registerDatapath.xml rename to src/main/resources/registerDatapath.xml