diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml new file mode 100644 index 00000000..1c7f5c93 --- /dev/null +++ b/.github/workflows/makefile.yml @@ -0,0 +1,32 @@ +name: Makefile CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - run: sudo apt-get update && sudo apt-get install openjdk-17-jdk-headless + - uses: actions/checkout@v4 + - run: git fetch origin --tags --unshallow + - run: git submodule update --init + - run: ./build-jar.sh + - run: ./build-jar-flatlaf.sh + - uses: actions/upload-artifact@v4 + with: + path: '*.jar' + - run: ./test.sh + - uses: softprops/action-gh-release@v2 + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/test-ci' + with: + files: rars-flatlaf.jar + tag_name: 'lastest' + make_latest: true diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 00000000..383700b3 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,46 @@ +name: maven +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + maven: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'zulu' + cache: maven + - name: Build with Maven + run: mvn --batch-mode --update-snapshots verify site + - uses: actions/upload-artifact@v4 + if: success() || failure() # always run even if the previous step fails + with: + name: maven-target-${{ matrix.os }} + path: target/ + - run: mkdir staging && cp target/*.jar staging + - uses: actions/upload-artifact@v4 + with: + name: Package-${{ matrix.os }} + path: staging + + event_file: + name: "Event File" + runs-on: ubuntu-latest + steps: + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: Event File + path: ${{ github.event_path }} diff --git a/.github/workflows/report.yml b/.github/workflows/report.yml new file mode 100644 index 00000000..be729611 --- /dev/null +++ b/.github/workflows/report.yml @@ -0,0 +1,34 @@ +name: Test Results +on: + workflow_run: + workflows: ["maven"] + types: + - completed +permissions: {} +jobs: + test-results: + name: Test Results + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion != 'skipped' + + permissions: + checks: write + # needed unless run with comment_mode: off + pull-requests: write + # required by download step to access artifacts API + actions: read + + steps: + - name: Download and Extract Artifacts + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d + with: + run_id: ${{ github.event.workflow_run.id }} + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + commit: ${{ github.event.workflow_run.head_sha }} + event_file: artifacts/Event File/event.json + event_name: ${{ github.event.workflow_run.event }} + files: "**/TEST-*.xml" diff --git a/.gitignore b/.gitignore index 91399c8e..defa8290 100644 --- a/.gitignore +++ b/.gitignore @@ -4,13 +4,23 @@ out # Build products build +tmp +flatlaf-3.2.jar rars.jar +rars-flatlaf.jar +src/Version.properties + +# Maven +target/ # Eclipse project files .classpath .project examples/riscv +# Emacs +.settings + # MacOS .DS_Store */.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..c0db1310 --- /dev/null +++ b/LICENSE @@ -0,0 +1,60 @@ +Copyright (c) 2003-2013, 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) + +=== + +Copyright (c) 2012-2015, The Regents of the University of California (Regents). +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the Regents nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +=== + +Copyright (C) 1999 Slava Pestov + +You may use and modify this package for any purpose. Redistribution is +permitted, in both source and binary form, provided that this notice +remains intact in all source distributions of this package. \ No newline at end of file diff --git a/License.txt b/License.txt deleted file mode 100644 index 121fd7b7..00000000 --- a/License.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2003-2013, 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) diff --git a/README.md b/README.md index 911cb34c..eafccd61 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,14 @@ -RARS -- RISC-V Assembler and Runtime Simulator ----------------------------------------------- +# RARSM -- RISC-V Assembler and Runtime Simulator (iMproved) -RARS, the RISC-V Assembler, Simulator, and Runtime, will assemble and simulate -the execution of RISC-V assembly language programs. Its primary goal is to be -an effective development environment for people getting started with RISC-V. +Fork of [RARS](https://github.com/TheThirdOne/rars) with added features (PRed updtream) -## Features +* https://github.com/TheThirdOne/rars/pull/190 +* https://github.com/TheThirdOne/rars/pull/191 +* https://github.com/TheThirdOne/rars/pull/192 +* https://github.com/TheThirdOne/rars/pull/193 +* https://github.com/TheThirdOne/rars/pull/194 +* https://github.com/TheThirdOne/rars/pull/195 +* https://github.com/TheThirdOne/rars/pull/196 +* https://github.com/TheThirdOne/rars/pull/197 - - RISC-V IMFDN Base (riscv32 and riscv64) - - Several system calls that match behaviour from MARS or SPIKE. - - Support for debugging using breakpoints and/or `ebreak` - - Side by side comparison from pseudo-instruction to machine code with - intermediate steps - - Multifile assembly using either files open or a directory - -## Documentation - -Documentation for supported [instructions](https://github.com/TheThirdOne/rars/wiki/Supported-Instructions), [system calls](https://github.com/TheThirdOne/rars/wiki/Environment-Calls), [assembler directives](https://github.com/TheThirdOne/rars/wiki/Assembler-Directives) and more can be found on the [wiki](https://github.com/TheThirdOne/rars/wiki). Documentation included in the download can be accessed via the help menu. - -## Download - -RARS is distributed as an executable jar. You will need at least Java 8 to run it. - -The latest stable release can be found [here](https://github.com/TheThirdOne/rars/releases/latest), a release with the latest developments can be found on the [continuous release](https://github.com/TheThirdOne/rars/releases/tag/continuous), and the [releases page](https://github.com/TheThirdOne/rars/releases) contains all previous stable releases with patch notes. - -Alternatively, if you wish to make your own jar and/or modify the code, you -should clone the repo with `git clone https://github.com/TheThirdOne/rars --recursive`. -Running the script `./build-jar.sh` on a Unix system will build `rars.jar`. - -## Screenshot - -![Screenshot of sample program](screenshot.png) - -## Changes from MARS 4.5 - -RARS was built on MARS 4.5 and owes a lot to the development of MARS; its -important to note what are new developments and what come straight from MARS. -Besides moving from supporting MIPS to RISC-V and the associated small changes, -there are several general changes worth noting. - - - Instructions can now be hot-loaded like Tools. If you want to support an additional extension to the RISC-V instruction set. the .class files just need to be added to the right folder - - ScreenMagnifier, MARS Bot, Intro to Tools, Scavenger Hunt, and MARS Xray were removed from the included tools. ScreenMagnifier, MARS Bot, Intro to Tools, and Scavenger Hunt were removed because they provide little benefit. And MARS Xray was removed because it is not set up to work with RISC-V, however if someone ports it, it could be merged in. - - Removed delayed branching - - Removed the print feature - - Added a testing framework to verify compatibility with the RISC-V specification - - Significant internal restructuring and refactoring. +Unfortunately, upstream is not responsive, so we stopped doing PR as they require some unmerges ones. diff --git a/build-jar-flatlaf.sh b/build-jar-flatlaf.sh new file mode 100755 index 00000000..ba7ec218 --- /dev/null +++ b/build-jar-flatlaf.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +flatlaf="flatlaf-3.2.jar" + +if [ ! -f "$flatlaf" ]; then + curl https://repo1.maven.org/maven2/com/formdev/flatlaf/3.2/flatlaf-3.2.jar -o "$flatlaf" +fi + +rm -r tmp/ +mkdir -p tmp/ +cd tmp/ + + +jar x < ../rars.jar +jar x < "../$flatlaf" + +cat > META-INF/MANIFEST.MF < /dev/null ; then + version=$(git describe --tags --match 'v*' --dirty | cut -c2-) + echo "Version = $version" > src/Version.properties mkdir -p build - find src -name "*.java" | xargs javac -d build + find src -name "*.java" | xargs javac --release 11 -d build if [[ "$OSTYPE" == "darwin"* ]]; then find src -type f -not -name "*.java" -exec rsync -R {} build \; else @@ -9,9 +11,10 @@ if git submodule status | grep \( > /dev/null ; then fi cp -rf build/src/* build rm -r build/src - cp README.md License.txt build + cp README.md LICENSE build cd build jar cfm ../rars.jar ./META-INF/MANIFEST.MF * + chmod +x ../rars.jar else echo "It looks like JSoftFloat is not cloned. Consider running \"git submodule update --init\"" -fi \ No newline at end of file +fi diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..0d627776 --- /dev/null +++ b/pom.xml @@ -0,0 +1,199 @@ + + 4.0.0 + rars + rars + 1.7-git + jar + + + + com.formdev + flatlaf + 3.4.1 + runtime + + + + org.junit.jupiter + junit-jupiter + 5.10.3 + test + + + + src + test + + + src + true + + **/*.java + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.7.1 + + + jar-with-dependencies + + + + rars.Launch + + + + + + assemble-all + package + + single + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.12.1 + + + org.apache.maven.plugins + maven-surefire-plugin + 3.3.0 + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + default-prepare-agent + + prepare-agent + + + + default-report + test + + report + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + 0.20 + + + + + + + + + + + org.panteleyev + jpackage-maven-plugin + 1.6.4 + + + ${project.basedir}/target + RARS + 1.6 + ${icon.path} + Privat + rars.Launch + + ${project.build.finalName}-jar-with-dependencies.jar + + ${project.basedir}/target + MIT License + + + + + package-${os.family} + package + + jpackage + + + + + + + + + MacOs Profile<--> + mac + + + Mac + + + + ${project.basedir}/res/riscvColor.icns + Mac + + + Windows Profile<--> + windows + + + Windows + + + + ${project.basedir}/res/riscvColor.ico + Windows + + + Linux Profile<--> + linux + + + Unix + Linux + + + + ${project.basedir}/res/riscvColor.png + Linux + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 3.3.0 + + + + + 11 + 11 + 11 + UTF-8 + + diff --git a/res/riscvColor.icns b/res/riscvColor.icns new file mode 100644 index 00000000..d7cbbc52 Binary files /dev/null and b/res/riscvColor.icns differ diff --git a/res/riscvColor.ico b/res/riscvColor.ico new file mode 100644 index 00000000..7af0fdef Binary files /dev/null and b/res/riscvColor.ico differ diff --git a/res/riscvColor.png b/res/riscvColor.png new file mode 100644 index 00000000..ba091820 Binary files /dev/null and b/res/riscvColor.png differ diff --git a/src/Config.properties b/src/Config.properties index 97acf820..02480115 100644 --- a/src/Config.properties +++ b/src/Config.properties @@ -1,11 +1,11 @@ -# maximum length of scrolled text in Mars Message and Run I/O tabs, in bytes. +# maximum length of scrolled text in Rars Message and Run I/O tabs, in bytes. MessageLimit = 1000000 # Maximum number of errors that can be recorded in one assemble operation. ErrorLimit = 200 # Maximum number of "backstep" operations that can be taken. An instruction # may produce more than one (e.g. trap instruction may set several registers) BackstepLimit = 2000 -# Acceptable file extensions for MIPS assembly files. Separate with spaces. +# Acceptable file extensions for RISC-V assembly files. Separate with spaces. Extensions = asm s # The set of ASCII strings to use for ASCII display or print # of data segment contents. This covers 8-bit ASCII codes 0-255. diff --git a/src/PseudoOps-64.txt b/src/PseudoOps-64.txt index a82ad405..cbc67454 100644 --- a/src/PseudoOps-64.txt +++ b/src/PseudoOps-64.txt @@ -34,3 +34,8 @@ ld t1,-100 ;ld RG1, VL2(x0) ;#Load Double word : Set t1 to contents of effec ld t1,10000000 ;lui RG1, VH2 ;ld RG1, VL2(RG1) ;#Load Double word : Set t1 to contents of effective memory word address ld t1,label ;auipc RG1, PCH2 ;ld RG1, PCL2(RG1) ;#Load Double word : Set t1 to contents of memory word at label's address ld t1,%lo(label)(t2) ;ld RG1,LL4(RG7) ;#Load from Address + +sd t1,(t2) ;sd RG1,0(RG3) ;#Store Double Word : Store t1 contents into effective memory word address +sd t1,-100 ;sd RG1, VL2(x0) ;#Store Double Word : Store $t1 contents into effective memory word address +sd t1,10000000,t2 ;lui RG3, VH2 ;sd RG1, VL2(RG3) ;#Store Double Word : Store $t1 contents into effective memory word address using t2 as a temporary +sd t1,label,t2 ;auipc RG3, PCH2 ;sd RG1, PCL2(RG3) ;#Store Double Word : Store $t1 contents into memory word at label's address using t2 as a temporary diff --git a/src/PseudoOps.txt b/src/PseudoOps.txt index 6a0c19a9..1892c07f 100644 --- a/src/PseudoOps.txt +++ b/src/PseudoOps.txt @@ -111,7 +111,7 @@ jr t0, -100 ;jalr x0, RG1, VL2 ;#Jump Register: Jump to address in t0 jalr t0, -100 ;jalr x1, RG1, VL2 ;#Jump And Link Register: Jump to address in t0 and set the return address to ra jalr t0,-100(t1);jalr RG1, RG4, VL2;#Jump And Link Register: Jump to address in t1 and set the return address to t0 ret ;jalr x0, x1, 0 ;#Return: return from a subroutine -call label ;auipc x6,PCH1 ;jalr x1, x6, PCL1;#CALL: call a far-away subroutine +call label ;auipc x1,PCH1 ;jalr x1, x1, PCL1;#CALL: call a far-away subroutine tail label ;auipc x6,PCH1 ;jalr x0, x6, PCL1;#TAIL call: tail call (call without saving return address)a far-away subroutine ######################### load/store pseudo-ops start here ########################## diff --git a/src/Settings.properties b/src/Settings.properties index 3b0a023a..dc0d4966 100644 --- a/src/Settings.properties +++ b/src/Settings.properties @@ -3,7 +3,7 @@ AssembleAll = false AssembleOnOpen = false BareMachine = false -DataSegmentHighlighting = true +ExplicitWriteHighlighting = true DelayedBranching = false DisplayAddressesInHex = true DisplayValuesInHex = true @@ -13,7 +13,7 @@ ExtendedAssembler = true LabelWindowVisibility = false LoadExceptionHandler = false ProgramArguments = false -RegistersHighlighting = true +ExplicitReadHighlighting = true StartAtMain = false WarningsAreErrors = false PopupInstructionGuidance = true @@ -24,10 +24,10 @@ OddRowBackground = 0x00ffffff OddRowForeground = 0 TextSegmentHighlightBackground = 0x00ffff99 TextSegmentHighlightForeground = 0 -TextSegmentDelaySlotHighlightBackground = 0x33ff00 +TextSegmentDelaySlotHighlightBackground = 0x0033ff00 TextSegmentDelaySlotHighlightForeground = 0 -DataSegmentHighlightBackground = 0x0099ccff -DataSegmentHighlightForeground = 0 -RegisterHighlightBackground = 0x0099cc55 -RegisterHighlightForeground = 0 +ExplicitWriteHighlightBackground = 0x00ffaaaa +ExplicitWriteHighlightForeground = 0 +ExplicitReadHighlightBackground = 0x0099ccff +ExplicitReadHighlightForeground = 0 DeriveCurrentDirectory = false diff --git a/src/Syscall.properties b/src/Syscall.properties index 15dfee75..a9a665be 100644 --- a/src/Syscall.properties +++ b/src/Syscall.properties @@ -1,15 +1,18 @@ -# Spike compatable calls +# Spike and Linux compatible calls GetCWD = 17 Close = 57 LSeek = 62 Read = 63 Write = 64 Exit2 = 93 -Open = 1024 -# Almost compatable +# Almost compatible Sbrk = 9 Time = 30 +Open = 1024 + +# Compatible with Linux +Brk = 214 # MARS / SPIM compatibility PrintInt = 1 @@ -44,6 +47,6 @@ MessageDialogInt = 56 MessageDialogDouble = 58 MessageDialogString = 59 -# Not compatable +# Not compatible # Collided with Close (57) -MessageDialogFloat = 60 \ No newline at end of file +MessageDialogFloat = 60 diff --git a/src/help/Command.html b/src/help/Command.html index c4acdbf8..7521844b 100644 --- a/src/help/Command.html +++ b/src/help/Command.html @@ -1,11 +1,9 @@ -RARS 1.6 help contents +<title>RARS help contents

RARS - RISC-V Assembler and Runtime Simulator

-

Release 1.0

-

August 2017

Using RARS from a command line.

@@ -22,46 +20,45 @@

Using RARS from a command line.

for potentially correct documentation

- - - - - + + + + + - + - - - - +and .data. Also supports an address range (see m-n below). Current supported dump formats are Binary, HexText, BinaryText, AsciiText. See examples below. + + + + - - - - - - - - +for a 32KB address space with text segment at address 0. + + + + + + + + If 0, negative or not specified, there is no maximum. + NOTE: Depending on your command shell, you may need to escape the $, e.g. \$t3 + content to display at end of run. Even-numbered float register displays both float and double. Option may be repeated. $ not required. + m <= n, both must be on word boundary. Option may be repeated. +strings). The count is also at the top of the runtime stack ($sp), followed by the array.This option and its arguments must be the last items in the command!
OptionDescriptionSince
aassemble only, do not simulate1.0
aenterminate RARS with integer exit code n if assembly error occurs4.1
asciidisplay memory or register contents interpreted as ASCII codes. (alternatives are dec and hex)4.1
bbrief - do not display register/memory address along with contents2.2
OptionDescription
aassemble only, do not simulate
aenterminate RARS with integer exit code n if assembly error occurs
asciidisplay memory or register contents interpreted as ASCII codes. (alternatives are dec and hex)
bbrief - do not display register/memory address along with contents
ddisplay RARS debugging statements (of interest mainly to RARS developer)
decdisplay memory or register contents in decimal. (alternatives are ascii and hex)2.2
decdisplay memory or register contents in decimal. (alternatives are ascii and hex)
dumpdump memory contents to file. Option has 3 arguments, e.g. dump <segment> <format> <file>. Current supported segments are .text -and .data. Also supports an address range (see m-n below). Current supported dump formats are Binary, HexText, BinaryText, AsciiText. See examples below.3.4
gforce GUI mode1.6
hexdisplay memory or register contents in hexadecimal - this is the default. (alternatives are ascii and dec)2.2
hdisplay this help. Use this option by itself and with no filename.1.0
icdisplay instruction count; the number of basic instructions 'executed'4.3
gforce GUI mode
hexdisplay memory or register contents in hexadecimal - this is the default. (alternatives are ascii and dec)
hdisplay this help. Use this option by itself and with no filename.
icdisplay instruction count; the number of basic instructions 'executed'
mcset memory configuration. Option has 1 argument, e.g. mc <config>. Argument <config> is case-sensitive and its possible values are Default for the default 32-bit address space, CompactDataAtZero for a 32KB address space with data segment at address 0, or CompactTextAtZero -for a 32KB address space with text segment at address 0.3.7
medisplay RARS messages to standard err instead of standard out. Allows you to separate RARS messages from program output using redirection.4.3
nccopyright notice will not be displayed. Useful if redirecting or piping program output.3.5
nppseudo-instructions or extended instruction formats are not permitted.3.0
pproject option - will assemble the specified file and all other assembly files (*.asm; *.s) in its directory.3.1
senterminate RARS with exit code n if simulate (run) error occurs4.1
smstart execution at statement having global label 'main' if defined3.8
smcSelf Modifying Code - Program can write and execute in either text or data segment4.4
weassembler warnings will be considered errors.3.5
nppseudo-instructions or extended instruction formats are not permitted.
pproject option - will assemble the specified file and all other assembly files (*.asm; *.s) in its directory.
senterminate RARS with exit code n if simulate (run) error occurs
smstart execution at statement having global label 'main' if defined
smcSelf Modifying Code - Program can write and execute in either text or data segment
versionshow copyright notice and version will not be displayed.
weassembler warnings will be considered errors.
nwhere n is an integer maximum count of execution steps to simulate. - If 0, negative or not specified, there is no maximum.1.0
$regwhere reg is number or name (e.g. 5, t3, f10) of register whose content to display at end of run. Even-numbered float register displays both float and double. Option may be repeated. - NOTE: Depending on your command shell, you may need to escape the $, e.g. \$t32.2
reg_namewhere reg_name is the name (e.g. t3, f10) of register whose - content to display at end of run. Even-numbered float register displays both float and double. Option may be repeated. $ not required.2.2
m-nmemory address range from m to n whose contents to display at end of run. m and n may be decimal or hexadecimal (starts with 0x), - m <= n, both must be on word boundary. Option may be repeated.2.2
paprogram arguments - all remaining space-separated items are argument values provided to the program via $a0 (argc - argument count) and $a1 (argv - address of array containing pointers to null-terminated argument -strings). The count is also at the top of the runtime stack ($sp), followed by the array.This option and its arguments must be the last items in the command!3.5

Example: java -jar rars.jar h
@@ -97,4 +94,4 @@

Using RARS from a command line.

or if you want to run a number of different programs such as for grading purposes. - \ No newline at end of file + diff --git a/src/help/Debugging.html b/src/help/Debugging.html index 5e8831c6..ff73928c 100644 --- a/src/help/Debugging.html +++ b/src/help/Debugging.html @@ -1,11 +1,9 @@ -RARS 1.6 help contents +<title>RARS help contents

RARS - RISC-V Assembler and Runtime Simulator

-

Release 1.0

-

August 2017

Interactive Debugging Features

diff --git a/src/help/History.html b/src/help/History.html index 3a3cac41..638905de 100644 --- a/src/help/History.html +++ b/src/help/History.html @@ -4,10 +4,18 @@

RARS - RISC-V Assembler and Runtime Simulator

-

Release 1.6

-

February 2023

+

Release 1.7

+

Septembre 2024

Release History

+ +

+ RARS 1.7 was released in Septembre 2024. + This release was for many bugfixes around 64-bit instructions. + Added darkmode. + The new repo can be found at rarsm/rars on Github. +

+

RARS 1.6 was released in February 2023. It added some minor features and bugfixes that accumulated diff --git a/src/help/IDE.html b/src/help/IDE.html index f7c114ee..86997c56 100644 --- a/src/help/IDE.html +++ b/src/help/IDE.html @@ -1,77 +1,85 @@ -RARS 1.6 help contents - +RARS help contents

-

RARS - RISC-V Assembler and Runtime Simulator

-

Release 1.0

-

August 2017

-

Using RARS through its Integrated Development Environment (IDE)

+

RARS - RISC-V Assembler and Runtime Simulator

+

Using RARS through its Integrated Development Environment (IDE)

- -The IDE is invoked when RARS is run with no command arguments, e.g. java -jar rars.jar. -It may also be launched from a graphical interface by double-clicking the rars.jar icon -that represents this executable JAR file. -The IDE provides basic editing, assembling and execution capabilities. Hopefully it -is intuitive to use. Here are comments on some features. +The IDE is invoked when RARS is run with no command arguments, e.g. java -jar rars.jar. It may also be launched +from a graphical interface by double-clicking the rars.jar icon that represents this executable JAR file. The +IDE provides basic editing, assembling and execution capabilities. Hopefully it is intuitive to use. Here are comments +on some features. - -

The assembler and simulator are invoked from the IDE -when you select the Assemble, Go, -or Step operations from the Run menu or their corresponding -toolbar icons or keyboard shortcuts. RARS messages are displayed on the -RARS Messages tab of the message area at the bottom of the screen. -Runtime console input and output is handled in the Run I/O tab. +

The assembler and simulator are invoked from the IDE when you select the Assemble, Go, or Step + operations from the Run menu or their corresponding toolbar icons or keyboard shortcuts. RARS messages are + displayed on the RARS Messages tab of the message area at the bottom of the screen. Runtime console input and + output is handled in the Run I/O tab. \ No newline at end of file diff --git a/src/help/Intro.html b/src/help/Intro.html index fe6db650..558cd6bd 100644 --- a/src/help/Intro.html +++ b/src/help/Intro.html @@ -1,11 +1,9 @@ -RARS 1.6 help contents +<title>RARS 1.7 help contents

RARS - RISC-V Assembler and Runtime Simulator

-

Release 1.0

-

August 2017

Introduction

diff --git a/src/help/Limits.html b/src/help/Limits.html index e7ffd356..533470df 100644 --- a/src/help/Limits.html +++ b/src/help/Limits.html @@ -1,11 +1,10 @@ -RARS 1.6 help contents +<title>RARS help contents

RARS - RISC-V Assembler and Runtime Simulator

-

Release 1.0

-

August 2017

+

Operating Requirements

diff --git a/src/images/ALUcontrol.png b/src/images/ALUcontrol.png deleted file mode 100644 index a91bd94b..00000000 Binary files a/src/images/ALUcontrol.png and /dev/null differ diff --git a/src/images/Edit_tab.jpg b/src/images/Edit_tab.jpg deleted file mode 100644 index d421d69e..00000000 Binary files a/src/images/Edit_tab.jpg and /dev/null differ diff --git a/src/images/Execute_tab.jpg b/src/images/Execute_tab.jpg deleted file mode 100644 index 76895e2c..00000000 Binary files a/src/images/Execute_tab.jpg and /dev/null differ diff --git a/src/images/control.png b/src/images/control.png deleted file mode 100644 index 1c532868..00000000 Binary files a/src/images/control.png and /dev/null differ diff --git a/src/images/datapath.png b/src/images/datapath.png deleted file mode 100644 index 7f4ee347..00000000 Binary files a/src/images/datapath.png and /dev/null differ diff --git a/src/images/register.png b/src/images/register.png deleted file mode 100644 index 6e1ccb55..00000000 Binary files a/src/images/register.png and /dev/null differ diff --git a/src/rars/AssemblyException.java b/src/rars/AssemblyException.java index 81df89b1..e81dd6a6 100644 --- a/src/rars/AssemblyException.java +++ b/src/rars/AssemblyException.java @@ -1,32 +1,5 @@ package rars; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Exception wrapping ErrorList, used mainly in Tokenizer and Assembler; Represents errors that occurs while assembling a RISCV program. * diff --git a/src/rars/CancelException.java b/src/rars/CancelException.java new file mode 100644 index 00000000..9b71a036 --- /dev/null +++ b/src/rars/CancelException.java @@ -0,0 +1,7 @@ +package rars; + +/** + * This exception is only used to trigger breakpoints for I/O and other system call where the user selected cancel or equivalent. + */ +public class CancelException extends SimulationException { +} diff --git a/src/rars/ErrorList.java b/src/rars/ErrorList.java index d38a17a3..e34d87b4 100644 --- a/src/rars/ErrorList.java +++ b/src/rars/ErrorList.java @@ -1,33 +1,6 @@ package rars; import java.util.ArrayList; -/* -Copyright (c) 2003-2012, 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) - */ /** * Maintains list of generated error messages, regardless of source (tokenizing, parsing, diff --git a/src/rars/ErrorMessage.java b/src/rars/ErrorMessage.java index ef019e23..248e459c 100644 --- a/src/rars/ErrorMessage.java +++ b/src/rars/ErrorMessage.java @@ -4,33 +4,6 @@ import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; -/* -Copyright (c) 2003-2012, 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) - */ /** * Represents occurrance of an error detected during tokenizing, assembly or simulation. diff --git a/src/rars/Globals.java b/src/rars/Globals.java index 7ba6ee40..aaa43535 100644 --- a/src/rars/Globals.java +++ b/src/rars/Globals.java @@ -13,34 +13,6 @@ import java.util.StringTokenizer; import java.util.concurrent.locks.ReentrantLock; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Collection of globally-available data structures. * @@ -51,6 +23,7 @@ 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"; + private static String versionPropertiesFile = "Version"; /** * The set of implemented instructions. @@ -100,7 +73,15 @@ public class Globals { /** * The current version number. Can't wait for "initialize()" call to get it. */ - public static final String version = "1.6"; + public static final String version = getVersion(); + /** + * Get the current version from a property file set at built-time. + * */ + private static String getVersion() { + String v = getPropertyEntry(versionPropertiesFile, "Version"); + if (v == null) return "1.6-undefined"; + return v; + } /** * List of accepted file extensions for RISCV assembly source files. */ diff --git a/src/rars/Launch.java b/src/rars/Launch.java index 39270e23..ea5609d6 100644 --- a/src/rars/Launch.java +++ b/src/rars/Launch.java @@ -5,7 +5,6 @@ import rars.riscv.dump.DumpFormat; import rars.riscv.dump.DumpFormatLoader; import rars.riscv.hardware.*; -import rars.simulator.ProgramArgumentList; import rars.simulator.Simulator; import rars.util.Binary; import rars.util.FilenameFinder; @@ -20,36 +19,6 @@ import java.io.PrintStream; import java.util.ArrayList; import java.util.Iterator; -import java.util.Observable; -import java.util.Observer; - -/* -Copyright (c) 2003-2012, 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) - */ /** * Launch the application @@ -131,6 +100,7 @@ public class Launch { private ArrayList programArgumentList; // optional program args for program (becomes argc, argv) private int assembleErrorExitCode; // RARS command exit code to return if assemble error occurs private int simulateErrorExitCode;// RARS command exit code to return if simulation error occurs + private int maxStepsErrorExitCode;// RARS command exit code to return if max number of instructions is reached public static void main(String[] args){ new Launch(args); @@ -146,13 +116,14 @@ private Launch(String[] args) { assembleProject = false; countInstructions = false; instructionCount = 0; - assembleErrorExitCode = 0; - simulateErrorExitCode = 0; + assembleErrorExitCode = 1; + simulateErrorExitCode = 2; + maxStepsErrorExitCode = 3; registerDisplayList = new ArrayList<>(); memoryDisplayList = new ArrayList<>(); filenameList = new ArrayList<>(); MemoryConfigurations.setCurrentConfiguration(MemoryConfigurations.getDefaultConfiguration()); - out = System.out; + out = System.err; if (!parseCommandArgs(args)) { System.exit(Globals.exitCode); @@ -231,6 +202,18 @@ private void dumpSegments(Program program) { private void launchIDE() { // System.setProperty("apple.laf.useScreenMenuBar", "true"); // Puts RARS menu on Mac OS menu bar + try { + if (Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED)) { + UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarkLaf"); + Globals.getSettings().setDarkMode(); + } + else { + UIManager.setLookAndFeel("com.formdev.flatlaf.FlatIntelliJLaf"); + Globals.getSettings().setLightMode(); + } + } catch( Exception ex ) { + System.err.println( "Failed to initialize LaF. Continue with default LaF." ); + } SwingUtilities.invokeLater( new Runnable() { public void run() { @@ -250,18 +233,11 @@ public void run() { // Returns true if command args parse OK, false otherwise. private boolean parseCommandArgs(String[] args) { - String noCopyrightSwitch = "nc"; - String displayMessagesToErrSwitch = "me"; boolean argsOK = true; boolean inProgramArgumentList = false; programArgumentList = null; if (args.length == 0) return true; // should not get here... - // If the option to display RARS messages to standard erro is used, - // it must be processed before any others (since messages may be - // generated during option parsing). - processDisplayMessagesToErrSwitch(args, displayMessagesToErrSwitch); - displayCopyright(args, noCopyrightSwitch); // ..or not.. if (args.length == 1 && args[0].equals("h")) { displayHelp(); return false; @@ -282,12 +258,16 @@ private boolean parseCommandArgs(String[] args) { inProgramArgumentList = true; continue; } - // messages-to-standard-error switch already processed, so ignore. - if (args[i].toLowerCase().equals(displayMessagesToErrSwitch)) { + // messages-to-standard-error removed, so ignore. + if (args[i].toLowerCase().equals("me")) { continue; } - // no-copyright switch already processed, so ignore. - if (args[i].toLowerCase().equals(noCopyrightSwitch)) { + // no-copyright switch removed, so ignore. + if (args[i].toLowerCase().equals("nc")) { + continue; + } + if (args[i].toLowerCase().equals("version")) { + displayVersion(); continue; } if (args[i].toLowerCase().equals("dump")) { @@ -507,6 +487,7 @@ private Program runCommand() { Simulator.Reason done = program.simulate(); if (done == Simulator.Reason.MAX_STEPS) { out.println("\nProgram terminated when maximum step limit " + options.maxSteps + " reached."); + Globals.exitCode = maxStepsErrorExitCode; break; } else if (done == Simulator.Reason.CLIFF_TERMINATION) { out.println("\nProgram terminated by dropping off the bottom."); @@ -666,29 +647,11 @@ private void displayMemoryPostMortem(Memory memory) { } } - /////////////////////////////////////////////////////////////////////// - // If option to display RARS messages to standard err (System.err) is - // present, it must be processed before all others. Since messages may - // be output as early as during the command parse. - private void processDisplayMessagesToErrSwitch(String[] args, String displayMessagesToErrSwitch) { - for (String arg : args) { - if (arg.toLowerCase().equals(displayMessagesToErrSwitch)) { - out = System.err; - return; - } - } - } - /////////////////////////////////////////////////////////////////////// - // Decide whether copyright should be displayed, and display - // if so. - - private void displayCopyright(String[] args, String noCopyrightSwitch) { - for (String arg : args) { - if (arg.toLowerCase().equals(noCopyrightSwitch)) { - return; - } - } - out.println("RARS " + Globals.version + " Copyright " + Globals.copyrightYears + " " + Globals.copyrightHolders + "\n"); + /** + * Display version and copyright. + * */ + private void displayVersion() { + out.println("RARS " + Globals.version + " Copyright " + Globals.copyrightYears + " " + Globals.copyrightHolders + "\n"); } @@ -735,15 +698,13 @@ private void displayHelp() { out.println(" 32-bit address space, CompactDataAtZero for a 32KB memory with"); out.println(" data segment at address 0, or CompactTextAtZero for a 32KB"); out.println(" memory with text segment at address 0."); - out.println(" me -- display RARS messages to standard err instead of standard out. "); - out.println(" Can separate messages from program output using redirection"); - out.println(" nc -- do not display copyright notice (for cleaner redirected/piped output)."); out.println(" np -- use of pseudo instructions and formats not permitted"); out.println(" p -- Project mode - assemble all files in the same directory as given file."); out.println(" se -- terminate RARS with integer exit code if a simulation (run) error occurs."); out.println(" sm -- start execution at statement with global label main, if defined"); out.println(" smc -- Self Modifying Code - Program can write and branch to either text or data segment"); out.println(" rv64 -- Enables 64 bit assembly and executables (Not fully compatible with rv32)"); + out.println(" version -- Show version and copyright"); out.println(" -- where is an integer maximum count of steps to simulate."); out.println(" If 0, negative or not specified, there is no maximum."); out.println(" x -- where is number or name (e.g. 5, t3, f10) of register whose "); diff --git a/src/rars/ProgramStatement.java b/src/rars/ProgramStatement.java index 1499dff3..41b05410 100644 --- a/src/rars/ProgramStatement.java +++ b/src/rars/ProgramStatement.java @@ -16,34 +16,6 @@ import java.util.ArrayList; -/* -Copyright (c) 2003-2013, 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) - */ - /** * Represents one assembly/machine statement. This represents the "bare machine" level. * Pseudo-instructions have already been processed at this point and each assembly diff --git a/src/rars/RISCVprogram.java b/src/rars/RISCVprogram.java index fdc0bbdd..7bda71d9 100644 --- a/src/rars/RISCVprogram.java +++ b/src/rars/RISCVprogram.java @@ -5,39 +5,10 @@ import rars.simulator.BackStepper; import rars.simulator.Simulator; -import java.io.BufferedReader; -import java.io.FileReader; +import java.io.*; import java.util.ArrayList; import java.util.Arrays; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Internal representations of the program. Connects source, tokens and machine code. Having * all these structures available facilitates construction of good messages, @@ -57,6 +28,7 @@ public class RISCVprogram { private ArrayList tokenList; private ArrayList parsedList; private ArrayList machineList; + private ArrayList textSegmentLines; private BackStepper backStepper; private SymbolTable localSymbolTable; private MacroPool macroPool; @@ -143,6 +115,16 @@ public ArrayList createParsedList() { return parsedList; } + public ArrayList createMachineList() { + machineList = new ArrayList<>(); + return machineList; + } + + public ArrayList createTextSegmentLines() { + textSegmentLines = new ArrayList<>(); + return textSegmentLines; + } + /** * Produces existing list of parsed source code statements. * @@ -166,6 +148,10 @@ public ArrayList getMachineList() { return machineList; } + public ArrayList getTextSegmentLines() { + return textSegmentLines; + } + /** * Returns BackStepper associated with this program. It is created upon successful assembly. @@ -238,7 +224,7 @@ public void readSource(String file) throws AssemblyException { BufferedReader inputFile; String line; try { - inputFile = new BufferedReader(new FileReader(file)); + inputFile = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); line = inputFile.readLine(); while (line != null) { sourceList.add(line); @@ -333,7 +319,7 @@ public ErrorList assemble(ArrayList programsToAssemble, boolean ex boolean warningsAreErrors) throws AssemblyException { this.backStepper = null; Assembler asm = new Assembler(); - this.machineList = asm.assemble(programsToAssemble, extendedAssemblerEnabled, warningsAreErrors); + asm.assemble(programsToAssemble, extendedAssemblerEnabled, warningsAreErrors, this); this.backStepper = new BackStepper(); return asm.getErrorList(); } diff --git a/src/rars/Settings.java b/src/rars/Settings.java index 16bcf9fb..fba66145 100644 --- a/src/rars/Settings.java +++ b/src/rars/Settings.java @@ -13,34 +13,6 @@ import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; -/* -Copyright (c) 2003-2013, 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) - */ - /** * Contains various IDE settings. Persistent settings are maintained for the * current user and on the current machine using @@ -110,17 +82,13 @@ public enum Bool { */ WARNINGS_ARE_ERRORS("WarningsAreErrors", false), /** - * Flag to determine whether or not to display and use program arguments - */ - PROGRAM_ARGUMENTS("ProgramArguments", false), - /** - * Flag to control whether or not highlighting is applied to data segment window + * Flag to control whether or not highlighting is applied when explicit writing */ - DATA_SEGMENT_HIGHLIGHTING("DataSegmentHighlighting", true), + EXPLICIT_WRITE_HIGHLIGHTING("ExplicitWriteHighlighting", true), /** - * Flag to control whether or not highlighting is applied to register windows + * Flag to control whether or not highlighting is applied when explicit reading */ - REGISTERS_HIGHLIGHTING("RegistersHighlighting", true), + EXPLICIT_READ_HIGHLIGHTING("ExplicitReadHighlighting", true), /** * Flag to control whether or not assembler automatically initializes program counter to 'main's address */ @@ -137,6 +105,10 @@ public enum Bool { * Flag to control whether or not simulator will use popup dialog for input syscalls */ POPUP_SYSCALL_INPUT("PopupSyscallInput", false), + /** + * Flag to controg whether or not the run I/O mode is batch (true) or interactive (false). + */ + BATCH_IOMODE("BatchIOMode", false), /** * Flag to control whether or not to use generic text editor instead of language-aware styled editor */ @@ -158,7 +130,11 @@ public enum Bool { * Flag to determine whether to calculate relative paths from the current working directory * or from the RARS executable path. */ - DERIVE_CURRENT_WORKING_DIRECTORY("DeriveCurrentWorkingDirectory", false); + DERIVE_CURRENT_WORKING_DIRECTORY("DeriveCurrentWorkingDirectory", false), + /** + * Flag to determine whether rars is in dark mode instead of light mode. + */ + DARK_MODE_ENABLED("DarkModeEnabled", false); // TODO: add option for turning off user trap handling and interrupts private String name; @@ -244,25 +220,25 @@ String getName() { */ public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FONT = 4; /** - * Font for text segment highlighted background + * Font for data segment highlighted background */ - public static final int DATASEGMENT_HIGHLIGHT_FONT = 5; + public static final int EXPLICIT_WRITE_HIGHLIGHT_FONT = 5; /** - * Font for register highlighted background + * Font for data segment highlighted background */ - public static final int REGISTER_HIGHLIGHT_FONT = 6; + public static final int EXPLICIT_READ_HIGHLIGHT_FONT = 6; private static final String[] fontFamilySettingsKeys = {"EditorFontFamily", "EvenRowFontFamily", "OddRowFontFamily", " TextSegmentHighlightFontFamily", "TextSegmentDelayslotHighightFontFamily", - "DataSegmentHighlightFontFamily", "RegisterHighlightFontFamily" + "ExplicitWriteHighlightFontFamily","ExplicitReadHighlightFontFamily" }; private static final String[] fontStyleSettingsKeys = {"EditorFontStyle", "EvenRowFontStyle", "OddRowFontStyle", " TextSegmentHighlightFontStyle", "TextSegmentDelayslotHighightFontStyle", - "DataSegmentHighlightFontStyle", "RegisterHighlightFontStyle" + "ExplicitWriteHighlightFontStyle", "ExplicitWriteHighlightFontStyle" }; private static final String[] fontSizeSettingsKeys = {"EditorFontSize", "EvenRowFontSize", "OddRowFontSize", " TextSegmentHighlightFontSize", "TextSegmentDelayslotHighightFontSize", - "DataSegmentHighlightFontSize", "RegisterHighlightFontSize" + "ExplicitWriteHighlightFontSize", "ExplicitWriteHighlightFontSize" }; @@ -321,21 +297,21 @@ String getName() { */ public static final int TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FOREGROUND = 7; /** - * RGB color for text segment highlighted background + * RGB color for highlighted background when explicitly writing data */ - public static final int DATASEGMENT_HIGHLIGHT_BACKGROUND = 8; + public static final int EXPLICIT_WRITE_HIGHLIGHT_BACKGROUND = 8; /** - * RGB color for text segment highlighted foreground + * RGB color for highlighted foreground when explicitly writing data */ - public static final int DATASEGMENT_HIGHLIGHT_FOREGROUND = 9; + public static final int EXPLICIT_WRITE_HIGHLIGHT_FOREGROUND = 9; /** - * RGB color for register highlighted background + * RGB color for highlighted background when explicitly reading data */ - public static final int REGISTER_HIGHLIGHT_BACKGROUND = 10; + public static final int EXPLICIT_READ_HIGHLIGHT_BACKGROUND = 10; /** - * RGB color for register highlighted foreground + * RGB color for highlighted foreground when explicitly reading data */ - public static final int REGISTER_HIGHLIGHT_FOREGROUND = 11; + public static final int EXPLICIT_READ_HIGHLIGHT_FOREGROUND = 11; /** * RGB background color of Editor */ @@ -371,17 +347,24 @@ public enum ColorMode { "EvenRowBackground", "EvenRowForeground", "OddRowBackground", "OddRowForeground", "TextSegmentHighlightBackground", "TextSegmentHighlightForeground", "TextSegmentDelaySlotHighlightBackground", "TextSegmentDelaySlotHighlightForeground", - "DataSegmentHighlightBackground", "DataSegmentHighlightForeground", - "RegisterHighlightBackground", "RegisterHighlightForeground", + "ExplicitWriteHighlightBackground", "ExplicitWriteHighlightForeground", + "ExplicitReadHighlightBackground", "ExplicitReadHighlightForeground", "EditorBackground", "EditorForeground", "EditorLineHighlight", "EditorSelection", "EditorCaretColor"}; + + // default light color settings for editor (not syntax) and execute/register panes + private static String[] defaultLightColorSettingsValues = { + "0x00e0e0e0", "0", "0x00ffffff", "0", "0x00ffff99", "0", "0x0033ff00", "0", "0x00ffaaaa", "0", "0x0099ccff","0", "0x00ffffff", "0x00000000", "0x00eeeeee", "0x00ccccff", "0x00000000"}; + + // default dark color settings for editor (not syntax) and execute/register panes + private static String[] defaultDarkColorSettingsValues = { + "0x00333333", "0x00cccccc", "0x00202020", "0x00cccccc", "0x00ffff99", "0", "0x0033ff00", "0", "0x00ffaaaa", "0", "0x0099ccff", "0", "0x00202020", "0x00bbbbbb","0x00333333", "0x00304060", "0x00bbbbbb"}; /** * 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", "0x00ffffff", "0x00000000", "0x00eeeeee", "0x00ccccff", "0x00000000"}; + private static String[] defaultColorSettingsValues = defaultLightColorSettingsValues; interface SystemColorProvider { Color getColor();} private SystemColorProvider[] systemColors; @@ -1308,4 +1291,52 @@ private int[] getTextSegmentColumnOrder(String stringOfColumnIndexes) { return list; } + /* + * Sets dark default syntax styles and dark default color settings/highlights. + * If light default was used as current color, changes to dark default. If custom colors, doesn't change them. + */ + public void setDarkMode() { + defaultColorSettingsValues = defaultDarkColorSettingsValues; + SyntaxUtilities.setDarkDefaultStyles(); + SyntaxStyle[] syntaxStyle = SyntaxUtilities.getDefaultSyntaxStyles(); + defaultSyntaxStyleColorSettingsValues = new String[syntaxStyle.length]; + for (int i = 0; i < syntaxStyle.length; i++) + defaultSyntaxStyleColorSettingsValues[i] = syntaxStyle[i].getColorAsHexString(); + + oldDefaultToNew(SyntaxUtilities.getLightDefaultSyntaxStyles(), defaultSyntaxStyleColorSettingsValues, + defaultLightColorSettingsValues, defaultDarkColorSettingsValues); + } + + /* + * Sets light default syntax styles and light default color settings/highlights. + * If dark default was used as current color, changes to light default. If custom colors, doesn't change them. + */ + public void setLightMode() { + defaultColorSettingsValues = defaultLightColorSettingsValues; + SyntaxUtilities.setLightDefaultStyles(); + SyntaxStyle[] syntaxStyle = SyntaxUtilities.getDefaultSyntaxStyles(); + defaultSyntaxStyleColorSettingsValues = new String[syntaxStyle.length]; + for (int i = 0; i < syntaxStyle.length; i++) + defaultSyntaxStyleColorSettingsValues[i] = syntaxStyle[i].getColorAsHexString(); + + oldDefaultToNew(SyntaxUtilities.getDarkDefaultSyntaxStyles(), defaultSyntaxStyleColorSettingsValues, + defaultDarkColorSettingsValues, defaultColorSettingsValues); + } + + /* + * Sets current colors to the new default colors specified iff it was set to the opposite default before. + */ + private void oldDefaultToNew(SyntaxStyle[] oppositeSyntaxDefault, String[] newDefaultSyntax, + String[] oppositeDefaultColorSettingsValues, String[] newDefaultColorSettingsValues) { + for (int i = 0; i < syntaxStyleColorSettingsValues.length; i++) + if (syntaxStyleColorSettingsValues[i].equals(oppositeSyntaxDefault[i].getColorAsHexString())) { + syntaxStyleColorSettingsValues[i] = newDefaultSyntax[i]; + } + + for (int i = 0; i < colorSettingsValues.length; i++) + if (colorSettingsValues[i].equals(oppositeDefaultColorSettingsValues[i]) || (colorSettingsValues[i].equals("0x00000000") && oppositeDefaultColorSettingsValues[i].equals("0"))) { + colorSettingsValues[i] = newDefaultColorSettingsValues[i]; + } + } + } diff --git a/src/rars/api/Program.java b/src/rars/api/Program.java index e49d2c6d..89f8d5f8 100644 --- a/src/rars/api/Program.java +++ b/src/rars/api/Program.java @@ -8,6 +8,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.UnsupportedEncodingException; import java.util.ArrayList; /** @@ -60,6 +61,10 @@ public Program(Options set){ simulation = new Memory(); } + public Options getOptions() { + return set; + } + /** * Assembles from a list of files * @@ -154,6 +159,10 @@ public void setup(ArrayList args, String STDIN){ } } + public RISCVprogram getCode() { + return code; + } + /** * Simulates a processor executing the machine code. * @@ -195,14 +204,22 @@ public Simulator.Reason simulate() throws SimulationException { * @return converts the bytes sent to stdout into a string (resets to "" when setup is called) */ public String getSTDOUT(){ - return stdout.toString(); + try { + return stdout.toString("UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } } /** * @return converts the bytes sent to stderr into a string (resets to "" when setup is called) */ public String getSTDERR(){ - return stderr.toString(); + try { + return stderr.toString("UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } } /** diff --git a/src/rars/assembler/Assembler.java b/src/rars/assembler/Assembler.java index e4dc2164..d17af87e 100644 --- a/src/rars/assembler/Assembler.java +++ b/src/rars/assembler/Assembler.java @@ -13,35 +13,6 @@ import java.util.ArrayList; import java.util.Collections; - -/* - Copyright (c) 2003-2012, 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) - */ - /** * An Assembler is capable of assembling a RISCV program. It has only one public * method, assemble(), which implements a two-pass assembler. It @@ -58,6 +29,7 @@ public class Assembler { // macro definition segment private int externAddress; private boolean autoAlign; + private boolean instructionInDataWarningGiven; private Directives dataDirective; private RISCVprogram fileCurrentlyBeingAssembled; private TokenList globalDeclarationList; @@ -88,17 +60,14 @@ public ErrorList getErrorList() { * considered errors and terminate the assemble; false means the * assembler will produce warning message but otherwise ignore * warnings. - * @return An ArrayList representing the assembled program. Each member of - * the list is a ProgramStatement object containing the source, - * intermediate, and machine binary representations of a program - * statement. Returns null if incoming array list is null or empty. + * @param programAssembled The whole program currently being assembled. * @see ProgramStatement **/ - public ArrayList assemble(ArrayList tokenizedProgramFiles, boolean extendedAssemblerEnabled, - boolean warningsAreErrors) throws AssemblyException { + public void assemble(ArrayList tokenizedProgramFiles, boolean extendedAssemblerEnabled, + boolean warningsAreErrors, RISCVprogram programAssembled) throws AssemblyException { if (tokenizedProgramFiles == null || tokenizedProgramFiles.size() == 0) - return null; + return; textAddress = new AddressSpace(Memory.textBaseAddress); dataAddress = new AddressSpace(Memory.dataBaseAddress); externAddress = Memory.externBaseAddress; @@ -106,7 +75,8 @@ public ArrayList assemble(ArrayList tokenizedPro accumulatedDataSegmentForwardReferences = new DataSegmentForwardReferences(); Globals.symbolTable.clear(); Globals.memory.clear(); - ArrayList machineList = new ArrayList<>(); + ArrayList machineList = programAssembled.createMachineList(); + ArrayList textSegmentLines = programAssembled.createTextSegmentLines(); this.errors = new ErrorList(); if (Globals.debug) System.out.println("Assembler first pass begins:"); @@ -136,6 +106,7 @@ public ArrayList assemble(ArrayList tokenizedPro // tokenList is an ArrayList of TokenList objects, one per source line; // each ArrayList in tokenList consists of Token objects. ArrayList sourceLineList = fileCurrentlyBeingAssembled.getSourceLineList(); + ArrayList sourceLines = fileCurrentlyBeingAssembled.getSourceList(); ArrayList tokenList = fileCurrentlyBeingAssembled.getTokenList(); ArrayList parsedList = fileCurrentlyBeingAssembled.createParsedList(); // each file keeps its own macro definitions @@ -156,6 +127,11 @@ public ArrayList assemble(ArrayList tokenizedPro extendedAssemblerEnabled); if (statements != null) { parsedList.addAll(statements); + } else if (!sourceLines.get(i).isBlank()) { //not an instruction and not a blank line + ProgramStatement programStatement = new ProgramStatement(sourceLineList.get(i).getRISCVprogram(), + sourceLines.get(i), tokenList.get(i), null, null, + -1, sourceLineList.get(i).getLineNumber()); + parsedList.add(programStatement); } } if (inMacroSegment) { @@ -197,13 +173,31 @@ public ArrayList assemble(ArrayList tokenizedPro this.fileCurrentlyBeingAssembled = program; ArrayList parsedList = fileCurrentlyBeingAssembled.getParsedList(); for (ProgramStatement statement : parsedList) { - statement.buildBasicStatementFromBasicInstruction(errors); + if (statement.getInstruction() != null) + statement.buildBasicStatementFromBasicInstruction(errors); if (errors.errorsOccurred()) { throw new AssemblyException(errors); } + // add warning if instructions were written in .data + if (Memory.inDataSegment(statement.getAddress()) && !instructionInDataWarningGiven) { + errors.add(new ErrorMessage(true, statement.getSourceProgram(), statement.getSourceLine(), + statement.getStrippedTokenList().get(0).getStartPos(), + "Instructions in .data !")); + instructionInDataWarningGiven = true; + } if (statement.getInstruction() instanceof BasicInstruction) { - machineList.add(statement); - } else { + //if statement is in .text, add to machineList + if (Memory.inTextSegment(statement.getAddress())) + machineList.add(statement); + //if statement is in .data, write instruction code in data segment of memory + else if (Memory.inDataSegment(statement.getAddress())) { + dataAddress.set(statement.getAddress()); + statement.buildMachineStatementFromBasicStatement(errors); + writeToDataSegment(statement.getBinaryStatement(), Instruction.INSTRUCTION_LENGTH, + statement.getStrippedTokenList().get(0), errors); + } + textSegmentLines.add(statement); + } else if (statement.getInstruction() != null) { // It is a pseudo-instruction: // 1. Fetch its basic instruction template list // 2. For each template in the list, @@ -259,16 +253,33 @@ public ArrayList assemble(ArrayList tokenizedPro Instruction instr = OperandFormat.bestOperandMatch(newTokenList, instrMatches); // Only first generated instruction is linked to original source - ProgramStatement ps = new ProgramStatement( - this.fileCurrentlyBeingAssembled, - (instrNumber == 0) ? statement.getSource() : "", newTokenList, - newTokenList, instr, textAddress.get(), statement.getSourceLine()); - textAddress.increment(Instruction.INSTRUCTION_LENGTH); - ps.buildBasicStatementFromBasicInstruction(errors); - machineList.add(ps); + // Once again, need refactoring, should treat data and text segment the same way + // If in text segment, add current instruction to machineList + if (Memory.inTextSegment(statement.getAddress())) { + ProgramStatement ps = new ProgramStatement( + this.fileCurrentlyBeingAssembled, + (instrNumber == 0) ? statement.getSource() : "", newTokenList, + newTokenList, instr, textAddress.get(), statement.getSourceLine()); + textAddress.increment(Instruction.INSTRUCTION_LENGTH); + ps.buildBasicStatementFromBasicInstruction(errors); + machineList.add(ps); + textSegmentLines.add(ps); + // If in data segment, write instruction code in memory + } else if (Memory.inDataSegment(statement.getAddress())) { + ProgramStatement ps = new ProgramStatement( + this.fileCurrentlyBeingAssembled, + (instrNumber == 0) ? statement.getSource() : "", newTokenList, + newTokenList, instr, dataAddress.get(), statement.getSourceLine()); + ps.buildBasicStatementFromBasicInstruction(errors); + ps.buildMachineStatementFromBasicStatement(errors); + writeToDataSegment(ps.getBinaryStatement(), Instruction.INSTRUCTION_LENGTH, + ps.getStrippedTokenList().get(0), errors); //also increments dataAddress + textSegmentLines.add(ps); + } } // end of FOR loop, repeated for each template in list. - } // end of ELSE part for extended instruction. - + } else { + textSegmentLines.add(statement); //not an instruction + } } // end of assembler second pass. } if (Globals.debug) @@ -309,7 +320,6 @@ public ArrayList assemble(ArrayList tokenizedPro if (errors.errorsOccurred() || errors.warningsOccurred() && warningsAreErrors) { throw new AssemblyException(errors); } - return machineList; } // assemble() // ////////////////////////////////////////////////////////////////////// @@ -469,35 +479,36 @@ private ArrayList parseLine(TokenList tokenList, String source return null; } - // If we are in the text segment, the variable "token" must now refer to - // an OPERATOR - // token. If not, it is either a syntax error or the specified operator - // is not - // yet implemented. - if (!this.inDataSegment) { - ArrayList instrMatches = this.matchInstruction(token); - if (instrMatches == null) - return ret; - // OK, we've got an operator match, let's check the operands. - Instruction inst = OperandFormat.bestOperandMatch(tokens, instrMatches); - // Here's the place to flag use of extended (pseudo) instructions - // when setting disabled. - if (inst instanceof ExtendedInstruction && !extendedAssemblerEnabled) { - errors.add(new ErrorMessage(token.getSourceProgram(), token.getSourceLine(), - token.getStartPos(), - "Extended (pseudo) instruction or format not permitted. See Settings.")); - } - if (OperandFormat.tokenOperandMatch(tokens, inst, errors)) { - programStatement = new ProgramStatement(this.fileCurrentlyBeingAssembled, source, - tokenList, tokens, inst, textAddress.get(), sourceLineNumber); - // instruction length is 4 for all basic instruction, varies for extended instruction - // Modified to permit use of compact expansion if address fits - // in 15 bits. DPS 4-Aug-2009 + // If we are here, the variable "token" must now refer to an OPERATOR token. + // If not, it is either a syntax error or the specified operator is not yet implemented. + ArrayList instrMatches = this.matchInstruction(token); + if (instrMatches == null) + return ret; + // OK, we've got an operator match, let's check the operands. + Instruction inst = OperandFormat.bestOperandMatch(tokens, instrMatches); + // Here's the place to flag use of extended (pseudo) instructions + // when setting disabled. + if (inst instanceof ExtendedInstruction && !extendedAssemblerEnabled) { + errors.add(new ErrorMessage(token.getSourceProgram(), token.getSourceLine(), + token.getStartPos(), + "Extended (pseudo) instruction or format not permitted. See Settings.")); + } + if (OperandFormat.tokenOperandMatch(tokens, inst, errors)) { + // need refactoring, shouldn't have to treat this with two cases + if (!this.inDataSegment) { + programStatement = new ProgramStatement(this.fileCurrentlyBeingAssembled, source, tokenList, + tokens, inst, textAddress.get(), sourceLineNumber); int instLength = inst.getInstructionLength(); textAddress.increment(instLength); ret.add(programStatement); - return ret; + } else { + programStatement = new ProgramStatement(this.fileCurrentlyBeingAssembled, source, tokenList, + tokens, inst, dataAddress.get(), sourceLineNumber); + int instLength = inst.getInstructionLength(); + dataAddress.increment(instLength); + ret.add(programStatement); } + return ret; } return null; } // parseLine() @@ -937,6 +948,9 @@ private void storeInteger(Token token, Directives directive, ErrorList errors) { } if (directive == Directives.DWORD){ + if (this.autoAlign) { + this.dataAddress.set(this.alignToBoundary(this.dataAddress.get(), 8)); + } writeToDataSegment((int)longvalue, 4, token, errors); writeToDataSegment((int)(longvalue>>32), 4, token, errors); return; diff --git a/src/rars/assembler/DataTypes.java b/src/rars/assembler/DataTypes.java index 5134b5bc..a94f3a90 100644 --- a/src/rars/assembler/DataTypes.java +++ b/src/rars/assembler/DataTypes.java @@ -1,34 +1,5 @@ package rars.assembler; -/* -Copyright (c) 2003-2006, 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) - */ - - /** * Information about data types. * diff --git a/src/rars/assembler/Directives.java b/src/rars/assembler/Directives.java index dcd84a53..8febcf22 100644 --- a/src/rars/assembler/Directives.java +++ b/src/rars/assembler/Directives.java @@ -2,34 +2,6 @@ import java.util.ArrayList; -/* -Copyright (c) 2003-2012, 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) - */ - /** * Class representing RISCV assembler directives. If Java had enumerated types, these * would probably be implemented that way. Each directive is represented by a unique object. diff --git a/src/rars/assembler/Macro.java b/src/rars/assembler/Macro.java index f6fb2127..5a669a70 100644 --- a/src/rars/assembler/Macro.java +++ b/src/rars/assembler/Macro.java @@ -9,31 +9,6 @@ import java.util.ArrayList; import java.util.Collections; -/* -Copyright (c) 2013-2014. - -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) - */ - /** * Stores information of a macro definition. * diff --git a/src/rars/assembler/MacroPool.java b/src/rars/assembler/MacroPool.java index 7ec2b9c4..44a200b7 100644 --- a/src/rars/assembler/MacroPool.java +++ b/src/rars/assembler/MacroPool.java @@ -4,31 +4,6 @@ import java.util.ArrayList; -/* -Copyright (c) 2013. - -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) - */ - /** * Stores information of macros defined by now.
* Will be used in first pass of assembling RISCV source code. When reached diff --git a/src/rars/assembler/OperandFormat.java b/src/rars/assembler/OperandFormat.java index 810ae96b..ad2c5e7c 100644 --- a/src/rars/assembler/OperandFormat.java +++ b/src/rars/assembler/OperandFormat.java @@ -6,34 +6,6 @@ import java.util.ArrayList; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Provides utility method related to operand formats. * @@ -113,7 +85,7 @@ private static boolean operandTypeCheck(TokenList cand, Instruction spec, ErrorL // Not an error if spec calls for identifier and candidate is operator, since operator names can be used as labels. // TODO: maybe add more cases in here if (specType == TokenTypes.IDENTIFIER && candType == TokenTypes.OPERATOR) { - Token replacement = new Token(TokenTypes.IDENTIFIER, candToken.getValue(), candToken.getSourceProgram(), candToken.getSourceLine(), candToken.getStartPos()); + Token replacement = new Token(TokenTypes.IDENTIFIER, candToken.getValue(), candToken.getSourceProgram(), candToken.getSourceLine(), candToken.getStartPos(), candToken.getOriginalText()); cand.set(i, replacement); continue; } diff --git a/src/rars/assembler/SourceLine.java b/src/rars/assembler/SourceLine.java index a0fdcf47..5f6da08c 100644 --- a/src/rars/assembler/SourceLine.java +++ b/src/rars/assembler/SourceLine.java @@ -2,34 +2,6 @@ import rars.RISCVprogram; -/* -Copyright (c) 2003-2013, 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) - */ - /** * Handy class to represent, for a given line of source code, the code * itself, the program containing it, and its line number within that program. diff --git a/src/rars/assembler/Symbol.java b/src/rars/assembler/Symbol.java index 30a448f4..5251519e 100644 --- a/src/rars/assembler/Symbol.java +++ b/src/rars/assembler/Symbol.java @@ -1,33 +1,5 @@ package rars.assembler; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Represents a program identifier to be stored in the symbol table. * diff --git a/src/rars/assembler/SymbolTable.java b/src/rars/assembler/SymbolTable.java index 523f5bbf..8512ee4a 100644 --- a/src/rars/assembler/SymbolTable.java +++ b/src/rars/assembler/SymbolTable.java @@ -6,34 +6,6 @@ import java.util.ArrayList; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Creats a table of Symbol objects. * diff --git a/src/rars/assembler/Token.java b/src/rars/assembler/Token.java index 7436826c..c889bcf3 100644 --- a/src/rars/assembler/Token.java +++ b/src/rars/assembler/Token.java @@ -2,34 +2,6 @@ import rars.RISCVprogram; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Represents one token in the input program. Each Token carries, along with its * type and value, the position (line, column) in which its source appears in the program. @@ -47,6 +19,7 @@ public class Token { // original program and line will differ from the above if token was defined in an included file private RISCVprogram originalProgram; private int originalSourceLine; + private String originalText; /** * Constructor for Token class. @@ -59,7 +32,7 @@ public class Token { * @see TokenTypes **/ - public Token(TokenTypes type, String value, RISCVprogram sourceProgram, int line, int start) { + public Token(TokenTypes type, String value, RISCVprogram sourceProgram, int line, int start, String originalText) { this.type = type; this.value = value; this.sourceProgram = sourceProgram; @@ -67,6 +40,7 @@ public Token(TokenTypes type, String value, RISCVprogram sourceProgram, int line this.sourcePos = start; this.originalProgram = sourceProgram; this.originalSourceLine = line; + this.originalText = originalText; } @@ -103,6 +77,17 @@ public int getOriginalSourceLine() { return this.originalSourceLine; } + /** + * Produces the token's original text. In most cases, this is equivalent to + * {@code Token.getValue()} but when the token is a character literal this + * will return {@code "'a'"} rather then {@code getValue}'s {@code "97"}. + * + * @return original text representing this token + **/ + public String getOriginalText() { + return this.originalText; + } + /** * Produces token type of this token. * diff --git a/src/rars/assembler/TokenList.java b/src/rars/assembler/TokenList.java index 0fc51ce6..dae1e068 100644 --- a/src/rars/assembler/TokenList.java +++ b/src/rars/assembler/TokenList.java @@ -3,34 +3,6 @@ import java.util.ArrayList; import java.util.Iterator; -/* -Copyright (c) 2003-2013, 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) - */ - /** * Represents the list of tokens in a single line of code. It uses, but is not * a subclass of, ArrayList. diff --git a/src/rars/assembler/TokenTypes.java b/src/rars/assembler/TokenTypes.java index df5fe385..2c04cfa5 100644 --- a/src/rars/assembler/TokenTypes.java +++ b/src/rars/assembler/TokenTypes.java @@ -7,34 +7,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.Binary; - /* -Copyright (c) 2003-2008, 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) - */ - /** * Constants to identify the types of tokens found in RISCV programs. * @@ -250,13 +222,17 @@ public static boolean isFloatingTokenType(TokenTypes type) { // DPS 14-Jul-2008: added '$' as valid symbol. Permits labels to include $. // MIPS-target GCC will produce labels that start with $. public static boolean isValidIdentifier(String value) { - boolean result = - (Character.isLetter(value.charAt(0)) || value.charAt(0) == '_' || value.charAt(0) == '.' || value.charAt(0) == '$'); - int index = 1; - while (result && index < value.length()) { - if (!(Character.isLetterOrDigit(value.charAt(index)) || value.charAt(index) == '_' || value.charAt(index) == '.' || value.charAt(index) == '$')) - result = false; - index++; + boolean result; + try { + result = (Character.isLetter(value.charAt(0)) || value.charAt(0) == '_' || value.charAt(0) == '.' || value.charAt(0) == '$'); + int index = 1; + while (result && index < value.length()) { + if (!(Character.isLetterOrDigit(value.charAt(index)) || value.charAt(index) == '_' || value.charAt(index) == '.' || value.charAt(index) == '$')) + result = false; + index++; + } + } catch (StringIndexOutOfBoundsException e) { + result = false; } return result; } diff --git a/src/rars/assembler/Tokenizer.java b/src/rars/assembler/Tokenizer.java index d6ffd30f..70a30f57 100644 --- a/src/rars/assembler/Tokenizer.java +++ b/src/rars/assembler/Tokenizer.java @@ -7,34 +7,6 @@ import java.util.HashMap; import java.util.Map; -/* -Copyright (c) 2003-2013, 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) - */ - /** * A tokenizer is capable of tokenizing a complete source program, or a given line from * a source program. Since RARS assembly is line-oriented, each line defines a complete statement. @@ -339,7 +311,7 @@ public TokenList tokenizeLine(RISCVprogram program, int lineNum, String theLine, tokenStartPos = linePos + 1; token[tokenPos++] = c; if (line.length > linePos + 3 && line[linePos + 1] == 'I' && line[linePos + 2] == 'n' && line[linePos + 3] == 'f') { - result.add(new Token(TokenTypes.REAL_NUMBER, "-Inf", program, lineNum, tokenStartPos)); + result.add(new Token(TokenTypes.REAL_NUMBER, "-Inf", program, lineNum, tokenStartPos, "-Inf")); linePos += 3; tokenPos = 0; break; @@ -491,7 +463,7 @@ private TokenList processEqv(RISCVprogram program, int lineNum, String theLine, // multiple tokens, so I want to get everything from the IDENTIFIER to either the // COMMENT or to the end. int startExpression = tokens.get(dirPos + 2).getStartPos(); - int endExpression = tokens.get(tokenPosLastOperand).getStartPos() + tokens.get(tokenPosLastOperand).getValue().length(); + int endExpression = tokens.get(tokenPosLastOperand).getStartPos() + tokens.get(tokenPosLastOperand).getOriginalText().length(); String expression = theLine.substring(startExpression - 1, endExpression - 1); // Symbol cannot be redefined - the only reason for this is to act like the Gnu .eqv if (equivalents.containsKey(symbol) && !equivalents.get(symbol).equals(expression)) { @@ -536,13 +508,14 @@ public ErrorList getErrors() { private void processCandidateToken(char[] token, RISCVprogram program, int line, String theLine, int tokenPos, int tokenStartPos, TokenList tokenList) { String value = new String(token, 0, tokenPos); + String original = value; if (value.length() > 0 && value.charAt(0) == '\'') value = preprocessCharacterLiteral(value); TokenTypes type = TokenTypes.matchTokenType(value); if (type == TokenTypes.ERROR) { errors.add(new ErrorMessage(program, line, tokenStartPos, theLine + "\nInvalid language element: " + value)); } - Token toke = new Token(type, value, program, line, tokenStartPos); + Token toke = new Token(type, value, program, line, tokenStartPos, original); tokenList.add(toke); } diff --git a/src/rars/riscv/AbstractSyscall.java b/src/rars/riscv/AbstractSyscall.java index 2ea151f5..cfb5120e 100644 --- a/src/rars/riscv/AbstractSyscall.java +++ b/src/rars/riscv/AbstractSyscall.java @@ -1,35 +1,7 @@ package rars.riscv; -import rars.ExitingException; import rars.ProgramStatement; -/* -Copyright (c) 2003-2006, 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) - */ - +import rars.SimulationException; /** * Abstract class that a syscall system service must extend. A qualifying service @@ -137,7 +109,7 @@ public int getNumber() { * @param statement ProgramStatement object for this syscall instruction. */ public abstract void simulate(ProgramStatement statement) - throws ExitingException; + throws SimulationException; public int compareTo(AbstractSyscall other) { if (this == other) return 0; diff --git a/src/rars/riscv/BasicInstruction.java b/src/rars/riscv/BasicInstruction.java index 03ac3e3a..27b022cd 100644 --- a/src/rars/riscv/BasicInstruction.java +++ b/src/rars/riscv/BasicInstruction.java @@ -1,33 +1,5 @@ package rars.riscv; -/* -Copyright (c) 2003-2013, 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) - */ - import rars.ProgramStatement; import rars.SimulationException; diff --git a/src/rars/riscv/BasicInstructionFormat.java b/src/rars/riscv/BasicInstructionFormat.java index c607e051..4a9c8613 100644 --- a/src/rars/riscv/BasicInstructionFormat.java +++ b/src/rars/riscv/BasicInstructionFormat.java @@ -1,32 +1,5 @@ package rars.riscv; -/* -Copyright (c) 2017-2019, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * These are seven RISCV-defined formats of basic machine instructions: * R, R4, I, S, B, U, and J. Examples of each respectively would be add, fmadd, addi, sw, beq, lui, and jal. diff --git a/src/rars/riscv/ExtendedInstruction.java b/src/rars/riscv/ExtendedInstruction.java index 217b39a9..c3b2aa06 100644 --- a/src/rars/riscv/ExtendedInstruction.java +++ b/src/rars/riscv/ExtendedInstruction.java @@ -8,34 +8,6 @@ import java.util.ArrayList; import java.util.StringTokenizer; - /* -Copyright (c) 2003-2008, 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) - */ - /** * ExtendedInstruction represents a RISCV extended (a.k.a pseudo) instruction. This * assembly language instruction does not have a corresponding machine instruction. Instead diff --git a/src/rars/riscv/Instruction.java b/src/rars/riscv/Instruction.java index caf9ac7c..bbd227a6 100644 --- a/src/rars/riscv/Instruction.java +++ b/src/rars/riscv/Instruction.java @@ -6,34 +6,6 @@ import java.util.StringTokenizer; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Base class to represent member of RISCV instruction set. * diff --git a/src/rars/riscv/InstructionSet.java b/src/rars/riscv/InstructionSet.java index b186eb2f..c6b95f93 100644 --- a/src/rars/riscv/InstructionSet.java +++ b/src/rars/riscv/InstructionSet.java @@ -16,34 +16,6 @@ import java.lang.reflect.Modifier; import java.util.*; - /* -Copyright (c) 2003-2013, 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) - */ - /** * The list of Instruction objects, each of which represents a RISCV instruction. * The instruction may either be basic (translates into binary machine code) or diff --git a/src/rars/riscv/SyscallLoader.java b/src/rars/riscv/SyscallLoader.java index 46ea065f..31cc9bb9 100644 --- a/src/rars/riscv/SyscallLoader.java +++ b/src/rars/riscv/SyscallLoader.java @@ -6,36 +6,6 @@ import java.util.ArrayList; import java.util.HashSet; -/* -Copyright (c) 2003-2006, 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) - */ - - - /** * This class provides functionality to bring external Syscall definitions * into RARS. This permits anyone with knowledge of the Rars public interfaces, diff --git a/src/rars/riscv/SyscallNumberOverride.java b/src/rars/riscv/SyscallNumberOverride.java index 4e2c45a1..cc25d7ab 100644 --- a/src/rars/riscv/SyscallNumberOverride.java +++ b/src/rars/riscv/SyscallNumberOverride.java @@ -1,33 +1,5 @@ package rars.riscv; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Represents User override of default syscall number assignment. * Such overrides are specified in the Syscall.properties file read when diff --git a/src/rars/riscv/dump/AbstractDumpFormat.java b/src/rars/riscv/dump/AbstractDumpFormat.java index 587a7c30..5276b150 100644 --- a/src/rars/riscv/dump/AbstractDumpFormat.java +++ b/src/rars/riscv/dump/AbstractDumpFormat.java @@ -5,33 +5,6 @@ import java.io.File; import java.io.IOException; -/* -Copyright (c) 2003-2008, 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) - */ /** * Abstract class for memory dump file formats. Provides constructors and diff --git a/src/rars/riscv/dump/AsciiTextDumpFormat.java b/src/rars/riscv/dump/AsciiTextDumpFormat.java index 869c294d..0f82006f 100644 --- a/src/rars/riscv/dump/AsciiTextDumpFormat.java +++ b/src/rars/riscv/dump/AsciiTextDumpFormat.java @@ -8,33 +8,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -/* -Copyright (c) 2003-2011, 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) - */ /** * Class that represents the "ASCII text" memory dump format. Memory contents diff --git a/src/rars/riscv/dump/BinaryDumpFormat.java b/src/rars/riscv/dump/BinaryDumpFormat.java index f9f65ad3..fabf6ecc 100644 --- a/src/rars/riscv/dump/BinaryDumpFormat.java +++ b/src/rars/riscv/dump/BinaryDumpFormat.java @@ -7,33 +7,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -/* -Copyright (c) 2003-2008, 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) - */ /** * Class that represents the "binary" memory dump format. The output diff --git a/src/rars/riscv/dump/BinaryTextDumpFormat.java b/src/rars/riscv/dump/BinaryTextDumpFormat.java index 93a5b601..64774814 100644 --- a/src/rars/riscv/dump/BinaryTextDumpFormat.java +++ b/src/rars/riscv/dump/BinaryTextDumpFormat.java @@ -7,33 +7,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -/* -Copyright (c) 2003-2008, 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) - */ /** * Class that represents the "binary text" memory dump format. The output diff --git a/src/rars/riscv/dump/DumpFormat.java b/src/rars/riscv/dump/DumpFormat.java index 571186df..4685846e 100644 --- a/src/rars/riscv/dump/DumpFormat.java +++ b/src/rars/riscv/dump/DumpFormat.java @@ -5,33 +5,6 @@ import java.io.File; import java.io.IOException; -/* -Copyright (c) 2003-2008, 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) - */ /** * Interface for memory dump file formats. All RARS needs to be able diff --git a/src/rars/riscv/dump/DumpFormatLoader.java b/src/rars/riscv/dump/DumpFormatLoader.java index 7d01bcf2..621a2108 100644 --- a/src/rars/riscv/dump/DumpFormatLoader.java +++ b/src/rars/riscv/dump/DumpFormatLoader.java @@ -5,34 +5,6 @@ import java.lang.reflect.Modifier; import java.util.ArrayList; -/* -Copyright (c) 2003-2008, 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) - */ - /* This class provides functionality to bring external memory dump format definitions * into RARS. This is adapted from the ToolLoader class, which is in turn adapted diff --git a/src/rars/riscv/dump/HexTextDumpFormat.java b/src/rars/riscv/dump/HexTextDumpFormat.java index 113d6a1d..a57c33cb 100644 --- a/src/rars/riscv/dump/HexTextDumpFormat.java +++ b/src/rars/riscv/dump/HexTextDumpFormat.java @@ -7,33 +7,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -/* -Copyright (c) 2003-2008, 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) - */ /** * Class that represents the "hexadecimal text" memory dump format. The output diff --git a/src/rars/riscv/dump/SegmentWindowDumpFormat.java b/src/rars/riscv/dump/SegmentWindowDumpFormat.java index 4d30b946..35481ac1 100644 --- a/src/rars/riscv/dump/SegmentWindowDumpFormat.java +++ b/src/rars/riscv/dump/SegmentWindowDumpFormat.java @@ -11,33 +11,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -/* -Copyright (c) 2003-2008, 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) - */ /** * Dump memory contents in Segment Window format. Each line of diff --git a/src/rars/riscv/hardware/AccessNotice.java b/src/rars/riscv/hardware/AccessNotice.java index de486ead..cc331128 100644 --- a/src/rars/riscv/hardware/AccessNotice.java +++ b/src/rars/riscv/hardware/AccessNotice.java @@ -1,33 +1,5 @@ package rars.riscv.hardware; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Object provided to Observers of runtime access to memory or registers. * The access types READ and WRITE defined here; use subclasses defined for diff --git a/src/rars/riscv/hardware/AddressErrorException.java b/src/rars/riscv/hardware/AddressErrorException.java index 673997a8..9e8676e5 100644 --- a/src/rars/riscv/hardware/AddressErrorException.java +++ b/src/rars/riscv/hardware/AddressErrorException.java @@ -2,34 +2,6 @@ import rars.util.Binary; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Represents AddressErrorException. This is generated by the simulator when the * source code references a memory address not valid for the context. diff --git a/src/rars/riscv/hardware/ControlAndStatusRegisterFile.java b/src/rars/riscv/hardware/ControlAndStatusRegisterFile.java index f0336e09..3fe1719d 100644 --- a/src/rars/riscv/hardware/ControlAndStatusRegisterFile.java +++ b/src/rars/riscv/hardware/ControlAndStatusRegisterFile.java @@ -4,33 +4,6 @@ import java.util.Observer; -/* -Copyright (c) 2017-2019, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Represents the implemented control and status registers. The main classes are fcsr (for floating point errors), * timers, and interrupt handling. diff --git a/src/rars/riscv/hardware/FloatingPointRegisterFile.java b/src/rars/riscv/hardware/FloatingPointRegisterFile.java index 949bcc0c..48b092d5 100644 --- a/src/rars/riscv/hardware/FloatingPointRegisterFile.java +++ b/src/rars/riscv/hardware/FloatingPointRegisterFile.java @@ -4,34 +4,6 @@ import java.util.Observer; -/* -Copyright (c) 2003-2009, 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) - */ - /** * Represents the Floating Point Unit (FPU) * diff --git a/src/rars/riscv/hardware/LinkedRegister.java b/src/rars/riscv/hardware/LinkedRegister.java index 3d2af631..d4399470 100644 --- a/src/rars/riscv/hardware/LinkedRegister.java +++ b/src/rars/riscv/hardware/LinkedRegister.java @@ -1,32 +1,5 @@ package rars.riscv.hardware; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * A register which aliases a subset of another register */ diff --git a/src/rars/riscv/hardware/Memory.java b/src/rars/riscv/hardware/Memory.java index df578613..0b48b523 100644 --- a/src/rars/riscv/hardware/Memory.java +++ b/src/rars/riscv/hardware/Memory.java @@ -5,6 +5,7 @@ import rars.Settings; import rars.SimulationException; import rars.riscv.Instruction; +import rars.riscv.InstructionSet; import rars.util.Binary; import java.util.Collection; @@ -12,34 +13,6 @@ import java.util.Observer; import java.util.Vector; - /* -Copyright (c) 2003-2009, 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) - */ - /** * Represents memory. Different segments are represented by different data structs. * @@ -337,7 +310,7 @@ private void initialize() { * Returns the next available word-aligned heap address. There is no recycling and * no heap management! There is however nearly 4MB of heap space available in Rars. * - * @param numBytes Number of bytes requested. Should be multiple of 4, otherwise next higher multiple of 4 allocated. + * @param numBytes Number of bytes requested. Should be multiple of the architecture size (4 in RV32 or 8 in RV64) , otherwise next higher multiple of the arch size allocated. * @return address of allocated heap storage. * @throws IllegalArgumentException if number of requested bytes is negative or exceeds available heap storage */ @@ -347,8 +320,9 @@ public int allocateBytesFromHeap(int numBytes) throws IllegalArgumentException { throw new IllegalArgumentException("request (" + numBytes + ") is negative heap amount"); } int newHeapAddress = heapAddress + numBytes; - if (newHeapAddress % 4 != 0) { - newHeapAddress = newHeapAddress + (4 - newHeapAddress % 4); // next higher multiple of 4 + int size = InstructionSet.rv64 ? 8 : 4; + if (newHeapAddress % size != 0) { + newHeapAddress = newHeapAddress + (size - newHeapAddress % size); // next higher multiple of 4 } if (newHeapAddress >= dataSegmentLimitAddress) { throw new IllegalArgumentException("request (" + numBytes + ") exceeds available heap storage"); @@ -375,6 +349,10 @@ public int allocateBytesFromHeap(int numBytes) throws IllegalArgumentException { // Allocates blocks if necessary. public int set(int address, int value, int length) throws AddressErrorException { + // This method is very complex and produce wrong results if length>4 + // So clamp the length to 4 + if (length > 4) length = 4; + int oldValue = 0; if (Globals.debug) System.out.println("memory[" + address + "] set to " + value + "(" + length + " bytes)"); int relativeByteAddress; @@ -619,6 +597,19 @@ public int get(int address, int length) throws AddressErrorException { return get(address, length, true); } + public long getRaw(int address, int length) throws AddressErrorException { + if (length == 8) { + long low = get(address, 4, false); + long high = get(address+4, 4, false); + if (low < 0) low += 0x100000000l; + return (high << 32) | low; + } else { + long v = get(address, length, false); + if (v < 0) v += 0x100000000l; + return v; + } + } + // Does the real work, but includes option to NOT notify observers. private int get(int address, int length, boolean notify) throws AddressErrorException { int value = 0; @@ -638,22 +629,15 @@ private int get(int address, int length, boolean notify) throws AddressErrorExce } else if (inTextSegment(address)) { // Burch Mod (Jan 2013): replace throw with calls to getStatementNoNotify & getBinaryStatement // DPS adaptation 5-Jul-2013: either throw or call, depending on setting - if (Globals.getSettings().getBooleanSetting(Settings.Bool.SELF_MODIFYING_CODE_ENABLED)) { - if(address%4+length > 4){ - // TODO: add checks for halfword load not aligned to halfword boundary - throw new AddressErrorException( - "Load address not aligned to word boundary ", - SimulationException.LOAD_ADDRESS_MISALIGNED, address); - } - ProgramStatement stmt = getStatementNoNotify((address/4)*4); - // TODO: maybe find a way to make the bit manipulation more clear - // It just selects the right bytes from the word loaded - value = stmt == null ? 0 : length == 4 ? stmt.getBinaryStatement() : stmt.getBinaryStatement()>>(8*(address%4))&((1< 4){ + // TODO: add checks for halfword load not aligned to halfword boundary throw new AddressErrorException( - "Cannot read directly from text segment!", - SimulationException.LOAD_ACCESS_FAULT, address); + "Load address not aligned to word boundary ", SimulationException.LOAD_ADDRESS_MISALIGNED, address); } + ProgramStatement stmt = getStatementNoNotify((address/4)*4); + // TODO: maybe find a way to make the bit manipulation more clear + // It just selects the right bytes from the word loaded + value = stmt == null ? 0 : length == 4 ? stmt.getBinaryStatement() : stmt.getBinaryStatement()>>(8*(address%4))&((1< @@ -91,6 +62,16 @@ public long getValue(int num) { return getRegister(num).getValue(); } + /** + * Returns the value of the register. Observers are not notified. + * + * @param num The register's number. + * @return value The value of the given register. + */ + public long getValueNoNotify(int num) { + return getRegister(num).getValueNoNotify(); + } + /** * Returns the value of the register. * diff --git a/src/rars/riscv/hardware/RegisterFile.java b/src/rars/riscv/hardware/RegisterFile.java index ac5ece2c..872d70d6 100644 --- a/src/rars/riscv/hardware/RegisterFile.java +++ b/src/rars/riscv/hardware/RegisterFile.java @@ -7,34 +7,6 @@ import java.util.Observer; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Represents the collection of RISCV integer registers. * @@ -110,6 +82,17 @@ public static int getValue(int num) { } + /** + * Returns the value of the register. Observers are not notified. + * + * @param num The register's number. + * @return value The value of the given register. + */ + public static int getValueNoNotify(int num) { + return (int) instance.getValueNoNotify(num); + + } + /** * Returns the value of the register. * @@ -119,7 +102,10 @@ public static int getValue(int num) { public static long getValueLong(int num) { return instance.getValue(num); + } + public static long getValueLong(String name) { + return instance.getValue(name); } /** diff --git a/src/rars/riscv/instructions/ADD.java b/src/rars/riscv/instructions/ADD.java index 4719e4b7..997735ed 100644 --- a/src/rars/riscv/instructions/ADD.java +++ b/src/rars/riscv/instructions/ADD.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class ADD extends Arithmetic { public ADD() { super("add t1,t2,t3", "Addition: set t1 to (t2 plus t3)", diff --git a/src/rars/riscv/instructions/ADDI.java b/src/rars/riscv/instructions/ADDI.java index 7cc8aa1e..cdf68df6 100644 --- a/src/rars/riscv/instructions/ADDI.java +++ b/src/rars/riscv/instructions/ADDI.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class ADDI extends ImmediateInstruction { public ADDI() { super("addi t1,t2,-100", "Addition immediate: set t1 to (t2 plus signed 12-bit immediate)", "000"); diff --git a/src/rars/riscv/instructions/AND.java b/src/rars/riscv/instructions/AND.java index 4f0998f5..860146fb 100644 --- a/src/rars/riscv/instructions/AND.java +++ b/src/rars/riscv/instructions/AND.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class AND extends Arithmetic { public AND() { super("and t1,t2,t3", "Bitwise AND : Set t1 to bitwise AND of t2 and t3", diff --git a/src/rars/riscv/instructions/ANDI.java b/src/rars/riscv/instructions/ANDI.java index 88e1f22a..2be50051 100644 --- a/src/rars/riscv/instructions/ANDI.java +++ b/src/rars/riscv/instructions/ANDI.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class ANDI extends ImmediateInstruction { public ANDI() { super("andi t1,t2,-100", "Bitwise AND immediate : Set t1 to bitwise AND of t2 and sign-extended 12-bit immediate", "111"); diff --git a/src/rars/riscv/instructions/AUIPC.java b/src/rars/riscv/instructions/AUIPC.java index cd5d6559..6dc267fd 100644 --- a/src/rars/riscv/instructions/AUIPC.java +++ b/src/rars/riscv/instructions/AUIPC.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class AUIPC extends BasicInstruction { public AUIPC() { super("auipc t1,100000", "Add upper immediate to pc: set t1 to (pc plus an upper 20-bit immediate)", diff --git a/src/rars/riscv/instructions/Arithmetic.java b/src/rars/riscv/instructions/Arithmetic.java index 194d1570..b60f140d 100644 --- a/src/rars/riscv/instructions/Arithmetic.java +++ b/src/rars/riscv/instructions/Arithmetic.java @@ -6,33 +6,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Base class for all integer instructions using immediates * diff --git a/src/rars/riscv/instructions/BEQ.java b/src/rars/riscv/instructions/BEQ.java index 250ce4b2..49e0639d 100644 --- a/src/rars/riscv/instructions/BEQ.java +++ b/src/rars/riscv/instructions/BEQ.java @@ -3,33 +3,6 @@ import rars.ProgramStatement; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class BEQ extends Branch { public BEQ() { super("beq t1,t2,label", "Branch if equal : Branch to statement at label's address if t1 and t2 are equal", "000"); diff --git a/src/rars/riscv/instructions/BGE.java b/src/rars/riscv/instructions/BGE.java index bb293912..544aff86 100644 --- a/src/rars/riscv/instructions/BGE.java +++ b/src/rars/riscv/instructions/BGE.java @@ -3,33 +3,6 @@ import rars.ProgramStatement; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class BGE extends Branch { public BGE() { super("bge t1,t2,label", "Branch if greater than or equal: Branch to statement at label's address if t1 is greater than or equal to t2", "101"); diff --git a/src/rars/riscv/instructions/BGEU.java b/src/rars/riscv/instructions/BGEU.java index 4afca9a2..fc27439d 100644 --- a/src/rars/riscv/instructions/BGEU.java +++ b/src/rars/riscv/instructions/BGEU.java @@ -3,33 +3,6 @@ import rars.ProgramStatement; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class BGEU extends Branch { public BGEU() { super("bgeu t1,t2,label", "Branch if greater than or equal to (unsigned): Branch to statement at label's address if t1 is greater than or equal to t2 (with an unsigned interpretation)", "111"); diff --git a/src/rars/riscv/instructions/BLT.java b/src/rars/riscv/instructions/BLT.java index df552406..cb3df55d 100644 --- a/src/rars/riscv/instructions/BLT.java +++ b/src/rars/riscv/instructions/BLT.java @@ -3,33 +3,6 @@ import rars.ProgramStatement; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class BLT extends Branch { public BLT() { super("blt t1,t2,label", "Branch if less than: Branch to statement at label's address if t1 is less than t2", "100"); diff --git a/src/rars/riscv/instructions/BLTU.java b/src/rars/riscv/instructions/BLTU.java index f7545533..ee24ce9c 100644 --- a/src/rars/riscv/instructions/BLTU.java +++ b/src/rars/riscv/instructions/BLTU.java @@ -3,33 +3,6 @@ import rars.ProgramStatement; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class BLTU extends Branch { public BLTU() { super("bltu t1,t2,label", "Branch if less than (unsigned): Branch to statement at label's address if t1 is less than t2 (with an unsigned interpretation)", "110"); diff --git a/src/rars/riscv/instructions/BNE.java b/src/rars/riscv/instructions/BNE.java index 44c56ba8..391bef9a 100644 --- a/src/rars/riscv/instructions/BNE.java +++ b/src/rars/riscv/instructions/BNE.java @@ -3,33 +3,6 @@ import rars.ProgramStatement; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class BNE extends Branch { public BNE() { super("bne t1,t2,label", "Branch if not equal : Branch to statement at label's address if t1 and t2 are not equal", "001"); diff --git a/src/rars/riscv/instructions/Branch.java b/src/rars/riscv/instructions/Branch.java index 2700e8e5..e15232dd 100644 --- a/src/rars/riscv/instructions/Branch.java +++ b/src/rars/riscv/instructions/Branch.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstructionFormat; import rars.riscv.InstructionSet; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Base class for all branching instructions *

diff --git a/src/rars/riscv/instructions/CSRRC.java b/src/rars/riscv/instructions/CSRRC.java index ceea2863..e0e4dc0f 100644 --- a/src/rars/riscv/instructions/CSRRC.java +++ b/src/rars/riscv/instructions/CSRRC.java @@ -7,32 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class CSRRC extends BasicInstruction { public CSRRC() { super("csrrc t0, fcsr, t1", "Atomic Read/Clear CSR: read from the CSR into t0 and clear bits of the CSR according to t1", diff --git a/src/rars/riscv/instructions/CSRRCI.java b/src/rars/riscv/instructions/CSRRCI.java index 13a97d38..0ffec495 100644 --- a/src/rars/riscv/instructions/CSRRCI.java +++ b/src/rars/riscv/instructions/CSRRCI.java @@ -7,32 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class CSRRCI extends BasicInstruction { public CSRRCI() { super("csrrci t0, fcsr, 10", "Atomic Read/Clear CSR Immediate: read from the CSR into t0 and clear bits of the CSR according to a constant", diff --git a/src/rars/riscv/instructions/CSRRS.java b/src/rars/riscv/instructions/CSRRS.java index 80a4c8ff..d405a062 100644 --- a/src/rars/riscv/instructions/CSRRS.java +++ b/src/rars/riscv/instructions/CSRRS.java @@ -7,32 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class CSRRS extends BasicInstruction { public CSRRS() { super("csrrs t0, fcsr, t1", "Atomic Read/Set CSR: read from the CSR into t0 and logical or t1 into the CSR", diff --git a/src/rars/riscv/instructions/CSRRSI.java b/src/rars/riscv/instructions/CSRRSI.java index b0e5e9f9..a31c00d9 100644 --- a/src/rars/riscv/instructions/CSRRSI.java +++ b/src/rars/riscv/instructions/CSRRSI.java @@ -7,32 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class CSRRSI extends BasicInstruction { public CSRRSI() { super("csrrsi t0, fcsr, 10", "Atomic Read/Set CSR Immediate: read from the CSR into t0 and logical or a constant into the CSR", diff --git a/src/rars/riscv/instructions/CSRRW.java b/src/rars/riscv/instructions/CSRRW.java index 7cb44d46..07f613e1 100644 --- a/src/rars/riscv/instructions/CSRRW.java +++ b/src/rars/riscv/instructions/CSRRW.java @@ -7,32 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class CSRRW extends BasicInstruction { public CSRRW() { super("csrrw t0, fcsr, t1", "Atomic Read/Write CSR: read from the CSR into t0 and write t1 into the CSR", diff --git a/src/rars/riscv/instructions/CSRRWI.java b/src/rars/riscv/instructions/CSRRWI.java index 40efe473..1621f2f2 100644 --- a/src/rars/riscv/instructions/CSRRWI.java +++ b/src/rars/riscv/instructions/CSRRWI.java @@ -7,32 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class CSRRWI extends BasicInstruction { public CSRRWI() { super("csrrwi t0, fcsr, 10", "Atomic Read/Write CSR Immediate: read from the CSR into t0 and write a constant into the CSR", diff --git a/src/rars/riscv/instructions/DIV.java b/src/rars/riscv/instructions/DIV.java index 5553d929..25e65189 100644 --- a/src/rars/riscv/instructions/DIV.java +++ b/src/rars/riscv/instructions/DIV.java @@ -2,34 +2,6 @@ import rars.riscv.hardware.ControlAndStatusRegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class DIV extends Arithmetic { public DIV() { super("div t1,t2,t3", "Division: set t1 to the result of t2/t3", diff --git a/src/rars/riscv/instructions/DIVU.java b/src/rars/riscv/instructions/DIVU.java index 27001a04..3c7a250f 100644 --- a/src/rars/riscv/instructions/DIVU.java +++ b/src/rars/riscv/instructions/DIVU.java @@ -2,34 +2,6 @@ import rars.riscv.hardware.ControlAndStatusRegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class DIVU extends Arithmetic { public DIVU() { super("divu t1,t2,t3", "Division: set t1 to the result of t2/t3 using unsigned division", diff --git a/src/rars/riscv/instructions/EBREAK.java b/src/rars/riscv/instructions/EBREAK.java index e8547146..9ce87ee0 100644 --- a/src/rars/riscv/instructions/EBREAK.java +++ b/src/rars/riscv/instructions/EBREAK.java @@ -6,33 +6,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class EBREAK extends BasicInstruction { public EBREAK() { super("ebreak", "Pause execution", diff --git a/src/rars/riscv/instructions/ECALL.java b/src/rars/riscv/instructions/ECALL.java index 48e66c7d..a963dcbf 100644 --- a/src/rars/riscv/instructions/ECALL.java +++ b/src/rars/riscv/instructions/ECALL.java @@ -7,33 +7,6 @@ import rars.riscv.BasicInstructionFormat; import rars.riscv.InstructionSet; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class ECALL extends BasicInstruction { public ECALL() { super("ecall", "Issue a system call : Execute the system call specified by value in a7", diff --git a/src/rars/riscv/instructions/FADDS.java b/src/rars/riscv/instructions/FADDS.java index ba9271ac..fb49a73b 100644 --- a/src/rars/riscv/instructions/FADDS.java +++ b/src/rars/riscv/instructions/FADDS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FCLASSS.java b/src/rars/riscv/instructions/FCLASSS.java index ad613829..645e5bd8 100644 --- a/src/rars/riscv/instructions/FCLASSS.java +++ b/src/rars/riscv/instructions/FCLASSS.java @@ -7,33 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FCLASSS extends BasicInstruction { public FCLASSS() { super("fclass.s t1, f1", "Classify a floating point number", diff --git a/src/rars/riscv/instructions/FCVTSW.java b/src/rars/riscv/instructions/FCVTSW.java index 3902630c..6e156940 100644 --- a/src/rars/riscv/instructions/FCVTSW.java +++ b/src/rars/riscv/instructions/FCVTSW.java @@ -11,33 +11,6 @@ import java.math.BigInteger; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FCVTSW extends BasicInstruction { public FCVTSW() { super("fcvt.s.w f1, t1, dyn", "Convert float from integer: Assigns the value of t1 to f1", diff --git a/src/rars/riscv/instructions/FCVTSWU.java b/src/rars/riscv/instructions/FCVTSWU.java index 4a452ae8..3817698c 100644 --- a/src/rars/riscv/instructions/FCVTSWU.java +++ b/src/rars/riscv/instructions/FCVTSWU.java @@ -11,33 +11,6 @@ import java.math.BigInteger; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FCVTSWU extends BasicInstruction { public FCVTSWU() { super("fcvt.s.wu f1, t1, dyn", "Convert float from unsigned integer: Assigns the value of t1 to f1", diff --git a/src/rars/riscv/instructions/FCVTWS.java b/src/rars/riscv/instructions/FCVTWS.java index 84792325..eba5e607 100644 --- a/src/rars/riscv/instructions/FCVTWS.java +++ b/src/rars/riscv/instructions/FCVTWS.java @@ -13,33 +13,6 @@ import java.math.BigInteger; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FCVTWS extends BasicInstruction { public FCVTWS() { super("fcvt.w.s t1, f1, dyn", "Convert integer from float: Assigns the value of f1 (rounded) to t1", diff --git a/src/rars/riscv/instructions/FCVTWUS.java b/src/rars/riscv/instructions/FCVTWUS.java index 3babac10..5b71bd34 100644 --- a/src/rars/riscv/instructions/FCVTWUS.java +++ b/src/rars/riscv/instructions/FCVTWUS.java @@ -11,33 +11,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FCVTWUS extends BasicInstruction { public FCVTWUS() { super("fcvt.wu.s t1, f1, dyn", "Convert unsinged integer from float: Assigns the value of f1 (rounded) to t1", diff --git a/src/rars/riscv/instructions/FDIVS.java b/src/rars/riscv/instructions/FDIVS.java index 3b9e2c6d..117b5223 100644 --- a/src/rars/riscv/instructions/FDIVS.java +++ b/src/rars/riscv/instructions/FDIVS.java @@ -4,33 +4,6 @@ import jsoftfloat.types.Float32; import rars.riscv.hardware.ControlAndStatusRegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FDIVS extends Floating { public FDIVS() { super("fdiv.s", "Floating DIVide: assigns f1 to f2 / f3", "0001100"); diff --git a/src/rars/riscv/instructions/FENCE.java b/src/rars/riscv/instructions/FENCE.java index e5324a6c..61c10d7a 100644 --- a/src/rars/riscv/instructions/FENCE.java +++ b/src/rars/riscv/instructions/FENCE.java @@ -4,33 +4,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FENCE extends BasicInstruction { public FENCE() { super("fence 1, 1", "Ensure that IO and memory accesses before the fence happen before the following IO and memory accesses as viewed by a different thread", diff --git a/src/rars/riscv/instructions/FENCEI.java b/src/rars/riscv/instructions/FENCEI.java index a53d2d53..9c5d36b5 100644 --- a/src/rars/riscv/instructions/FENCEI.java +++ b/src/rars/riscv/instructions/FENCEI.java @@ -4,33 +4,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FENCEI extends BasicInstruction { public FENCEI() { super("fence.i", "Ensure that stores to instruction memory are visible to instruction fetches", diff --git a/src/rars/riscv/instructions/FEQS.java b/src/rars/riscv/instructions/FEQS.java index 5c7f71d3..e16b5ca8 100644 --- a/src/rars/riscv/instructions/FEQS.java +++ b/src/rars/riscv/instructions/FEQS.java @@ -9,33 +9,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FEQS extends BasicInstruction { public FEQS() { super("feq.s t1, f1, f2", "Floating EQuals: if f1 = f2, set t1 to 1, else set t1 to 0", diff --git a/src/rars/riscv/instructions/FLES.java b/src/rars/riscv/instructions/FLES.java index f0404acf..5be1f80c 100644 --- a/src/rars/riscv/instructions/FLES.java +++ b/src/rars/riscv/instructions/FLES.java @@ -9,33 +9,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FLES extends BasicInstruction { public FLES() { super("fle.s t1, f1, f2", "Floating Less than or Equals: if f1 <= f2, set t1 to 1, else set t1 to 0", diff --git a/src/rars/riscv/instructions/FLTS.java b/src/rars/riscv/instructions/FLTS.java index b979eb53..4282347d 100644 --- a/src/rars/riscv/instructions/FLTS.java +++ b/src/rars/riscv/instructions/FLTS.java @@ -9,33 +9,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FLTS extends BasicInstruction { public FLTS() { super("flt.s t1, f1, f2", "Floating Less Than: if f1 < f2, set t1 to 1, else set t1 to 0", diff --git a/src/rars/riscv/instructions/FLW.java b/src/rars/riscv/instructions/FLW.java index 76565885..a435c19e 100644 --- a/src/rars/riscv/instructions/FLW.java +++ b/src/rars/riscv/instructions/FLW.java @@ -9,33 +9,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FLW extends BasicInstruction { public FLW() { super("flw f1, -100(t1)", "Load a float from memory", diff --git a/src/rars/riscv/instructions/FMADDS.java b/src/rars/riscv/instructions/FMADDS.java index 347be21d..cb702392 100644 --- a/src/rars/riscv/instructions/FMADDS.java +++ b/src/rars/riscv/instructions/FMADDS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FMAXS.java b/src/rars/riscv/instructions/FMAXS.java index 5def2248..b9cab35d 100644 --- a/src/rars/riscv/instructions/FMAXS.java +++ b/src/rars/riscv/instructions/FMAXS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FMINS.java b/src/rars/riscv/instructions/FMINS.java index 293ae25d..68f0904d 100644 --- a/src/rars/riscv/instructions/FMINS.java +++ b/src/rars/riscv/instructions/FMINS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FMSUBS.java b/src/rars/riscv/instructions/FMSUBS.java index a5b78c80..1f82cecb 100644 --- a/src/rars/riscv/instructions/FMSUBS.java +++ b/src/rars/riscv/instructions/FMSUBS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FMULS.java b/src/rars/riscv/instructions/FMULS.java index 0ce957a8..4b53ea7c 100644 --- a/src/rars/riscv/instructions/FMULS.java +++ b/src/rars/riscv/instructions/FMULS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FMVSX.java b/src/rars/riscv/instructions/FMVSX.java index 7670a204..a581de39 100644 --- a/src/rars/riscv/instructions/FMVSX.java +++ b/src/rars/riscv/instructions/FMVSX.java @@ -6,33 +6,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FMVSX extends BasicInstruction { public FMVSX() { super("fmv.s.x f1, t1", "Move float: move bits representing a float from an integer register", diff --git a/src/rars/riscv/instructions/FMVXS.java b/src/rars/riscv/instructions/FMVXS.java index 095f34e5..0679a9ba 100644 --- a/src/rars/riscv/instructions/FMVXS.java +++ b/src/rars/riscv/instructions/FMVXS.java @@ -6,33 +6,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FMVXS extends BasicInstruction { public FMVXS() { super("fmv.x.s t1, f1", "Move float: move bits representing a float to an integer register", diff --git a/src/rars/riscv/instructions/FNMADDS.java b/src/rars/riscv/instructions/FNMADDS.java index 51220a61..65d32ac9 100644 --- a/src/rars/riscv/instructions/FNMADDS.java +++ b/src/rars/riscv/instructions/FNMADDS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FNMSUBS.java b/src/rars/riscv/instructions/FNMSUBS.java index 54308b9e..ea73ea05 100644 --- a/src/rars/riscv/instructions/FNMSUBS.java +++ b/src/rars/riscv/instructions/FNMSUBS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FSGNJNS.java b/src/rars/riscv/instructions/FSGNJNS.java index e8d3b3c0..094b0a45 100644 --- a/src/rars/riscv/instructions/FSGNJNS.java +++ b/src/rars/riscv/instructions/FSGNJNS.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FSGNJNS extends BasicInstruction { public FSGNJNS() { super("fsgnjn.s f1, f2, f3", "Floating point sign injection (inverted): replace the sign bit of f2 with the opposite of sign bit of f3 and assign it to f1", diff --git a/src/rars/riscv/instructions/FSGNJS.java b/src/rars/riscv/instructions/FSGNJS.java index 19cec7c8..1f9badc4 100644 --- a/src/rars/riscv/instructions/FSGNJS.java +++ b/src/rars/riscv/instructions/FSGNJS.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FSGNJS extends BasicInstruction { public FSGNJS() { super("fsgnj.s f1, f2, f3", "Floating point sign injection: replace the sign bit of f2 with the sign bit of f3 and assign it to f1", diff --git a/src/rars/riscv/instructions/FSGNJXS.java b/src/rars/riscv/instructions/FSGNJXS.java index 8f9aae61..88e86609 100644 --- a/src/rars/riscv/instructions/FSGNJXS.java +++ b/src/rars/riscv/instructions/FSGNJXS.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FSGNJXS extends BasicInstruction { public FSGNJXS() { super("fsgnjx.s f1, f2, f3", "Floating point sign injection (xor): xor the sign bit of f2 with the sign bit of f3 and assign it to f1", diff --git a/src/rars/riscv/instructions/FSQRTS.java b/src/rars/riscv/instructions/FSQRTS.java index 0c889d79..8a15c30e 100644 --- a/src/rars/riscv/instructions/FSQRTS.java +++ b/src/rars/riscv/instructions/FSQRTS.java @@ -9,33 +9,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FSQRTS extends BasicInstruction { public FSQRTS() { super("fsqrt.s f1, f2, dyn", "Floating SQuare RooT: Assigns f1 to the square root of f2", diff --git a/src/rars/riscv/instructions/FSUBS.java b/src/rars/riscv/instructions/FSUBS.java index 11974226..f1e0812e 100644 --- a/src/rars/riscv/instructions/FSUBS.java +++ b/src/rars/riscv/instructions/FSUBS.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - import jsoftfloat.Environment; import jsoftfloat.types.Float32; diff --git a/src/rars/riscv/instructions/FSW.java b/src/rars/riscv/instructions/FSW.java index 3c5cbee3..b442002f 100644 --- a/src/rars/riscv/instructions/FSW.java +++ b/src/rars/riscv/instructions/FSW.java @@ -9,33 +9,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class FSW extends BasicInstruction { public FSW() { super("fsw f1, -100(t1)", "Store a float to memory", diff --git a/src/rars/riscv/instructions/Floating.java b/src/rars/riscv/instructions/Floating.java index 5955db2f..ff31623f 100644 --- a/src/rars/riscv/instructions/Floating.java +++ b/src/rars/riscv/instructions/Floating.java @@ -11,33 +11,6 @@ import rars.riscv.BasicInstructionFormat; import jsoftfloat.Environment; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Base class for float to float operations * diff --git a/src/rars/riscv/instructions/FusedFloat.java b/src/rars/riscv/instructions/FusedFloat.java index 893ac6d1..0294f9f7 100644 --- a/src/rars/riscv/instructions/FusedFloat.java +++ b/src/rars/riscv/instructions/FusedFloat.java @@ -10,33 +10,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Helper class for 4 argument floating point instructions */ diff --git a/src/rars/riscv/instructions/ImmediateInstruction.java b/src/rars/riscv/instructions/ImmediateInstruction.java index bb9a081a..a03ee5e9 100644 --- a/src/rars/riscv/instructions/ImmediateInstruction.java +++ b/src/rars/riscv/instructions/ImmediateInstruction.java @@ -6,33 +6,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Base class for all integer instructions using immediates * diff --git a/src/rars/riscv/instructions/JAL.java b/src/rars/riscv/instructions/JAL.java index 685bed0a..09964e20 100644 --- a/src/rars/riscv/instructions/JAL.java +++ b/src/rars/riscv/instructions/JAL.java @@ -7,33 +7,6 @@ import rars.riscv.Instruction; import rars.riscv.InstructionSet; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class JAL extends BasicInstruction { public JAL() { super("jal t1, target", "Jump and link : Set t1 to Program Counter (return address) then jump to statement at target address", diff --git a/src/rars/riscv/instructions/JALR.java b/src/rars/riscv/instructions/JALR.java index 2f209ac5..5a2e0b50 100644 --- a/src/rars/riscv/instructions/JALR.java +++ b/src/rars/riscv/instructions/JALR.java @@ -6,33 +6,6 @@ import rars.riscv.BasicInstructionFormat; import rars.riscv.InstructionSet; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class JALR extends BasicInstruction { public JALR() { super("jalr t1, t2, -100", "Jump and link register: Set t1 to Program Counter (return address) then jump to statement at t2 + immediate", diff --git a/src/rars/riscv/instructions/LB.java b/src/rars/riscv/instructions/LB.java index 5fad1587..eb0a011b 100644 --- a/src/rars/riscv/instructions/LB.java +++ b/src/rars/riscv/instructions/LB.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class LB extends Load { public LB() { super("lb t1, -100(t2)", "Set t1 to sign-extended 8-bit value from effective memory byte address", "000"); diff --git a/src/rars/riscv/instructions/LBU.java b/src/rars/riscv/instructions/LBU.java index 7714a81e..a40d2e13 100644 --- a/src/rars/riscv/instructions/LBU.java +++ b/src/rars/riscv/instructions/LBU.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class LBU extends Load { public LBU() { super("lbu t1, -100(t2)", "Set t1 to zero-extended 8-bit value from effective memory byte address", "100"); diff --git a/src/rars/riscv/instructions/LH.java b/src/rars/riscv/instructions/LH.java index 70a4d818..22f28976 100644 --- a/src/rars/riscv/instructions/LH.java +++ b/src/rars/riscv/instructions/LH.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class LH extends Load { public LH() { super("lh t1, -100(t2)", "Set t1 to sign-extended 16-bit value from effective memory halfword address", "001"); diff --git a/src/rars/riscv/instructions/LHU.java b/src/rars/riscv/instructions/LHU.java index e345ada8..65952861 100644 --- a/src/rars/riscv/instructions/LHU.java +++ b/src/rars/riscv/instructions/LHU.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class LHU extends Load { public LHU() { super("lhu t1, -100(t2)", "Set t1 to zero-extended 16-bit value from effective memory halfword address", "101"); diff --git a/src/rars/riscv/instructions/LUI.java b/src/rars/riscv/instructions/LUI.java index 0a162a71..f7bbe06c 100644 --- a/src/rars/riscv/instructions/LUI.java +++ b/src/rars/riscv/instructions/LUI.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class LUI extends BasicInstruction { public LUI() { super("lui t1,100000", "Load upper immediate: set t1 to 20-bit followed by 12 0s", diff --git a/src/rars/riscv/instructions/LW.java b/src/rars/riscv/instructions/LW.java index 4fd0998a..8d011e6b 100644 --- a/src/rars/riscv/instructions/LW.java +++ b/src/rars/riscv/instructions/LW.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class LW extends Load { public LW() { super("lw t1, -100(t2)", "Set t1 to contents of effective memory word address", "010"); diff --git a/src/rars/riscv/instructions/Load.java b/src/rars/riscv/instructions/Load.java index e2c89eb7..9956aa2d 100644 --- a/src/rars/riscv/instructions/Load.java +++ b/src/rars/riscv/instructions/Load.java @@ -7,33 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Base class for all Load instructions * diff --git a/src/rars/riscv/instructions/MUL.java b/src/rars/riscv/instructions/MUL.java index 5b95ba76..86ffa6a2 100644 --- a/src/rars/riscv/instructions/MUL.java +++ b/src/rars/riscv/instructions/MUL.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class MUL extends Arithmetic { public MUL() { super("mul t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3", diff --git a/src/rars/riscv/instructions/MULH.java b/src/rars/riscv/instructions/MULH.java index d65c0077..b8024361 100644 --- a/src/rars/riscv/instructions/MULH.java +++ b/src/rars/riscv/instructions/MULH.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - import java.math.BigInteger; public class MULH extends Arithmetic { diff --git a/src/rars/riscv/instructions/MULHSU.java b/src/rars/riscv/instructions/MULHSU.java index a92389a4..20c05f80 100644 --- a/src/rars/riscv/instructions/MULHSU.java +++ b/src/rars/riscv/instructions/MULHSU.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - import java.math.BigInteger; public class MULHSU extends Arithmetic { diff --git a/src/rars/riscv/instructions/MULHU.java b/src/rars/riscv/instructions/MULHU.java index 52e5f379..4de07193 100644 --- a/src/rars/riscv/instructions/MULHU.java +++ b/src/rars/riscv/instructions/MULHU.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - import java.math.BigInteger; public class MULHU extends Arithmetic { diff --git a/src/rars/riscv/instructions/OR.java b/src/rars/riscv/instructions/OR.java index 94c7ba24..1b5b15b8 100644 --- a/src/rars/riscv/instructions/OR.java +++ b/src/rars/riscv/instructions/OR.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class OR extends Arithmetic { public OR() { super("or t1,t2,t3", "Bitwise OR : Set t1 to bitwise OR of t2 and t3", diff --git a/src/rars/riscv/instructions/ORI.java b/src/rars/riscv/instructions/ORI.java index ac4dede8..7cf6123c 100644 --- a/src/rars/riscv/instructions/ORI.java +++ b/src/rars/riscv/instructions/ORI.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class ORI extends ImmediateInstruction { public ORI() { super("ori t1,t2,-100", "Bitwise OR immediate : Set t1 to bitwise OR of t2 and sign-extended 12-bit immediate", "110"); diff --git a/src/rars/riscv/instructions/REM.java b/src/rars/riscv/instructions/REM.java index 1fa9644e..f6a4198a 100644 --- a/src/rars/riscv/instructions/REM.java +++ b/src/rars/riscv/instructions/REM.java @@ -2,34 +2,6 @@ import rars.riscv.hardware.ControlAndStatusRegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class REM extends Arithmetic { public REM() { super("rem t1,t2,t3", "Remainder: set t1 to the remainder of t2/t3", diff --git a/src/rars/riscv/instructions/REMU.java b/src/rars/riscv/instructions/REMU.java index b7f517e1..c2901a8d 100644 --- a/src/rars/riscv/instructions/REMU.java +++ b/src/rars/riscv/instructions/REMU.java @@ -2,34 +2,6 @@ import rars.riscv.hardware.ControlAndStatusRegisterFile; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class REMU extends Arithmetic { public REMU() { super("remu t1,t2,t3", "Remainder: set t1 to the remainder of t2/t3 using unsigned division", diff --git a/src/rars/riscv/instructions/SB.java b/src/rars/riscv/instructions/SB.java index bc8f3446..fd0e32c2 100644 --- a/src/rars/riscv/instructions/SB.java +++ b/src/rars/riscv/instructions/SB.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SB extends Store { public SB() { super("sb t1, -100(t2)", "Store byte : Store the low-order 8 bits of t1 into the effective memory byte address", "000"); diff --git a/src/rars/riscv/instructions/SH.java b/src/rars/riscv/instructions/SH.java index 829b6cba..66e9aa49 100644 --- a/src/rars/riscv/instructions/SH.java +++ b/src/rars/riscv/instructions/SH.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SH extends Store { public SH() { super("sh t1, -100(t2)", "Store halfword : Store the low-order 16 bits of t1 into the effective memory halfword address", "001"); diff --git a/src/rars/riscv/instructions/SLL.java b/src/rars/riscv/instructions/SLL.java index 6ea995fd..40fad9f3 100644 --- a/src/rars/riscv/instructions/SLL.java +++ b/src/rars/riscv/instructions/SLL.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SLL extends Arithmetic { public SLL() { super("sll t1,t2,t3", "Shift left logical: Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3", diff --git a/src/rars/riscv/instructions/SLLI.java b/src/rars/riscv/instructions/SLLI.java index 550b2b12..a1bd264e 100644 --- a/src/rars/riscv/instructions/SLLI.java +++ b/src/rars/riscv/instructions/SLLI.java @@ -5,34 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SLLI extends BasicInstruction { public SLLI() { super("slli t1,t2,10", "Shift left logical : Set t1 to result of shifting t2 left by number of bits specified by immediate", diff --git a/src/rars/riscv/instructions/SLT.java b/src/rars/riscv/instructions/SLT.java index 322f935d..1a77b0ed 100644 --- a/src/rars/riscv/instructions/SLT.java +++ b/src/rars/riscv/instructions/SLT.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SLT extends Arithmetic { public SLT() { super("slt t1,t2,t3", "Set less than : If t2 is less than t3, then set t1 to 1 else set t1 to 0", diff --git a/src/rars/riscv/instructions/SLTI.java b/src/rars/riscv/instructions/SLTI.java index 8b390b5d..b54e4146 100644 --- a/src/rars/riscv/instructions/SLTI.java +++ b/src/rars/riscv/instructions/SLTI.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SLTI extends ImmediateInstruction { public SLTI() { super("slti t1,t2,-100", "Set less than immediate : If t2 is less than sign-extended 12-bit immediate, then set t1 to 1 else set t1 to 0", diff --git a/src/rars/riscv/instructions/SLTIU.java b/src/rars/riscv/instructions/SLTIU.java index 9e31f5b2..7ca1dc09 100644 --- a/src/rars/riscv/instructions/SLTIU.java +++ b/src/rars/riscv/instructions/SLTIU.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SLTIU extends ImmediateInstruction { public SLTIU() { super("sltiu t1,t2,-100", "Set less than immediate unsigned : If t2 is less than sign-extended 16-bit immediate using unsigned comparison, then set t1 to 1 else set t1 to 0", diff --git a/src/rars/riscv/instructions/SLTU.java b/src/rars/riscv/instructions/SLTU.java index b1f090b8..9171e86b 100644 --- a/src/rars/riscv/instructions/SLTU.java +++ b/src/rars/riscv/instructions/SLTU.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SLTU extends Arithmetic { public SLTU() { super("sltu t1,t2,t3", "Set less than : If t2 is less than t3 using unsigned comparision, then set t1 to 1 else set t1 to 0", diff --git a/src/rars/riscv/instructions/SRA.java b/src/rars/riscv/instructions/SRA.java index 858c9362..6eab564c 100644 --- a/src/rars/riscv/instructions/SRA.java +++ b/src/rars/riscv/instructions/SRA.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SRA extends Arithmetic { public SRA() { super("sra t1,t2,t3", "Shift right arithmetic: Set t1 to result of sign-extended shifting t2 right by number of bits specified by value in low-order 5 bits of t3", diff --git a/src/rars/riscv/instructions/SRAI.java b/src/rars/riscv/instructions/SRAI.java index f4b6bd3c..c613e4ec 100644 --- a/src/rars/riscv/instructions/SRAI.java +++ b/src/rars/riscv/instructions/SRAI.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SRAI extends BasicInstruction { public SRAI() { super("srai t1,t2,10", "Shift right arithmetic : Set t1 to result of sign-extended shifting t2 right by number of bits specified by immediate", diff --git a/src/rars/riscv/instructions/SRL.java b/src/rars/riscv/instructions/SRL.java index 56f94c0c..5c3e56b0 100644 --- a/src/rars/riscv/instructions/SRL.java +++ b/src/rars/riscv/instructions/SRL.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SRL extends Arithmetic { public SRL() { super("srl t1,t2,t3", "Shift right logical: Set t1 to result of shifting t2 right by number of bits specified by value in low-order 5 bits of t3", diff --git a/src/rars/riscv/instructions/SRLI.java b/src/rars/riscv/instructions/SRLI.java index 37b20024..8df89087 100644 --- a/src/rars/riscv/instructions/SRLI.java +++ b/src/rars/riscv/instructions/SRLI.java @@ -5,34 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class SRLI extends BasicInstruction { public SRLI() { super("srli t1,t2,10", "Shift right logical : Set t1 to result of shifting t2 right by number of bits specified by immediate", diff --git a/src/rars/riscv/instructions/SUB.java b/src/rars/riscv/instructions/SUB.java index 640649f4..49b1d3c8 100644 --- a/src/rars/riscv/instructions/SUB.java +++ b/src/rars/riscv/instructions/SUB.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SUB extends Arithmetic { public SUB() { super("sub t1,t2,t3", "Subtraction: set t1 to (t2 minus t3)", diff --git a/src/rars/riscv/instructions/SW.java b/src/rars/riscv/instructions/SW.java index 73b3ca65..33726dcd 100644 --- a/src/rars/riscv/instructions/SW.java +++ b/src/rars/riscv/instructions/SW.java @@ -3,33 +3,6 @@ import rars.Globals; import rars.riscv.hardware.AddressErrorException; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SW extends Store { public SW() { super("sw t1, -100(t2)", "Store word : Store contents of t1 into effective memory word address", "010"); diff --git a/src/rars/riscv/instructions/Store.java b/src/rars/riscv/instructions/Store.java index 7f309041..33114a2e 100644 --- a/src/rars/riscv/instructions/Store.java +++ b/src/rars/riscv/instructions/Store.java @@ -7,33 +7,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - /** * Base class for all Store instructions * diff --git a/src/rars/riscv/instructions/URET.java b/src/rars/riscv/instructions/URET.java index 2c142e3d..ebcdec46 100644 --- a/src/rars/riscv/instructions/URET.java +++ b/src/rars/riscv/instructions/URET.java @@ -6,32 +6,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ public class URET extends BasicInstruction { public URET() { super("uret", "Return from handling an interrupt or exception (to uepc)", diff --git a/src/rars/riscv/instructions/WFI.java b/src/rars/riscv/instructions/WFI.java index 54d05d26..e3bb9897 100644 --- a/src/rars/riscv/instructions/WFI.java +++ b/src/rars/riscv/instructions/WFI.java @@ -5,33 +5,6 @@ import rars.riscv.BasicInstruction; import rars.riscv.BasicInstructionFormat; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class WFI extends BasicInstruction { public WFI() { super("wfi", "Wait for Interrupt", diff --git a/src/rars/riscv/instructions/XOR.java b/src/rars/riscv/instructions/XOR.java index 425397be..33cf7bba 100644 --- a/src/rars/riscv/instructions/XOR.java +++ b/src/rars/riscv/instructions/XOR.java @@ -1,33 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - - public class XOR extends Arithmetic { public XOR() { super("xor t1,t2,t3", "Bitwise XOR : Set t1 to bitwise XOR of t2 and t3", diff --git a/src/rars/riscv/instructions/XORI.java b/src/rars/riscv/instructions/XORI.java index 96b5ab0e..1ed5d1ff 100644 --- a/src/rars/riscv/instructions/XORI.java +++ b/src/rars/riscv/instructions/XORI.java @@ -1,32 +1,5 @@ package rars.riscv.instructions; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class XORI extends ImmediateInstruction { public XORI() { super("xori t1,t2,-100", "Bitwise XOR immediate : Set t1 to bitwise XOR of t2 and sign-extended 12-bit immediate", "100"); diff --git a/src/rars/riscv/syscalls/NullString.java b/src/rars/riscv/syscalls/NullString.java index bfd26418..00afc287 100644 --- a/src/rars/riscv/syscalls/NullString.java +++ b/src/rars/riscv/syscalls/NullString.java @@ -9,35 +9,6 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; -/* -Copyright (c) 2003-2017, Pete Sanderson,Benjamin Landers and Kenneth Vollmar - -Developed by Pete Sanderson (psanderson@otterbein.edu), -Benjamin Landers (benjaminrlanders@gmail.com), -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) - */ - /** * Small helper class to wrap getting null terminated strings from memory */ diff --git a/src/rars/riscv/syscalls/RandomStreams.java b/src/rars/riscv/syscalls/RandomStreams.java index b4718327..a6978665 100644 --- a/src/rars/riscv/syscalls/RandomStreams.java +++ b/src/rars/riscv/syscalls/RandomStreams.java @@ -5,35 +5,6 @@ import java.util.HashMap; import java.util.Random; -/* -Copyright (c) 2003-2008, 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) - */ - - /** * This small class serves only to hold a static HashMap for storing * random number generators for use by all the random number generator diff --git a/src/rars/riscv/syscalls/SyscallBrk.java b/src/rars/riscv/syscalls/SyscallBrk.java new file mode 100644 index 00000000..b1503d01 --- /dev/null +++ b/src/rars/riscv/syscalls/SyscallBrk.java @@ -0,0 +1,22 @@ +package rars.riscv.syscalls; + +import rars.ExitingException; +import rars.Globals; +import rars.ProgramStatement; +import rars.riscv.AbstractSyscall; +import rars.riscv.hardware.RegisterFile; + +public class SyscallBrk extends AbstractSyscall { + public SyscallBrk() { + super("Brk", "Set and get heap address. Is compatible with the low level Linux brk syscall (not the POSIX one).", "a0 = wanted heap address, or 0 to get it", "a0 = resulting heap address"); + } + + public void simulate(ProgramStatement statement) { + int val = RegisterFile.getValue("a0"); + if (val >= Globals.memory.heapBaseAddress && val < Globals.memory.dataSegmentLimitAddress ) { + // no alignment, just a plain address to use now + Globals.memory.heapAddress = val; + } + RegisterFile.updateRegister("a0", Globals.memory.heapAddress); + } +} \ No newline at end of file diff --git a/src/rars/riscv/syscalls/SyscallClose.java b/src/rars/riscv/syscalls/SyscallClose.java index 1f96be13..12c028bd 100644 --- a/src/rars/riscv/syscalls/SyscallClose.java +++ b/src/rars/riscv/syscalls/SyscallClose.java @@ -5,34 +5,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallClose extends AbstractSyscall { public SyscallClose() { super("Close", "Close a file", "a0 = the file descriptor to close", "N/A"); diff --git a/src/rars/riscv/syscalls/SyscallConfirmDialog.java b/src/rars/riscv/syscalls/SyscallConfirmDialog.java index f046c0ba..8924dc5c 100644 --- a/src/rars/riscv/syscalls/SyscallConfirmDialog.java +++ b/src/rars/riscv/syscalls/SyscallConfirmDialog.java @@ -7,34 +7,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallConfirmDialog extends AbstractSyscall { public SyscallConfirmDialog() { super("ConfirmDialog", "Service to display a message to user", diff --git a/src/rars/riscv/syscalls/SyscallExit.java b/src/rars/riscv/syscalls/SyscallExit.java index 0b8f7a12..b598c83a 100644 --- a/src/rars/riscv/syscalls/SyscallExit.java +++ b/src/rars/riscv/syscalls/SyscallExit.java @@ -5,37 +5,6 @@ import rars.ProgramStatement; import rars.riscv.AbstractSyscall; -/* -Copyright (c) 2003-2006, 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) - */ - - - - public class SyscallExit extends AbstractSyscall { public SyscallExit() { super("Exit", "Exits the program with code 0"); diff --git a/src/rars/riscv/syscalls/SyscallExit2.java b/src/rars/riscv/syscalls/SyscallExit2.java index 26cdf76f..c61bdc6c 100644 --- a/src/rars/riscv/syscalls/SyscallExit2.java +++ b/src/rars/riscv/syscalls/SyscallExit2.java @@ -6,34 +6,6 @@ import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallExit2 extends AbstractSyscall { public SyscallExit2() { super("Exit2", "Exits the program with a code", "a0 = the number to exit with", "N/A"); diff --git a/src/rars/riscv/syscalls/SyscallGetCWD.java b/src/rars/riscv/syscalls/SyscallGetCWD.java index 5172eb6d..ac031120 100644 --- a/src/rars/riscv/syscalls/SyscallGetCWD.java +++ b/src/rars/riscv/syscalls/SyscallGetCWD.java @@ -9,33 +9,6 @@ import java.nio.charset.StandardCharsets; -/* -Copyright (c) 20017, Benjamin Landers - -Developed by Benjamin Landers (benjaminrlanders@gmail.com) - -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) - */ - public class SyscallGetCWD extends AbstractSyscall { public SyscallGetCWD() { super("GetCWD", "Writes the path of the current working directory into a buffer", diff --git a/src/rars/riscv/syscalls/SyscallInputDialogDouble.java b/src/rars/riscv/syscalls/SyscallInputDialogDouble.java index a51fbd00..1e8c4fe7 100644 --- a/src/rars/riscv/syscalls/SyscallInputDialogDouble.java +++ b/src/rars/riscv/syscalls/SyscallInputDialogDouble.java @@ -10,34 +10,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Service to input data. */ diff --git a/src/rars/riscv/syscalls/SyscallInputDialogFloat.java b/src/rars/riscv/syscalls/SyscallInputDialogFloat.java index 3437b2f1..ce4dc916 100644 --- a/src/rars/riscv/syscalls/SyscallInputDialogFloat.java +++ b/src/rars/riscv/syscalls/SyscallInputDialogFloat.java @@ -8,34 +8,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Service to input data. *

diff --git a/src/rars/riscv/syscalls/SyscallInputDialogInt.java b/src/rars/riscv/syscalls/SyscallInputDialogInt.java index ffac8081..98937e54 100644 --- a/src/rars/riscv/syscalls/SyscallInputDialogInt.java +++ b/src/rars/riscv/syscalls/SyscallInputDialogInt.java @@ -7,34 +7,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Service to input data. *

diff --git a/src/rars/riscv/syscalls/SyscallInputDialogString.java b/src/rars/riscv/syscalls/SyscallInputDialogString.java index 209e0c7a..eadd5a55 100644 --- a/src/rars/riscv/syscalls/SyscallInputDialogString.java +++ b/src/rars/riscv/syscalls/SyscallInputDialogString.java @@ -10,34 +10,6 @@ import javax.swing.*; import java.nio.charset.StandardCharsets; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Service to input data. *

diff --git a/src/rars/riscv/syscalls/SyscallLSeek.java b/src/rars/riscv/syscalls/SyscallLSeek.java index cd0812f6..83676bbe 100644 --- a/src/rars/riscv/syscalls/SyscallLSeek.java +++ b/src/rars/riscv/syscalls/SyscallLSeek.java @@ -6,33 +6,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2017, Benjamin Landers - -Developed by Benjamin Landers (benjminrlanders@gmail.com) - -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) - */ - public class SyscallLSeek extends AbstractSyscall { public SyscallLSeek() { super("LSeek", "Seek to a position in a file", diff --git a/src/rars/riscv/syscalls/SyscallMessageDialog.java b/src/rars/riscv/syscalls/SyscallMessageDialog.java index db2c60bd..936abd25 100644 --- a/src/rars/riscv/syscalls/SyscallMessageDialog.java +++ b/src/rars/riscv/syscalls/SyscallMessageDialog.java @@ -7,34 +7,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallMessageDialog extends AbstractSyscall { public SyscallMessageDialog() { super("MessageDialog", "Service to display a message to user", diff --git a/src/rars/riscv/syscalls/SyscallMessageDialogDouble.java b/src/rars/riscv/syscalls/SyscallMessageDialogDouble.java index 7980f8f7..13006da9 100644 --- a/src/rars/riscv/syscalls/SyscallMessageDialogDouble.java +++ b/src/rars/riscv/syscalls/SyscallMessageDialogDouble.java @@ -10,34 +10,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Service to display a message to user. */ diff --git a/src/rars/riscv/syscalls/SyscallMessageDialogFloat.java b/src/rars/riscv/syscalls/SyscallMessageDialogFloat.java index 83822d9d..04b17973 100644 --- a/src/rars/riscv/syscalls/SyscallMessageDialogFloat.java +++ b/src/rars/riscv/syscalls/SyscallMessageDialogFloat.java @@ -7,34 +7,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallMessageDialogFloat extends AbstractSyscall { public SyscallMessageDialogFloat() { super("MessageDialogFloat", "Service to display a message followed by a float to user", diff --git a/src/rars/riscv/syscalls/SyscallMessageDialogInt.java b/src/rars/riscv/syscalls/SyscallMessageDialogInt.java index daaeb97f..091ea1f4 100644 --- a/src/rars/riscv/syscalls/SyscallMessageDialogInt.java +++ b/src/rars/riscv/syscalls/SyscallMessageDialogInt.java @@ -7,34 +7,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallMessageDialogInt extends AbstractSyscall { public SyscallMessageDialogInt() { super("MessageDialogInt", "Service to display a message followed by a int to user", diff --git a/src/rars/riscv/syscalls/SyscallMessageDialogString.java b/src/rars/riscv/syscalls/SyscallMessageDialogString.java index f2c422d0..5dcdbfee 100644 --- a/src/rars/riscv/syscalls/SyscallMessageDialogString.java +++ b/src/rars/riscv/syscalls/SyscallMessageDialogString.java @@ -6,34 +6,6 @@ import javax.swing.*; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallMessageDialogString extends AbstractSyscall { public SyscallMessageDialogString() { super("MessageDialogString", "Service to display a message followed by a string to user", diff --git a/src/rars/riscv/syscalls/SyscallMidiOut.java b/src/rars/riscv/syscalls/SyscallMidiOut.java index f2bfd0bc..35d82906 100644 --- a/src/rars/riscv/syscalls/SyscallMidiOut.java +++ b/src/rars/riscv/syscalls/SyscallMidiOut.java @@ -4,35 +4,6 @@ import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; - -/* -Copyright (c) 2003-2009, 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) - */ - public class SyscallMidiOut extends AbstractSyscall { // Endpoints of ranges for the three "byte" parameters. The duration // parameter is limited at the high end only by the int range. diff --git a/src/rars/riscv/syscalls/SyscallMidiOutSync.java b/src/rars/riscv/syscalls/SyscallMidiOutSync.java index 77aa6f71..6005c84e 100644 --- a/src/rars/riscv/syscalls/SyscallMidiOutSync.java +++ b/src/rars/riscv/syscalls/SyscallMidiOutSync.java @@ -4,43 +4,6 @@ import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2003-2007, Pete Sanderson and Kenneth Vollmar - -Developed by Pete Sanderson (psanderson@otterbein.edu) -and Kenneth Vollmar (kenvollmar@missouristate.edu) - -Modified 2009-10-19 by Max Hailperin -to use a specific method for synchronously generating -a tone, rather than using an asyncronous method followed -by a Thread.sleep, because sleeping isn't a reliable -synchronization method -- depending on thread scheduling, -the actual tone generation could have been delayed, in -which case the tone might still be playing when the -sleep ended. - -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) - */ - public class SyscallMidiOutSync extends AbstractSyscall { // Endpoints of ranges for the three "byte" parameters. The duration diff --git a/src/rars/riscv/syscalls/SyscallOpen.java b/src/rars/riscv/syscalls/SyscallOpen.java index 8eb50b1a..174823c6 100644 --- a/src/rars/riscv/syscalls/SyscallOpen.java +++ b/src/rars/riscv/syscalls/SyscallOpen.java @@ -6,34 +6,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallOpen extends AbstractSyscall { public SyscallOpen() { super("Open", "Opens a file from a path
Only supported flags (a1) are read-only (0), write-only (1) and" + diff --git a/src/rars/riscv/syscalls/SyscallPrintChar.java b/src/rars/riscv/syscalls/SyscallPrintChar.java index 58b130f9..f375fbf8 100644 --- a/src/rars/riscv/syscalls/SyscallPrintChar.java +++ b/src/rars/riscv/syscalls/SyscallPrintChar.java @@ -5,33 +5,7 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ +import java.nio.charset.StandardCharsets; public class SyscallPrintChar extends AbstractSyscall { public SyscallPrintChar() { @@ -40,8 +14,9 @@ public SyscallPrintChar() { } public void simulate(ProgramStatement statement) { - char t = (char) (RegisterFile.getValue("a0") & 0x000000ff); - SystemIO.printString(Character.toString(t)); + byte[] t = new byte[1]; + t[0] = (byte) RegisterFile.getValue("a0"); + SystemIO.printString(new String(t, StandardCharsets.UTF_8)); } } \ No newline at end of file diff --git a/src/rars/riscv/syscalls/SyscallPrintDouble.java b/src/rars/riscv/syscalls/SyscallPrintDouble.java index dc4942be..bd5ca1bb 100644 --- a/src/rars/riscv/syscalls/SyscallPrintDouble.java +++ b/src/rars/riscv/syscalls/SyscallPrintDouble.java @@ -7,34 +7,6 @@ import rars.util.Binary; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallPrintDouble extends AbstractSyscall { /** * Build an instance of the Print Double syscall. Default service number diff --git a/src/rars/riscv/syscalls/SyscallPrintFloat.java b/src/rars/riscv/syscalls/SyscallPrintFloat.java index 51102270..23fbb85a 100644 --- a/src/rars/riscv/syscalls/SyscallPrintFloat.java +++ b/src/rars/riscv/syscalls/SyscallPrintFloat.java @@ -5,34 +5,6 @@ import rars.riscv.hardware.FloatingPointRegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallPrintFloat extends AbstractSyscall { public SyscallPrintFloat() { super("PrintFloat", "Prints a floating point number", "fa0 = float to print", "N/A"); diff --git a/src/rars/riscv/syscalls/SyscallPrintInt.java b/src/rars/riscv/syscalls/SyscallPrintInt.java index 81a41377..a8e5811b 100644 --- a/src/rars/riscv/syscalls/SyscallPrintInt.java +++ b/src/rars/riscv/syscalls/SyscallPrintInt.java @@ -5,40 +5,12 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallPrintInt extends AbstractSyscall { public SyscallPrintInt() { super("PrintInt", "Prints an integer", "a0 = integer to print", "N/A"); } public void simulate(ProgramStatement statement) { - SystemIO.printString(Integer.toString(RegisterFile.getValue("a0"))); + SystemIO.printString(Long.toString(RegisterFile.getValueLong("a0"))); } } \ No newline at end of file diff --git a/src/rars/riscv/syscalls/SyscallPrintIntBinary.java b/src/rars/riscv/syscalls/SyscallPrintIntBinary.java index 6d1cd0cd..a2ff243b 100644 --- a/src/rars/riscv/syscalls/SyscallPrintIntBinary.java +++ b/src/rars/riscv/syscalls/SyscallPrintIntBinary.java @@ -2,44 +2,21 @@ import rars.ProgramStatement; import rars.riscv.AbstractSyscall; +import rars.riscv.InstructionSet; import rars.riscv.hardware.RegisterFile; import rars.util.Binary; import rars.util.SystemIO; -/* -Copyright (c) 2003-2009, 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) - */ - public class SyscallPrintIntBinary extends AbstractSyscall { public SyscallPrintIntBinary() { super("PrintIntBinary", "Prints an integer (in binary format left-padded with zeroes) ", "a0 = integer to print", "N/A"); } public void simulate(ProgramStatement statement) { - SystemIO.printString(Binary.intToBinaryString(RegisterFile.getValue("a0"))); + if (InstructionSet.rv64) { + SystemIO.printString(Binary.longToBinaryString(RegisterFile.getValueLong("a0"))); + } else { + SystemIO.printString(Binary.intToBinaryString(RegisterFile.getValue("a0"))); + } } } \ No newline at end of file diff --git a/src/rars/riscv/syscalls/SyscallPrintIntHex.java b/src/rars/riscv/syscalls/SyscallPrintIntHex.java index eb3853a8..34fdb0e7 100644 --- a/src/rars/riscv/syscalls/SyscallPrintIntHex.java +++ b/src/rars/riscv/syscalls/SyscallPrintIntHex.java @@ -2,44 +2,21 @@ import rars.ProgramStatement; import rars.riscv.AbstractSyscall; +import rars.riscv.InstructionSet; import rars.riscv.hardware.RegisterFile; import rars.util.Binary; import rars.util.SystemIO; -/* -Copyright (c) 2003-2009, 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) - */ - public class SyscallPrintIntHex extends AbstractSyscall { public SyscallPrintIntHex() { super("PrintIntHex", "Prints an integer (in hexdecimal format left-padded with zeroes)", "a0 = integer to print", "N/A"); } public void simulate(ProgramStatement statement) { - SystemIO.printString(Binary.intToHexString(RegisterFile.getValue("a0"))); + if (InstructionSet.rv64) { + SystemIO.printString(Binary.longToHexString(RegisterFile.getValueLong("a0"))); + } else { + SystemIO.printString(Binary.intToHexString(RegisterFile.getValue("a0"))); + } } } \ No newline at end of file diff --git a/src/rars/riscv/syscalls/SyscallPrintIntUnsigned.java b/src/rars/riscv/syscalls/SyscallPrintIntUnsigned.java index e0c72948..f6177c2d 100644 --- a/src/rars/riscv/syscalls/SyscallPrintIntUnsigned.java +++ b/src/rars/riscv/syscalls/SyscallPrintIntUnsigned.java @@ -2,45 +2,21 @@ import rars.ProgramStatement; import rars.riscv.AbstractSyscall; +import rars.riscv.InstructionSet; import rars.riscv.hardware.RegisterFile; import rars.util.Binary; import rars.util.SystemIO; -/* -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) - */ - public class SyscallPrintIntUnsigned extends AbstractSyscall { public SyscallPrintIntUnsigned() { super("PrintIntUnsigned", "Prints an integer (unsigned)", "a0 = integer to print", "N/A"); } public void simulate(ProgramStatement statement) { - SystemIO.printString( - Binary.unsignedIntToIntString(RegisterFile.getValue("a0"))); + if (InstructionSet.rv64) { + SystemIO.printString(Long.toUnsignedString(RegisterFile.getValueLong("a0"))); + } else { + SystemIO.printString(Integer.toUnsignedString(RegisterFile.getValue("a0"))); + } } } \ No newline at end of file diff --git a/src/rars/riscv/syscalls/SyscallPrintString.java b/src/rars/riscv/syscalls/SyscallPrintString.java index 93061e38..3d38d64e 100644 --- a/src/rars/riscv/syscalls/SyscallPrintString.java +++ b/src/rars/riscv/syscalls/SyscallPrintString.java @@ -5,34 +5,6 @@ import rars.riscv.AbstractSyscall; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallPrintString extends AbstractSyscall { public SyscallPrintString() { super("PrintString", "Prints a null-terminated string to the console", diff --git a/src/rars/riscv/syscalls/SyscallRandDouble.java b/src/rars/riscv/syscalls/SyscallRandDouble.java index 396ef692..9368ab08 100644 --- a/src/rars/riscv/syscalls/SyscallRandDouble.java +++ b/src/rars/riscv/syscalls/SyscallRandDouble.java @@ -8,35 +8,6 @@ import java.util.Random; -/* -Copyright (c) 2003-2008, 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) - */ - - /** * Service to return a random floating point value. */ diff --git a/src/rars/riscv/syscalls/SyscallRandFloat.java b/src/rars/riscv/syscalls/SyscallRandFloat.java index def7ab43..19a83061 100644 --- a/src/rars/riscv/syscalls/SyscallRandFloat.java +++ b/src/rars/riscv/syscalls/SyscallRandFloat.java @@ -6,34 +6,6 @@ import java.util.Random; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallRandFloat extends AbstractSyscall { public SyscallRandFloat() { super("RandFloat", "Get a random float", "a0 = index of pseudorandom number generator", diff --git a/src/rars/riscv/syscalls/SyscallRandInt.java b/src/rars/riscv/syscalls/SyscallRandInt.java index 0a15b848..d6738f08 100644 --- a/src/rars/riscv/syscalls/SyscallRandInt.java +++ b/src/rars/riscv/syscalls/SyscallRandInt.java @@ -6,34 +6,6 @@ import java.util.Random; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallRandInt extends AbstractSyscall { public SyscallRandInt() { super("RandInt", "Get a random integer", "a0 = index of pseudorandom number generator", "a0 = random integer"); diff --git a/src/rars/riscv/syscalls/SyscallRandIntRange.java b/src/rars/riscv/syscalls/SyscallRandIntRange.java index e0fb8494..4a72bfc6 100644 --- a/src/rars/riscv/syscalls/SyscallRandIntRange.java +++ b/src/rars/riscv/syscalls/SyscallRandIntRange.java @@ -7,34 +7,6 @@ import java.util.Random; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallRandIntRange extends AbstractSyscall { public SyscallRandIntRange() { super("RandIntRange", "Get a random bounded integer", "a0 = index of pseudorandom number generator
a1 = upper bound for random number", diff --git a/src/rars/riscv/syscalls/SyscallRandSeed.java b/src/rars/riscv/syscalls/SyscallRandSeed.java index 77d0969d..07e4c55d 100644 --- a/src/rars/riscv/syscalls/SyscallRandSeed.java +++ b/src/rars/riscv/syscalls/SyscallRandSeed.java @@ -6,34 +6,6 @@ import java.util.Random; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallRandSeed extends AbstractSyscall { public SyscallRandSeed() { super("RandSeed", "Set seed for the underlying Java pseudorandom number generator", diff --git a/src/rars/riscv/syscalls/SyscallRead.java b/src/rars/riscv/syscalls/SyscallRead.java index f2c97642..3643c768 100644 --- a/src/rars/riscv/syscalls/SyscallRead.java +++ b/src/rars/riscv/syscalls/SyscallRead.java @@ -8,34 +8,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2009, 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) - */ - public class SyscallRead extends AbstractSyscall { public SyscallRead() { super("Read", "Read from a file descriptor into a buffer", diff --git a/src/rars/riscv/syscalls/SyscallReadChar.java b/src/rars/riscv/syscalls/SyscallReadChar.java index 6e7bdd39..bac868c9 100644 --- a/src/rars/riscv/syscalls/SyscallReadChar.java +++ b/src/rars/riscv/syscalls/SyscallReadChar.java @@ -1,52 +1,22 @@ package rars.riscv.syscalls; -import rars.ExitingException; -import rars.ProgramStatement; +import rars.*; import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallReadChar extends AbstractSyscall { public SyscallReadChar() { - super("ReadChar", "Reads a character from input console", "N/A", "a0 = the character"); + super("ReadChar", "Reads a character from input console", "N/A", "a0 = the character or -1 if end of input."); } - public void simulate(ProgramStatement statement) throws ExitingException { - try { - RegisterFile.updateRegister("a0", SystemIO.readChar(this.getNumber())); - } catch (IndexOutOfBoundsException e) // means null input - { + public void simulate(ProgramStatement statement) throws SimulationException { + int character = SystemIO.readChar(this.getNumber()); + if (character == SystemIO.NOTASCII) { throw new ExitingException(statement, - "invalid char input (syscall " + this.getNumber() + ")"); + "invalid or non printable ASCII input (syscall " + this.getNumber() + ")"); } + RegisterFile.updateRegister("a0", character); } -} \ No newline at end of file +} diff --git a/src/rars/riscv/syscalls/SyscallReadDouble.java b/src/rars/riscv/syscalls/SyscallReadDouble.java index d89603f3..d3bb1c41 100644 --- a/src/rars/riscv/syscalls/SyscallReadDouble.java +++ b/src/rars/riscv/syscalls/SyscallReadDouble.java @@ -2,39 +2,11 @@ import rars.ExitingException; import rars.ProgramStatement; +import rars.SimulationException; import rars.riscv.hardware.FloatingPointRegisterFile; import rars.riscv.AbstractSyscall; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - - /** * Service to read the bits of console input double into $f0 and $f1. * $f1 contains high order word of the double. @@ -52,7 +24,7 @@ public SyscallReadDouble() { /** * Performs syscall function to read the bits of input double into $f0 and $f1. */ - public void simulate(ProgramStatement statement) throws ExitingException { + public void simulate(ProgramStatement statement) throws SimulationException { double doubleValue = 0; try { doubleValue = SystemIO.readDouble(this.getNumber()); diff --git a/src/rars/riscv/syscalls/SyscallReadFloat.java b/src/rars/riscv/syscalls/SyscallReadFloat.java index b73f022b..7c43a001 100644 --- a/src/rars/riscv/syscalls/SyscallReadFloat.java +++ b/src/rars/riscv/syscalls/SyscallReadFloat.java @@ -2,44 +2,17 @@ import rars.ExitingException; import rars.ProgramStatement; +import rars.SimulationException; import rars.riscv.AbstractSyscall; import rars.riscv.hardware.FloatingPointRegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallReadFloat extends AbstractSyscall { public SyscallReadFloat() { super("ReadFloat", "Reads a float from input console", "N/A", "fa0 = the float"); } - public void simulate(ProgramStatement statement) throws ExitingException { + public void simulate(ProgramStatement statement) throws SimulationException { float floatValue; try { floatValue = SystemIO.readFloat(this.getNumber()); diff --git a/src/rars/riscv/syscalls/SyscallReadInt.java b/src/rars/riscv/syscalls/SyscallReadInt.java index 576533b6..da0717f9 100644 --- a/src/rars/riscv/syscalls/SyscallReadInt.java +++ b/src/rars/riscv/syscalls/SyscallReadInt.java @@ -1,49 +1,26 @@ package rars.riscv.syscalls; -import rars.ExitingException; -import rars.Globals; -import rars.ProgramStatement; +import rars.*; +import rars.riscv.InstructionSet; import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallReadInt extends AbstractSyscall { public SyscallReadInt() { super("ReadInt", "Reads an int from input console", "N/A", "a0 = the int"); } - public void simulate(ProgramStatement statement) throws ExitingException { + public void simulate(ProgramStatement statement) throws SimulationException { try { - RegisterFile.updateRegister("a0", SystemIO.readInteger(this.getNumber())); + if (InstructionSet.rv64) { + RegisterFile.updateRegister("a0", SystemIO.readLong(this.getNumber())); + } else { + RegisterFile.updateRegister("a0", SystemIO.readInteger(this.getNumber())); + } } catch (NumberFormatException e) { + if (e.getMessage().equals("Cancel")) + throw new CancelException(); throw new ExitingException(statement, "invalid integer input (syscall " + this.getNumber() + ")"); } diff --git a/src/rars/riscv/syscalls/SyscallReadString.java b/src/rars/riscv/syscalls/SyscallReadString.java index 39acfd3a..f8d5e52e 100644 --- a/src/rars/riscv/syscalls/SyscallReadString.java +++ b/src/rars/riscv/syscalls/SyscallReadString.java @@ -1,8 +1,6 @@ package rars.riscv.syscalls; -import rars.ExitingException; -import rars.Globals; -import rars.ProgramStatement; +import rars.*; import rars.riscv.AbstractSyscall; import rars.riscv.hardware.AddressErrorException; import rars.riscv.hardware.RegisterFile; @@ -10,35 +8,6 @@ import java.nio.charset.StandardCharsets; -/* -Copyright (c) 2003-2006, 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) - */ - - /** * Service to read console input string into buffer starting at address in a0 for a1-1 bytes. *

@@ -50,10 +19,10 @@ a copy of this software and associated documentation files (the public class SyscallReadString extends AbstractSyscall { public SyscallReadString() { super("ReadString", "Reads a string from the console", - "a0 = address of input buffer
a1 = maximum number of characters to read", "N/A"); + "a0 = address of input buffer
a1 = size of the buffer", "N/A"); } - public void simulate(ProgramStatement statement) throws ExitingException { + public void simulate(ProgramStatement statement) throws SimulationException { String inputString = ""; int buf = RegisterFile.getValue("a0"); // buf addr int maxLength = RegisterFile.getValue("a1") - 1; diff --git a/src/rars/riscv/syscalls/SyscallSbrk.java b/src/rars/riscv/syscalls/SyscallSbrk.java index 117274f0..63b484ee 100644 --- a/src/rars/riscv/syscalls/SyscallSbrk.java +++ b/src/rars/riscv/syscalls/SyscallSbrk.java @@ -6,34 +6,6 @@ import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2003-2006, 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) - */ - public class SyscallSbrk extends AbstractSyscall { public SyscallSbrk() { super("Sbrk", "Allocate heap memory", "a0 = amount of memory in bytes", "a0 = address to the allocated block"); diff --git a/src/rars/riscv/syscalls/SyscallSleep.java b/src/rars/riscv/syscalls/SyscallSleep.java index 05254aa3..afa35442 100644 --- a/src/rars/riscv/syscalls/SyscallSleep.java +++ b/src/rars/riscv/syscalls/SyscallSleep.java @@ -4,34 +4,6 @@ import rars.riscv.AbstractSyscall; import rars.riscv.hardware.RegisterFile; -/* -Copyright (c) 2003-2008, 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) - */ - public class SyscallSleep extends AbstractSyscall { public SyscallSleep() { super("Sleep", "Set the current thread to sleep for a time (not precise)", "a0 = time to sleep in milliseconds", "N/A"); diff --git a/src/rars/riscv/syscalls/SyscallTime.java b/src/rars/riscv/syscalls/SyscallTime.java index 02ed400e..1f930dab 100644 --- a/src/rars/riscv/syscalls/SyscallTime.java +++ b/src/rars/riscv/syscalls/SyscallTime.java @@ -5,34 +5,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.Binary; -/* -Copyright (c) 2003-2007, 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) - */ - public class SyscallTime extends AbstractSyscall { public SyscallTime() { super("Time", "Get the current time (milliseconds since 1 January 1970)", "N/A", "a0 = low order 32 bits
a1=high order 32 bits"); diff --git a/src/rars/riscv/syscalls/SyscallWrite.java b/src/rars/riscv/syscalls/SyscallWrite.java index 29fc528f..6af8783c 100644 --- a/src/rars/riscv/syscalls/SyscallWrite.java +++ b/src/rars/riscv/syscalls/SyscallWrite.java @@ -8,35 +8,6 @@ import rars.riscv.hardware.RegisterFile; import rars.util.SystemIO; -/* -Copyright (c) 2003-2009, 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) - */ - - /** * Service to write to file descriptor given in a0. a1 specifies buffer * and a2 specifies length. Number of characters written is returned in a0. diff --git a/src/rars/riscv/syscalls/ToneGenerator.java b/src/rars/riscv/syscalls/ToneGenerator.java index acd1cea7..3ab59872 100644 --- a/src/rars/riscv/syscalls/ToneGenerator.java +++ b/src/rars/riscv/syscalls/ToneGenerator.java @@ -7,35 +7,6 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -/* -Copyright (c) 2003-2007, 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) - */ - - ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// // diff --git a/src/rars/simulator/BackStepper.java b/src/rars/simulator/BackStepper.java index 6396d593..2ff210ce 100644 --- a/src/rars/simulator/BackStepper.java +++ b/src/rars/simulator/BackStepper.java @@ -7,34 +7,6 @@ import rars.riscv.hardware.RegisterFile; import rars.riscv.Instruction; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Used to "step backward" through execution, undoing each instruction. * diff --git a/src/rars/simulator/ProgramArgumentList.java b/src/rars/simulator/ProgramArgumentList.java index a3b7fa55..038efb6a 100644 --- a/src/rars/simulator/ProgramArgumentList.java +++ b/src/rars/simulator/ProgramArgumentList.java @@ -1,6 +1,7 @@ package rars.simulator; import rars.Globals; +import rars.riscv.InstructionSet; import rars.riscv.hardware.AddressErrorException; import rars.riscv.hardware.Memory; import rars.riscv.hardware.RegisterFile; @@ -8,34 +9,6 @@ import java.util.ArrayList; import java.util.StringTokenizer; - /* -Copyright (c) 2003-2008, 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) - */ - /** * Models Program Arguments, one or more strings provided to the source * program at runtime. Equivalent to C's main(int argc, char **argv) or @@ -49,6 +22,10 @@ public class ProgramArgumentList { private ArrayList programArgumentList; + public ArrayList getProgramArgumentList() { + return programArgumentList; + } + /** * Constructor that parses string to produce list. Delimiters * are the default Java StringTokenizer delimiters (space, tab, @@ -117,7 +94,6 @@ public ProgramArgumentList(ArrayList list, int startPosition) { } } - ////////////////////////////////////////////////////////////////////// // Place any program arguments into memory and registers // Arguments are stored starting at highest word of non-kernel @@ -131,7 +107,7 @@ public void storeProgramArguments() { if (programArgumentList == null || programArgumentList.size() == 0) { return; } - // Runtime stack initialization from stack top-down (each is 4 bytes) : + // Runtime stack initialization from stack top-down (each is 4 bytes, or 8 byte in 64bit mode) : // programArgumentList.size() // address of first character of first program argument // address of first character of second program argument @@ -152,6 +128,7 @@ public void storeProgramArguments() { // Etc down to first character of second arg. // Follow this pattern for all remaining arguments. + int xlen = InstructionSet.rv64 ? 8 : Memory.WORD_LENGTH_BYTES; // width of an integer register (pointer size) int highAddress = Memory.stackBaseAddress; // highest non-kernel address, sits "under" stack String programArgument; @@ -175,22 +152,22 @@ public void storeProgramArguments() { // 0x7ffffffc - 0x7fffeffc = 0x00001000 = 4096 bytes. In this case, set // stackAddress to next lower word boundary minus 4 for clearance (since every // byte from highAddress+1 is filled). - stackAddress = highAddress - (highAddress % Memory.WORD_LENGTH_BYTES) - Memory.WORD_LENGTH_BYTES; + stackAddress = highAddress - (highAddress % xlen) - xlen; } - Globals.memory.set(stackAddress, 0, Memory.WORD_LENGTH_BYTES); // null word for end of argv array - stackAddress -= Memory.WORD_LENGTH_BYTES; + Globals.memory.set(stackAddress, 0, xlen); // null word for end of argv array + stackAddress -= xlen; for (int i = argStartAddress.length - 1; i >= 0; i--) { - Globals.memory.set(stackAddress, argStartAddress[i], Memory.WORD_LENGTH_BYTES); - stackAddress -= Memory.WORD_LENGTH_BYTES; + Globals.memory.set(stackAddress, argStartAddress[i], xlen); + stackAddress -= xlen; } - Globals.memory.set(stackAddress, argStartAddress.length, Memory.WORD_LENGTH_BYTES); // argc - stackAddress -= Memory.WORD_LENGTH_BYTES; + Globals.memory.set(stackAddress, argStartAddress.length, xlen); // argc + stackAddress -= xlen; // Need to set $sp register to stack address, $a0 to argc, $a1 to argv // Need to by-pass the backstepping mechanism so go directly to Register instead of RegisterFile - RegisterFile.getRegister("sp").setValue(stackAddress + Memory.WORD_LENGTH_BYTES); + RegisterFile.getRegister("sp").setValue(stackAddress + xlen); RegisterFile.getRegister("a0").setValue(argStartAddress.length); // argc - RegisterFile.getRegister("a1").setValue(stackAddress + Memory.WORD_LENGTH_BYTES + Memory.WORD_LENGTH_BYTES); // argv + RegisterFile.getRegister("a1").setValue(stackAddress + xlen + xlen); // argv } catch (AddressErrorException aee) { System.out.println("Internal Error: Memory write error occurred while storing program arguments! " + aee); System.exit(0); diff --git a/src/rars/simulator/Simulator.java b/src/rars/simulator/Simulator.java index 27a99323..fce39cdd 100644 --- a/src/rars/simulator/Simulator.java +++ b/src/rars/simulator/Simulator.java @@ -13,34 +13,6 @@ import java.util.Arrays; import java.util.Observable; - /* -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) - */ - /** * Used to simulate the execution of an assembled source program. * @@ -393,6 +365,7 @@ public void run() { // lock variable, then full (albeit heavy-handed) protection of memory and // registers is assured. Not as critical for reading from those resources. Globals.memoryAndRegistersLock.lock(); + boolean checkHandlerBkpt = false; try { // Handle pending interupts and traps first long uip = ControlAndStatusRegisterFile.getValueNoNotify("uip"), uie = ControlAndStatusRegisterFile.getValueNoNotify("uie"); @@ -408,12 +381,14 @@ public void run() { if (handleInterrupt(InterruptController.claimExternal(), SimulationException.EXTERNAL_INTERRUPT, pc)) { pendingExternal = false; uip &= ~0x100; + checkHandlerBkpt = true; } else { return; // if the interrupt can't be handled, but the interrupt enable bit is high, thats an error } } else if (IE && (uip & 0x1) != 0 && (uie & ControlAndStatusRegisterFile.SOFTWARE_INTERRUPT) != 0) { if (handleInterrupt(0, SimulationException.SOFTWARE_INTERRUPT, pc)) { uip &= ~0x1; + checkHandlerBkpt = true; } else { return; // if the interrupt can't be handled, but the interrupt enable bit is high, thats an error } @@ -421,11 +396,13 @@ public void run() { if (handleInterrupt(InterruptController.claimTimer(), SimulationException.TIMER_INTERRUPT, pc)) { pendingTimer = false; uip &= ~0x10; + checkHandlerBkpt = true; } else { return; // if the interrupt can't be handled, but the interrupt enable bit is high, thats an error } } else if (pendingTrap) { // if we have a pending trap and aren't handling an interrupt it must be handled if (handleTrap(InterruptController.claimTrap(), pc - Instruction.INSTRUCTION_LENGTH)) { // account for that the PC has already been incremented + checkHandlerBkpt = true; } else { return; } @@ -436,6 +413,15 @@ public void run() { ControlAndStatusRegisterFile.updateRegister("uip", uip); } + if (checkHandlerBkpt) { + // Return if we've reached a breakpoint on the handler's entry point. + if (ebreak || (breakPoints != null) && + (Arrays.binarySearch(breakPoints, RegisterFile.getProgramCounter()) >= 0)) { + stopExecution(false, Reason.BREAKPOINT); + return; + } + } + // always handle interrupts and traps before quiting // Check number of instructions executed. Return if at limit (-1 is no limit). if (maxSteps > 0) { @@ -493,6 +479,10 @@ public void run() { Globals.program.getBackStepper().addDoNothing(pc); } ebreak = true; + } catch (CancelException b) { + // Reset the pc in front of the instruction + RegisterFile.setProgramCounter(pc); + ebreak = true; } catch (WaitException w) { if (Globals.getSettings().getBackSteppingEnabled()) { Globals.program.getBackStepper().addDoNothing(pc); diff --git a/src/rars/simulator/SimulatorNotice.java b/src/rars/simulator/SimulatorNotice.java index 33b78fbf..4db465fe 100644 --- a/src/rars/simulator/SimulatorNotice.java +++ b/src/rars/simulator/SimulatorNotice.java @@ -1,33 +1,5 @@ package rars.simulator; -/* -Copyright (c) 2003-2009, 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) - */ - import rars.SimulationException; import rars.venus.run.RunSpeedPanel; diff --git a/src/rars/tools/AbstractToolAndApplication.java b/src/rars/tools/AbstractToolAndApplication.java index 91b80859..723ba45e 100644 --- a/src/rars/tools/AbstractToolAndApplication.java +++ b/src/rars/tools/AbstractToolAndApplication.java @@ -22,34 +22,6 @@ import java.util.Observable; import java.util.Observer; -/* -Copyright (c) 2003-2008, 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) - */ - /** * An abstract class that provides generic components to facilitate implementation of * a Tool and/or stand-alone Rars-based application. Provides default definitions @@ -76,8 +48,6 @@ public abstract class AbstractToolAndApplication extends JFrame implements Tool, // Some GUI settings private EmptyBorder emptyBorder = new EmptyBorder(4, 4, 4, 4); - private Color backgroundColor = Color.WHITE; - private int lowMemoryAddress = Memory.dataSegmentBaseAddress; private int highMemoryAddress = Memory.stackBaseAddress; @@ -375,7 +345,6 @@ public void actionPerformed(ActionEvent e) { operationStatusMessages = new MessageField("No file open."); operationStatusMessages.setColumns(40); operationStatusMessages.setMargin(new Insets(0, 3, 0, 3)); //(top, left, bottom, right) - operationStatusMessages.setBackground(backgroundColor); operationStatusMessages.setFocusable(false); operationStatusMessages.setToolTipText("Display operation status messages"); diff --git a/src/rars/tools/BHTEntry.java b/src/rars/tools/BHTEntry.java index 81c8bd8a..a5ef990b 100644 --- a/src/rars/tools/BHTEntry.java +++ b/src/rars/tools/BHTEntry.java @@ -1,30 +1,3 @@ -/* -Copyright (c) 2009, Ingo Kofler, ITEC, Klagenfurt University, Austria - -Developed by Ingo Kofler (ingo.kofler@itec.uni-klu.ac.at) - -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) - */ - package rars.tools;//.bhtsim; /** diff --git a/src/rars/tools/BHTSimGUI.java b/src/rars/tools/BHTSimGUI.java index 44e5c2a9..854e7e2f 100644 --- a/src/rars/tools/BHTSimGUI.java +++ b/src/rars/tools/BHTSimGUI.java @@ -1,30 +1,3 @@ -/* -Copyright (c) 2009, Ingo Kofler, ITEC, Klagenfurt University, Austria - -Developed by Ingo Kofler (ingo.kofler@itec.uni-klu.ac.at) - -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) - */ - package rars.tools;//.bhtsim; import javax.swing.*; diff --git a/src/rars/tools/BHTSimulator.java b/src/rars/tools/BHTSimulator.java index d363daf8..1dc246c9 100644 --- a/src/rars/tools/BHTSimulator.java +++ b/src/rars/tools/BHTSimulator.java @@ -1,30 +1,3 @@ -/* -Copyright (c) 2009, Ingo Kofler, ITEC, Klagenfurt University, Austria - -Developed by Ingo Kofler (ingo.kofler@itec.uni-klu.ac.at) - -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) - */ - package rars.tools; import rars.ProgramStatement; diff --git a/src/rars/tools/BHTableModel.java b/src/rars/tools/BHTableModel.java index 1206a717..d7a09e66 100644 --- a/src/rars/tools/BHTableModel.java +++ b/src/rars/tools/BHTableModel.java @@ -1,30 +1,3 @@ -/* -Copyright (c) 2009, Ingo Kofler, ITEC, Klagenfurt University, Austria - -Developed by Ingo Kofler (ingo.kofler@itec.uni-klu.ac.at) - -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) - */ - package rars.tools;//.bhtsim; import javax.swing.table.AbstractTableModel; diff --git a/src/rars/tools/BitmapDisplay.java b/src/rars/tools/BitmapDisplay.java index 58808c71..a5d33b76 100644 --- a/src/rars/tools/BitmapDisplay.java +++ b/src/rars/tools/BitmapDisplay.java @@ -11,34 +11,6 @@ import java.awt.event.ActionListener; import java.util.Observable; -/* -Copyright (c) 2010-2011, 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) - */ - /** * Bitmapp display simulator. It can be run either as a stand-alone Java application having * access to the rars package, or through RARS as an item in its Tools menu. It makes @@ -60,7 +32,6 @@ public class BitmapDisplay extends AbstractToolAndApplication { // Some GUI settings private EmptyBorder emptyBorder = new EmptyBorder(4, 4, 4, 4); private Font countFonts = new Font("Times", Font.BOLD, 12); - private Color backgroundColor = Color.WHITE; // Values for Combo Boxes @@ -268,7 +239,6 @@ private JComponent buildOrganizationArea() { visualizationUnitPixelWidthSelector = new JComboBox<>(visualizationUnitPixelWidthChoices); visualizationUnitPixelWidthSelector.setEditable(false); - visualizationUnitPixelWidthSelector.setBackground(backgroundColor); visualizationUnitPixelWidthSelector.setSelectedIndex(defaultVisualizationUnitPixelWidthIndex); visualizationUnitPixelWidthSelector.setToolTipText("Width in pixels of rectangle representing memory word"); visualizationUnitPixelWidthSelector.addActionListener( @@ -281,7 +251,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationUnitPixelHeightSelector = new JComboBox<>(visualizationUnitPixelHeightChoices); visualizationUnitPixelHeightSelector.setEditable(false); - visualizationUnitPixelHeightSelector.setBackground(backgroundColor); visualizationUnitPixelHeightSelector.setSelectedIndex(defaultVisualizationUnitPixelHeightIndex); visualizationUnitPixelHeightSelector.setToolTipText("Height in pixels of rectangle representing memory word"); visualizationUnitPixelHeightSelector.addActionListener( @@ -294,7 +263,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationPixelWidthSelector = new JComboBox<>(displayAreaPixelWidthChoices); visualizationPixelWidthSelector.setEditable(false); - visualizationPixelWidthSelector.setBackground(backgroundColor); visualizationPixelWidthSelector.setSelectedIndex(defaultDisplayWidthIndex); visualizationPixelWidthSelector.setToolTipText("Total width in pixels of display area"); visualizationPixelWidthSelector.addActionListener( @@ -309,7 +277,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationPixelHeightSelector = new JComboBox<>(displayAreaPixelHeightChoices); visualizationPixelHeightSelector.setEditable(false); - visualizationPixelHeightSelector.setBackground(backgroundColor); visualizationPixelHeightSelector.setSelectedIndex(defaultDisplayHeightIndex); visualizationPixelHeightSelector.setToolTipText("Total height in pixels of display area"); visualizationPixelHeightSelector.addActionListener( @@ -324,7 +291,6 @@ public void actionPerformed(ActionEvent e) { }); displayBaseAddressSelector = new JComboBox<>(displayBaseAddressChoices); displayBaseAddressSelector.setEditable(false); - displayBaseAddressSelector.setBackground(backgroundColor); displayBaseAddressSelector.setSelectedIndex(defaultBaseAddressIndex); displayBaseAddressSelector.setToolTipText("Base address for display area (upper left corner)"); displayBaseAddressSelector.addActionListener( diff --git a/src/rars/tools/CacheSimulator.java b/src/rars/tools/CacheSimulator.java index 2c6bf884..72d685b5 100644 --- a/src/rars/tools/CacheSimulator.java +++ b/src/rars/tools/CacheSimulator.java @@ -16,34 +16,6 @@ import java.util.Observable; import java.util.Random; -/* -Copyright (c) 2003-2011, 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) - */ - /** * A data cache simulator. It can be run either as a stand-alone Java application having * access to the rars package, or through RARS as an item in its Tools menu. It makes @@ -74,7 +46,7 @@ public class CacheSimulator extends AbstractToolAndApplication { // Some GUI settings private EmptyBorder emptyBorder = new EmptyBorder(4, 4, 4, 4); private Font countFonts = new Font("Times", Font.BOLD, 12); - private Color backgroundColor = Color.WHITE; + private Color backgroundColor = super.getBackground(); // Values for Combo Boxes private int[] cacheBlockSizeChoicesInt, cacheBlockCountChoicesInt; @@ -163,13 +135,11 @@ public void itemStateChanged(ItemEvent e) { debug = e.getStateChange() == ItemEvent.SELECTED; resetLogDisplay(); logText.setEnabled(debug); - logText.setBackground(debug ? Color.WHITE : logPanel.getBackground()); } }); logPanel.add(logShow); logText = new JTextArea(5, 70); logText.setEnabled(debug); - logText.setBackground(debug ? Color.WHITE : logPanel.getBackground()); logText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); logText.setToolTipText("Displays cache activity log if enabled"); logScroll = new JScrollPane(logText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); @@ -186,7 +156,6 @@ private JComponent buildOrganizationArea() { organization.setBorder(otb); cachePlacementSelector = new JComboBox<>(placementPolicyChoices); cachePlacementSelector.setEditable(false); - cachePlacementSelector.setBackground(backgroundColor); cachePlacementSelector.setSelectedIndex(defaultPlacementPolicyIndex); cachePlacementSelector.addActionListener( new ActionListener() { @@ -198,12 +167,10 @@ public void actionPerformed(ActionEvent e) { cacheReplacementSelector = new JComboBox<>(replacementPolicyChoices); cacheReplacementSelector.setEditable(false); - cacheReplacementSelector.setBackground(backgroundColor); cacheReplacementSelector.setSelectedIndex(defaultReplacementPolicyIndex); cacheBlockSizeSelector = new JComboBox<>(cacheBlockSizeChoices); cacheBlockSizeSelector.setEditable(false); - cacheBlockSizeSelector.setBackground(backgroundColor); cacheBlockSizeSelector.setSelectedIndex(defaultCacheBlockSizeIndex); cacheBlockSizeSelector.addActionListener( new ActionListener() { @@ -214,7 +181,6 @@ public void actionPerformed(ActionEvent e) { }); cacheBlockCountSelector = new JComboBox<>(cacheBlockCountChoices); cacheBlockCountSelector.setEditable(false); - cacheBlockCountSelector.setBackground(backgroundColor); cacheBlockCountSelector.setSelectedIndex(defaultCacheBlockCountIndex); cacheBlockCountSelector.addActionListener( new ActionListener() { @@ -230,7 +196,6 @@ public void actionPerformed(ActionEvent e) { cacheSetSizeSelector = new JComboBox<>(cacheSetSizeChoices); cacheSetSizeSelector.setEditable(false); - cacheSetSizeSelector.setBackground(backgroundColor); cacheSetSizeSelector.setSelectedIndex(defaultCacheSetSizeIndex); cacheSetSizeSelector.addActionListener( new ActionListener() { @@ -286,7 +251,6 @@ public void actionPerformed(ActionEvent e) { cacheSizeDisplay = new JTextField(8); cacheSizeDisplay.setHorizontalAlignment(JTextField.RIGHT); cacheSizeDisplay.setEditable(false); - cacheSizeDisplay.setBackground(backgroundColor); cacheSizeDisplay.setFont(countFonts); cacheTotalSizeRow.add(cacheSizeDisplay, BorderLayout.EAST); updateCacheSizeDisplay(); @@ -315,7 +279,6 @@ private JComponent buildPerformanceArea() { memoryAccessCountDisplay = new JTextField(10); memoryAccessCountDisplay.setHorizontalAlignment(JTextField.RIGHT); memoryAccessCountDisplay.setEditable(false); - memoryAccessCountDisplay.setBackground(backgroundColor); memoryAccessCountDisplay.setFont(countFonts); memoryAccessCountRow.add(memoryAccessCountDisplay, BorderLayout.EAST); @@ -325,7 +288,6 @@ private JComponent buildPerformanceArea() { cacheHitCountDisplay = new JTextField(10); cacheHitCountDisplay.setHorizontalAlignment(JTextField.RIGHT); cacheHitCountDisplay.setEditable(false); - cacheHitCountDisplay.setBackground(backgroundColor); cacheHitCountDisplay.setFont(countFonts); cacheHitCountRow.add(cacheHitCountDisplay, BorderLayout.EAST); @@ -335,7 +297,6 @@ private JComponent buildPerformanceArea() { cacheMissCountDisplay = new JTextField(10); cacheMissCountDisplay.setHorizontalAlignment(JTextField.RIGHT); cacheMissCountDisplay.setEditable(false); - cacheMissCountDisplay.setBackground(backgroundColor); cacheMissCountDisplay.setFont(countFonts); cacheMissCountRow.add(cacheMissCountDisplay, BorderLayout.EAST); @@ -345,7 +306,6 @@ private JComponent buildPerformanceArea() { cacheHitRateDisplay = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100); cacheHitRateDisplay.setStringPainted(true); cacheHitRateDisplay.setForeground(Color.BLUE); - cacheHitRateDisplay.setBackground(backgroundColor); cacheHitRateDisplay.setFont(countFonts); cacheHitRateRow.add(cacheHitRateDisplay, BorderLayout.EAST); @@ -854,8 +814,7 @@ private class Animation { private JTextField[] blocks; public final Color hitColor = Color.GREEN; public final Color missColor = Color.RED; - public final Color defaultColor = Color.WHITE; - + public final Color defaultColor = backgroundColor; public Animation() { animation = Box.createVerticalBox(); } diff --git a/src/rars/tools/ConversionTool.java b/src/rars/tools/ConversionTool.java new file mode 100644 index 00000000..68582a46 --- /dev/null +++ b/src/rars/tools/ConversionTool.java @@ -0,0 +1,251 @@ +package rars.tools; + +import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import java.awt.*; + +public class ConversionTool { + private boolean updating = false; + + /** + * Creates a panel containing the conversion tool. + * + * @return A JPanel containing the conversion tool. + */ + + public JPanel createConversionToolPanel() { + JPanel panel = new JPanel(); + panel.setLayout(new FlowLayout()); + + // Create labels and text fields for each format + JLabel decimalLabel = new JLabel("Dec:"); + JTextField decimalField = new JTextField(5); + decimalField.setToolTipText("Enter a decimal number (e.g., 97)"); + + JLabel hexLabel = new JLabel("Hex:"); + JTextField hexField = new JTextField(7); + hexField.setToolTipText("Enter a hexadecimal number with or without '0x' prefix (e.g., 0x61)"); + + JLabel binaryLabel = new JLabel("Bin:"); + JTextField binaryField = new JTextField(10); + binaryField.setToolTipText("Enter a binary number with or without '0b' prefix (e.g., 0b01100001)"); + + JLabel charLabel = new JLabel("ASCII:"); + JTextField charField = new JTextField(2); + charField.setToolTipText("Enter a single character (e.g., a)"); + + // Add labels and text fields to the panel + panel.add(decimalLabel); + panel.add(decimalField); + panel.add(hexLabel); + panel.add(hexField); + panel.add(binaryLabel); + panel.add(binaryField); + panel.add(charLabel); + panel.add(charField); + + // Document Listeners to the all formats text fields to update it when the user types + addDocumentListeners(decimalField, hexField, binaryField, charField); + + return panel; + } + + /** + * Adds document listeners to the text fields to update the other fields when the user types. + * + * @param decimalField The decimal text field. + * @param hexField The hexadecimal text field. + * @param binaryField The binary text field. + * @param charField The character text field. + */ + private void addDocumentListeners(JTextField decimalField, JTextField hexField, JTextField binaryField, JTextField charField) { + decimalField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + updateFromDecimal(decimalField, hexField, binaryField, charField); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updateFromDecimal(decimalField, hexField, binaryField, charField); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updateFromDecimal(decimalField, hexField, binaryField, charField); + } + }); + + hexField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + updateFromHex(hexField, decimalField, binaryField, charField); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updateFromHex(hexField, decimalField, binaryField, charField); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updateFromHex(hexField, decimalField, binaryField, charField); + } + }); + + binaryField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + updateFromBinary(binaryField, decimalField, hexField, charField); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updateFromBinary(binaryField, decimalField, hexField, charField); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updateFromBinary(binaryField, decimalField, hexField, charField); + } + }); + + charField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + updateFromChar(charField, decimalField, hexField, binaryField); + } + + @Override + public void removeUpdate(DocumentEvent e) { + updateFromChar(charField, decimalField, hexField, binaryField); + } + + @Override + public void changedUpdate(DocumentEvent e) { + updateFromChar(charField, decimalField, hexField, binaryField); + } + }); + } + + /** + * Updates the other fields when the decimal field is changed. + * + * @param decimalField The decimal text field. + * @param hexField The hexadecimal text field. + * @param binaryField The binary text field. + * @param charField The character text field. + */ + private void updateFromDecimal(JTextField decimalField, JTextField hexField, JTextField binaryField, JTextField charField) { + if (updating) return; + updating = true; + try { + int decimal = Integer.parseInt(decimalField.getText()); + hexField.setText("0x" + Integer.toHexString(decimal)); + binaryField.setText("0b" + Integer.toBinaryString(decimal)); + if (decimal <= 127) + charField.setText(Character.toString((char) decimal)); + else + charField.setText(""); + } catch (NumberFormatException ex) { + hexField.setText(""); + binaryField.setText(""); + charField.setText(""); + } + updating = false; + } + + /** + * Updates the other fields when the hexadecimal field is changed. + * + * @param hexField The hexadecimal text field. + * @param decimalField The decimal text field. + * @param binaryField The binary text field. + * @param charField The character text field. + */ + private void updateFromHex(JTextField hexField, JTextField decimalField, JTextField binaryField, JTextField charField) { + if (updating) return; + updating = true; + try { + String hexInput = hexField.getText(); + if (hexInput.startsWith("0x")) { + hexInput = hexInput.substring(2); + } + int decimal = Integer.parseInt(hexInput, 16); + decimalField.setText(Integer.toString(decimal)); + binaryField.setText("0b" + Integer.toBinaryString(decimal)); + if (decimal <= 127) + charField.setText(Character.toString((char) decimal)); + else + charField.setText(""); + } catch (NumberFormatException ex) { + decimalField.setText(""); + binaryField.setText(""); + charField.setText(""); + } + updating = false; + } + + /** + * Updates the other fields when the binary field is changed. + * + * @param binaryField The binary text field. + * @param decimalField The decimal text field. + * @param hexField The hexadecimal text field. + * @param charField The character text field. + */ + private void updateFromBinary(JTextField binaryField, JTextField decimalField, JTextField hexField, JTextField charField) { + if (updating) return; + updating = true; + try { + String binaryInput = binaryField.getText(); + if (binaryInput.startsWith("0b")) { + binaryInput = binaryInput.substring(2); + } + int decimal = Integer.parseInt(binaryInput, 2); + decimalField.setText(Integer.toString(decimal)); + hexField.setText("0x" + Integer.toHexString(decimal)); + if (decimal <= 127) + charField.setText(Character.toString((char) decimal)); + else + charField.setText(""); + } catch (NumberFormatException ex) { + decimalField.setText(""); + hexField.setText(""); + charField.setText(""); + } + updating = false; + } + + /** + * Updates the other fields when the character field is changed. + * + * @param charField The character text field. + * @param decimalField The decimal text field. + * @param hexField The hexadecimal text field. + * @param binaryField The binary text field. + */ + private void updateFromChar(JTextField charField, JTextField decimalField, JTextField hexField, JTextField binaryField) { + if (updating) return; + updating = true; + try { + if (charField.getText().length() > 0) { + char character = charField.getText().charAt(0); + int decimal = (int) character; + decimalField.setText(Integer.toString(decimal)); + hexField.setText("0x" + Integer.toHexString(decimal)); + binaryField.setText("0b" + Integer.toBinaryString(decimal)); + } else { + decimalField.setText(""); + hexField.setText(""); + binaryField.setText(""); + } + } catch (Exception ex) { + decimalField.setText(""); + hexField.setText(""); + binaryField.setText(""); + } + updating = false; + } +} \ No newline at end of file diff --git a/src/rars/tools/DigitalLabSim.java b/src/rars/tools/DigitalLabSim.java index 8ef7f915..23c1bd8c 100644 --- a/src/rars/tools/DigitalLabSim.java +++ b/src/rars/tools/DigitalLabSim.java @@ -1,6 +1,6 @@ package rars.tools; -import rars.Globals; +import rars.*; import rars.riscv.hardware.*; import rars.util.Binary; @@ -28,6 +28,7 @@ public class DigitalLabSim extends AbstractToolAndApplication { // GUI Interface. private static JPanel panelTools; + private Color backgroundColor = super.getBackground(); // Seven Segment display private SevenSegmentPanel sevenSegPanel; // Keyboard @@ -305,7 +306,7 @@ public HexaKeyboard() { button = new JButton[16]; for (i = 0; i < 16; i++) { button[i] = new JButton(Integer.toHexString(i)); - button[i].setBackground(Color.WHITE); + button[i].setBackground(backgroundColor); button[i].setMargin(new Insets(10, 10, 10, 10)); button[i].addMouseListener(new EcouteurClick(i)); this.add(button[i]); @@ -316,7 +317,7 @@ public void resetHexaKeyboard() { int i; KeyBoardValueButtonClick = -1; for (i = 0; i < 16; i++) { - button[i].setBackground(Color.WHITE); + button[i].setBackground(backgroundColor); } } @@ -345,10 +346,11 @@ public void mouseClicked(MouseEvent arg0) { KeyBoardValueButtonClick = -1; updateMMIOControlAndData(OUT_ADRESS_HEXA_KEYBOARD, 0); for (i = 0; i < 16; i++) - button[i].setBackground(Color.WHITE); + button[i].setBackground(backgroundColor); } else { // new button pressed KeyBoardValueButtonClick = buttonValue; - button[KeyBoardValueButtonClick].setBackground(Color.GREEN); + Color ColorButtonPressed = Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED) ? new Color(0x00,0x66,0x55) : Color.GREEN; + button[KeyBoardValueButtonClick].setBackground(ColorButtonPressed); if (KeyboardInterruptOnOff) { InterruptController.registerExternalInterrupt(EXTERNAL_INTERRUPT_HEXA_KEYBOARD); } diff --git a/src/rars/tools/FloatRepresentation.java b/src/rars/tools/FloatRepresentation.java index e3f13fcc..83910f6c 100644 --- a/src/rars/tools/FloatRepresentation.java +++ b/src/rars/tools/FloatRepresentation.java @@ -1,6 +1,6 @@ package rars.tools; -import rars.Globals; +import rars.*; import rars.riscv.hardware.AccessNotice; import rars.riscv.hardware.FloatingPointRegisterFile; import rars.riscv.hardware.Register; @@ -15,34 +15,6 @@ import java.awt.event.KeyEvent; import java.util.Observable; - /* -Copyright (c) 2003-2006, 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) - */ - /** * Tool to help students learn about IEEE 754 representation of 32 bit * floating point values. This representation is used by the "float" @@ -66,16 +38,15 @@ public class FloatRepresentation extends AbstractToolAndApplication { private static final int maxLengthBinaryFraction = 23; private static final int maxLengthBinaryTotal = maxLengthBinarySign + maxLengthBinaryExponent + maxLengthBinaryFraction; private static final int maxLengthDecimal = 20; - private static final String denormalizedLabel = " significand (denormalized - no 'hidden bit')"; + private static final String denormalizedLabel = " significand (subnormal - no 'hidden bit')"; private static final String normalizedLabel = " significand ('hidden bit' underlined) "; private static final Font instructionsFont = new Font("Arial", Font.PLAIN, 14); private static final Font hexDisplayFont = new Font("Courier", Font.PLAIN, 32); private static final Font binaryDisplayFont = new Font("Courier", Font.PLAIN, 18); private static final Font decimalDisplayFont = new Font("Courier", Font.PLAIN, 18); private static final Color hexDisplayColor = Color.red; - private static final Color binaryDisplayColor = Color.black; - private static final Color decimalDisplayColor = Color.blue; - private static final String expansionFontTag = ""; + private static final String expansionFontTagLight = ""; + private static final String expansionFontTagDark = ""; private static final String instructionFontTag = ""; private static final int exponentBias = 127; // 32 bit floating point exponent bias @@ -222,7 +193,6 @@ protected JComponent buildDisplayArea() { binarySignDisplay = new JTextField(defaultBinarySign, maxLengthBinarySign + 1); binarySignDisplay.setFont(binaryDisplayFont); - binarySignDisplay.setForeground(binaryDisplayColor); binarySignDisplay.setHorizontalAlignment(JTextField.RIGHT); binarySignDisplay.setToolTipText("The sign bit"); binarySignDisplay.setEditable(true); @@ -230,7 +200,6 @@ protected JComponent buildDisplayArea() { binaryExponentDisplay = new JTextField(defaultBinaryExponent, maxLengthBinaryExponent + 1); binaryExponentDisplay.setFont(binaryDisplayFont); - binaryExponentDisplay.setForeground(binaryDisplayColor); binaryExponentDisplay.setHorizontalAlignment(JTextField.RIGHT); binaryExponentDisplay.setToolTipText("" + maxLengthBinaryExponent + "-bit exponent"); binaryExponentDisplay.setEditable(true); @@ -238,7 +207,6 @@ protected JComponent buildDisplayArea() { binaryFractionDisplay = new BinaryFractionDisplayTextField(defaultBinaryFraction, maxLengthBinaryFraction + 1); binaryFractionDisplay.setFont(binaryDisplayFont); - binaryFractionDisplay.setForeground(binaryDisplayColor); binaryFractionDisplay.setHorizontalAlignment(JTextField.RIGHT); binaryFractionDisplay.setToolTipText("" + maxLengthBinaryFraction + "-bit fraction"); binaryFractionDisplay.setEditable(true); @@ -286,7 +254,7 @@ protected JComponent buildDisplayArea() { // Editable display for decimal version of float value. decimalDisplay = new JTextField(defaultDecimal, maxLengthDecimal + 1); decimalDisplay.setFont(decimalDisplayFont); - decimalDisplay.setForeground(decimalDisplayColor); + decimalDisplay.setForeground(Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED)? new Color(0x66,0xCC,0xFF) : Color.blue); decimalDisplay.setHorizontalAlignment(JTextField.RIGHT); decimalDisplay.setToolTipText("Decimal floating point value"); decimalDisplay.setMargin(new Insets(0, 0, 0, 0)); @@ -303,11 +271,10 @@ protected JComponent buildDisplayArea() { JPanel place2 = new JPanel(rightPanelLayout); JPanel place3 = new JPanel(rightPanelLayout); JPanel place4 = new JPanel(rightPanelLayout); - + String expansionFontTag = Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED) ? expansionFontTagDark : expansionFontTagLight; JEditorPane hexExplain = new JEditorPane("text/html", expansionFontTag + "<  Hexadecimal representation" + ""); hexExplain.setEditable(false); hexExplain.setFocusable(false); - hexExplain.setForeground(Color.black); hexExplain.setBackground(place1.getBackground()); JEditorPane hexToBinExplain = new JEditorPane("text/html", expansionFontTag + "<  Each hex digit represents 4 bits" + ""); hexToBinExplain.setEditable(false); @@ -530,10 +497,10 @@ private FlavorsOfFloat buildOneFromInt(int intValue) { public String buildExpansionFromBinaryString(String binaryString) { int biasedExponent = Binary.binaryStringToInt( binaryString.substring(maxLengthBinarySign, maxLengthBinarySign + maxLengthBinaryExponent)); - String stringExponent = Integer.toString(biasedExponent - exponentBias); + String stringExponent = Integer.toString(biasedExponent == 0 ? -126 : biasedExponent - exponentBias); // stringExponent length will range from 1 to 4 (e.g. "0" to "-128") characters. // Right-pad with HTML spaces (" ") to total length 5 displayed characters. - return "" + expansionFontTag + return "" + (Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED) ? expansionFontTagDark : expansionFontTagLight) + "-1" + binaryString.substring(0, maxLengthBinarySign) + "  *  2" + stringExponent + HTMLspaces.substring(0, (5 - stringExponent.length()) * 6) + "  *  " @@ -822,6 +789,7 @@ public void paintComponent(Graphics g) { // class BinaryToDecimalFormulaGraphic extends JPanel { final String subtractLabelTrailer = " - 127"; + final String subnormalLabel = "-126"; final int arrowHeadOffset = 5; final int lowerY = 0; final int upperY = 50; @@ -884,7 +852,7 @@ private void drawSubtractLabel(Graphics g, String label) { // format the label for a given integer exponent value... private String buildSubtractLabel(int value) { - return Integer.toString(value) + subtractLabelTrailer; + return (value == 0) ? subnormalLabel : Integer.toString(value) + subtractLabelTrailer; } } @@ -974,4 +942,4 @@ public void paintComponent(Graphics g) { } } -} \ No newline at end of file +} diff --git a/src/rars/tools/InstructionCounter.java b/src/rars/tools/InstructionCounter.java index bcf84694..9ad3f169 100644 --- a/src/rars/tools/InstructionCounter.java +++ b/src/rars/tools/InstructionCounter.java @@ -1,29 +1,3 @@ -/* -Copyright (c) 2008, Felipe Lessa - -Developed by Felipe Lessa (felipe.lessa@gmail.com) - -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) - */ package rars.tools; import rars.ProgramStatement; diff --git a/src/rars/tools/InstructionMemoryDump.java b/src/rars/tools/InstructionMemoryDump.java index 0a680c42..79c4ac51 100644 --- a/src/rars/tools/InstructionMemoryDump.java +++ b/src/rars/tools/InstructionMemoryDump.java @@ -1,30 +1,3 @@ -/* - Copyright (c) 2019, John Owens - - Developed by John Owens (jowens@ece.ucdavis.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) -*/ - /** * Instructions for use * diff --git a/src/rars/tools/InstructionStatistics.java b/src/rars/tools/InstructionStatistics.java index ef96d88d..3e26093e 100644 --- a/src/rars/tools/InstructionStatistics.java +++ b/src/rars/tools/InstructionStatistics.java @@ -1,30 +1,3 @@ -/* -Copyright (c) 2009, Ingo Kofler, ITEC, Klagenfurt University, Austria - -Developed by Ingo Kofler (ingo.kofler@itec.uni-klu.ac.at) -Based on the Instruction Counter tool by Felipe Lessa (felipe.lessa@gmail.com) - -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) - */ package rars.tools; import rars.ProgramStatement; diff --git a/src/rars/tools/KeyboardAndDisplaySimulator.java b/src/rars/tools/KeyboardAndDisplaySimulator.java index 4b8d9c25..a96d4a89 100644 --- a/src/rars/tools/KeyboardAndDisplaySimulator.java +++ b/src/rars/tools/KeyboardAndDisplaySimulator.java @@ -18,35 +18,6 @@ import java.util.Observable; import java.util.Random; - -/* -Copyright (c) 2003-2014, 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) - */ - // TODO: make an example that uses this. I'm not sure it wasn't broken in the porting process. /** diff --git a/src/rars/tools/MemoryReferenceVisualization.java b/src/rars/tools/MemoryReferenceVisualization.java index d0b55f11..63991b1a 100644 --- a/src/rars/tools/MemoryReferenceVisualization.java +++ b/src/rars/tools/MemoryReferenceVisualization.java @@ -1,5 +1,6 @@ package rars.tools; +import rars.*; import rars.riscv.hardware.AccessNotice; import rars.riscv.hardware.Memory; import rars.riscv.hardware.MemoryAccessNotice; @@ -14,34 +15,6 @@ import java.util.Arrays; import java.util.Observable; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Memory reference visualization. It can be run either as a stand-alone Java application having * access to the rars package, or through RARS as an item in its Tools menu. It makes @@ -64,7 +37,6 @@ public class MemoryReferenceVisualization extends AbstractToolAndApplication { // Some GUI settings private EmptyBorder emptyBorder = new EmptyBorder(4, 4, 4, 4); private Font countFonts = new Font("Times", Font.BOLD, 12); - private Color backgroundColor = Color.WHITE; // Values for Combo Boxes @@ -93,7 +65,7 @@ public class MemoryReferenceVisualization extends AbstractToolAndApplication { // This array of (count,color) pairs must be kept sorted! count is low end of subrange. // This array will grow if user adds colors at additional counter points (see below). private CounterColor[] defaultCounterColors = - {new CounterColor(0, Color.black), + {new CounterColor(0, Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED) ? Color.white: Color.black), new CounterColor(1, Color.blue), new CounterColor(2, Color.green), new CounterColor(3, Color.yellow), @@ -297,7 +269,6 @@ public void actionPerformed(ActionEvent e) { }); wordsPerUnitSelector = new JComboBox<>(wordsPerUnitChoices); wordsPerUnitSelector.setEditable(false); - wordsPerUnitSelector.setBackground(backgroundColor); wordsPerUnitSelector.setSelectedIndex(defaultWordsPerUnitIndex); wordsPerUnitSelector.setToolTipText("Number of memory words represented by one visualization element (rectangle)"); wordsPerUnitSelector.addActionListener( @@ -309,7 +280,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationUnitPixelWidthSelector = new JComboBox<>(visualizationUnitPixelWidthChoices); visualizationUnitPixelWidthSelector.setEditable(false); - visualizationUnitPixelWidthSelector.setBackground(backgroundColor); visualizationUnitPixelWidthSelector.setSelectedIndex(defaultVisualizationUnitPixelWidthIndex); visualizationUnitPixelWidthSelector.setToolTipText("Width in pixels of rectangle representing memory access"); visualizationUnitPixelWidthSelector.addActionListener( @@ -322,7 +292,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationUnitPixelHeightSelector = new JComboBox<>(visualizationUnitPixelHeightChoices); visualizationUnitPixelHeightSelector.setEditable(false); - visualizationUnitPixelHeightSelector.setBackground(backgroundColor); visualizationUnitPixelHeightSelector.setSelectedIndex(defaultVisualizationUnitPixelHeightIndex); visualizationUnitPixelHeightSelector.setToolTipText("Height in pixels of rectangle representing memory access"); visualizationUnitPixelHeightSelector.addActionListener( @@ -335,7 +304,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationPixelWidthSelector = new JComboBox<>(displayAreaPixelWidthChoices); visualizationPixelWidthSelector.setEditable(false); - visualizationPixelWidthSelector.setBackground(backgroundColor); visualizationPixelWidthSelector.setSelectedIndex(defaultDisplayWidthIndex); visualizationPixelWidthSelector.setToolTipText("Total width in pixels of visualization area"); visualizationPixelWidthSelector.addActionListener( @@ -351,7 +319,6 @@ public void actionPerformed(ActionEvent e) { }); visualizationPixelHeightSelector = new JComboBox<>(displayAreaPixelHeightChoices); visualizationPixelHeightSelector.setEditable(false); - visualizationPixelHeightSelector.setBackground(backgroundColor); visualizationPixelHeightSelector.setSelectedIndex(defaultDisplayHeightIndex); visualizationPixelHeightSelector.setToolTipText("Total height in pixels of visualization area"); visualizationPixelHeightSelector.addActionListener( @@ -367,7 +334,6 @@ public void actionPerformed(ActionEvent e) { }); displayBaseAddressSelector = new JComboBox<>(displayBaseAddressChoices); displayBaseAddressSelector.setEditable(false); - displayBaseAddressSelector.setBackground(backgroundColor); displayBaseAddressSelector.setSelectedIndex(defaultBaseAddressIndex); displayBaseAddressSelector.setToolTipText("Base address for visualization area (upper left corner)"); displayBaseAddressSelector.addActionListener( diff --git a/src/rars/tools/TimerTool.java b/src/rars/tools/TimerTool.java index 99213e2a..2b3d6faf 100644 --- a/src/rars/tools/TimerTool.java +++ b/src/rars/tools/TimerTool.java @@ -1,28 +1,3 @@ -/* -Developed by Zachary Selk at the University of Alberta (zrselk@gmail.com) - -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) -*/ - package rars.tools; import rars.Globals; diff --git a/src/rars/tools/Tool.java b/src/rars/tools/Tool.java index 9d64be37..5dbd420c 100644 --- a/src/rars/tools/Tool.java +++ b/src/rars/tools/Tool.java @@ -1,34 +1,5 @@ package rars.tools; -/* -Copyright (c) 2003-2006, 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) - */ - - /** * Interface for any tool that interacts with an executing program. * A qualifying tool must be a class in the Tools package that diff --git a/src/rars/util/Binary.java b/src/rars/util/Binary.java index 5577f456..e9df75fc 100644 --- a/src/rars/util/Binary.java +++ b/src/rars/util/Binary.java @@ -4,34 +4,6 @@ import java.util.Arrays; - /* -Copyright (c) 2003-2006, 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) - */ - /** * Some utility methods for working with binary representations. * @@ -294,6 +266,34 @@ public static String intToHexString(int d) { return t; } + public static String intToHexString(long d, int length) { + String leadingZero = new String("0"); + String leadingX = new String("0x"); + String t = Long.toUnsignedString(d, 16); + if (t.length() > 2*length) { + // drop possible leading FF when negative number are used + t = t.substring(t.length() - 2*length); + } + while (t.length() < 2*length) + t = leadingZero.concat(t); + + t = leadingX.concat(t); + return t; + } + + /** + * Perform a sign extension of `length` bytes of `d` as a whole 64bit long value. + * */ + public static long signExtension(long d, int length) { + int l = (8-length)*8; + return (d << l) >> l; + } + + public static String intToDecString(long d, int length) { + d = signExtension(d, length); + return Long.toString(d); + } + /** * Returns a 6 character string representing the 16-bit hexadecimal equivalent of the * given integer value. First two characters are "0x". It assumes value will "fit" @@ -354,8 +354,12 @@ public static String unsignedIntToIntString(int d) { * @return String that represents ASCII equivalent */ public static String intToAscii(int d) { + return intToAscii(d, 4); + } + + public static String intToAscii(long d, int length) { StringBuilder result = new StringBuilder(8); - for (int i = 3; i >= 0; i--) { + for (int i = length-1; i >= 0; i--) { int byteValue = getByte(d, i); result.append((byteValue < Globals.ASCII_TABLE.length) ? Globals.ASCII_TABLE[byteValue] : Globals.ASCII_NON_PRINT); } @@ -414,6 +418,18 @@ public static Integer stringToIntFast(String s){ return null; } } + }else if(s.length() > 2+i && s.charAt(i) == '0' && (s.charAt(i+1) == 'b' || s.charAt(i+1) == 'B')) { // Binary case + if(s.length() > 32+2+i) return null; // This must overflow or contain invalid characters + i += 2; + for(; i < s.length(); i++) { + char c = s.charAt(i); + result *= 2; + if ('0' <= c && c <= '1') { + result += c - '0'; + } else { + return null; + } + } }else if (first == '0'){ // Octal case if(s.length() > 12+i) return null; // This must overflow or contain invalid characters for(; i < s.length(); i++){ @@ -604,8 +620,10 @@ public static int setByte(int value, int bite, int replace) { * @return zero-extended byte value in low order byte. **/ - public static int getByte(int value, int bite) { - return value << ((3 - bite) << 3) >>> 24; + public static int getByte(long value, int bite) { + int v = (int)(value >>> (bite*8)) & 0xFF; + return v; + //return (int)(value << ((3 - bite) << 3) >>> 24); } // KENV 1/4/05 diff --git a/src/rars/util/EditorFont.java b/src/rars/util/EditorFont.java index be2bc26f..f00179e8 100644 --- a/src/rars/util/EditorFont.java +++ b/src/rars/util/EditorFont.java @@ -5,34 +5,6 @@ import java.awt.*; import java.util.Arrays; - /* -Copyright (c) 2003-2009, 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) - */ - /** * Specialized Font class designed to be used by both the * settings menu methods and the Settings class. diff --git a/src/rars/util/FilenameFinder.java b/src/rars/util/FilenameFinder.java index 1504e7d8..baca891f 100644 --- a/src/rars/util/FilenameFinder.java +++ b/src/rars/util/FilenameFinder.java @@ -12,34 +12,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -/* -Copyright (c) 2003-2008, 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) - */ - /** * Utility class to perform necessary file-related search * operations. One is to find file names in JAR file, diff --git a/src/rars/util/MemoryDump.java b/src/rars/util/MemoryDump.java index ed5847b0..746d4671 100644 --- a/src/rars/util/MemoryDump.java +++ b/src/rars/util/MemoryDump.java @@ -2,33 +2,6 @@ import rars.riscv.hardware.Memory; - /* -Copyright (c) 2003-2009, 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) - */ // TODO: refactor this out of existance public class MemoryDump { private static final String[] segmentNames = {".text", ".data"}; diff --git a/src/rars/util/PropertiesFile.java b/src/rars/util/PropertiesFile.java index 71859f48..382e63a7 100644 --- a/src/rars/util/PropertiesFile.java +++ b/src/rars/util/PropertiesFile.java @@ -4,34 +4,6 @@ import java.io.InputStream; import java.util.Properties; - /* -Copyright (c) 2003-2006, 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) - */ - /** * Provides means to work with ".properties" files which are used to store * various RARS settings. diff --git a/src/rars/util/SystemIO.java b/src/rars/util/SystemIO.java index 3b9b4126..593266dd 100644 --- a/src/rars/util/SystemIO.java +++ b/src/rars/util/SystemIO.java @@ -1,40 +1,14 @@ package rars.util; +import rars.CancelException; import rars.Globals; import rars.Settings; +import rars.SimulationException; import java.io.*; import java.nio.channels.FileChannel; import java.nio.charset.StandardCharsets; - /* -Copyright (c) 2003-2013, 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) - */ - /** * Provides standard i/o services needed to simulate the RISCV syscall * routines. These methods will detect whether the simulator is being @@ -76,6 +50,12 @@ public class SystemIO { private static final int STDOUT = 1; private static final int STDERR = 2; + // special result of readChar + /** End of stream reached */ + public static final int EOF = -1; + /** the character is not a printable ASCII */ + public static final int NOTASCII = -2; + /** * Implements syscall to read an integer value. * Client is responsible for catching NumberFormatException. @@ -84,13 +64,21 @@ public class SystemIO { * @return int value corresponding to user input */ - public static int readInteger(int serviceNumber) { + public static int readInteger(int serviceNumber) throws CancelException { String input = readStringInternal("0", "Enter an integer value (syscall " + serviceNumber + ")", -1); // Client is responsible for catching NumberFormatException + if (input == null) throw new CancelException(); return Integer.parseInt(input.trim()); } - private static String readStringInternal(String init, String prompt, int maxlength) { + public static long readLong(int serviceNumber) throws CancelException { + String input = readStringInternal("0", "Enter an integer value (syscall " + serviceNumber + ")", -1); + // Client is responsible for catching NumberFormatException + if (input == null) throw new CancelException(); + return Long.parseLong(input.trim()); + } + + private static String readStringInternal(String init, String prompt, int maxlength) throws CancelException { String input = init; if (Globals.getGui() == null) { try { @@ -102,6 +90,13 @@ private static String readStringInternal(String init, String prompt, int maxleng } else { if (Globals.getSettings().getBooleanSetting(Settings.Bool.POPUP_SYSCALL_INPUT)) { input = Globals.getGui().getMessagesPane().getInputString(prompt); + } else if (!Globals.getGui().getMessagesPane().isInteractiveMode()) { + try { + input = getInputReaderFromGui().readLine(); + if (input == null) + input = ""; + } catch (IOException e) { // as above + } } else { input = Globals.getGui().getMessagesPane().getInputString(maxlength); } @@ -117,7 +112,7 @@ private static String readStringInternal(String init, String prompt, int maxleng * @return float value corresponding to user input * Feb 14 2005 Ken Vollmar */ - public static float readFloat(int serviceNumber) { + public static float readFloat(int serviceNumber) throws CancelException { String input = readStringInternal("0", "Enter a float value (syscall " + serviceNumber + ")", -1); return Float.parseFloat(input.trim()); } @@ -130,7 +125,7 @@ public static float readFloat(int serviceNumber) { * @return double value corresponding to user input * Feb 14 2005 Ken Vollmar */ - public static double readDouble(int serviceNumber) { + public static double readDouble(int serviceNumber) throws CancelException { String input = readStringInternal("0", "Enter a Double value (syscall " + serviceNumber + ")", -1); return Double.parseDouble(input.trim()); } @@ -158,7 +153,7 @@ public static void printString(String string) { * @param maxLength the maximum string length * @return the entered string, truncated to maximum length if necessary */ - public static String readString(int serviceNumber, int maxLength) { + public static String readString(int serviceNumber, int maxLength) throws CancelException { String input = readStringInternal("", "Enter a string of maximum length " + maxLength + " (syscall " + serviceNumber + ")", maxLength); if (input.endsWith("\n")) { @@ -175,26 +170,45 @@ public static String readString(int serviceNumber, int maxLength) { /** * Implements syscall having 12 in $v0, to read a char value. + * Only printable characters are accepted (9, 10, and 32 to 126). * * @param serviceNumber the number assigned to Read Char syscall (default 12) - * @return int value with lowest byte corresponding to user input + * @return int value with lowest byte corresponding to user input, EOF on end of data, or NOTASCII on invalid ASCII character. */ - public static int readChar(int serviceNumber) { - int returnValue = 0; + public static int readChar(int serviceNumber) throws CancelException { + int returnValue; - String input = readStringInternal("0", "Enter a character value (syscall " + serviceNumber + ")", 1); - // The whole try-catch is not really necessary in this case since I'm - // just propagating the runtime exception (the default behavior), but - // I want to make it explicit. The client needs to catch it. - try { - returnValue = (int) (input.charAt(0)); // first character input - } catch (IndexOutOfBoundsException e) // no chars present - { - throw e; // was: returnValue = 0; + if (Globals.getGui() == null) { + try { + //Read the next char from the buffered input reader + returnValue = getInputReader().read(); + if (returnValue == -1) + returnValue = EOF; + } catch (IOException e) { + returnValue = EOF; + } + } else if (Globals.getSettings().getBooleanSetting(Settings.Bool.POPUP_SYSCALL_INPUT)) { + // Need a popup? + String input = readStringInternal("0", "Enter a character value (syscall " + serviceNumber + ")", 1); + if (input.length()>0) + returnValue = input.getBytes(StandardCharsets.UTF_8) [0] & 0xFF; // truncate + else + returnValue = EOF; // assume EOF on empty string + } else { + // Otherwise delegate to the Read syscall + byte[] input = new byte[1]; + int len = readFromFile(0, input, 1); + if (len>0) + returnValue = input[0] & 0xFF; + else + returnValue = EOF; } - return returnValue; + if ((returnValue < 32 || returnValue >= 127) && returnValue != -1 && returnValue != '\n' && returnValue != '\t') { + return NOTASCII; + } + return returnValue; } @@ -254,6 +268,20 @@ public static int writeToFile(int fd, byte[] myBuffer, int lengthRequested) { } // end writeToFile + /** + * Read bytes from string in a byte buffer + * + * @param input input to read + * @param buffer byte array to contain bytes read + * @return number of bytes read + */ + private static int readInBuffer(String input, byte[] buffer) { + byte[] bytesRead = input.getBytes(); + for (int i = 0; i < buffer.length; i++) { + buffer[i] = (i < bytesRead.length) ? bytesRead[i] : 0; + } + return Math.min(buffer.length, bytesRead.length); + } /** * Read bytes from file. @@ -268,13 +296,23 @@ public static int readFromFile(int fd, byte[] myBuffer, int lengthRequested) { /////////////// DPS 8-Jan-2013 ////////////////////////////////////////////////// /// Read from STDIN file descriptor while using IDE - get input from Messages pane. if (fd == STDIN && Globals.getGui() != null) { - String input = Globals.getGui().getMessagesPane().getInputString(lengthRequested); - byte[] bytesRead = input.getBytes(); - - for (int i = 0; i < myBuffer.length; i++) { - myBuffer[i] = (i < bytesRead.length) ? bytesRead[i] : 0; + //asks user for input in run pane + if (Globals.getGui().getMessagesPane().isInteractiveMode()) { + String input = Globals.getGui().getMessagesPane().getInputString(lengthRequested); + return readInBuffer(input, myBuffer); + //takes input from input pane + } else { + try { + char[] chars = new char[lengthRequested]; + int len = getInputReaderFromGui().read(chars); + if (len <= 0) return len; + String input = new String(chars); + return readInBuffer(input, myBuffer); + } catch (IOException e) { + fileErrorString = "IO Exception on read from the input window of GUI"; + return -1; + } } - return Math.min(myBuffer.length, bytesRead.length); } //////////////////////////////////////////////////////////////////////////////////// //// When running in command mode, code below works for either regular file or STDIN @@ -420,9 +458,11 @@ public static void closeFile(int fd) { /** * Reset all files -- clears out the file descriptor table. + * Reset the buffered reader from the input field of the gui. */ public static void resetFiles() { FileIOData.resetFiles(); + InputFromGui.reset(); } /** @@ -434,6 +474,17 @@ public static String getFileErrorMessage() { return fileErrorString; } + /** + * @return BufferedReader from the input field of the gui + */ + private static BufferedReader getInputReaderFromGui() { + if (InputFromGui.inputReaderFromGui == null) { + InputFromGui.inputReaderFromGui = + new BufferedReader(new StringReader(Globals.getGui().getMessagesPane().getInputField())); + } + return InputFromGui.inputReaderFromGui; + } + /////////////////////////////////////////////////////////////////////// // Private method to simply return the BufferedReader used for // keyboard input, redirected input, or piped input. @@ -460,7 +511,7 @@ private static BufferedWriter getOutputWriter(){ private static void print2Gui(String output){ long time = System.currentTimeMillis(); if (time > lasttime) { - Globals.getGui().getMessagesPane().postRunMessage(buffer+output); + Globals.getGui().getMessagesPane().postOutput(buffer+output); buffer = ""; lasttime = time + 100; } else { @@ -474,7 +525,7 @@ private static void print2Gui(String output){ public static void flush(boolean force) { long time = System.currentTimeMillis(); if (buffer != "" && (force || time > lasttime)){ - Globals.getGui().getMessagesPane().postRunMessage(buffer); + Globals.getGui().getMessagesPane().postOutput(buffer); buffer = ""; lasttime = time + 100; } @@ -680,4 +731,24 @@ private static int nowOpening(String filename, int flag) { } } // end private class FileIOData -} + + /** + * Maintain information on input from input window of GUI + */ + private static class InputFromGui { + public static BufferedReader inputReaderFromGui; + + private static void reset() { + if (inputReaderFromGui != null) { + try { + inputReaderFromGui.close(); + } catch (IOException e) { + // will only read the above line if this inputReader has been opened + } + inputReaderFromGui=null; + + } + } + + } +} \ No newline at end of file diff --git a/src/rars/venus/DataSegmentWindow.java b/src/rars/venus/DataSegmentWindow.java index ad1c52a1..2a29f321 100644 --- a/src/rars/venus/DataSegmentWindow.java +++ b/src/rars/venus/DataSegmentWindow.java @@ -21,34 +21,6 @@ import java.util.Observable; import java.util.Observer; -/* -Copyright (c) 2003-2013, 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) - */ - /** * Represents the Data Segment window, which is a type of JInternalFrame. * @@ -67,21 +39,22 @@ public class DataSegmentWindow extends JInternalFrame implements Observer { private JButton dataButton, nextButton, prevButton, stakButton, globButton, heapButton, extnButton, mmioButton, textButton; private JCheckBox asciiDisplayCheckBox; - private static final int VALUES_PER_ROW = 8; - private static final int NUMBER_OF_ROWS = 16; // with 8 value columns, this shows 512 bytes; - private static final int NUMBER_OF_COLUMNS = VALUES_PER_ROW + 1;// 1 for address and 8 for values - private static final int BYTES_PER_VALUE = 4; - private static final int BYTES_PER_ROW = VALUES_PER_ROW * BYTES_PER_VALUE; - private static final int MEMORY_CHUNK_SIZE = NUMBER_OF_ROWS * BYTES_PER_ROW; + private int valuesPerRow = 8; + private int numberOfRows = 16; // with 8 value columns, this shows 512 bytes; + private int numberOfColumns; // 1 for address and 8 for values + private int bytesPerValue; + private int bytesPerRow; + private int memoryChunkSize; // PREV_NEXT_CHUNK_SIZE determines how many rows will be scrolled when Prev or Next buttons fire. // MEMORY_CHUNK_SIZE/2 means scroll half a table up or down. Easier to view series that flows off the edge. // MEMORY_CHUNK_SIZE means scroll a full table's worth. Scrolls through memory faster. DPS 26-Jan-09 - private static final int PREV_NEXT_CHUNK_SIZE = MEMORY_CHUNK_SIZE / 2; + private int prevNextChunkSize = memoryChunkSize / 2; private static final int ADDRESS_COLUMN = 0; private static final boolean USER_MODE = false; private static final boolean KERNEL_MODE = true; private boolean addressHighlighting = false; + private boolean writingHighlight = false; private boolean asciiDisplay = false; private int addressRow, addressColumn, addressRowFirstAddress; private Settings settings; @@ -118,6 +91,7 @@ public DataSegmentWindow(NumberDisplayBaseChooser[] choosers) { firstAddress = homeAddress; // first address to display at any given time userOrKernelMode = USER_MODE; addressHighlighting = false; + writingHighlight = false; contentPane = this.getContentPane(); tablePanel = new JPanel(new GridLayout(1, 2, 10, 0)); JPanel features = new JPanel(); @@ -173,7 +147,39 @@ public void itemStateChanged(ItemEvent e) { }); features.add(asciiDisplayCheckBox); + String[] bytesPerValueStrings = {"1 byte", "2 half","4 word","8 dword"}; + JComboBox bytesPerValueBox = new JComboBox(bytesPerValueStrings); + bytesPerValueBox.setSelectedIndex(2); // word + bytesPerValueBox.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + JComboBox cb = (JComboBox)e.getSource(); + int bytesPerValue = 1 << cb.getSelectedIndex(); + //String choice = ((String)cb.getSelectedItem()).substring(0, 1); + //int bytesPerValue = Integer.parseInt(choice); + DataSegmentWindow.this.setDimensions(valuesPerRow, numberOfRows, bytesPerValue); + } + }); + features.add(bytesPerValueBox); + contentPane.add(features, BorderLayout.SOUTH); + DataSegmentWindow.this.setDimensions(8, 16, 4); + } + + public void setDimensions(int valuesPerRow, int numberOfRows, int bytesPerValue) { + this.valuesPerRow = valuesPerRow; + this.numberOfRows = numberOfRows; // with 8 value columns, this shows 512 bytes; + numberOfColumns = this.valuesPerRow + 1;// 1 for address and 8 for values + this.bytesPerValue = bytesPerValue; + bytesPerRow = this.valuesPerRow * this.bytesPerValue; + memoryChunkSize = this.numberOfRows * bytesPerRow; + // PREV_NEXT_CHUNK_SIZE determines how many rows will be scrolled when Prev or Next buttons fire. + // MEMORY_CHUNK_SIZE/2 means scroll half a table up or down. Easier to view series that flows off the edge. + // MEMORY_CHUNK_SIZE means scroll a full table's worth. Scrolls through memory faster. DPS 26-Jan-09 + prevNextChunkSize = memoryChunkSize / 2; + + DataSegmentWindow.this.updateValues(); + DataSegmentWindow.this.updateDataAddresses(); } public void updateBaseAddressComboBox() { @@ -274,30 +280,30 @@ private Point displayCellForAddress(int address) { if (baseAddress == -1) { if (desiredComboBoxIndex == GLOBAL_POINTER_ADDRESS_INDEX) { baseAddress = RegisterFile.getValue(RegisterFile.GLOBAL_POINTER_REGISTER) - - (RegisterFile.getValue(RegisterFile.GLOBAL_POINTER_REGISTER) % BYTES_PER_ROW); + - (RegisterFile.getValue(RegisterFile.GLOBAL_POINTER_REGISTER) % bytesPerRow); } else if (desiredComboBoxIndex == STACK_POINTER_BASE_ADDRESS_INDEX) { baseAddress = RegisterFile.getValue(RegisterFile.STACK_POINTER_REGISTER) - - (RegisterFile.getValue(RegisterFile.STACK_POINTER_REGISTER) % BYTES_PER_ROW); + - (RegisterFile.getValue(RegisterFile.STACK_POINTER_REGISTER) % bytesPerRow); } else { return null;// shouldn't happen since these are the only two } } int byteOffset = address - baseAddress; - int chunkOffset = byteOffset / MEMORY_CHUNK_SIZE; - int byteOffsetIntoChunk = byteOffset % MEMORY_CHUNK_SIZE; + int chunkOffset = byteOffset / memoryChunkSize; + int byteOffsetIntoChunk = byteOffset % memoryChunkSize; // Subtract 1 from chunkOffset because we're gonna call the "next" action // listener to get the correct chunk loaded and displayed, and the first // thing it does is increment firstAddress by MEMORY_CHUNK_SIZE. Here // we do an offsetting decrement in advance because we don't want the // increment but we want the other actions that method provides. - firstAddress = firstAddress + chunkOffset * MEMORY_CHUNK_SIZE - PREV_NEXT_CHUNK_SIZE; + firstAddress = firstAddress + chunkOffset * memoryChunkSize - prevNextChunkSize; nextButton.getActionListeners()[0].actionPerformed(null); // STEP 4: Find cell containing this address. Add 1 to column calculation // because table column 0 displays address, not memory contents. The // "convertColumnIndexToView()" is not necessary because the columns cannot be // reordered, but I included it as a precautionary measure in case that changes. - int addrRow = byteOffsetIntoChunk / BYTES_PER_ROW; - int addrColumn = byteOffsetIntoChunk % BYTES_PER_ROW / BYTES_PER_VALUE + 1; + int addrRow = byteOffsetIntoChunk / bytesPerRow; + int addrColumn = byteOffsetIntoChunk % bytesPerRow / bytesPerValue + 1; addrColumn = dataTable.convertColumnIndexToView(addrColumn); Rectangle addressCell = dataTable.getCellRect(addrRow, addrColumn, true); // STEP 5: Center the row containing the cell of interest, to the extent possible. @@ -379,7 +385,7 @@ private int getBaseAddressIndexForAddress(int address) { desiredComboBoxIndex = EXTERN_BASE_ADDRESS_INDEX; } // Check distance from global pointer; can be either side of it... - thisDistance = Math.abs(address - RegisterFile.getValue(RegisterFile.GLOBAL_POINTER_REGISTER)); // distance from global pointer + thisDistance = Math.abs(address - RegisterFile.getValueNoNotify(RegisterFile.GLOBAL_POINTER_REGISTER)); // distance from global pointer if (thisDistance < shortDistance) { shortDistance = thisDistance; desiredComboBoxIndex = GLOBAL_POINTER_ADDRESS_INDEX; @@ -397,7 +403,7 @@ private int getBaseAddressIndexForAddress(int address) { desiredComboBoxIndex = HEAP_BASE_ADDRESS_INDEX; } // Check distance from stack pointer. Can be on either side of it... - thisDistance = Math.abs(address - RegisterFile.getValue(RegisterFile.STACK_POINTER_REGISTER)); + thisDistance = Math.abs(address - RegisterFile.getValueNoNotify(RegisterFile.STACK_POINTER_REGISTER)); if (thisDistance < shortDistance) { shortDistance = thisDistance; desiredComboBoxIndex = STACK_POINTER_BASE_ADDRESS_INDEX; @@ -410,23 +416,10 @@ private int getBaseAddressIndexForAddress(int address) { // Generates the Address/Data part of the Data Segment window. // Returns the JScrollPane for the Address/Data part of the Data Segment window. private JScrollPane generateDataPanel() { - dataData = new Object[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS]; - int valueBase = Globals.getGui().getMainPane().getExecutePane().getValueDisplayBase(); + dataData = new Object[numberOfRows][numberOfColumns]; int addressBase = Globals.getGui().getMainPane().getExecutePane().getAddressDisplayBase(); - int address = this.homeAddress; - for (int row = 0; row < NUMBER_OF_ROWS; row++) { - dataData[row][ADDRESS_COLUMN] = NumberDisplayBaseChooser.formatUnsignedInteger(address, addressBase); - for (int column = 1; column < NUMBER_OF_COLUMNS; column++) { - try { - dataData[row][column] = NumberDisplayBaseChooser.formatNumber(Globals.memory.getRawWord(address), valueBase); - } catch (AddressErrorException aee) { - dataData[row][column] = NumberDisplayBaseChooser.formatNumber(0, valueBase); - } - address += BYTES_PER_VALUE; - } - } - String[] names = new String[NUMBER_OF_COLUMNS]; - for (int i = 0; i < NUMBER_OF_COLUMNS; i++) { + String[] names = new String[numberOfColumns]; + for (int i = 0; i < numberOfColumns; i++) { names[i] = getHeaderStringForColumn(i, addressBase); } dataTable = new MyTippedJTable(new DataTableModel(dataData, names)); @@ -440,7 +433,7 @@ private JScrollPane generateDataPanel() { dataTable.getColumnModel().getColumn(ADDRESS_COLUMN).setCellRenderer(monoRightCellRenderer); // Data cells are columns 1 onward, render right-justitifed in mono font but highlightable. AddressCellRenderer addressCellRenderer = new AddressCellRenderer(); - for (int i = 1; i < NUMBER_OF_COLUMNS; i++) { + for (int i = 1; i < numberOfColumns; i++) { dataTable.getColumnModel().getColumn(i).setPreferredWidth(60); dataTable.getColumnModel().getColumn(i).setCellRenderer(addressCellRenderer); } @@ -451,7 +444,7 @@ private JScrollPane generateDataPanel() { // Little helper. Is called when headers set up and each time number base changes. private String getHeaderStringForColumn(int i, int base) { - return (i == ADDRESS_COLUMN) ? "Address" : "Value (+" + Integer.toString((i - 1) * BYTES_PER_VALUE, base) + ")"; + return (i == ADDRESS_COLUMN) ? "Address" : "Value (+" + Integer.toString((i - 1) * bytesPerValue, base) + ")"; } @@ -507,40 +500,22 @@ public void updateModelForMemoryRange(int firstAddr) { int valueBase = getValueDisplayFormat(); int addressBase = Globals.getGui().getMainPane().getExecutePane().getAddressDisplayBase(); int address = firstAddr; - TableModel dataModel = dataTable.getModel(); - for (int row = 0; row < NUMBER_OF_ROWS; row++) { - ((DataTableModel) dataModel).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatUnsignedInteger(address, addressBase), row, ADDRESS_COLUMN); - for (int column = 1; column < NUMBER_OF_COLUMNS; column++) { + DataTableModel dataModel = (DataTableModel) dataTable.getModel(); + for (int row = 0; row < numberOfRows; row++) { + dataModel.setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatUnsignedInteger(address, addressBase), row, ADDRESS_COLUMN); + for (int column = 1; column < numberOfColumns; column++) { try { - ((DataTableModel) dataModel).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(Globals.memory.getWordNoNotify(address), valueBase), row, column); + long datum = Globals.memory.getRaw(address, bytesPerValue); + dataModel.setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(datum, valueBase, bytesPerValue), row, column); } catch (AddressErrorException aee) { - // Bit of a hack here. Memory will throw an exception if you try to read directly from text segment when the - // self-modifying code setting is disabled. This is a good thing if it is the executing MIPS program trying to - // read. But not a good thing if it is the DataSegmentDisplay trying to read. I'll trick Memory by - // temporarily enabling the setting as "non persistent" so it won't write through to the registry. - if (Memory.inTextSegment(address)) { - int displayValue = 0; - if (!Globals.getSettings().getBooleanSetting(Settings.Bool.SELF_MODIFYING_CODE_ENABLED)) { - Globals.getSettings().setBooleanSettingNonPersistent(Settings.Bool.SELF_MODIFYING_CODE_ENABLED, true); - try { - displayValue = Globals.memory.getWordNoNotify(address); - } catch (AddressErrorException e) { - // Still got an exception? Doesn't seem possible but if we drop through it will write default value 0. - } - Globals.getSettings().setBooleanSettingNonPersistent(Settings.Bool.SELF_MODIFYING_CODE_ENABLED, false); - } - ((DataTableModel) dataModel).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(displayValue, valueBase), row, column); - } // Bug Fix: the following line of code disappeared during the release 4.4 mods, but is essential to // display values of 0 for valid MIPS addresses that are outside the MARS simulated address space. Such // addresses cause an AddressErrorException. Prior to 4.4, they performed this line of code unconditionally. // With 4.4, I added the above IF statement to work with the text segment but inadvertently removed this line! // Now it becomes the "else" part, executed when not in text segment. DPS 8-July-2014. - else { - ((DataTableModel) dataModel).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(0, valueBase), row, column); - } + dataModel.setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(0, valueBase, bytesPerValue), row, column); } - address += BYTES_PER_VALUE; + address += bytesPerValue; } } } @@ -551,13 +526,13 @@ public void updateModelForMemoryRange(int firstAddr) { public void updateCell(int address, int value) { int offset = address - this.firstAddress; - if (offset < 0 || offset >= MEMORY_CHUNK_SIZE) { // out of range + if (offset < 0 || offset >= memoryChunkSize) { // out of range return; } - int row = offset / BYTES_PER_ROW; - int column = (offset % BYTES_PER_ROW) / BYTES_PER_VALUE + 1; // column 0 reserved for address + int row = offset / bytesPerRow; + int column = (offset % bytesPerRow) / bytesPerValue + 1; // column 0 reserved for address int valueBase = Globals.getGui().getMainPane().getExecutePane().getValueDisplayBase(); - ((DataTableModel) dataTable.getModel()).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(value, valueBase), + ((DataTableModel) dataTable.getModel()).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(value, valueBase, bytesPerValue), row, column); } @@ -571,13 +546,13 @@ public void updateDataAddresses() { int addressBase = Globals.getGui().getMainPane().getExecutePane().getAddressDisplayBase(); int address = this.firstAddress; String formattedAddress; - for (int i = 0; i < NUMBER_OF_ROWS; i++) { + for (int i = 0; i < numberOfRows; i++) { formattedAddress = NumberDisplayBaseChooser.formatUnsignedInteger(address, addressBase); ((DataTableModel) dataTable.getModel()).setDisplayAndModelValueAt(formattedAddress, i, 0); - address += BYTES_PER_ROW; + address += bytesPerRow; } // column headers include address offsets, so translate them too - for (int i = 1; i < NUMBER_OF_COLUMNS; i++) { + for (int i = 1; i < numberOfColumns; i++) { dataTable.getColumnModel().getColumn(i).setHeaderValue(getHeaderStringForColumn(i, addressBase)); } dataTable.getTableHeader().repaint(); @@ -605,10 +580,10 @@ public void resetMemoryRange() { public void resetValues() { int valueBase = Globals.getGui().getMainPane().getExecutePane().getValueDisplayBase(); - TableModel dataModel = dataTable.getModel(); - for (int row = 0; row < NUMBER_OF_ROWS; row++) { - for (int column = 1; column < NUMBER_OF_COLUMNS; column++) { - ((DataTableModel) dataModel).setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(0, valueBase), row, column); + DataTableModel dataModel = (DataTableModel)dataTable.getModel(); + for (int row = 0; row < numberOfRows; row++) { + for (int column = 1; column < numberOfColumns; column++) { + dataModel.setDisplayAndModelValueAt(NumberDisplayBaseChooser.formatNumber(0, valueBase, bytesPerValue), row, column); } } disableAllButtons(); @@ -682,7 +657,7 @@ public void actionPerformed(ActionEvent ae) { // updateModelForMemoryRange requires argument to be multiple of 4 // but for cleaner display we'll make it multiple of 32 (last nibble is 0). // This makes it easier to mentally calculate address from row address + column offset. - firstAddress = firstAddress - (firstAddress % BYTES_PER_ROW); + firstAddress = firstAddress - (firstAddress % bytesPerRow); homeAddress = firstAddress; firstAddress = setFirstAddressAndPrevNextButtonEnableStatus(firstAddress); updateModelForMemoryRange(firstAddress); @@ -696,7 +671,7 @@ public void actionPerformed(ActionEvent ae) { // get $sp stack pointer, but guard against it having value below data segment firstAddress = Math.max(Memory.dataSegmentBaseAddress, RegisterFile.getValue(RegisterFile.STACK_POINTER_REGISTER)); // See comment above for gloButton... - firstAddress = firstAddress - (firstAddress % BYTES_PER_ROW); + firstAddress = firstAddress - (firstAddress % bytesPerRow); homeAddress = Memory.stackBaseAddress; firstAddress = setFirstAddressAndPrevNextButtonEnableStatus(firstAddress); updateModelForMemoryRange(firstAddress); @@ -786,8 +761,8 @@ private int setFirstAddressAndPrevNextButtonEnableStatus(int lowAddress) { } else { prevButton.setEnabled(true); } - if (lowAddress >= highLimit - MEMORY_CHUNK_SIZE) { - lowAddress = highLimit - MEMORY_CHUNK_SIZE + 1; + if (lowAddress >= highLimit - memoryChunkSize) { + lowAddress = highLimit - memoryChunkSize + 1; nextButton.setEnabled(false); } else { nextButton.setEnabled(true); @@ -835,7 +810,15 @@ public void update(Observable observable, Object obj) { int address = access.getAddress(); // Use the same highlighting technique as for Text Segment -- see // AddressCellRenderer class below. + writingHighlight = true; this.highlightCellForAddress(address); + } else if (access.getAccessType() == AccessNotice.READ) { + int address = access.getAddress(); + // If it's not fetching an instruction, will highlight in data segment the cell corresponding to the address + if (!Memory.inTextSegment(address)) { + writingHighlight = false; //so it is a reading highlight + this.highlightCellForAddress(address); + } } } } @@ -845,7 +828,8 @@ private void updateRowHeight() { return; } Font possibleFonts[] = { - settings.getFontByPosition(Settings.DATASEGMENT_HIGHLIGHT_FONT), + settings.getFontByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_FONT), + settings.getFontByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_FONT), settings.getFontByPosition(Settings.EVEN_ROW_FONT), settings.getFontByPosition(Settings.ODD_ROW_FONT), }; @@ -951,7 +935,7 @@ public void setValueAt(Object value, int row, int col) { // calculate address from row and column try { - address = Binary.stringToInt((String) data[row][ADDRESS_COLUMN]) + (col - 1) * BYTES_PER_VALUE; // KENV 1/6/05 + address = Binary.stringToInt((String) data[row][ADDRESS_COLUMN]) + (col - 1) * bytesPerValue; // KENV 1/6/05 } catch (NumberFormatException nfe) { // can't really happen since memory addresses are completely under // the control of my software. @@ -961,7 +945,7 @@ public void setValueAt(Object value, int row, int col) { Globals.memoryAndRegistersLock.lock(); try { try { - Globals.memory.setRawWord(address, val); + Globals.memory.set(address, val, bytesPerValue); } // somehow, user was able to display out-of-range address. Most likely to occur between // stack base and Kernel. Also text segment with self-modifying-code setting off. @@ -972,7 +956,7 @@ public void setValueAt(Object value, int row, int col) { Globals.memoryAndRegistersLock.unlock(); }// end synchronized block int valueBase = Globals.getGui().getMainPane().getExecutePane().getValueDisplayBase(); - data[row][col] = NumberDisplayBaseChooser.formatNumber(val, valueBase); + data[row][col] = NumberDisplayBaseChooser.formatNumber(val, valueBase, bytesPerValue); fireTableCellUpdated(row, col); } @@ -1004,7 +988,7 @@ private void printDebugData() { // Special renderer capable of highlighting cells by changing background color. // Will set background to highlight color if certain conditions met. - class AddressCellRenderer extends DefaultTableCellRenderer { + class AddressCellRenderer extends MonoRightCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { @@ -1013,11 +997,16 @@ public Component getTableCellRendererComponent(JTable table, Object value, cell.setHorizontalAlignment(SwingConstants.RIGHT); int rowFirstAddress = Binary.stringToInt(table.getValueAt(row, ADDRESS_COLUMN).toString()); - if (settings.getBooleanSetting(Settings.Bool.DATA_SEGMENT_HIGHLIGHTING) && addressHighlighting && - rowFirstAddress == addressRowFirstAddress && column == addressColumn) { - cell.setBackground(settings.getColorSettingByPosition(Settings.DATASEGMENT_HIGHLIGHT_BACKGROUND)); - cell.setForeground(settings.getColorSettingByPosition(Settings.DATASEGMENT_HIGHLIGHT_FOREGROUND)); - cell.setFont(settings.getFontByPosition(Settings.DATASEGMENT_HIGHLIGHT_FONT)); + if (settings.getBooleanSetting(Settings.Bool.EXPLICIT_WRITE_HIGHLIGHTING) && addressHighlighting && + rowFirstAddress == addressRowFirstAddress && column == addressColumn && writingHighlight) { + cell.setBackground(settings.getColorSettingByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_BACKGROUND)); + cell.setForeground(settings.getColorSettingByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_FOREGROUND)); + cell.setFont(settings.getFontByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_FONT)); + } else if (settings.getBooleanSetting(Settings.Bool.EXPLICIT_READ_HIGHLIGHTING) && addressHighlighting && + rowFirstAddress == addressRowFirstAddress && column == addressColumn && !writingHighlight) { //not writing highlight means reading highlight + cell.setBackground(settings.getColorSettingByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_BACKGROUND)); + cell.setForeground(settings.getColorSettingByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_FOREGROUND)); + cell.setFont(settings.getFontByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_FONT)); } else if (row % 2 == 0) { cell.setBackground(settings.getColorSettingByPosition(Settings.EVEN_ROW_BACKGROUND)); cell.setForeground(settings.getColorSettingByPosition(Settings.EVEN_ROW_FOREGROUND)); @@ -1060,7 +1049,7 @@ public String getToolTipText(MouseEvent e) { int index = columnModel.getColumnIndexAtX(p.x); int realIndex = columnModel.getColumn(index).getModelIndex(); return (realIndex < 2) ? columnToolTips[realIndex] - : columnToolTips[2] + ((realIndex - 1) * 4) + columnToolTips[3]; + : columnToolTips[2] + ((realIndex - 1) * bytesPerValue) + columnToolTips[3]; } }; } @@ -1083,7 +1072,7 @@ public PrevButton(Icon ico) { // This one will respond when either timer goes off or button lifted. public void actionPerformed(ActionEvent ae) { - firstAddress -= PREV_NEXT_CHUNK_SIZE; + firstAddress -= prevNextChunkSize; firstAddress = setFirstAddressAndPrevNextButtonEnableStatus(firstAddress); updateModelForMemoryRange(firstAddress); } @@ -1106,7 +1095,7 @@ public NextButton(Icon ico) { // This one will respond when either timer goes off or button lifted. public void actionPerformed(ActionEvent ae) { - firstAddress += PREV_NEXT_CHUNK_SIZE; + firstAddress += prevNextChunkSize; firstAddress = setFirstAddressAndPrevNextButtonEnableStatus(firstAddress); updateModelForMemoryRange(firstAddress); } diff --git a/src/rars/venus/EditFindReplaceAction.java b/src/rars/venus/EditFindReplaceAction.java index 06066faf..c2f8ef1a 100644 --- a/src/rars/venus/EditFindReplaceAction.java +++ b/src/rars/venus/EditFindReplaceAction.java @@ -10,34 +10,6 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; - /* -Copyright (c) 2003-2009, 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) - */ - /** * Action for the Edit -> Find/Replace menu item */ diff --git a/src/rars/venus/EditPane.java b/src/rars/venus/EditPane.java index 85700d1e..f3e0328d 100644 --- a/src/rars/venus/EditPane.java +++ b/src/rars/venus/EditPane.java @@ -20,34 +20,6 @@ import java.util.Observable; import java.util.Observer; -/* -Copyright (c) 2003-2011, 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) - */ - /** * Represents one file opened for editing. Maintains required internal structures. * Before Mars 4.0, there was only one editor pane, a tab, and only one file could diff --git a/src/rars/venus/EditTabbedPane.java b/src/rars/venus/EditTabbedPane.java index 5e139378..ebe49575 100644 --- a/src/rars/venus/EditTabbedPane.java +++ b/src/rars/venus/EditTabbedPane.java @@ -13,40 +13,9 @@ import javax.swing.filechooser.FileFilter; import java.awt.*; import java.beans.PropertyChangeListener; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +import java.io.*; import java.util.ArrayList; - /* -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) - */ - /** * Tabbed pane for the editor. Each of its tabs represents an open file. * @@ -295,7 +264,7 @@ private boolean saveFile(EditPane editPane) { } File theFile = new File(editPane.getPathname()); try { - BufferedWriter outFileStream = new BufferedWriter(new FileWriter(theFile)); + BufferedWriter outFileStream = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(theFile), "UTF-8")); outFileStream.write(editPane.getSource(), 0, editPane.getSource().length()); outFileStream.close(); } catch (java.io.IOException c) { @@ -388,7 +357,7 @@ private File saveAsFile(EditPane editPane) { // Either file with selected name does not exist or user wants to // overwrite it, so go for it! try { - BufferedWriter outFileStream = new BufferedWriter(new FileWriter(theFile)); + BufferedWriter outFileStream = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(theFile), "UTF-8")); outFileStream.write(editPane.getSource(), 0, editPane.getSource().length()); outFileStream.close(); } catch (java.io.IOException c) { @@ -555,7 +524,7 @@ public FileOpener(Editor theEditor) { // Note: add sequence is significant - last one added becomes default. fileFilterList = new ArrayList<>(); fileFilterList.add(fileChooser.getAcceptAllFileFilter()); - fileFilterList.add(FilenameFinder.getFileFilter(Globals.fileExtensions, "Assembler Files", true)); + fileFilterList.add(FilenameFinder.getFileFilter(Globals.fileExtensions, "Assembly Files", true)); fileFilterCount = 0; // this will trigger fileChooser file filter load in next line setChoosableFileFilters(); } @@ -564,6 +533,7 @@ public FileOpener(Editor theEditor) { * Launch a file chooser for name of file to open. Return true if file opened, false otherwise */ private boolean openFile() { + fileChooser.updateUI(); // The fileChooser's list may be rebuilt from the master ArrayList if a new filter // has been added by the user. setChoosableFileFilters(); @@ -732,4 +702,4 @@ public void propertyChange(java.beans.PropertyChangeEvent e) { } -} \ No newline at end of file +} diff --git a/src/rars/venus/Editor.java b/src/rars/venus/Editor.java index 371cd599..1b2ba08e 100644 --- a/src/rars/venus/Editor.java +++ b/src/rars/venus/Editor.java @@ -2,34 +2,6 @@ import java.io.File; import java.util.ArrayList; - - /* -Copyright (c) 2003-2007, 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) - */ /** * Manage the file being edited. @@ -149,11 +121,11 @@ void setCurrentSaveDirectory(String currentSaveDirectory) { /** * Generates a default file name * - * @return returns string mipsN.asm, where N is 1,2,3,... + * @return returns string mipsN.s, where N is 1,2,3,... */ public String getNextDefaultFilename() { newUsageCount++; - return "riscv" + newUsageCount + ".asm"; + return "riscv" + newUsageCount + ".s"; } diff --git a/src/rars/venus/ExecutePane.java b/src/rars/venus/ExecutePane.java index a489d587..0c32d6f5 100644 --- a/src/rars/venus/ExecutePane.java +++ b/src/rars/venus/ExecutePane.java @@ -9,34 +9,6 @@ import javax.swing.*; import java.awt.*; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Container for the execution-related windows. Currently displayed as a tabbed pane. * @@ -118,7 +90,6 @@ public void setWindowBounds() { Dimension textFullDim = new Dimension((int) (fullWidth), halfHeight); dataSegment.setBounds(0, textDim.height + 1, dataDim.width, dataDim.height); if (labelWindowVisible) { - System.out.println("YEA"); textSegment.setBounds(0, 0, textDim.width, textDim.height); labelValues.setBounds(textDim.width + 1, 0, lablDim.width, lablDim.height); } else { @@ -267,4 +238,4 @@ public void numberDisplayBaseChanged(NumberDisplayBaseChooser chooser) { } } -} \ No newline at end of file +} diff --git a/src/rars/venus/FileDumpMemoryAction.java b/src/rars/venus/FileDumpMemoryAction.java index 375fd57e..8585333d 100644 --- a/src/rars/venus/FileDumpMemoryAction.java +++ b/src/rars/venus/FileDumpMemoryAction.java @@ -20,34 +20,6 @@ import java.io.IOException; import java.util.ArrayList; - /* -Copyright (c) 2003-2008, 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) - */ - /** * Action for the File -> Save For Dump Memory menu item */ diff --git a/src/rars/venus/FileStatus.java b/src/rars/venus/FileStatus.java index 9eeaa902..abe9a23e 100644 --- a/src/rars/venus/FileStatus.java +++ b/src/rars/venus/FileStatus.java @@ -4,34 +4,6 @@ import java.io.File; -/* -Copyright (c) 2003-2006, 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) - */ - /** * Used to store and return information on the status of the current ASM file that * is being edited in the program. diff --git a/src/rars/venus/GuiAction.java b/src/rars/venus/GuiAction.java index f122be5d..3b3f1e0c 100644 --- a/src/rars/venus/GuiAction.java +++ b/src/rars/venus/GuiAction.java @@ -3,34 +3,6 @@ import javax.swing.*; import java.awt.event.ActionEvent; - /* -Copyright (c) 2003-2006, 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) - */ - /** * parent class for Action subclasses to be defined for every menu/toolbar * option. diff --git a/src/rars/venus/HelpAboutAction.java b/src/rars/venus/HelpAboutAction.java index 086db2c3..80ba52b0 100644 --- a/src/rars/venus/HelpAboutAction.java +++ b/src/rars/venus/HelpAboutAction.java @@ -5,34 +5,6 @@ import javax.swing.*; import java.awt.event.ActionEvent; - /* -Copyright (c) 2003-2006, 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) - */ - /** * Action for the Help -> About menu item */ diff --git a/src/rars/venus/HelpHelpAction.java b/src/rars/venus/HelpHelpAction.java index 03234bcc..f414adbd 100644 --- a/src/rars/venus/HelpHelpAction.java +++ b/src/rars/venus/HelpHelpAction.java @@ -1,6 +1,7 @@ package rars.venus; import rars.Globals; +import rars.Settings; import rars.assembler.Directives; import rars.riscv.*; @@ -22,39 +23,11 @@ import java.util.Collections; import java.util.Vector; - /* -Copyright (c) 2003-2008, 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) - */ - /** * Action for the Help -> Help menu item */ public class HelpHelpAction extends GuiAction { - private VenusUI mainUI; + private final VenusUI mainUI; public HelpHelpAction(String name, Icon icon, String descrip, Integer mnemonic, KeyStroke accel, VenusUI gui) { @@ -67,9 +40,6 @@ private Dimension getSize() { return new Dimension(800, 600); } - // Light gray background color for alternating lines of the instruction lists - static Color altBackgroundColor = new Color(0xEE, 0xEE, 0xEE); - /** * Separates Instruction name descriptor from detailed (operation) description * in help string. @@ -155,7 +125,7 @@ private JPanel createCopyrightInfoPanel() { JScrollPane copyrightScrollPane; JEditorPane copyrightDisplay; try { - StringBuilder text = loadFiletoStringBuilder("/License.txt").append(""); + StringBuilder text = loadFiletoStringBuilder("/LICENSE").append(""); copyrightDisplay = new JEditorPane("text/html", "

" + text.toString());
             copyrightDisplay.setEditable(false);
             copyrightDisplay.setCaretPosition(0); // assure top of document displayed
@@ -188,7 +158,11 @@ private JPanel createRarsHelpInfoPanel() {
     // Set up MIPS help tab.  Most contents are generated from instruction set info.
     private JPanel createHelpInfoPanel() {
         JPanel helpInfo = new JPanel(new BorderLayout());
-        String helpRemarksColor = "CCFF99";
+        String helpRemarksColor;
+        if (Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED))
+            helpRemarksColor = "006655";
+        else
+            helpRemarksColor = "CCFF99";
         // Introductory remarks go at the top as a label
         // TODO: update this to consider 12 and 20 bit numbers rather than 16
         String helpRemarks =
@@ -386,7 +360,7 @@ public Component getListCellRendererComponent(
                 setBackground(list.getSelectionBackground());
                 setForeground(list.getSelectionForeground());
             } else {
-                setBackground((index % 2 == 0) ? altBackgroundColor : list.getBackground());
+                setBackground((index % 2 == 0) ? Globals.getSettings().getColorSettingByPosition(Settings.EVEN_ROW_BACKGROUND) : list.getBackground());
                 setForeground(list.getForeground());
             }
             setEnabled(list.isEnabled());
diff --git a/src/rars/venus/LabelsWindow.java b/src/rars/venus/LabelsWindow.java
index 424ecaff..cc17bef6 100644
--- a/src/rars/venus/LabelsWindow.java
+++ b/src/rars/venus/LabelsWindow.java
@@ -20,34 +20,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
-   
-	/*
-Copyright (c) 2003-2009,  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)
- */
 
 /**
  * Represents the Labels window, which is a type of JInternalFrame.  Venus user
@@ -338,7 +310,7 @@ private JTable generateLabelTable() {
             for (int i = 0; i < symbols.size(); i++) {//sets up the label table
                 Symbol s = symbols.get(i);
                 labelData[i][LABEL_COLUMN] = s.getName();
-                labelData[i][ADDRESS_COLUMN] = NumberDisplayBaseChooser.formatNumber(s.getAddress(), addressBase);
+                labelData[i][ADDRESS_COLUMN] = NumberDisplayBaseChooser.formatNumber(s.getAddress(), addressBase, 4);
             }
             LabelTableModel m = new LabelTableModel(labelData, LabelsWindow.columnNames);
             if (labelTable == null) {
@@ -360,7 +332,7 @@ public void updateLabelAddresses() {
             int numSymbols = (labelData == null) ? 0 : labelData.length;
             for (int i = 0; i < numSymbols; i++) {
                 address = symbols.get(i).getAddress();
-                formattedAddress = NumberDisplayBaseChooser.formatNumber(address, addressBase);
+                formattedAddress = NumberDisplayBaseChooser.formatNumber(address, addressBase, 4);
                 labelTable.getModel().setValueAt(formattedAddress, i, ADDRESS_COLUMN);
             }
         }
diff --git a/src/rars/venus/MainPane.java b/src/rars/venus/MainPane.java
index 8e5226a0..47ee3e16 100644
--- a/src/rars/venus/MainPane.java
+++ b/src/rars/venus/MainPane.java
@@ -11,35 +11,6 @@
 import javax.swing.plaf.basic.BasicTabbedPaneUI;
 import java.awt.*;
 
-	
-	/*
-Copyright (c) 2003-2006,  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 tabbed areas in the UI and also created the internal windows that
  * exist in them.
@@ -76,12 +47,11 @@ public MainPane(VenusUI appFrame, Editor editor, RegistersWindow regs,
 
         this.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
         this.addTab(editTabTitle, editTabIcon, editTabbedPane);
-        this.setForeground(Color.black);
-
         this.addTab(executeTabTitle, executeTabIcon, executeTab);
 
         this.setToolTipTextAt(0, "Text editor for composing RISCV programs.");
         this.setToolTipTextAt(1, "View and control assembly language program execution.  Enabled upon successful assemble.");
+        editTabbedPane.setMinimumSize(new Dimension(0,0));
       
       	/* Listener has one specific purpose: when Execute tab is selected for the 
            * first time, set the bounds of its internal frames by invoking the
diff --git a/src/rars/venus/MessagesPane.java b/src/rars/venus/MessagesPane.java
index a0a3aedc..be7fa7a3 100644
--- a/src/rars/venus/MessagesPane.java
+++ b/src/rars/venus/MessagesPane.java
@@ -1,8 +1,12 @@
 package rars.venus;
 
+import rars.CancelException;
 import rars.ErrorList;
 import rars.Globals;
+import rars.Settings;
+import rars.simulator.ProgramArgumentList;
 import rars.simulator.Simulator;
+import rars.util.SystemIO;
 
 import javax.swing.*;
 import javax.swing.event.DocumentEvent;
@@ -18,43 +22,24 @@
 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;
-    private JPanel assembleTab, runTab;
+public class MessagesPane extends JPanel {
+    private final Box runButtonBox;
+    private final JRadioButton buttonPopup;
+    private final JRadioButton buttonInteractive;
+    private final JRadioButton buttonBatch;
+    private final JButton inputTabClearButton;
+    private final Box runioContent;
+    private final JTextField programArguments;
+    private JTabbedPane leftPane;
+    private JSplitPane batchTab;
+    JTextArea assemble, run, input, output;
+    private JPanel assembleTab, runTab, inputTab, runioTab;
     // 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
@@ -71,10 +56,16 @@ public class MessagesPane extends JTabbedPane {
     public MessagesPane() {
         super();
         this.setMinimumSize(new Dimension(0, 0));
+        leftPane = new JTabbedPane();
         assemble = new JTextArea();
         run = new JTextArea();
+        input = new JTextArea();
+        output = new JTextArea();
+        programArguments = new JTextField();
         assemble.setEditable(false);
         run.setEditable(false);
+        input.setEditable(true);
+        output.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"
@@ -82,6 +73,9 @@ public MessagesPane() {
         Font monoFont = new Font(Font.MONOSPACED, Font.PLAIN, 12);
         assemble.setFont(monoFont);
         run.setFont(monoFont);
+        input.setFont(monoFont);
+        output.setFont(monoFont);
+        programArguments.setFont(monoFont);
 
         JButton assembleTabClearButton = new JButton("Clear");
         assembleTabClearButton.setToolTipText("Clear the Messages area");
@@ -92,7 +86,7 @@ public void actionPerformed(ActionEvent e) {
                     }
                 });
         assembleTab = new JPanel(new BorderLayout());
-        assembleTab.add(createBoxForButton(assembleTabClearButton), BorderLayout.WEST);
+        assembleTab.add(createBoxForComponent(assembleTabClearButton), BorderLayout.WEST);
         assembleTab.add(new JScrollPane(assemble, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
         assemble.addMouseListener(
@@ -159,38 +153,135 @@ public void mouseClicked(MouseEvent e) {
                     }
                 });
 
-        JButton runTabClearButton = new JButton("Clear");
-        runTabClearButton.setToolTipText("Clear the Run I/O area");
+        JButton runTabClearButton = new JButton("Clear output");
+        runTabClearButton.setToolTipText("Clear the output area");
         runTabClearButton.addActionListener(
                 new ActionListener() {
                     public void actionPerformed(ActionEvent e) {
                         run.setText("");
+                        output.setText("");
                     }
                 });
+        inputTabClearButton = new JButton("Clear input");
+        inputTabClearButton.setToolTipText("Clear the input area (batch mode only)");
+        inputTabClearButton.addActionListener(
+                new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        input.setText("");
+                    }
+                });
+
+        /* Stack of buttons on the left */
+        runButtonBox = Box.createVerticalBox();
+        buttonPopup = new JRadioButton("Popups");
+        buttonInteractive = new JRadioButton("Interactive");
+        buttonBatch = new JRadioButton("Batch");
+        ButtonGroup bg = new ButtonGroup();
+        bg.add(buttonPopup);
+        bg.add(buttonInteractive);
+        bg.add(buttonBatch);
+        ActionListener bl = new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+               updateIOTab();
+            }
+        };
+        buttonPopup.addActionListener(bl);
+        buttonInteractive.addActionListener(bl);
+        buttonBatch.addActionListener(bl);
+        runButtonBox.add(buttonPopup);
+        runButtonBox.add(buttonInteractive);
+        runButtonBox.add(buttonBatch);
+        runButtonBox.add(runTabClearButton);
+        runButtonBox.add(inputTabClearButton);
+        if (Globals.getSettings().getBooleanSetting(Settings.Bool.BATCH_IOMODE)) {
+            buttonBatch.setSelected(true);
+        } else if (Globals.getSettings().getBooleanSetting(Settings.Bool.POPUP_SYSCALL_INPUT)) {
+            buttonPopup.setSelected(true);
+        } else {
+            buttonInteractive.setSelected(true);
+        }
+
+        /* runTab: A single interactive text area */
         runTab = new JPanel(new BorderLayout());
-        runTab.add(createBoxForButton(runTabClearButton), BorderLayout.WEST);
+        runTab.add(createBoxForComponent(runButtonBox), BorderLayout.WEST);
         runTab.add(new JScrollPane(run, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
 
-        this.addTab("Messages", assembleTab);
-        this.addTab("Run I/O", runTab);
-        this.setForeground(Color.BLACK);
+        /* batchTab: A dual text area */
+        JPanel inputTab = new JPanel(new BorderLayout());
+        inputTab.add(new JScrollPane(input, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
+        JPanel outputTab = new JPanel(new BorderLayout());
+        outputTab.add(new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
+        batchTab = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, inputTab, outputTab);
+        batchTab.setOneTouchExpandable(true);
+        batchTab.resetToPreferredSizes();
+        batchTab.setResizeWeight(0.5);
+
+        /* The runio, the content is dynamic */
+        runioContent = Box.createHorizontalBox();
+        runioTab = new JPanel(new BorderLayout());
+        runioTab.add(createBoxForComponent(runButtonBox), BorderLayout.WEST);
+        runioTab.add(runioContent);
+        updateIOTab();
+
+        /* The program argument tab */
+        JButton programArgumentsClearButton = new JButton("Clear");
+        programArgumentsClearButton.setToolTipText("Clear the program arguments");
+        programArgumentsClearButton.addActionListener(
+                new ActionListener() {
+                    public void actionPerformed(ActionEvent e) {
+                        programArguments.setText("");
+                    }
+                });
+        JPanel programArgumentsPanel = new JPanel(new BorderLayout());
+        programArgumentsPanel.add(createBoxForComponent(programArgumentsClearButton), BorderLayout.WEST);
+        programArguments.setMaximumSize(new Dimension(Integer.MAX_VALUE, programArguments.getPreferredSize().height));
+        programArgumentsPanel.add(createBoxForComponent(programArguments), BorderLayout.CENTER);
+
+        leftPane.addTab("Messages", assembleTab);
+        leftPane.addTab("Run I/O", runioTab);
+        leftPane.addTab("Program Arguments", programArgumentsPanel);
 
-        this.setToolTipTextAt(0, "Messages produced by Run menu. Click on assemble error message to select erroneous line");
-        this.setToolTipTextAt(1, "Simulated console input and output");
+        leftPane.setToolTipTextAt(0, "Messages produced by Run menu. Click on assemble error message to select erroneous line");
+        leftPane.setToolTipTextAt(1, "Simulated console input (used while running) and other run messages");
+        leftPane.setToolTipTextAt(2, "Arguments provided to program at runtime via a0 (argc) and a1 (argv)");
+
+        this.setLayout(new BorderLayout());
+        this.add(leftPane);
+    }
+
+    /** Update the content of the runio tab according to the selected radio buttons. */
+    private void updateIOTab() {
+        runioContent.removeAll();
+        if (buttonBatch.isSelected() ) {
+            Globals.getSettings().setBooleanSetting(Settings.Bool.BATCH_IOMODE, true);
+            Globals.getSettings().setBooleanSetting(Settings.Bool.POPUP_SYSCALL_INPUT, false);
+            runioContent.add(batchTab);
+            inputTabClearButton.setEnabled(true);
+        } else {
+            Globals.getSettings().setBooleanSetting(Settings.Bool.BATCH_IOMODE, false);
+            runioContent.add(runTab);
+            Globals.getSettings().setBooleanSetting(Settings.Bool.POPUP_SYSCALL_INPUT, buttonPopup.isSelected());
+            inputTabClearButton.setEnabled(false);
+        }
+        // Force the repaint and the application of the look-and-feel
+        SwingUtilities.updateComponentTreeUI(runioContent);
     }
 
     // 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;
+    private Box createBoxForComponent(Component component) {
+        Box componentRow = Box.createHorizontalBox();
+        componentRow.add(Box.createHorizontalStrut(6));
+        componentRow.add(component);
+        componentRow.add(Box.createHorizontalStrut(6));
+        Box componentBox = Box.createVerticalBox();
+        componentBox.add(Box.createVerticalGlue());
+        componentBox.add(componentRow);
+        componentBox.add(Box.createVerticalGlue());
+        return componentBox;
     }
 
     /**
@@ -277,24 +368,46 @@ public JTextArea getRunTextArea() {
     }
 
     /**
-     * Post a message to the assembler display
+     * Return true if the execution is (or will be) in interactive mode and false for batch mode.
+     * Currently, batch mode means that the input field is not empty.
+     */
+    public Boolean isInteractiveMode() {
+        return ! Globals.getSettings().getBooleanSetting(Settings.Bool.BATCH_IOMODE);
+    }
+
+    /**
+     * Returns the text written in the input field
      *
-     * @param message String to append to assembler display text
+     * @return input text field content
      */
-    public void postMessage(String message) {
-        assemble.append(message);
+    public String getInputField() {
+        return input.getText();
+    }
+
+    /** Append a message to a textarea and garbage collect very old text if needed. */
+    private void append(JTextArea area, String string) {
+        area.append(string);
         // 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) {
+        if (area.getDocument().getLength() > MAXIMUM_SCROLLED_CHARACTERS) {
             try {
-                assemble.getDocument().remove(0, NUMBER_OF_CHARACTERS_TO_CUT);
+                area.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);
+        area.setCaretPosition(area.getDocument().getLength());
+    }
+
+    /**
+     * Post a message to the assembler display
+     *
+     * @param message String to append to assembler display text
+     */
+    public void postMessage(String message) {
+        append(assemble, message);
+        leftPane.setSelectedComponent(assembleTab);
     }
 
     /**
@@ -313,18 +426,25 @@ public void postRunMessage(String 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
-                            }
-                        }
+                        selectRunMessageTab();
+                        append(run, mess);
+                        append(output, mess);
+                    }
+                });
+    }
+
+    /**
+     * Post a message to the output display
+     *
+     * @param message String to append to output display text
+     */
+    public void postOutput(String message) {
+        final String mess = message;
+        SwingUtilities.invokeLater(
+                new Runnable() {
+                    public void run() {
+                        append(run, mess);
+                        append(output, mess);
                     }
                 });
     }
@@ -333,14 +453,24 @@ public void run() {
      * Make the assembler message tab current (up front)
      */
     public void selectMessageTab() {
-        setSelectedComponent(assembleTab);
+        leftPane.setSelectedComponent(assembleTab);
     }
 
     /**
      * Make the runtime message tab current (up front)
      */
     public void selectRunMessageTab() {
-        setSelectedComponent(runTab);
+        leftPane.setSelectedComponent(runioTab);
+    }
+
+    /**
+    * Method to store any program arguments into memory and registers before
+    * execution begins. Arguments go into the gap between $sp and kernel memory.
+    * Argument pointers and count go into runtime stack and $sp is adjusted accordingly.
+    * $a0 gets argument count (argc), $a1 gets stack address of first arg pointer (argv).
+    */
+    public void processProgramArgumentsIfAny() {
+        new ProgramArgumentList(programArguments.getText()).storeProgramArguments();
     }
 
     /**
@@ -356,21 +486,25 @@ public void selectRunMessageTab() {
      * @param prompt Prompt to display to the user.
      * @return User input.
      */
-    public String getInputString(String prompt) {
+    public String getInputString(String prompt) throws CancelException {
         String input;
         boolean lock = Globals.memoryAndRegistersLock.isHeldByCurrentThread();
         if (lock) {
             Globals.memoryAndRegistersLock.unlock();
         }
-        JOptionPane pane = new JOptionPane(prompt, JOptionPane.QUESTION_MESSAGE, JOptionPane.DEFAULT_OPTION);
+        JOptionPane pane = new JOptionPane(prompt, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
         pane.setWantsInput(true);
         JDialog dialog = pane.createDialog(Globals.getGui(), "Keyboard Input");
         dialog.setVisible(true);
         input = (String) pane.getInputValue();
-        this.postRunMessage(Globals.userInputAlert + input + "\n");
         if (lock) {
             Globals.memoryAndRegistersLock.lock();
         }
+        if (input == JOptionPane.UNINITIALIZED_VALUE) {
+            throw new CancelException();
+        } else {
+            this.postRunMessage(Globals.userInputAlert + input + "\n");
+        }
         return input;
     }
 
@@ -527,4 +661,4 @@ String response() {
         }
     }  // Asker class
     ////////////////////////////////////////////////////////////////////////////
-}
+}
\ No newline at end of file
diff --git a/src/rars/venus/MonoRightCellRenderer.java b/src/rars/venus/MonoRightCellRenderer.java
index 9c4af347..f2dad740 100644
--- a/src/rars/venus/MonoRightCellRenderer.java
+++ b/src/rars/venus/MonoRightCellRenderer.java
@@ -4,39 +4,15 @@
 import javax.swing.table.DefaultTableCellRenderer;
 import java.awt.*;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /*
  * Use this to render Monospaced and right-aligned data in JTables.
  * I am using it to render integer addresses and values that are stored as
  * Strings containing either the decimal or hexidecimal version
  * of the integer value.
+ *
+ * This also add the ellipsis on the left on narrow columns, so the low order bytes are show first.
+ * e.g. "0x0000000000001234" is shown as "...01234" if not enough with in the column.
+ *
  */
 public class MonoRightCellRenderer extends DefaultTableCellRenderer {
     public static final Font MONOSPACED_PLAIN_12POINT = new Font("Monospaced", Font.PLAIN, 12);
@@ -47,6 +23,34 @@ public Component getTableCellRendererComponent(JTable table, Object value,
                 isSelected, hasFocus, row, column);
         cell.setFont(MONOSPACED_PLAIN_12POINT);
         cell.setHorizontalAlignment(SwingConstants.RIGHT);
+
+        //  Determine the width available to render the text
+
+        int availableWidth = table.getColumnModel().getColumn(column).getWidth();
+        availableWidth -= (int)table.getIntercellSpacing().getWidth();
+        Insets borderInsets = getBorder().getBorderInsets(cell);
+        availableWidth -= (borderInsets.left + borderInsets.right);
+        String cellText = cell.getText();
+        FontMetrics fm = getFontMetrics( getFont() );
+
+        //  Not enough space so start rendering from the end of the string
+        //  until all the space is used up
+        if (fm.stringWidth(cellText) > availableWidth) {
+            String dots = "...";
+            int textWidth = fm.stringWidth(dots);
+            int i = cellText.length() - 1;
+
+            for (; i > 0; i--) {
+                textWidth += fm.charWidth(cellText.charAt(i));
+
+                if (textWidth > availableWidth) {
+                    break;
+                }
+            }
+
+            cell.setText(dots + cellText.substring(i + 1));
+        }
+
         return cell;
     }
 }
\ No newline at end of file
diff --git a/src/rars/venus/NumberDisplayBaseChooser.java b/src/rars/venus/NumberDisplayBaseChooser.java
index 1d8ed6cc..6042a099 100644
--- a/src/rars/venus/NumberDisplayBaseChooser.java
+++ b/src/rars/venus/NumberDisplayBaseChooser.java
@@ -1,6 +1,7 @@
 package rars.venus;
 
 import rars.Globals;
+import rars.riscv.InstructionSet;
 import rars.util.Binary;
 
 import javax.swing.*;
@@ -9,34 +10,6 @@
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Use to select base for displaying numbers.  Initially the
  * choices are only 10 (decimal) and 16 (hex), so I'm using
@@ -138,20 +111,20 @@ public static String formatUnsignedInteger(int value, int base) {
      * @param base  the numerical base to use (currently 10 or 16)
      * @return a String equivalent of the value rendered appropriately.
      */
-    public static String formatNumber(int value, int base) {
+    public static String formatNumber(long value, int base, int length) {
         String result;
         switch (base) {
             case HEXADECIMAL:
-                result = Binary.intToHexString(value);
+                result = Binary.intToHexString(value, length);
                 break;
             case DECIMAL:
-                result = Integer.toString(value);
+                result = Binary.intToDecString(value, length);
                 break;
             case ASCII:
-                result = Binary.intToAscii(value);
+                result = Binary.intToAscii(value, length);
                 break;
             default:
-                result = Integer.toString(value);
+                result = Binary.intToDecString(value, length);
         }
         return result;
         //          if (base == NumberDisplayBaseChooser.HEXADECIMAL) {
@@ -163,11 +136,7 @@ public static String formatNumber(int value, int base) {
     }
 
     public static String formatNumber(long value, int base) {
-        if (base == NumberDisplayBaseChooser.HEXADECIMAL) {
-            return Binary.longToHexString(value);
-        } else {
-            return Long.toString(value);
-        }
+        return formatNumber(value, base, InstructionSet.rv64 ? 8 : 4);
     }
 
     /**
@@ -221,7 +190,7 @@ public String formatNumber(int value) {
         if (base == NumberDisplayBaseChooser.HEXADECIMAL) {
             return Binary.intToHexString(value);
         } else {
-            return new Integer(value).toString();
+            return Integer.toString(value);
         }
     }
 
diff --git a/src/rars/venus/TextSegmentWindow.java b/src/rars/venus/TextSegmentWindow.java
index e7bad860..22f8c215 100644
--- a/src/rars/venus/TextSegmentWindow.java
+++ b/src/rars/venus/TextSegmentWindow.java
@@ -15,34 +15,6 @@
 import java.awt.event.MouseListener;
 import java.util.*;
 
-	/*
-Copyright (c) 2003-2007,  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 Text Segment window in the Execute tab of the UI
  *
@@ -50,9 +22,6 @@ a copy of this software and associated documentation files (the
  **/
 
 public class TextSegmentWindow extends JInternalFrame implements Observer {
-    private JPanel programArgumentsPanel;  // DPS 17-July-2008
-    private JTextField programArgumentsTextField; // DPS 17-July-2008
-    private static final int PROGRAM_ARGUMENT_TEXTFIELD_COLUMNS = 40;
     private JTable table;
     private JScrollPane tableScroller;
     private Object[][] data;
@@ -96,11 +65,6 @@ public TextSegmentWindow() {
         contentPane = this.getContentPane();
         codeHighlighting = true;
         breakpointsEnabled = true;
-        programArgumentsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
-        programArgumentsPanel.add(new JLabel("Program Arguments: "));
-        programArgumentsTextField = new JTextField(PROGRAM_ARGUMENT_TEXTFIELD_COLUMNS);
-        programArgumentsTextField.setToolTipText("Arguments provided to program at runtime via a0 (argc) and a1 (argv)");
-        programArgumentsPanel.add(programArgumentsTextField);
     }
 
 
@@ -109,48 +73,14 @@ public TextSegmentWindow() {
      * Should convert the lines of code over to the table rows and columns.
      **/
     public void setupTable() {
-        int addressBase = Globals.getGui().getMainPane().getExecutePane().getAddressDisplayBase();
         codeHighlighting = true;
         breakpointsEnabled = true;
-        ArrayList sourceStatementList = Globals.program.getMachineList();
+        ArrayList sourceStatementList = Globals.program.getTextSegmentLines();
         data = new Object[sourceStatementList.size()][columnNames.length];
         intAddresses = new int[data.length];
         addressRows = new Hashtable<>(data.length);
         executeMods = new Hashtable<>(data.length);
-        // Get highest source line number to determine #leading spaces so line numbers will vertically align
-        // In multi-file situation, this will not necessarily be the last line b/c sourceStatementList contains
-        // source lines from all files.  DPS 3-Oct-10
-        int maxSourceLineNumber = 0;
-        for (int i = sourceStatementList.size() - 1; i >= 0; i--) {
-            ProgramStatement statement = sourceStatementList.get(i);
-            if (statement.getSourceLine() > maxSourceLineNumber) {
-                maxSourceLineNumber = statement.getSourceLine();
-            }
-        }
-        int sourceLineDigits = ("" + maxSourceLineNumber).length();
-        int leadingSpaces = 0;
-        int lastLine = -1;
-        for (int i = 0; i < sourceStatementList.size(); i++) {
-            ProgramStatement statement = sourceStatementList.get(i);
-            intAddresses[i] = statement.getAddress();
-            addressRows.put(intAddresses[i], i);
-            data[i][BREAK_COLUMN] = false;
-            data[i][ADDRESS_COLUMN] = NumberDisplayBaseChooser.formatUnsignedInteger(statement.getAddress(), addressBase);
-            data[i][CODE_COLUMN] = NumberDisplayBaseChooser.formatNumber(statement.getBinaryStatement(), 16);
-            data[i][BASIC_COLUMN] = statement.getPrintableBasicAssemblyStatement();
-            String sourceString = "";
-            if (!statement.getSource().equals("")) {
-                leadingSpaces = sourceLineDigits - ("" + statement.getSourceLine()).length();
-                String lineNumber = "          ".substring(0, leadingSpaces)
-                        + statement.getSourceLine() + ": ";
-                if (statement.getSourceLine() == lastLine)
-                    lineNumber = "          ".substring(0, sourceLineDigits) + "  ";
-                sourceString = lineNumber
-                        + rars.util.EditorFont.substituteSpacesForTabs(statement.getSource());
-            }
-            data[i][SOURCE_COLUMN] = sourceString;
-            lastLine = statement.getSourceLine();
-        }
+        addRows(sourceStatementList);
         contentPane.removeAll();
         tableModel = new TextTableModel(data);
         if (tableModelListener != null) {
@@ -163,12 +93,6 @@ public void setupTable() {
         // prevents cells in row from being highlighted when user clicks on breakpoint checkbox
         table.setRowSelectionAllowed(false);
 
-        table.getColumnModel().getColumn(BREAK_COLUMN).setPreferredWidth(40);
-        table.getColumnModel().getColumn(ADDRESS_COLUMN).setPreferredWidth(80);
-        table.getColumnModel().getColumn(CODE_COLUMN).setPreferredWidth(80);
-        table.getColumnModel().getColumn(BASIC_COLUMN).setPreferredWidth(160);
-        table.getColumnModel().getColumn(SOURCE_COLUMN).setPreferredWidth(280);
-
         CodeCellRenderer codeStepHighlighter = new CodeCellRenderer();
         table.getColumnModel().getColumn(BASIC_COLUMN).setCellRenderer(codeStepHighlighter);
         table.getColumnModel().getColumn(SOURCE_COLUMN).setCellRenderer(codeStepHighlighter);
@@ -183,9 +107,12 @@ public void setupTable() {
         tableScroller = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                 ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
         contentPane.add(tableScroller);
-        if (Globals.getSettings().getBooleanSetting(Settings.Bool.PROGRAM_ARGUMENTS)) {
-            addProgramArgumentsPanel();
-        }
+
+        setColumnMaxWidth(table.getColumnModel().getColumn(BREAK_COLUMN), columnNames[0]);
+        setColumnMaxWidth(table.getColumnModel().getColumn(ADDRESS_COLUMN), "0x00000000");
+        setColumnMaxWidth(table.getColumnModel().getColumn(CODE_COLUMN), "0x00000000");
+        table.getColumnModel().getColumn(BASIC_COLUMN).setPreferredWidth(160);
+        table.getColumnModel().getColumn(SOURCE_COLUMN).setPreferredWidth(280);
 
         deleteAsTextSegmentObserver();
         if (Globals.getSettings().getBooleanSetting(Settings.Bool.SELF_MODIFYING_CODE_ENABLED)) {
@@ -193,33 +120,76 @@ public void setupTable() {
         }
     }
 
-    ////////////  Support for program arguments added DPS 17-July-2008 //////////////
-
     /**
-     * Get program arguments from text field in south border of text segment window.
+     * Add rows in the data array from the information in the sourceStatementList.
      *
-     * @return String containing program arguments
+     * @param sourceStatementList contains the statements from de source code (comments, .eqv, instructions, ...)
+     *                            and the linked information (address, code, basic instruction, source code, ...)
      */
-    public String getProgramArguments() {
-        return programArgumentsTextField.getText();
-    }
+    private void addRows(ArrayList sourceStatementList) {
+        int maxSourceLineNumber = getMaxSourceLineNumber(sourceStatementList);
+        int addressBase = Globals.getGui().getMainPane().getExecutePane().getAddressDisplayBase();
+        int sourceLineDigits = ("" + maxSourceLineNumber).length();
+        int leadingSpaces = 0;
+        int lastLine = -1;
 
-    public void addProgramArgumentsPanel() {
-        // Don't add it if text segment window blank (file closed or no assemble yet)
-        if (contentPane != null && contentPane.getComponentCount() > 0) {
-            contentPane.add(programArgumentsPanel, BorderLayout.NORTH);
-            contentPane.validate();
+        for (int i = 0; i < sourceStatementList.size(); i++) {
+            ProgramStatement statement = sourceStatementList.get(i);
+            intAddresses[i] = statement.getAddress();
+            addressRows.put(intAddresses[i], i);
+            data[i][BREAK_COLUMN] = false;
+            String address = "";
+            String code = "";
+            String basicInstruction = "";
+            String sourceString = "";
+            if (statement.getInstruction() != null) {
+                address = NumberDisplayBaseChooser.formatUnsignedInteger(statement.getAddress(), addressBase);
+                code = NumberDisplayBaseChooser.formatNumber(statement.getBinaryStatement(), 16, 4);
+                basicInstruction = statement.getPrintableBasicAssemblyStatement();
+            }
+            if (!statement.getSource().equals("")) {
+                leadingSpaces = sourceLineDigits - ("" + statement.getSourceLine()).length();
+                String lineNumber = "          ".substring(0, leadingSpaces)
+                        + statement.getSourceLine() + ": ";
+                if (statement.getSourceLine() == lastLine)
+                    lineNumber = "          ".substring(0, sourceLineDigits) + "  ";
+                sourceString = lineNumber
+                        + rars.util.EditorFont.substituteSpacesForTabs(statement.getSource());
+            }
+            data[i][ADDRESS_COLUMN] = address;
+            data[i][CODE_COLUMN] = code;
+            data[i][BASIC_COLUMN] = basicInstruction;
+            data[i][SOURCE_COLUMN] = sourceString;
+            lastLine = statement.getSourceLine();
         }
     }
 
-    public void removeProgramArgumentsPanel() {
-        if (contentPane != null) {
-            contentPane.remove(programArgumentsPanel);
-            contentPane.validate();
+    /**
+     * Get highest source line number to determine #leading spaces so line numbers will vertically align
+     * In multi-file situation, this will not necessarily be the last line b/c sourceStatementList contains
+     * source lines from all files.  DPS 3-Oct-10
+     */
+    private static int getMaxSourceLineNumber(ArrayList sourceStatementList) {
+        int maxSourceLineNumber = 0;
+        for (int i = sourceStatementList.size() - 1; i >= 0; i--) {
+            ProgramStatement statement = sourceStatementList.get(i);
+            if (statement.getSourceLine() > maxSourceLineNumber) {
+                maxSourceLineNumber = statement.getSourceLine();
+            }
         }
+        return maxSourceLineNumber;
+    }
+
+    /**
+     *
+     */
+    public void setColumnMaxWidth(TableColumn column, String referenceText) {
+        Component component = this; // column.getCellRenderer().getTableCellRendererComponent();
+        FontMetrics fontMetrics = component.getFontMetrics(component.getFont());
+        int width = fontMetrics.stringWidth(referenceText) + 10;
+        column.setMaxWidth(width);
+        column.setPreferredWidth(width);
     }
-    //
-    ///////////////////////// end program arguments section  ////////////////////////
 
     /**
      * remove all components
@@ -247,11 +217,12 @@ public void updateCodeAddresses() {
         if (contentPane.getComponentCount() == 0)
             return; // ignore if no content to change
         int addressBase = Globals.getGui().getMainPane().getExecutePane().getAddressDisplayBase();
-        int address;
         String formattedAddress;
         for (int i = 0; i < intAddresses.length; i++) {
-            formattedAddress = NumberDisplayBaseChooser.formatUnsignedInteger(intAddresses[i], addressBase);
-            table.getModel().setValueAt(formattedAddress, i, ADDRESS_COLUMN);
+            if (intAddresses[i] != -1) {
+                formattedAddress = NumberDisplayBaseChooser.formatUnsignedInteger(intAddresses[i], addressBase);
+                table.getModel().setValueAt(formattedAddress, i, ADDRESS_COLUMN);
+            }
         }
     }
 
@@ -442,7 +413,19 @@ public int[] getSortedBreakPointsArray() {
         breakpointCount = 0;
         for (int i = 0; i < data.length; i++) {
             if ((Boolean) data[i][BREAK_COLUMN]) {
-                breakpoints[breakpointCount++] = intAddresses[i];
+                int index = i;
+                //if a breakpoint is not on an instruction, puts a breakpoint at next instruction
+                if(intAddresses[i] == -1) {
+                    for (int j = index; j < data.length; j++)
+                        if (intAddresses[j] != -1) {
+                            index = j;
+                            break;
+                        }
+                    if (index == i) //no instruction follows the breakpoint
+                        continue;   //don't add breakpoint
+                }
+                breakpoints[breakpointCount++] = intAddresses[index];
+                //TODO: we should probably, in place of this, lock the possibility to put a breakpoint if not an instruction
             }
         }
         Arrays.sort(breakpoints);
@@ -839,13 +822,11 @@ public Component getTableCellRendererComponent(JTable table, Object value,
     * Cell renderer for Machine Code column.  Alternates background color by row but otherwise is
     * same as MonoRightCellRenderer.
     */
-    class MachineCodeCellRenderer extends DefaultTableCellRenderer {
+    class MachineCodeCellRenderer extends MonoRightCellRenderer {
         public Component getTableCellRendererComponent(JTable table, Object value,
                                                        boolean isSelected, boolean hasFocus, int row, int column) {
             JLabel cell = (JLabel) super.getTableCellRendererComponent(table, value,
                     isSelected, hasFocus, row, column);
-            cell.setFont(MonoRightCellRenderer.MONOSPACED_PLAIN_12POINT);
-            cell.setHorizontalAlignment(SwingConstants.RIGHT);
             if (row % 2 == 0) {
                 cell.setBackground(Globals.getSettings().getColorSettingByPosition(Settings.EVEN_ROW_BACKGROUND));
                 cell.setForeground(Globals.getSettings().getColorSettingByPosition(Settings.EVEN_ROW_FOREGROUND));
diff --git a/src/rars/venus/ToolAction.java b/src/rars/venus/ToolAction.java
index 809d4f6e..0325c996 100644
--- a/src/rars/venus/ToolAction.java
+++ b/src/rars/venus/ToolAction.java
@@ -5,34 +5,6 @@
 import javax.swing.*;
 import java.awt.event.ActionEvent;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Connects a Tool class (class that implements Tool interface) to
  * the Mars menu system by supplying the response to that tool's menu item
diff --git a/src/rars/venus/ToolLoader.java b/src/rars/venus/ToolLoader.java
index 9196aa73..442376b3 100644
--- a/src/rars/venus/ToolLoader.java
+++ b/src/rars/venus/ToolLoader.java
@@ -9,34 +9,6 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * This class provides functionality to bring external Mars tools into the Mars
  * system by adding them to its Tools menu.  This permits anyone with knowledge
diff --git a/src/rars/venus/VenusUI.java b/src/rars/venus/VenusUI.java
index 15c976a2..4833e0f5 100644
--- a/src/rars/venus/VenusUI.java
+++ b/src/rars/venus/VenusUI.java
@@ -2,9 +2,12 @@
 
 import rars.Globals;
 import rars.Settings;
+import rars.SimulationException;
 import rars.riscv.InstructionSet;
 import rars.riscv.dump.DumpFormatLoader;
 import rars.simulator.Simulator;
+import rars.simulator.SimulatorNotice;
+import rars.tools.ConversionTool;
 import rars.venus.registers.ControlAndStatusWindow;
 import rars.venus.registers.FloatingPointWindow;
 import rars.venus.registers.RegistersPane;
@@ -18,44 +21,16 @@
 import java.net.URL;
 import java.util.ArrayList;
 
-/*
-Copyright (c) 2003-2013,  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)
- */
-
 /**
  * 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.
-		*/
+/* 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;
@@ -83,9 +58,9 @@ public class VenusUI extends JFrame {
     private JMenuItem fileNew, fileOpen, fileClose, fileCloseAll, fileSave, fileSaveAs, fileSaveAll, fileDumpMemory, 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,
+    private JCheckBoxMenuItem settingsLabel, settingsValueDisplayBase, settingsAddressDisplayBase,
             settingsExtended, settingsAssembleOnOpen, settingsAssembleAll, settingsAssembleOpen, settingsWarningsAreErrors,
-            settingsStartAtMain, settingsProgramArguments, settingsSelfModifyingCode, settingsRV64, settingsDeriveCurrentWorkingDirectory;
+            settingsStartAtMain, settingsSelfModifyingCode, settingsRV64, settingsDeriveCurrentWorkingDirectory, settingsDarkMode;
     private JMenuItem settingsExceptionHandler, settingsEditor, settingsHighlighting, settingsMemoryConfiguration;
     private JMenuItem helpHelp, helpAbout;
 
@@ -94,6 +69,7 @@ public class VenusUI extends JFrame {
     private JButton New, Open, Save, SaveAs, SaveAll, DumpMemory;
     private JButton Run, Assemble, Reset, Step, Backstep, Stop, Pause;
     private JButton Help;
+    ConversionTool conversionTool = new ConversionTool();
 
     // 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
@@ -106,11 +82,11 @@ public class VenusUI extends JFrame {
     private Action editCutAction, editCopyAction, editPasteAction, editFindReplaceAction, editSelectAllAction;
     private Action runAssembleAction, runGoAction, runStepAction, runBackstepAction, runResetAction,
             runStopAction, runPauseAction, runClearBreakpointsAction, runToggleBreakpointsAction;
-    private Action settingsLabelAction, settingsPopupInputAction, settingsValueDisplayBaseAction, settingsAddressDisplayBaseAction,
+    private Action settingsLabelAction, settingsValueDisplayBaseAction, settingsAddressDisplayBaseAction,
             settingsExtendedAction, settingsAssembleOnOpenAction, settingsAssembleOpenAction, settingsAssembleAllAction,
-            settingsWarningsAreErrorsAction, settingsStartAtMainAction, settingsProgramArgumentsAction,
+            settingsWarningsAreErrorsAction, settingsStartAtMainAction,
             settingsExceptionHandlerAction, settingsEditorAction, settingsHighlightingAction, settingsMemoryConfigurationAction,
-            settingsSelfModifyingCodeAction, settingsRV64Action, settingsDeriveCurrentWorkingDirectoryAction;
+            settingsSelfModifyingCodeAction, settingsRV64Action, settingsDeriveCurrentWorkingDirectoryAction, settingsDarkModeAction;
     private Action helpHelpAction, helpAboutAction;
 
 
@@ -126,9 +102,9 @@ public VenusUI(String name, ArrayList paths) {
         mainUI = this;
         Globals.setGui(this);
         this.editor = new Editor(this);
-
-        double screenWidth = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
-        double screenHeight = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
+        Rectangle maximumWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
+        double screenWidth = maximumWindowBounds.getWidth();
+        double screenHeight = maximumWindowBounds.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;
@@ -202,6 +178,7 @@ public VenusUI(String name, ArrayList paths) {
         JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT));
         jp.add(toolbar);
         jp.add(RunSpeedPanel.getInstance());
+        jp.add(conversionTool.createConversionToolPanel());
         JPanel center = new JPanel(new BorderLayout());
         center.add(jp, BorderLayout.NORTH);
         center.add(horizonSplitter);
@@ -411,9 +388,6 @@ public void handler(boolean visibility) {
                     System.out.println("ExecutePane reference 2");
                 }
             };
-            settingsPopupInputAction = new SettingsAction("Popup dialog for input syscalls (5,6,7,8,12)",
-                    "If set, use popup dialog for input syscalls (5,6,7,8,12) instead of cursor in Run I/O window",
-                    Settings.Bool.POPUP_SYSCALL_INPUT);
 
             settingsValueDisplayBaseAction = new SettingsAction("Values displayed in hexadecimal",
                     "Toggle between hexadecimal and decimal display of memory/register values",
@@ -447,17 +421,6 @@ public void handler(boolean isHex) {
             settingsStartAtMainAction = new SettingsAction("Initialize Program Counter to global 'main' if defined",
                     "If set, assembler will initialize Program Counter to text address globally labeled 'main', if defined.",
                     Settings.Bool.START_AT_MAIN);
-            settingsProgramArgumentsAction = new SettingsAction("Program arguments provided to program",
-                    "If set, program arguments for the program can be entered in border of Text Segment window.",
-                    Settings.Bool.PROGRAM_ARGUMENTS) {
-                public void handler(boolean selected) {
-                    if (selected) {
-                        mainPane.getExecutePane().getTextSegmentWindow().addProgramArgumentsPanel();
-                    } else {
-                        mainPane.getExecutePane().getTextSegmentWindow().removeProgramArgumentsPanel();
-                    }
-                }
-            };
             settingsSelfModifyingCodeAction = new SettingsAction("Self-modifying code",
                     "If set, the program can write and branch to both text and data segments.",
                     Settings.Bool.SELF_MODIFYING_CODE_ENABLED);
@@ -476,7 +439,8 @@ public void handler(boolean value) {
             settingsDeriveCurrentWorkingDirectoryAction = new SettingsAction("Derive current working directory",
                     "If set, the working directory is derived from the main file instead of the RARS executable directory.",
                     Settings.Bool.DERIVE_CURRENT_WORKING_DIRECTORY);
-
+            settingsDarkModeAction = new SettingsAction("Dark mode", "If set, RARS will be in dark mode at the next opening. Uncheck for light mode",
+                    Settings.Bool.DARK_MODE_ENABLED);
 
             settingsEditorAction = new SettingsEditorAction("Editor...", null,
                     "View and modify text editor settings.", null, null
@@ -613,8 +577,6 @@ private JMenuBar setUpMenuBar() {
 
         settingsLabel = new JCheckBoxMenuItem(settingsLabelAction);
         settingsLabel.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.LABEL_WINDOW_VISIBILITY));
-        settingsPopupInput = new JCheckBoxMenuItem(settingsPopupInputAction);
-        settingsPopupInput.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.POPUP_SYSCALL_INPUT));
         settingsValueDisplayBase = new JCheckBoxMenuItem(settingsValueDisplayBaseAction);
         settingsValueDisplayBase.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.DISPLAY_VALUES_IN_HEX));//mainPane.getExecutePane().getValueDisplayBaseChooser().isSelected());
         // Tell the corresponding JCheckBox in the Execute Pane about me -- it has already been created.
@@ -631,6 +593,25 @@ private JMenuBar setUpMenuBar() {
         settingsRV64.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.RV64_ENABLED));
         settingsDeriveCurrentWorkingDirectory = new JCheckBoxMenuItem(settingsDeriveCurrentWorkingDirectoryAction);
         settingsDeriveCurrentWorkingDirectory.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.DERIVE_CURRENT_WORKING_DIRECTORY));
+        settingsDarkMode = new JCheckBoxMenuItem(settingsDarkModeAction);
+        settingsDarkMode.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.DARK_MODE_ENABLED));
+        settingsDarkMode.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                try {
+                    if (settingsDarkMode.isSelected()) {
+                        UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarkLaf");
+                        SwingUtilities.updateComponentTreeUI(mainUI);
+                        Globals.getSettings().setDarkMode();
+                    } else {
+                        UIManager.setLookAndFeel("com.formdev.flatlaf.FlatIntelliJLaf");
+                        SwingUtilities.updateComponentTreeUI(mainUI);
+                        Globals.getSettings().setLightMode();
+                    }
+                } catch (Exception ex) {
+                    System.err.println( "Failed to initialize LaF. Continue with default LaF." );
+                }
+            }
+        });
         settingsAssembleOnOpen = new JCheckBoxMenuItem(settingsAssembleOnOpenAction);
         settingsAssembleOnOpen.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.ASSEMBLE_ON_OPEN));
         settingsAssembleAll = new JCheckBoxMenuItem(settingsAssembleAllAction);
@@ -641,16 +622,12 @@ private JMenuBar setUpMenuBar() {
         settingsWarningsAreErrors.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.WARNINGS_ARE_ERRORS));
         settingsStartAtMain = new JCheckBoxMenuItem(settingsStartAtMainAction);
         settingsStartAtMain.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.START_AT_MAIN));
-        settingsProgramArguments = new JCheckBoxMenuItem(settingsProgramArgumentsAction);
-        settingsProgramArguments.setSelected(Globals.getSettings().getBooleanSetting(Settings.Bool.PROGRAM_ARGUMENTS));
         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();
@@ -665,6 +642,7 @@ private JMenuBar setUpMenuBar() {
         settings.add(settingsSelfModifyingCode);
         settings.add(settingsRV64);
         settings.addSeparator();
+        settings.add(settingsDarkMode);
         settings.add(settingsEditor);
         settings.add(settingsHighlighting);
         settings.add(settingsExceptionHandler);
@@ -1064,6 +1042,120 @@ public static int getMenuState() {
         return menuState;
     }
 
+    /**
+     * Method called when a simulation is started to update the UI.
+     *
+     * @return true if the ui was updated to start the simulation.
+     */
+    public boolean onStartedSimulation(String name) {
+        ExecutePane executePane = getMainPane().getExecutePane();
+
+        if (!FileStatus.isAssembled()) {
+            // note: this should never occur since "Go" and "Step" are only enabled after successful assembly.
+            JOptionPane.showMessageDialog(this, "The program must be assembled before it can be run.");
+            return false;
+        }
+
+        if (!getStarted()) {
+            getMessagesPane().processProgramArgumentsIfAny();
+        }
+
+        if (!getReset() && !getStarted()) {
+            // This should never occur because at termination the Go and Step buttons are disabled.
+            JOptionPane.showMessageDialog(this, "reset " + mainUI.getReset() + " started " + mainUI.getStarted());//"You must reset before you can execute the program again.");
+            return false;
+        }
+
+        setStarted(true);  // added 8/27/05
+
+        getMessagesPane().postMessage(name + ": running " + FileStatus.getFile().getName() + "\n\n");
+        getMessagesPane().selectRunMessageTab();
+        executePane.getTextSegmentWindow().setCodeHighlighting(false);
+        executePane.getTextSegmentWindow().unhighlightAllSteps();
+        //clears highlight of registers and data segment if the run step was used before
+        executePane.getRegistersWindow().clearHighlighting();
+        executePane.getFloatingPointWindow().clearHighlighting();
+        executePane.getControlAndStatusWindow().clearHighlighting();
+        executePane.getDataSegmentWindow().clearHighlighting();
+
+        return true;
+    }
+
+    /**
+     * Method called when a simulation is stopped to update the UI.
+     */
+    public void onStoppedSimulation(String name, SimulatorNotice notice) {
+        ExecutePane executePane = getMainPane().getExecutePane();
+        executePane.getRegistersWindow().updateRegisters();
+        executePane.getFloatingPointWindow().updateRegisters();
+        executePane.getControlAndStatusWindow().updateRegisters();
+        executePane.getDataSegmentWindow().updateValues();
+
+        if (notice.getDone()) {
+            RunGoAction.resetMaxSteps();
+            executePane.getTextSegmentWindow().unhighlightAllSteps();
+            executePane.getTextSegmentWindow().setCodeHighlighting(false);
+            FileStatus.set(FileStatus.TERMINATED);
+        } else {
+            executePane.getTextSegmentWindow().setCodeHighlighting(true);
+            executePane.getTextSegmentWindow().highlightStepAtPC();
+            FileStatus.set(FileStatus.RUNNABLE);
+        }
+
+        Simulator.Reason reason = notice.getReason();
+        switch (reason) {
+            case NORMAL_TERMINATION:
+                mainUI.getMessagesPane().postMessage(
+                        "\n" + name + ": execution completed successfully.\n\n");
+                mainUI.getMessagesPane().postRunMessage(
+                        "\n-- program is finished running (" + Globals.exitCode + ") --\n\n");
+                mainUI.getMessagesPane().selectRunMessageTab();
+                break;
+            case CLIFF_TERMINATION:
+                mainUI.getMessagesPane().postMessage(
+                        "\n" + name + ": execution terminated by null instruction.\n\n");
+                mainUI.getMessagesPane().postRunMessage(
+                        "\n-- program is finished running (dropped off bottom) --\n\n");
+                mainUI.getMessagesPane().selectRunMessageTab();
+                break;
+            case EXCEPTION:
+                SimulationException pe = notice.getException();
+                mainUI.getMessagesPane().postMessage(
+                        pe.error().generateReport());
+                mainUI.getMessagesPane().postMessage(
+                        "\n" + name + ": execution terminated with errors.\n\n");
+                mainUI.getMessagesPane().postRunMessage("\n"+pe.error().getMessage());
+                break;
+            case STOP:
+                mainUI.getMessagesPane().postMessage(
+                        "\n" + name + ": execution terminated by user.\n\n");
+                mainUI.getMessagesPane().selectMessageTab();
+                break;
+            case MAX_STEPS:
+                int maxSteps = notice.getMaxSteps();
+                if (maxSteps != 1) {
+                    // do not display something on Step Action
+                    mainUI.getMessagesPane().postMessage(
+                            "\n" + name + ": execution step limit of " + maxSteps + " exceeded.\n\n");
+                    mainUI.getMessagesPane().selectMessageTab();
+                }
+                break;
+            case BREAKPOINT:
+                mainUI.getMessagesPane().postMessage(
+                        "\n" + name + ": execution paused at breakpoint: " + FileStatus.getFile().getName() + "\n\n");
+                break;
+            case PAUSE:
+                mainUI.getMessagesPane().postMessage(
+                        "\n" + name + ": execution paused by user: " + FileStatus.getFile().getName() + "\n\n");
+                break;
+            default:
+                // Ne devrait pas arriver
+                throw new IllegalStateException("Unexpected value: " + reason);
+        }
+
+        mainUI.setReset(false);
+    }
+
     /**
      * To set whether the register values are reset.
      *
diff --git a/src/rars/venus/editors/TextEditingArea.java b/src/rars/venus/editors/TextEditingArea.java
index b1cc0afe..a45322d8 100644
--- a/src/rars/venus/editors/TextEditingArea.java
+++ b/src/rars/venus/editors/TextEditingArea.java
@@ -4,34 +4,6 @@
 import javax.swing.undo.UndoManager;
 import java.awt.*;
 
-/*
-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)
- */
-
 /**
  * Specifies capabilities that any test editor used in MARS must have.
  */
diff --git a/src/rars/venus/editors/generic/GenericTextArea.java b/src/rars/venus/editors/generic/GenericTextArea.java
index 761e6113..15111411 100644
--- a/src/rars/venus/editors/generic/GenericTextArea.java
+++ b/src/rars/venus/editors/generic/GenericTextArea.java
@@ -15,34 +15,6 @@
 import javax.swing.undo.UndoManager;
 import java.awt.*;
 
-/*
-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)
- */
-
 public class GenericTextArea extends JTextArea implements TextEditingArea {
 
 
diff --git a/src/rars/venus/editors/jeditsyntax/DefaultInputHandler.java b/src/rars/venus/editors/jeditsyntax/DefaultInputHandler.java
index 18b24573..9dc9ee48 100644
--- a/src/rars/venus/editors/jeditsyntax/DefaultInputHandler.java
+++ b/src/rars/venus/editors/jeditsyntax/DefaultInputHandler.java
@@ -1,12 +1,3 @@
-/*
- * DefaultInputHandler.java - Default implementation of an input handler
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import javax.swing.*;
diff --git a/src/rars/venus/editors/jeditsyntax/InputHandler.java b/src/rars/venus/editors/jeditsyntax/InputHandler.java
index dd27c509..472580eb 100644
--- a/src/rars/venus/editors/jeditsyntax/InputHandler.java
+++ b/src/rars/venus/editors/jeditsyntax/InputHandler.java
@@ -1,12 +1,3 @@
-/*
- * InputHandler.java - Manages key bindings and executes actions
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import javax.swing.*;
diff --git a/src/rars/venus/editors/jeditsyntax/JEditTextArea.java b/src/rars/venus/editors/jeditsyntax/JEditTextArea.java
index 7c942a08..a9bab375 100644
--- a/src/rars/venus/editors/jeditsyntax/JEditTextArea.java
+++ b/src/rars/venus/editors/jeditsyntax/JEditTextArea.java
@@ -1,12 +1,3 @@
-/*
- * JEditTextArea.java - jEdit's text component
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import rars.Globals;
diff --git a/src/rars/venus/editors/jeditsyntax/KeywordMap.java b/src/rars/venus/editors/jeditsyntax/KeywordMap.java
index 86e4f08b..d9d183f6 100644
--- a/src/rars/venus/editors/jeditsyntax/KeywordMap.java
+++ b/src/rars/venus/editors/jeditsyntax/KeywordMap.java
@@ -1,18 +1,9 @@
-/*
- * KeywordMap.java - Fast keyword->id map
- * Copyright (C) 1998, 1999 Slava Pestov
- * Copyright (C) 1999 Mike Dillon
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import rars.venus.editors.jeditsyntax.tokenmarker.Token;
 
 import javax.swing.text.Segment;
+import java.util.Arrays;
 
 /**
  * A KeywordMap is similar to a hashtable in that it maps keys
@@ -74,6 +65,22 @@ public byte lookup(Segment text, int offset, int length) {
         return Token.NULL;
     }
 
+    /**
+     * Looks up a key.
+     */
+    public byte lookup(String keyword) {
+        if (keyword.isEmpty())
+            return Token.NULL;
+        char[] chars = keyword.toCharArray();
+        Keyword k = map[getStringMapKey(keyword)];
+        while (k != null) {
+            if (Arrays.equals(k.keyword, chars))
+                return k.id;
+            k = k.next;
+        }
+        return Token.NULL;
+    }
+
     /**
      * Adds a key-value mapping.
      *
@@ -85,6 +92,15 @@ public void add(String keyword, byte id) {
         map[key] = new Keyword(keyword.toCharArray(), id, map[key]);
     }
 
+    /**
+     * remove all keywords.
+     */
+    public void clear() {
+        for (int i = 0; i < mapLength; i++) {
+            map[i] = null;
+        }
+    }
+
     /**
      * Returns true if the keyword map is set to be case insensitive,
      * false otherwise.
diff --git a/src/rars/venus/editors/jeditsyntax/PopupHelpItem.java b/src/rars/venus/editors/jeditsyntax/PopupHelpItem.java
index 2ecfe57b..3603439f 100644
--- a/src/rars/venus/editors/jeditsyntax/PopupHelpItem.java
+++ b/src/rars/venus/editors/jeditsyntax/PopupHelpItem.java
@@ -1,31 +1,3 @@
-/*
-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)
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import java.util.ArrayList;
diff --git a/src/rars/venus/editors/jeditsyntax/SyntaxDocument.java b/src/rars/venus/editors/jeditsyntax/SyntaxDocument.java
index b2801f45..5ca1d1a6 100644
--- a/src/rars/venus/editors/jeditsyntax/SyntaxDocument.java
+++ b/src/rars/venus/editors/jeditsyntax/SyntaxDocument.java
@@ -1,12 +1,3 @@
-/*
- * SyntaxDocument.java - Document that can be tokenized
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import rars.venus.editors.jeditsyntax.tokenmarker.TokenMarker;
@@ -135,6 +126,7 @@ protected void fireInsertUpdate(DocumentEvent evt) {
                         ch.getChildrenAdded().length -
                                 ch.getChildrenRemoved().length);
             }
+            tokenMarker.updated(evt);
         }
 
         super.fireInsertUpdate(evt);
@@ -154,6 +146,7 @@ protected void fireRemoveUpdate(DocumentEvent evt) {
                         ch.getChildrenRemoved().length -
                                 ch.getChildrenAdded().length);
             }
+            tokenMarker.updated(evt);
         }
 
         super.fireRemoveUpdate(evt);
diff --git a/src/rars/venus/editors/jeditsyntax/SyntaxStyle.java b/src/rars/venus/editors/jeditsyntax/SyntaxStyle.java
index ea27c999..17405f00 100644
--- a/src/rars/venus/editors/jeditsyntax/SyntaxStyle.java
+++ b/src/rars/venus/editors/jeditsyntax/SyntaxStyle.java
@@ -1,12 +1,3 @@
-/*
- * SyntaxStyle.java - A simple text style class
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import java.awt.*;
diff --git a/src/rars/venus/editors/jeditsyntax/SyntaxUtilities.java b/src/rars/venus/editors/jeditsyntax/SyntaxUtilities.java
index 9a5dc518..db0a917c 100644
--- a/src/rars/venus/editors/jeditsyntax/SyntaxUtilities.java
+++ b/src/rars/venus/editors/jeditsyntax/SyntaxUtilities.java
@@ -1,12 +1,3 @@
-/*
- * SyntaxUtilities.java - Utility functions used by syntax colorizing
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import rars.Globals;
@@ -27,6 +18,8 @@
  * @version $Id: SyntaxUtilities.java,v 1.9 1999/12/13 03:40:30 sp Exp $
  */
 public class SyntaxUtilities {
+
+    private static SyntaxStyle[] defaultStyles = getLightDefaultSyntaxStyles();
     /**
      * Checks if a subregion of a Segment is equal to a
      * string.
@@ -89,6 +82,13 @@ public static boolean regionMatches(boolean ignoreCase, Segment text,
      * to use the default syntax styles.
      */
     public static SyntaxStyle[] getDefaultSyntaxStyles() {
+        return defaultStyles;
+    }
+
+    /**
+     * Returns the light default style table.
+     */
+    public static SyntaxStyle[] getLightDefaultSyntaxStyles() {
         SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT];
 
         // SyntaxStyle constructor params: color, italic?, bold?
@@ -102,12 +102,48 @@ public static SyntaxStyle[] getDefaultSyntaxStyles() {
         styles[Token.LITERAL1] = new SyntaxStyle(new Color(0x00CC33), false, false);//(new Color(0x650099),false,false);
         styles[Token.LITERAL2] = new SyntaxStyle(new Color(0x00CC33), false, false);//(new Color(0x650099),false,true);
         styles[Token.LABEL] = new SyntaxStyle(Color.black, true, false);//(new Color(0x990033),false,true);
+        styles[Token.SYMBOL] = new SyntaxStyle(new Color(0x006666), false, false);
+        styles[Token.OPERATOR] = new SyntaxStyle(Color.black, false, true);
+        styles[Token.INVALID] = new SyntaxStyle(Color.red, false, false);
+        styles[Token.MACRO_ARG] = new SyntaxStyle(new Color(150, 150, 0), false, false);
+        return styles;
+    }
+
+    /**
+     * Returns the dark default style table.
+     */
+    public static SyntaxStyle[] getDarkDefaultSyntaxStyles() {
+        SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT];
+
+        // SyntaxStyle constructor params: color, italic?, bold?
+        // All need to be assigned even if not used by language (no gaps in array)
+        styles[Token.NULL] = new SyntaxStyle(Color.black, false, false);
+        styles[Token.COMMENT1] = new SyntaxStyle(new Color(0x00CC66), true, false);
+        styles[Token.COMMENT2] = new SyntaxStyle(new Color(0x990033), true, false);
+        styles[Token.KEYWORD1] = new SyntaxStyle(new Color(0x66CCFF), false, false);
+        styles[Token.KEYWORD2] = new SyntaxStyle(new Color(0x9999FF), false, false);
+        styles[Token.KEYWORD3] = new SyntaxStyle(new Color(0xFF9999), false, false);
+        styles[Token.LITERAL1] = new SyntaxStyle(new Color(0x00CC66), false, false);
+        styles[Token.LITERAL2] = new SyntaxStyle(new Color(0x00CC66), false, false);
+        styles[Token.LABEL] = new SyntaxStyle(new Color(0xFFCC66), true, false);
+        styles[Token.SYMBOL] = new SyntaxStyle(new Color(0x00AAAAA), false, false);
         styles[Token.OPERATOR] = new SyntaxStyle(Color.black, false, true);
         styles[Token.INVALID] = new SyntaxStyle(Color.red, false, false);
         styles[Token.MACRO_ARG] = new SyntaxStyle(new Color(150, 150, 0), false, false);
         return styles;
     }
 
+    /**
+     * sets the default style table to the dark default
+     */
+    public static void setDarkDefaultStyles() {
+        defaultStyles = getDarkDefaultSyntaxStyles();
+    }
+
+    public static void setLightDefaultStyles() {
+        defaultStyles = getLightDefaultSyntaxStyles();
+    }
+
     /**
      * Returns the CURRENT style table. This can be passed to the
      * setStyles() method of SyntaxDocument
@@ -127,6 +163,7 @@ public static SyntaxStyle[] getCurrentSyntaxStyles() {
         styles[Token.LITERAL1] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.LITERAL1);
         styles[Token.LITERAL2] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.LITERAL2);
         styles[Token.LABEL] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.LABEL);
+        styles[Token.SYMBOL] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.SYMBOL);
         styles[Token.OPERATOR] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.OPERATOR);
         styles[Token.INVALID] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.INVALID);
         styles[Token.MACRO_ARG] = Globals.getSettings().getEditorSyntaxStyleByPosition(Token.MACRO_ARG);
diff --git a/src/rars/venus/editors/jeditsyntax/TextAreaDefaults.java b/src/rars/venus/editors/jeditsyntax/TextAreaDefaults.java
index e2f6c5bf..15661748 100644
--- a/src/rars/venus/editors/jeditsyntax/TextAreaDefaults.java
+++ b/src/rars/venus/editors/jeditsyntax/TextAreaDefaults.java
@@ -1,12 +1,3 @@
-/*
- * TextAreaDefaults.java - Encapsulates default values for various settings
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import rars.Settings;
diff --git a/src/rars/venus/editors/jeditsyntax/TextAreaPainter.java b/src/rars/venus/editors/jeditsyntax/TextAreaPainter.java
index 046d010b..9fab121f 100644
--- a/src/rars/venus/editors/jeditsyntax/TextAreaPainter.java
+++ b/src/rars/venus/editors/jeditsyntax/TextAreaPainter.java
@@ -1,14 +1,3 @@
-/*
- * TextAreaPainter.java - Paints the text area
- * Copyright (C) 1999 Slava Pestov
- *
- * 08/05/2002	Cursor (caret) rendering fixed for JDK 1.4 (Anonymous)
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import rars.venus.editors.jeditsyntax.tokenmarker.Token;
diff --git a/src/rars/venus/editors/jeditsyntax/TextUtilities.java b/src/rars/venus/editors/jeditsyntax/TextUtilities.java
index 5997fedc..239e7b72 100644
--- a/src/rars/venus/editors/jeditsyntax/TextUtilities.java
+++ b/src/rars/venus/editors/jeditsyntax/TextUtilities.java
@@ -1,12 +1,3 @@
-/*
- * TextUtilities.java - Utility functions used by the text area classes
- * Copyright (C) 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax;
 
 import javax.swing.text.BadLocationException;
diff --git a/src/rars/venus/editors/jeditsyntax/tokenmarker/RISCVTokenMarker.java b/src/rars/venus/editors/jeditsyntax/tokenmarker/RISCVTokenMarker.java
index 2602c6de..fa3e0b7b 100644
--- a/src/rars/venus/editors/jeditsyntax/tokenmarker/RISCVTokenMarker.java
+++ b/src/rars/venus/editors/jeditsyntax/tokenmarker/RISCVTokenMarker.java
@@ -1,16 +1,6 @@
-/*
- * MIPSTokenMarker.java - MIPS Assembly token marker
- * Copyright (C) 1998, 1999 Slava Pestov, 2010 Pete Sanderson
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax.tokenmarker;
 
-import rars.Globals;
-import rars.Settings;
+import rars.*;
 import rars.assembler.Directives;
 import rars.riscv.BasicInstruction;
 import rars.riscv.hardware.FloatingPointRegisterFile;
@@ -19,7 +9,9 @@
 import rars.riscv.Instruction;
 import rars.venus.editors.jeditsyntax.KeywordMap;
 import rars.venus.editors.jeditsyntax.PopupHelpItem;
+import rars.venus.editors.jeditsyntax.SyntaxDocument;
 
+import javax.swing.event.DocumentEvent;
 import javax.swing.text.Segment;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -46,6 +38,7 @@ public static String[] getRISCVTokenLabels() {
             tokenLabels[Token.LITERAL1] = "String literal";
             tokenLabels[Token.LITERAL2] = "Character literal";
             tokenLabels[Token.LABEL] = "Label";
+            tokenLabels[Token.SYMBOL] = "Symbol";
             tokenLabels[Token.KEYWORD1] = "Instruction";
             tokenLabels[Token.KEYWORD2] = "Assembler directive";
             tokenLabels[Token.KEYWORD3] = "Register";
@@ -62,6 +55,7 @@ public static String[] getRISCVTokenExamples() {
             tokenExamples[Token.LITERAL1] = "\"First\"";
             tokenExamples[Token.LITERAL2] = "'\\n'";
             tokenExamples[Token.LABEL] = "main:";
+            tokenExamples[Token.SYMBOL] = "PrintInt";
             tokenExamples[Token.KEYWORD1] = "lui";
             tokenExamples[Token.KEYWORD2] = ".text";
             tokenExamples[Token.KEYWORD3] = "zero";
@@ -71,6 +65,14 @@ public static String[] getRISCVTokenExamples() {
         return tokenExamples;
     }
 
+    @Override
+    public void updated(DocumentEvent evt) {
+        SyntaxDocument document = (SyntaxDocument) evt.getDocument();
+        // clear info and retokenize all to collect label definitions
+        changingKeywords.clear();
+        document.tokenizeLines();
+    }
+
 
     public byte markTokensImpl(byte token, Segment line, int lineIndex) {
         char[] array = line.array;
@@ -119,16 +121,22 @@ public byte markTokensImpl(byte token, Segment line, int lineIndex) {
                             // (3) there are spaces between label name and colon, (4) label is valid
                             // MIPS identifier (otherwise would catch, say, 0 (zero) in .word 0:10)
                             backslash = false;
-                            //String lab = new String(array, lastOffset, i1-lastOffset-1).trim();
                             boolean validIdentifier = false;
+                            String label = null;
                             try {
-                                validIdentifier = rars.assembler.TokenTypes.isValidIdentifier(new String(array, lastOffset, i1 - lastOffset - 1).trim());
+                                label = new String(array, lastOffset, i1 - lastOffset - 1).trim();
+                                validIdentifier = rars.assembler.TokenTypes.isValidIdentifier(label);
                             } catch (StringIndexOutOfBoundsException e) {
                                 validIdentifier = false;
                             }
                             if (validIdentifier) {
                                 addToken(i1 - lastOffset, Token.LABEL);
                                 lastOffset = lastKeyword = i1;
+                                // Register the label, if new, to recognize its usages
+                                byte t = changingKeywords.lookup(label);
+                                if (t == Token.NULL) {
+                                    changingKeywords.add(label, Token.LABEL);
+                                }
                             }
                             break;
                         case '#':
@@ -454,26 +462,38 @@ private static KeywordMap getKeywords() {
     // private members
     private static KeywordMap cKeywords;
     private static String[] tokenLabels, tokenExamples;
+    private KeywordMap changingKeywords = new KeywordMap(false); //for labels and .eqv symbols
     private KeywordMap keywords;
     private int lastOffset;
     private int lastKeyword;
+    private boolean lastKeywordIsEqv = false;
 
     private void doKeyword(Segment line, int i, char c) {
         int i1 = i + 1;
 
         int len = i - lastKeyword;
         byte id = keywords.lookup(line, lastKeyword, len);
+        String keyword;
+        try {
+            keyword = line.toString().substring(lastKeyword - line.getBeginIndex(), i - line.getBeginIndex());
+        } catch (IndexOutOfBoundsException e) {
+            keyword = "";
+        }
+        if (id == Token.NULL) {
+            id = changingKeywords.lookup(line, lastKeyword, len);
+            if (id == Token.NULL && lastKeywordIsEqv) {
+                if (rars.assembler.TokenTypes.isValidIdentifier(keyword))
+                    changingKeywords.add(keyword, Token.SYMBOL);
+                lastKeywordIsEqv = false;
+            }
+        } else if (id == Token.KEYWORD2 && keyword.equals(".eqv")) {
+            lastKeywordIsEqv = true;
+        }
         if (id != Token.NULL) {
-            // If this is a Token.KEYWORD1 and line already contains a keyword,
-            // then assume this one is a label reference and ignore it.
-            //   if (id == Token.KEYWORD1 && tokenListContainsKeyword()) {
-            //    }
-            //    else {
             if (lastKeyword != lastOffset)
                 addToken(lastKeyword - lastOffset, Token.NULL);
             addToken(len, id);
             lastOffset = i;
-            //  }
         }
         lastKeyword = i1;
     }
diff --git a/src/rars/venus/editors/jeditsyntax/tokenmarker/Token.java b/src/rars/venus/editors/jeditsyntax/tokenmarker/Token.java
index a885ffae..dadc5a83 100644
--- a/src/rars/venus/editors/jeditsyntax/tokenmarker/Token.java
+++ b/src/rars/venus/editors/jeditsyntax/tokenmarker/Token.java
@@ -1,12 +1,3 @@
-/*
- * Token.java - Generic token
- * Copyright (C) 1998, 1999 Slava Pestov
- *
- * You may use and modify this package for any purpose. Redistribution is
- * permitted, in both source and binary form, provided that this notice
- * remains intact in all source distributions of this package.
- */
-
 package rars.venus.editors.jeditsyntax.tokenmarker;
 
 /**
@@ -64,49 +55,55 @@ public class Token {
      */
     public static final byte LABEL = 5;
 
+    /**
+     * Symbol token id. This can be used to mark symbols
+     * This should be used to mark symbols declared with .eqv
+     */
+    public static final byte SYMBOL = 6;
+
     /**
      * Keyword 1 token id. This can be used to mark a
      * keyword. This should be used for general language
      * constructs.
      */
-    public static final byte KEYWORD1 = 6;
+    public static final byte KEYWORD1 = 7;
 
     /**
      * Keyword 2 token id. This can be used to mark a
      * keyword. This should be used for preprocessor
      * commands, or variables.
      */
-    public static final byte KEYWORD2 = 7;
+    public static final byte KEYWORD2 = 8;
 
     /**
      * Keyword 3 token id. This can be used to mark a
      * keyword. This should be used for data types.
      */
-    public static final byte KEYWORD3 = 8;
+    public static final byte KEYWORD3 = 9;
 
     /**
      * Operator token id. This can be used to mark an
      * operator. (eg, SQL mode marks +, -, etc with this
      * token type)
      */
-    public static final byte OPERATOR = 9;
+    public static final byte OPERATOR = 10;
 
     /**
      * Invalid token id. This can be used to mark invalid
      * or incomplete tokens, so the user can easily spot
      * syntax errors.
      */
-    public static final byte INVALID = 10;
+    public static final byte INVALID = 11;
 
     /**
      * Macro parameter token.  Added for MARS 4.3.
      */
-    public static final byte MACRO_ARG = 11;
+    public static final byte MACRO_ARG = 12;
 
     /**
      * The total number of defined token ids.
      */
-    public static final byte ID_COUNT = 12;
+    public static final byte ID_COUNT = 13;
 
     /**
      * The first id that can be used for internal state
diff --git a/src/rars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.java b/src/rars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.java
index 69d4684c..0279a9ae 100644
--- a/src/rars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.java
+++ b/src/rars/venus/editors/jeditsyntax/tokenmarker/TokenMarker.java
@@ -1,16 +1,8 @@
-/*
-* TokenMarker.java - Generic token marker
-* Copyright (C) 1998, 1999 Slava Pestov
-*
-* You may use and modify this package for any purpose. Redistribution is
-* permitted, in both source and binary form, provided that this notice
-* remains intact in all source distributions of this package.
-*/
-
 package rars.venus.editors.jeditsyntax.tokenmarker;
 
 import rars.venus.editors.jeditsyntax.PopupHelpItem;
 
+import javax.swing.event.DocumentEvent;
 import javax.swing.text.Segment;
 import java.util.ArrayList;
 
@@ -314,6 +306,12 @@ protected void addToken(int length, byte id) {
         }
     }
 
+    /**
+     * method called when there is a change in the document.
+     */
+    public void updated(DocumentEvent evt) {
+    }
+
     /**
      * Inner class for storing information about tokenized lines.
      */
diff --git a/src/rars/venus/registers/ControlAndStatusWindow.java b/src/rars/venus/registers/ControlAndStatusWindow.java
index 3fb21358..53f600c5 100644
--- a/src/rars/venus/registers/ControlAndStatusWindow.java
+++ b/src/rars/venus/registers/ControlAndStatusWindow.java
@@ -32,15 +32,11 @@ public class ControlAndStatusWindow extends RegisterBlockWindow {
     };
 
     public ControlAndStatusWindow() {
-        super(ControlAndStatusRegisterFile.getRegisters(), regToolTips, "Current 32 bit value");
+        super(ControlAndStatusRegisterFile.getRegisters(), regToolTips, "Current value");
     }
 
     protected String formatRegister(Register value, int base) {
-        if (Globals.getSettings().getBooleanSetting(Settings.Bool.RV64_ENABLED)){
-            return NumberDisplayBaseChooser.formatNumber(value.getValue(), base);
-        }else {
-            return NumberDisplayBaseChooser.formatNumber((int)value.getValue(), base);
-        }
+        return NumberDisplayBaseChooser.formatNumber(value.getValue(), base);
     }
 
     protected void beginObserving() {
diff --git a/src/rars/venus/registers/RegisterBlockWindow.java b/src/rars/venus/registers/RegisterBlockWindow.java
index 6e832028..b11ffa0c 100644
--- a/src/rars/venus/registers/RegisterBlockWindow.java
+++ b/src/rars/venus/registers/RegisterBlockWindow.java
@@ -19,37 +19,10 @@
 import javax.swing.table.JTableHeader;
 import java.awt.*;
 import java.awt.event.MouseEvent;
+import java.util.Arrays;
 import java.util.Observable;
 import java.util.Observer;
 
-/*
-Copyright (c) 2003-2009,  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)
- */
-
 /**
  * Sets up a window to display registers in the UI.
  *
@@ -59,7 +32,7 @@ a copy of this software and associated documentation files (the
 public abstract class RegisterBlockWindow extends JPanel implements Observer {
     private JTable table;
     private boolean highlighting;
-    private int highlightRow;
+    private RegistersAccessNotice stepAccessNotices;    //contains the register access notices for the current step
     private Register[] registers;
 
     private static final int NAME_COLUMN = 0;
@@ -73,6 +46,7 @@ public abstract class RegisterBlockWindow extends JPanel implements Observer {
      * Constructor which sets up a fresh window with a table that contains the register values.
      **/
     public RegisterBlockWindow(Register[] registers, String[] registerDescriptions, String valueTip) {
+        stepAccessNotices = new RegistersAccessNotice();
         Simulator.getInstance().addObserver(this);
         settings = Globals.getSettings();
         settings.addObserver(this);
@@ -82,9 +56,9 @@ public RegisterBlockWindow(Register[] registers, String[] registerDescriptions,
                 new String[]{"Each register has a tool tip describing its usage convention", "Corresponding register number", valueTip}) {
         };
         updateRowHeight();
-        table.getColumnModel().getColumn(NAME_COLUMN).setPreferredWidth(50);
-        table.getColumnModel().getColumn(NUMBER_COLUMN).setPreferredWidth(25);
-        table.getColumnModel().getColumn(VALUE_COLUMN).setPreferredWidth(60);
+        table.getColumnModel().getColumn(NAME_COLUMN).setPreferredWidth(20);
+        table.getColumnModel().getColumn(NUMBER_COLUMN).setPreferredWidth(10);
+        table.getColumnModel().getColumn(VALUE_COLUMN).setPreferredWidth(150);
 
         // Display register values (String-ified) right-justified in mono font
         table.getColumnModel().getColumn(NAME_COLUMN).setCellRenderer(new RegisterCellRenderer(MonoRightCellRenderer.MONOSPACED_PLAIN_12POINT, SwingConstants.LEFT));
@@ -135,7 +109,7 @@ public void clearHighlighting() {
         if (table != null) {
             table.tableChanged(new TableModelEvent(table.getModel()));
         }
-        highlightRow = -1; // assure highlight will not occur upon re-assemble.
+        stepAccessNotices.clear();
     }
 
     /**
@@ -157,19 +131,31 @@ public void updateRegisters() {
     }
 
     /**
-     * Highlight the row corresponding to the given register.
+     * Adds the given register to the registers to highlight and updates highlighting
+     * for the current step
      *
      * @param register Register object corresponding to row to be selected.
+     * @param accessType the type of access: Write is 0, Read is 1 as in the AccessNotice
+     */
+    private void addRegisterHighlighting(Register register, int accessType) {
+        stepAccessNotices.add(getRow(register), accessType);
+        table.tableChanged(new TableModelEvent(table.getModel()));
+    }
+
+    /**
+     * Finds the row that contains the given register
+     *
+     * @param register Register object corresponding to a certain row
+     * @return  Index of row that contains the given register,
+     *          or -1 if register not found
      */
-    private void highlightCellForRegister(Register register) {
+    private int getRow(Register register) {
         for (int i = 0; i < registers.length; i++) {
             if (registers[i] == register) {
-                this.highlightRow = i;
-                table.tableChanged(new TableModelEvent(table.getModel()));
-                return;
+                return i;
             }
         }
-        this.highlightRow = -1;
+        return -1;
     }
 
     /**
@@ -202,19 +188,18 @@ public void update(Observable observable, Object obj) {
         } else if (obj instanceof RegisterAccessNotice) {
             // NOTE: each register is a separate Observable
             RegisterAccessNotice access = (RegisterAccessNotice) obj;
-            if (access.getAccessType() == AccessNotice.WRITE) {
                 // Uses the same highlighting technique as for Text Segment -- see
                 // AddressCellRenderer class in DataSegmentWindow.java.
-                this.highlighting = true;
-                this.highlightCellForRegister((Register) observable);
-                Globals.getGui().getRegistersPane().setSelectedComponent(this);
-            }
+            this.highlighting = true;
+            addRegisterHighlighting((Register) observable, access.getAccessType());
+            Globals.getGui().getRegistersPane().setSelectedComponent(this);
         }
     }
 
     private void updateRowHeight() {
         Font possibleFonts[] = {
-            settings.getFontByPosition(Settings.REGISTER_HIGHLIGHT_FONT),
+            settings.getFontByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_FONT),
+                settings.getFontByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_FONT),
             settings.getFontByPosition(Settings.EVEN_ROW_FONT),
             settings.getFontByPosition(Settings.ODD_ROW_FONT),
         };
@@ -234,7 +219,7 @@ private void updateRowHeight() {
     * don't want highlighting for a given column, don't use this.  Currently we highlight
     * all columns.
     */
-    private class RegisterCellRenderer extends DefaultTableCellRenderer {
+    private class RegisterCellRenderer extends MonoRightCellRenderer {
         private Font font;
         private int alignment;
 
@@ -250,10 +235,14 @@ public Component getTableCellRendererComponent(JTable table, Object value,
                     isSelected, hasFocus, row, column);
             cell.setFont(font);
             cell.setHorizontalAlignment(alignment);
-            if (settings.getBooleanSetting(Settings.Bool.REGISTERS_HIGHLIGHTING) && highlighting && row == highlightRow) {
-                cell.setBackground(settings.getColorSettingByPosition(Settings.REGISTER_HIGHLIGHT_BACKGROUND));
-                cell.setForeground(settings.getColorSettingByPosition(Settings.REGISTER_HIGHLIGHT_FOREGROUND));
-                cell.setFont(settings.getFontByPosition(Settings.REGISTER_HIGHLIGHT_FONT));
+            if (highlighting && stepAccessNotices.contains(row) && settings.getBooleanSetting(Settings.Bool.EXPLICIT_WRITE_HIGHLIGHTING) && stepAccessNotices.getAccessNoticeType(row) == AccessNotice.WRITE) {
+                    cell.setBackground(settings.getColorSettingByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_BACKGROUND));
+                    cell.setForeground(settings.getColorSettingByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_FOREGROUND));
+                    cell.setFont(settings.getFontByPosition(Settings.EXPLICIT_WRITE_HIGHLIGHT_FONT));
+            } else if (highlighting && stepAccessNotices.contains(row) && settings.getBooleanSetting(Settings.Bool.EXPLICIT_READ_HIGHLIGHTING) && stepAccessNotices.getAccessNoticeType(row) == AccessNotice.READ) {
+                    cell.setBackground(settings.getColorSettingByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_BACKGROUND));
+                    cell.setForeground(settings.getColorSettingByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_FOREGROUND));
+                    cell.setFont(settings.getFontByPosition(Settings.EXPLICIT_READ_HIGHLIGHT_FONT));
             } else if (row % 2 == 0) {
                 cell.setBackground(settings.getColorSettingByPosition(Settings.EVEN_ROW_BACKGROUND));
                 cell.setForeground(settings.getColorSettingByPosition(Settings.EVEN_ROW_FOREGROUND));
@@ -395,4 +384,49 @@ public String getToolTipText(MouseEvent e) {
                     };
         }
     }
+
+    //////////////////////////////////////////////////////////////
+    //
+    // Contains the access notice linked to each register.
+    // Each register is represented by the row in which it appears in the register window
+    //
+    private class RegistersAccessNotice {
+        private int[] accessNoticeTypes;
+
+        //Constructor which sets all access notices to none
+        public RegistersAccessNotice() {
+            accessNoticeTypes = new int[32];
+            Arrays.fill(accessNoticeTypes, -1);
+        }
+
+        //Adds an access notice linked to a register. Overwrites with a "write" type if there is a reading
+        //and a writing access notice for the same register, and that both highlighting are enabled
+        public void add(int row, int type) {
+            if (0 <= row && row < accessNoticeTypes.length)
+                if (accessNoticeTypes[row] == -1 ||
+                        (accessNoticeTypes[row] == AccessNotice.READ && settings.getBooleanSetting(Settings.Bool.EXPLICIT_WRITE_HIGHLIGHTING)))
+                    accessNoticeTypes[row] = type;
+        }
+
+        //Clears all register access notice
+        public void clear() {
+            Arrays.fill(accessNoticeTypes, -1);
+        }
+
+        //Returns the access notice type of a register
+        public int getAccessNoticeType(int row) {
+            if (0 <= row && row < accessNoticeTypes.length)
+                return accessNoticeTypes[row];
+            else
+                return -1;
+        }
+
+        // Returns true iff there is an access notice for a certain register
+        public boolean contains(int row) {
+            if (0 <= row && row < accessNoticeTypes.length) {
+                return accessNoticeTypes[row] != -1;
+            } else
+                return false;
+        }
+    }
 }
diff --git a/src/rars/venus/registers/RegistersPane.java b/src/rars/venus/registers/RegistersPane.java
index e17a22f9..7468dd77 100644
--- a/src/rars/venus/registers/RegistersPane.java
+++ b/src/rars/venus/registers/RegistersPane.java
@@ -5,34 +5,6 @@
 import javax.swing.*;
 import java.awt.Color;
 
-/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Contains tabbed areas in the UI to display register contents
  *
@@ -66,7 +38,6 @@ public RegistersPane(VenusUI appFrame, RegistersWindow regs, FloatingPointWindow
         this.addTab("Registers", regsTab);
         this.addTab("Floating Point", fpTab);
         this.addTab("Control and Status", csrTab);
-        this.setForeground(Color.black);
 
         this.setToolTipTextAt(0, "CPU registers");
         this.setToolTipTextAt(1, "Floating point unit registers");
diff --git a/src/rars/venus/registers/RegistersWindow.java b/src/rars/venus/registers/RegistersWindow.java
index 694cb4b4..638b964b 100644
--- a/src/rars/venus/registers/RegistersWindow.java
+++ b/src/rars/venus/registers/RegistersWindow.java
@@ -63,11 +63,7 @@ private static Register[] getRegisters() {
     }
 
     protected String formatRegister(Register value, int base) {
-        if (Globals.getSettings().getBooleanSetting(Settings.Bool.RV64_ENABLED)){
-            return NumberDisplayBaseChooser.formatNumber(value.getValue(), base);
-        }else {
-            return NumberDisplayBaseChooser.formatNumber((int)value.getValue(), base);
-        }
+        return NumberDisplayBaseChooser.formatNumber(value.getValue(), base);
     }
 
     protected void beginObserving() {
diff --git a/src/rars/venus/run/RunAssembleAction.java b/src/rars/venus/run/RunAssembleAction.java
index 5e5bec6c..866a1e23 100644
--- a/src/rars/venus/run/RunAssembleAction.java
+++ b/src/rars/venus/run/RunAssembleAction.java
@@ -11,34 +11,6 @@
 import java.awt.event.ActionEvent;
 import java.io.File;
 import java.util.ArrayList;
- 
- /*
-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)
- */
 
 /**
  * Action class for the Run -> Assemble menu item (and toolbar icon)
@@ -138,6 +110,7 @@ public void actionPerformed(ActionEvent e) {
                 mainUI.setReset(true);
                 mainUI.setStarted(false);
                 mainUI.getMainPane().setSelectedComponent(executePane);
+                mainUI.getMessagesPane().selectRunMessageTab();
 
                 // Aug. 24, 2005 Ken Vollmar
                 SystemIO.resetFiles();  // Ensure that I/O "file descriptors" are initialized for a new program run
diff --git a/src/rars/venus/run/RunBackstepAction.java b/src/rars/venus/run/RunBackstepAction.java
index 0f6e63fd..c9e668c6 100644
--- a/src/rars/venus/run/RunBackstepAction.java
+++ b/src/rars/venus/run/RunBackstepAction.java
@@ -13,34 +13,6 @@
 import javax.swing.*;
 import java.awt.event.ActionEvent;
 
-	/*
-Copyright (c) 2003-2009,  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)
- */
-
 /**
  * Action  for the Run -> Backstep menu item
  */
@@ -84,7 +56,12 @@ public void actionPerformed(ActionEvent e) {
             executePane.getFloatingPointWindow().updateRegisters();
             executePane.getControlAndStatusWindow().updateRegisters();
             executePane.getDataSegmentWindow().updateValues();
+            executePane.getRegistersWindow().clearHighlighting();
+            executePane.getFloatingPointWindow().clearHighlighting();
+            executePane.getControlAndStatusWindow().clearHighlighting();
+            executePane.getDataSegmentWindow().clearHighlighting();
             executePane.getTextSegmentWindow().highlightStepAtPC(); // Argument aded 25 June 2007
+            Globals.getGui().getRegistersPane().setSelectedComponent(executePane.getRegistersWindow());
             FileStatus.set(FileStatus.RUNNABLE);
             // if we've backed all the way, disable the button
             //    if (Globals.program.getBackStepper().empty()) {
diff --git a/src/rars/venus/run/RunClearBreakpointsAction.java b/src/rars/venus/run/RunClearBreakpointsAction.java
index 440dc1a5..39a1a40b 100644
--- a/src/rars/venus/run/RunClearBreakpointsAction.java
+++ b/src/rars/venus/run/RunClearBreakpointsAction.java
@@ -8,34 +8,6 @@
 import javax.swing.event.TableModelListener;
 import java.awt.event.ActionEvent;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Action class for the Run menu item to clear execution breakpoints that have been set.
  * It is a listener and is notified whenever a breakpoint is added or removed, thus will
diff --git a/src/rars/venus/run/RunGoAction.java b/src/rars/venus/run/RunGoAction.java
index d4c152dc..fd479378 100644
--- a/src/rars/venus/run/RunGoAction.java
+++ b/src/rars/venus/run/RunGoAction.java
@@ -19,34 +19,6 @@
 import java.util.Observable;
 import java.util.Observer;
 
-	/*
-Copyright (c) 2003-2007,  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)
- */
-
 /**
  * Action class for the Run -> Go menu item (and toolbar icon)
  */
@@ -54,8 +26,6 @@ public class RunGoAction extends GuiAction {
 
     public static int defaultMaxSteps = -1; // "forever", formerly 10000000; // 10 million
     public static int maxSteps = defaultMaxSteps;
-    private String name;
-    private ExecutePane executePane;
     private VenusUI mainUI;
 
     public RunGoAction(String name, Icon icon, String descrip,
@@ -68,142 +38,27 @@ public RunGoAction(String name, Icon icon, String descrip,
      * Action to take when GO is selected -- run the MIPS program!
      */
     public void actionPerformed(ActionEvent e) {
-        name = this.getValue(Action.NAME).toString();
-        executePane = mainUI.getMainPane().getExecutePane();
-        if (FileStatus.isAssembled()) {
-            if (!mainUI.getStarted()) {
-                processProgramArgumentsIfAny();  // DPS 17-July-2008
-            }
-            if (mainUI.getReset() || mainUI.getStarted()) {
-
-                mainUI.setStarted(true);  // added 8/27/05
-
-                mainUI.getMessagesPane().postMessage(
-                        name + ": running " + FileStatus.getFile().getName() + "\n\n");
-                mainUI.getMessagesPane().selectRunMessageTab();
-                executePane.getTextSegmentWindow().setCodeHighlighting(false);
-                executePane.getTextSegmentWindow().unhighlightAllSteps();
-                //FileStatus.set(FileStatus.RUNNING);
-                mainUI.setMenuState(FileStatus.RUNNING);
-
-                // Setup cleanup procedures for the simulation
-                final Observer stopListener =
-                        new Observer() {
-                            public void update(Observable o, Object simulator) {
-                                SimulatorNotice notice = ((SimulatorNotice) simulator);
-                                if (notice.getAction() != SimulatorNotice.SIMULATOR_STOP) return;
-                                Simulator.Reason reason = notice.getReason();
-                                if (reason == Simulator.Reason.PAUSE || reason == Simulator.Reason.BREAKPOINT) {
-                                    EventQueue.invokeLater(()->paused(notice.getDone(), reason, notice.getException()));
-                                } else {
-                                    EventQueue.invokeLater(()->stopped(notice.getException(), reason));
-                                }
-                                o.deleteObserver(this);
-                            }
-                        };
-                Simulator.getInstance().addObserver(stopListener);
-
-                int[] breakPoints = executePane.getTextSegmentWindow().getSortedBreakPointsArray();
-                Globals.program.startSimulation(maxSteps, breakPoints);
-            } else {
-                // This should never occur because at termination the Go and Step buttons are disabled.
-                JOptionPane.showMessageDialog(mainUI, "reset " + mainUI.getReset() + " started " + mainUI.getStarted());//"You must reset before you can execute the program again.");
-            }
-        } else {
-            // note: this should never occur since "Go" is only enabled after successful assembly.
-            JOptionPane.showMessageDialog(mainUI, "The program must be assembled before it can be run.");
-        }
-    }
-
-    /**
-     * Method to be called when Pause is selected through menu/toolbar/shortcut.  This should only
-     * happen when MIPS program is running (FileStatus.RUNNING).  See VenusUI.java for enabled
-     * status of menu items based on FileStatus.  Set GUI as if at breakpoint or executing
-     * step by step.
-     */
-
-    public void paused(boolean done, Simulator.Reason pauseReason, SimulationException pe) {
-        // I doubt this can happen (pause when execution finished), but if so treat it as stopped.
-        if (done) {
-            stopped(pe, Simulator.Reason.NORMAL_TERMINATION);
+        String name = this.getValue(Action.NAME).toString();
+        if (!mainUI.onStartedSimulation(name)) {
             return;
         }
-        if (pauseReason == Simulator.Reason.BREAKPOINT) {
-            mainUI.getMessagesPane().postMessage(
-                    name + ": execution paused at breakpoint: " + FileStatus.getFile().getName() + "\n\n");
-        } else {
-            mainUI.getMessagesPane().postMessage(
-                    name + ": execution paused by user: " + FileStatus.getFile().getName() + "\n\n");
-        }
-        mainUI.getMessagesPane().selectMessageTab();
-        executePane.getTextSegmentWindow().setCodeHighlighting(true);
-        executePane.getTextSegmentWindow().highlightStepAtPC();
-        executePane.getRegistersWindow().updateRegisters();
-        executePane.getFloatingPointWindow().updateRegisters();
-        executePane.getControlAndStatusWindow().updateRegisters();
-        executePane.getDataSegmentWindow().updateValues();
-        FileStatus.set(FileStatus.RUNNABLE);
-        mainUI.setReset(false);
-    }
-
-    /**
-     * Method to be called when Stop is selected through menu/toolbar/shortcut.  This should only
-     * happen when MIPS program is running (FileStatus.RUNNING).  See VenusUI.java for enabled
-     * status of menu items based on FileStatus.  Display finalized values as if execution
-     * terminated due to completion or exception.
-     */
-
-    public void stopped(SimulationException pe, Simulator.Reason reason) {
-        // show final register and data segment values.
-        executePane.getRegistersWindow().updateRegisters();
-        executePane.getFloatingPointWindow().updateRegisters();
-        executePane.getControlAndStatusWindow().updateRegisters();
-        executePane.getDataSegmentWindow().updateValues();
-        FileStatus.set(FileStatus.TERMINATED);
-        SystemIO.resetFiles(); // close any files opened in MIPS program
-        // Bring CSRs to the front if terminated due to exception.
-        if (pe != null) {
-            mainUI.getRegistersPane().setSelectedComponent(executePane.getControlAndStatusWindow());
-            executePane.getTextSegmentWindow().setCodeHighlighting(true);
-            executePane.getTextSegmentWindow().unhighlightAllSteps();
-            executePane.getTextSegmentWindow().highlightStepAtAddress(RegisterFile.getProgramCounter() - 4);
-        }
-        switch (reason) {
-            case NORMAL_TERMINATION:
-                mainUI.getMessagesPane().postMessage(
-                        "\n" + name + ": execution completed successfully.\n\n");
-                mainUI.getMessagesPane().postRunMessage(
-                        "\n-- program is finished running (" + Globals.exitCode + ") --\n\n");
-                mainUI.getMessagesPane().selectRunMessageTab();
-                break;
-            case CLIFF_TERMINATION:
-                mainUI.getMessagesPane().postMessage(
-                        "\n" + name + ": execution terminated by null instruction.\n\n");
-                mainUI.getMessagesPane().postRunMessage(
-                        "\n-- program is finished running (dropped off bottom) --\n\n");
-                mainUI.getMessagesPane().selectRunMessageTab();
-                break;
-            case EXCEPTION:
-                mainUI.getMessagesPane().postMessage(
-                        pe.error().generateReport());
-                mainUI.getMessagesPane().postMessage(
-                        "\n" + name + ": execution terminated with errors.\n\n");
-                break;
-            case STOP:
-                mainUI.getMessagesPane().postMessage(
-                        "\n" + name + ": execution terminated by user.\n\n");
-                mainUI.getMessagesPane().selectMessageTab();
-                break;
-            case MAX_STEPS:
-                mainUI.getMessagesPane().postMessage(
-                        "\n" + name + ": execution step limit of " + maxSteps + " exceeded.\n\n");
-                mainUI.getMessagesPane().selectMessageTab();
-                break;
-            default:
-                // should never get here, because the other two cases are covered by paused()
-        }
-        RunGoAction.resetMaxSteps();
-        mainUI.setReset(false);
+        mainUI.setMenuState(FileStatus.RUNNING);
+
+        // Setup cleanup procedures for the simulation
+        final Observer stopListener =
+                new Observer() {
+                    public void update(Observable o, Object simulator) {
+                        SimulatorNotice notice = ((SimulatorNotice) simulator);
+                        if (notice.getAction() != SimulatorNotice.SIMULATOR_STOP) return;
+                        EventQueue.invokeLater(() -> mainUI.onStoppedSimulation(name, notice));
+                        o.deleteObserver(this);
+                    }
+                };
+        Simulator.getInstance().addObserver(stopListener);
+
+        ExecutePane executePane = mainUI.getMainPane().getExecutePane();
+        int[] breakPoints = executePane.getTextSegmentWindow().getSortedBreakPointsArray();
+        Globals.program.startSimulation(maxSteps, breakPoints);
     }
 
     /**
@@ -213,20 +68,4 @@ public void stopped(SimulationException pe, Simulator.Reason reason) {
     public static void resetMaxSteps() {
         maxSteps = defaultMaxSteps;
     }
-
-    ////////////////////////////////////////////////////////////////////////////////////
-    // Method to store any program arguments into MIPS memory and registers before
-    // execution begins. Arguments go into the gap between $sp and kernel memory.
-    // Argument pointers and count go into runtime stack and $sp is adjusted accordingly.
-    // $a0 gets argument count (argc), $a1 gets stack address of first arg pointer (argv).
-    private void processProgramArgumentsIfAny() {
-        String programArguments = executePane.getTextSegmentWindow().getProgramArguments();
-        if (programArguments == null || programArguments.length() == 0 ||
-                !Globals.getSettings().getBooleanSetting(Settings.Bool.PROGRAM_ARGUMENTS)) {
-            return;
-        }
-        new ProgramArgumentList(programArguments).storeProgramArguments();
-    }
-
-
 }
\ No newline at end of file
diff --git a/src/rars/venus/run/RunResetAction.java b/src/rars/venus/run/RunResetAction.java
index 4659bf69..98385b37 100644
--- a/src/rars/venus/run/RunResetAction.java
+++ b/src/rars/venus/run/RunResetAction.java
@@ -12,34 +12,6 @@
 import javax.swing.*;
 import java.awt.event.ActionEvent;
 
-	/*
-Copyright (c) 2003-2009,  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)
- */
-
 /**
  * Action  for the Run -> Reset menu item
  */
@@ -83,13 +55,12 @@ public void actionPerformed(ActionEvent e) {
         FloatingPointRegisterFile.resetRegisters();
         ControlAndStatusRegisterFile.resetRegisters();
         InterruptController.reset();
-
-        executePane.getRegistersWindow().clearHighlighting();
         executePane.getRegistersWindow().updateRegisters();
-        executePane.getFloatingPointWindow().clearHighlighting();
+        executePane.getRegistersWindow().clearHighlighting();
         executePane.getFloatingPointWindow().updateRegisters();
-        executePane.getControlAndStatusWindow().clearHighlighting();
+        executePane.getFloatingPointWindow().clearHighlighting();
         executePane.getControlAndStatusWindow().updateRegisters();
+        executePane.getControlAndStatusWindow().clearHighlighting();
         executePane.getDataSegmentWindow().highlightCellForAddress(Memory.dataBaseAddress);
         executePane.getDataSegmentWindow().clearHighlighting();
         executePane.getTextSegmentWindow().resetModifiedSourceCode();
@@ -103,7 +74,7 @@ public void actionPerformed(ActionEvent e) {
         // Aug. 24, 2005 Ken Vollmar
         SystemIO.resetFiles();  // Ensure that I/O "file descriptors" are initialized for a new program run
 
-        mainUI.getMessagesPane().postRunMessage(
+        mainUI.getMessagesPane().postMessage(
                 "\n" + name + ": reset completed.\n\n");
     }
 }
\ No newline at end of file
diff --git a/src/rars/venus/run/RunSpeedPanel.java b/src/rars/venus/run/RunSpeedPanel.java
index a434daf3..e74e9166 100644
--- a/src/rars/venus/run/RunSpeedPanel.java
+++ b/src/rars/venus/run/RunSpeedPanel.java
@@ -7,34 +7,6 @@
 import javax.swing.event.ChangeListener;
 import java.awt.*;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Class for the Run speed slider control.  One is created and can be obtained using
  * getInstance().
diff --git a/src/rars/venus/run/RunStepAction.java b/src/rars/venus/run/RunStepAction.java
index 96b86bae..6b44270b 100644
--- a/src/rars/venus/run/RunStepAction.java
+++ b/src/rars/venus/run/RunStepAction.java
@@ -18,41 +18,11 @@
 import java.util.Observable;
 import java.util.Observer;
 
-/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Action  for the Run -> Step menu item
  */
 public class RunStepAction extends GuiAction {
 
-    private String name;
-    private ExecutePane executePane;
     private VenusUI mainUI;
 
     public RunStepAction(String name, Icon icon, String descrip,
@@ -65,87 +35,22 @@ public RunStepAction(String name, Icon icon, String descrip,
      * perform next simulated instruction step.
      */
     public void actionPerformed(ActionEvent e) {
-        name = this.getValue(Action.NAME).toString();
-        executePane = mainUI.getMainPane().getExecutePane();
-        if (FileStatus.isAssembled()) {
-            if (!mainUI.getStarted()) {  // DPS 17-July-2008
-                processProgramArgumentsIfAny();
-            }
-            mainUI.setStarted(true);
-            mainUI.getMessagesPane().selectRunMessageTab();
-            executePane.getTextSegmentWindow().setCodeHighlighting(true);
-
-            // Setup callback for after step finishes
-            final Observer stopListener =
-                    new Observer() {
-                        public void update(Observable o, Object simulator) {
-                            SimulatorNotice notice = ((SimulatorNotice) simulator);
-                            if (notice.getAction() != SimulatorNotice.SIMULATOR_STOP) return;
-                            EventQueue.invokeLater(() -> stepped(notice.getDone(), notice.getReason(), notice.getException()));
-                            o.deleteObserver(this);
-                        }
-                    };
-            Simulator.getInstance().addObserver(stopListener);
-
-            Globals.program.startSimulation(1, null);
-        } else {
-            // note: this should never occur since "Step" is only enabled after successful assembly.
-            JOptionPane.showMessageDialog(mainUI, "The program must be assembled before it can be run.");
-        }
-    }
-
-    // When step is completed, control returns here (from execution thread, indirectly)
-    // to update the GUI.
-    public void stepped(boolean done, Simulator.Reason reason, SimulationException pe) {
-        executePane.getRegistersWindow().updateRegisters();
-        executePane.getFloatingPointWindow().updateRegisters();
-        executePane.getControlAndStatusWindow().updateRegisters();
-        executePane.getDataSegmentWindow().updateValues();
-        if (!done) {
-            executePane.getTextSegmentWindow().highlightStepAtPC();
-            FileStatus.set(FileStatus.RUNNABLE);
-        }
-        if (done) {
-            RunGoAction.resetMaxSteps();
-            executePane.getTextSegmentWindow().unhighlightAllSteps();
-            FileStatus.set(FileStatus.TERMINATED);
-        }
-        if (done && pe == null) {
-            mainUI.getMessagesPane().postMessage(
-                    "\n" + name + ": execution " +
-                            ((reason == Simulator.Reason.CLIFF_TERMINATION) ? "terminated due to null instruction."
-                                    : "completed successfully.") + "\n\n");
-            mainUI.getMessagesPane().postRunMessage(
-                    "\n-- program is finished running" +
-                            ((reason == Simulator.Reason.CLIFF_TERMINATION) ? "(dropped off bottom)" : " (" + Globals.exitCode + ")") + " --\n\n");
-            mainUI.getMessagesPane().selectRunMessageTab();
-        }
-        if (pe != null) {
-            RunGoAction.resetMaxSteps();
-            mainUI.getMessagesPane().postMessage(
-                    pe.error().generateReport());
-            mainUI.getMessagesPane().postMessage(
-                    "\n" + name + ": execution terminated with errors.\n\n");
-            mainUI.getRegistersPane().setSelectedComponent(executePane.getControlAndStatusWindow());
-            FileStatus.set(FileStatus.TERMINATED); // should be redundant.
-            executePane.getTextSegmentWindow().setCodeHighlighting(true);
-            executePane.getTextSegmentWindow().unhighlightAllSteps();
-            executePane.getTextSegmentWindow().highlightStepAtAddress(RegisterFile.getProgramCounter() - 4);
-        }
-        mainUI.setReset(false);
-    }
-
-    ////////////////////////////////////////////////////////////////////////////////////
-    // Method to store any program arguments into MIPS memory and registers before
-    // execution begins. Arguments go into the gap between $sp and kernel memory.
-    // Argument pointers and count go into runtime stack and $sp is adjusted accordingly.
-    // $a0 gets argument count (argc), $a1 gets stack address of first arg pointer (argv).
-    private void processProgramArgumentsIfAny() {
-        String programArguments = executePane.getTextSegmentWindow().getProgramArguments();
-        if (programArguments == null || programArguments.length() == 0 ||
-                !Globals.getSettings().getBooleanSetting(Settings.Bool.PROGRAM_ARGUMENTS)) {
+        String name = this.getValue(Action.NAME).toString();
+        if (!mainUI.onStartedSimulation(name)) {
             return;
         }
-        new ProgramArgumentList(programArguments).storeProgramArguments();
+
+        // Setup callback for after step finishes
+        final Observer stopListener =
+                new Observer() {
+                    public void update(Observable o, Object simulator) {
+                        SimulatorNotice notice = ((SimulatorNotice) simulator);
+                        if (notice.getAction() != SimulatorNotice.SIMULATOR_STOP) return;
+                        EventQueue.invokeLater(() -> mainUI.onStoppedSimulation(name, notice));
+                        o.deleteObserver(this);
+                    }
+                };
+        Simulator.getInstance().addObserver(stopListener);
+        Globals.program.startSimulation(1, null);
     }
-}
\ No newline at end of file
+}
diff --git a/src/rars/venus/settings/SettingsAction.java b/src/rars/venus/settings/SettingsAction.java
index eb8c8043..0f71fb92 100644
--- a/src/rars/venus/settings/SettingsAction.java
+++ b/src/rars/venus/settings/SettingsAction.java
@@ -7,33 +7,6 @@
 import javax.swing.*;
 import java.awt.event.ActionEvent;
 
-/*
-Copyright (c) 20017,  Benjamin Landers
-
-Developed by Benjamin Landers
-
-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)
- */
-
 /**
  * Simple wrapper for boolean settings actions
  */
diff --git a/src/rars/venus/settings/SettingsEditorAction.java b/src/rars/venus/settings/SettingsEditorAction.java
index e13a2972..dcadb1ba 100644
--- a/src/rars/venus/settings/SettingsEditorAction.java
+++ b/src/rars/venus/settings/SettingsEditorAction.java
@@ -19,34 +19,6 @@
 import java.awt.*;
 import java.awt.event.*;
 
-	/*
-Copyright (c) 2003-2011,  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)
- */
-
 /**
  * Action class for the Settings menu item for text editor settings.
  */
diff --git a/src/rars/venus/settings/SettingsExceptionHandlerAction.java b/src/rars/venus/settings/SettingsExceptionHandlerAction.java
index ad524b3d..9df0cff8 100644
--- a/src/rars/venus/settings/SettingsExceptionHandlerAction.java
+++ b/src/rars/venus/settings/SettingsExceptionHandlerAction.java
@@ -13,34 +13,6 @@
 import java.awt.event.WindowEvent;
 import java.io.File;
 
-	/*
-Copyright (c) 2003-2006,  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)
- */
-
 /**
  * Action class for the Settings menu item for optionally loading a MIPS exception handler.
  */
diff --git a/src/rars/venus/settings/SettingsHighlightingAction.java b/src/rars/venus/settings/SettingsHighlightingAction.java
index aec35325..bb3f83ec 100644
--- a/src/rars/venus/settings/SettingsHighlightingAction.java
+++ b/src/rars/venus/settings/SettingsHighlightingAction.java
@@ -15,34 +15,6 @@
 import java.awt.*;
 import java.awt.event.*;
 
-	/*
-Copyright (c) 2003-2009,  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)
- */
-
 /**
  * Action class for the Settings menu item for text editor settings.
  */
@@ -55,8 +27,8 @@ public class SettingsHighlightingAction extends GuiAction {
     private static final int[] backgroundSettingPositions = {
             Settings.TEXTSEGMENT_HIGHLIGHT_BACKGROUND,
             Settings.TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_BACKGROUND,
-            Settings.DATASEGMENT_HIGHLIGHT_BACKGROUND,
-            Settings.REGISTER_HIGHLIGHT_BACKGROUND,
+            Settings.EXPLICIT_WRITE_HIGHLIGHT_BACKGROUND,
+            Settings.EXPLICIT_READ_HIGHLIGHT_BACKGROUND,
             Settings.EVEN_ROW_BACKGROUND,
             Settings.ODD_ROW_BACKGROUND
     };
@@ -64,8 +36,8 @@ public class SettingsHighlightingAction extends GuiAction {
     private static final int[] foregroundSettingPositions = {
             Settings.TEXTSEGMENT_HIGHLIGHT_FOREGROUND,
             Settings.TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FOREGROUND,
-            Settings.DATASEGMENT_HIGHLIGHT_FOREGROUND,
-            Settings.REGISTER_HIGHLIGHT_FOREGROUND,
+            Settings.EXPLICIT_WRITE_HIGHLIGHT_FOREGROUND,
+            Settings.EXPLICIT_READ_HIGHLIGHT_FOREGROUND,
             Settings.EVEN_ROW_FOREGROUND,
             Settings.ODD_ROW_FOREGROUND
     };
@@ -73,8 +45,8 @@ public class SettingsHighlightingAction extends GuiAction {
     private static final int[] fontSettingPositions = {
             Settings.TEXTSEGMENT_HIGHLIGHT_FONT,
             Settings.TEXTSEGMENT_DELAYSLOT_HIGHLIGHT_FONT,
-            Settings.DATASEGMENT_HIGHLIGHT_FONT,
-            Settings.REGISTER_HIGHLIGHT_FONT,
+            Settings.EXPLICIT_WRITE_HIGHLIGHT_FONT,
+            Settings.EXPLICIT_READ_HIGHLIGHT_FONT,
             Settings.EVEN_ROW_FONT,
             Settings.ODD_ROW_FONT
     };
@@ -87,9 +59,9 @@ public class SettingsHighlightingAction extends GuiAction {
     Color[] currentNondefaultBackground, currentNondefaultForeground;
     Color[] initialSettingsBackground, initialSettingsForeground;
     Font[] initialFont, currentFont, currentNondefaultFont;
-    JButton dataHighlightButton, registerHighlightButton;
-    boolean currentDataHighlightSetting, initialDataHighlightSetting;
-    boolean currentRegisterHighlightSetting, initialRegisterHighlightSetting;
+    JButton explicitWriteHighlightButton, explicitReadHighlightButton;
+    boolean currentExplicitWriteHighlightSetting, initialExplicitWriteHighlightSetting;
+    boolean currentExplicitReadHighlightSetting, initialExplicitReadHighlightSetting;
 
     private static final int gridVGap = 2;
     private static final int gridHGap = 2;
@@ -105,8 +77,8 @@ public class SettingsHighlightingAction extends GuiAction {
     public static final String RESET_TOOL_TIP_TEXT = "Reset to initial settings without applying";
     public static final String CANCEL_TOOL_TIP_TEXT = "Close dialog without applying current settings";
     // Tool tips for the data and register highlighting enable/disable controls
-    private static final String DATA_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT = "Click, to enable or disable highlighting in Data Segment window";
-    private static final String REGISTER_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT = "Click, to enable or disable highlighting in Register windows";
+    private static final String EXPLICIT_WRITE_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT = "Click, to enable or disable explicit writing highlighting";
+    private static final String EXPLICIT_READ_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT = "Click, to enable or disable explicit reading highlighting";
     private static final String fontButtonText = "font";
 
     /**
@@ -185,8 +157,8 @@ private JPanel buildDialogPanel() {
         // Note the labels have to match buttons by position...
         descriptions.add(new JLabel("Text Segment highlighting", SwingConstants.RIGHT));
         descriptions.add(new JLabel("Text Segment Delay Slot highlighting", SwingConstants.RIGHT));
-        descriptions.add(new JLabel("Data Segment highlighting *", SwingConstants.RIGHT));
-        descriptions.add(new JLabel("Register highlighting *", SwingConstants.RIGHT));
+        descriptions.add(new JLabel("Explicit writing highlighting *", SwingConstants.RIGHT));
+        descriptions.add(new JLabel("Explicit reading highlighting *", SwingConstants.RIGHT));
         descriptions.add(new JLabel("Even row normal", SwingConstants.RIGHT));
         descriptions.add(new JLabel("Odd row normal", SwingConstants.RIGHT));
 
@@ -225,36 +197,36 @@ protected void processKeyEvent(KeyEvent e) {
         contents.add(instructions, BorderLayout.NORTH);
 
         // Control highlighting enable/disable for Data Segment window and Register windows
-        JPanel dataRegisterHighlightControl = new JPanel(new GridLayout(2, 1));
-        dataHighlightButton = new JButton();
-        dataHighlightButton.setText(getHighlightControlText(currentDataHighlightSetting));
-        dataHighlightButton.setToolTipText(DATA_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT);
-        dataHighlightButton.addActionListener(
+        JPanel explicitReadWriteHighlightControl = new JPanel(new GridLayout(2, 1));
+        explicitWriteHighlightButton = new JButton();
+        explicitWriteHighlightButton.setText(getHighlightControlText(currentExplicitWriteHighlightSetting));
+        explicitWriteHighlightButton.setToolTipText(EXPLICIT_WRITE_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT);
+        explicitWriteHighlightButton.addActionListener(
                 new ActionListener() {
                     public void actionPerformed(ActionEvent e) {
-                        currentDataHighlightSetting = !currentDataHighlightSetting;
-                        dataHighlightButton.setText(getHighlightControlText(currentDataHighlightSetting));
+                        currentExplicitWriteHighlightSetting = !currentExplicitWriteHighlightSetting;
+                        explicitWriteHighlightButton.setText(getHighlightControlText(currentExplicitWriteHighlightSetting));
                     }
                 });
-        registerHighlightButton = new JButton();
-        registerHighlightButton.setText(getHighlightControlText(currentRegisterHighlightSetting));
-        registerHighlightButton.setToolTipText(REGISTER_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT);
-        registerHighlightButton.addActionListener(
+        explicitReadHighlightButton = new JButton();
+        explicitReadHighlightButton.setText(getHighlightControlText(currentExplicitReadHighlightSetting));
+        explicitReadHighlightButton.setToolTipText(EXPLICIT_READ_HIGHLIGHT_ENABLE_TOOL_TIP_TEXT);
+        explicitReadHighlightButton.addActionListener(
                 new ActionListener() {
                     public void actionPerformed(ActionEvent e) {
-                        currentRegisterHighlightSetting = !currentRegisterHighlightSetting;
-                        registerHighlightButton.setText(getHighlightControlText(currentRegisterHighlightSetting));
+                        currentExplicitReadHighlightSetting = !currentExplicitReadHighlightSetting;
+                        explicitReadHighlightButton.setText(getHighlightControlText(currentExplicitReadHighlightSetting));
                     }
                 });
-        JPanel dataHighlightPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
-        JPanel registerHighlightPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
-        dataHighlightPanel.add(new JLabel("* Data Segment highlighting is"));
-        dataHighlightPanel.add(dataHighlightButton);
-        registerHighlightPanel.add(new JLabel("* Register highlighting is"));
-        registerHighlightPanel.add(registerHighlightButton);
-        dataRegisterHighlightControl.setBorder(new LineBorder(Color.BLACK));
-        dataRegisterHighlightControl.add(dataHighlightPanel);
-        dataRegisterHighlightControl.add(registerHighlightPanel);
+        JPanel explicitWriteHighlightPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+        JPanel explicitReadHighlightPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+        explicitWriteHighlightPanel.add(new JLabel("* Explicit writing highlighting is"));
+        explicitReadHighlightPanel.add(new JLabel("* Explicit reading highlighting is"));
+        explicitWriteHighlightPanel.add(explicitWriteHighlightButton);
+        explicitReadHighlightPanel.add(explicitReadHighlightButton);
+        explicitReadWriteHighlightControl.setBorder(new LineBorder(Color.BLACK));
+        explicitReadWriteHighlightControl.add(explicitWriteHighlightPanel);
+        explicitReadWriteHighlightControl.add(explicitReadHighlightPanel);
 
         // Bottom row - the control buttons for Apply&Close, Apply, Cancel
         Box controlPanel = Box.createHorizontalBox();
@@ -302,7 +274,7 @@ public void actionPerformed(ActionEvent e) {
         controlPanel.add(Box.createHorizontalGlue());
 
         JPanel allControls = new JPanel(new GridLayout(2, 1));
-        allControls.add(dataRegisterHighlightControl);
+        allControls.add(explicitReadWriteHighlightControl);
         allControls.add(controlPanel);
         contents.add(allControls, BorderLayout.SOUTH);
         return contents;
@@ -346,8 +318,8 @@ private void initializeButtonColors() {
             foregroundButtons[i].setEnabled(!usingDefaults);
             fontButtons[i].setEnabled(!usingDefaults);
         }
-        currentDataHighlightSetting = initialDataHighlightSetting = settings.getBooleanSetting(Settings.Bool.DATA_SEGMENT_HIGHLIGHTING);
-        currentRegisterHighlightSetting = initialRegisterHighlightSetting = settings.getBooleanSetting(Settings.Bool.REGISTERS_HIGHLIGHTING);
+        currentExplicitWriteHighlightSetting = initialExplicitWriteHighlightSetting = settings.getBooleanSetting(Settings.Bool.EXPLICIT_WRITE_HIGHLIGHTING);
+        currentExplicitReadHighlightSetting = initialExplicitReadHighlightSetting = settings.getBooleanSetting(Settings.Bool.EXPLICIT_READ_HIGHLIGHTING);
     }
 
 
@@ -359,8 +331,8 @@ private void setHighlightingSettings() {
             settings.setColorSettingByPosition(foregroundSettingPositions[i], foregroundButtons[i].getBackground());
             settings.setFontByPosition(fontSettingPositions[i], samples[i].getFont());//fontButtons[i].getFont());			
         }
-        settings.setBooleanSetting(Settings.Bool.DATA_SEGMENT_HIGHLIGHTING, currentDataHighlightSetting);
-        settings.setBooleanSetting(Settings.Bool.REGISTERS_HIGHLIGHTING, currentRegisterHighlightSetting);
+        settings.setBooleanSetting(Settings.Bool.EXPLICIT_WRITE_HIGHLIGHTING, currentExplicitWriteHighlightSetting);
+        settings.setBooleanSetting(Settings.Bool.EXPLICIT_READ_HIGHLIGHTING, currentExplicitReadHighlightSetting);
         ExecutePane executePane = Globals.getGui().getMainPane().getExecutePane();
         executePane.getRegistersWindow().refresh();
         executePane.getControlAndStatusWindow().refresh();
@@ -379,8 +351,8 @@ private void setHighlightingSettings() {
     // Called when Reset selected.
     private void resetButtonColors() {
         Settings settings = Globals.getSettings();
-        dataHighlightButton.setText(getHighlightControlText(initialDataHighlightSetting));
-        registerHighlightButton.setText(getHighlightControlText(initialRegisterHighlightSetting));
+        explicitWriteHighlightButton.setText(getHighlightControlText(initialExplicitWriteHighlightSetting));
+        explicitReadHighlightButton.setText(getHighlightControlText(initialExplicitReadHighlightSetting));
         Color backgroundSetting, foregroundSetting;
         Font fontSetting;
         for (int i = 0; i < backgroundSettingPositions.length; i++) {
diff --git a/src/rars/venus/settings/SettingsMemoryConfigurationAction.java b/src/rars/venus/settings/SettingsMemoryConfigurationAction.java
index c2ebf72d..dc819d21 100644
--- a/src/rars/venus/settings/SettingsMemoryConfigurationAction.java
+++ b/src/rars/venus/settings/SettingsMemoryConfigurationAction.java
@@ -19,34 +19,6 @@
 import java.util.Map;
 import java.util.TreeMap;
 
-	/*
-Copyright (c) 2003-2009,  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)
- */
-
 /**
  * Action class for the Settings menu item for text editor settings.
  */
diff --git a/src/rars/venus/util/AbstractFontSettingDialog.java b/src/rars/venus/util/AbstractFontSettingDialog.java
index fb97d2e9..fcf375d4 100644
--- a/src/rars/venus/util/AbstractFontSettingDialog.java
+++ b/src/rars/venus/util/AbstractFontSettingDialog.java
@@ -14,34 +14,6 @@
 import java.awt.event.WindowEvent;
 import java.util.Vector;
 
-	/*
-Copyright (c) 2003-2009,  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)
- */
-
 /**
  * Abstract class for a font selection dialog.
  */
diff --git a/src/rars/venus/util/PopupListener.java b/src/rars/venus/util/PopupListener.java
index 3a94e993..64e7a4e9 100644
--- a/src/rars/venus/util/PopupListener.java
+++ b/src/rars/venus/util/PopupListener.java
@@ -4,35 +4,6 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
-/*
-Copyright (c) 2003-2006,  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)
- */
-
-
 // Experimental version 3 August 2006 Pete Sanderson
 // This will display the Settings popup menu upon right-click.
 // Menu selections themselves are handled separately.
diff --git a/test.sh b/test.sh
index fe1fd0cd..ed5b913b 100755
--- a/test.sh
+++ b/test.sh
@@ -1,4 +1,6 @@
 #!/bin/bash
-javac -cp rars.jar test/Test.java
-java -cp test:rars.jar Test
-rm test/Test.class
+javac -cp rars.jar test/RarsTest.java
+java -cp test:rars.jar RarsTest "$@"
+err=$?
+rm test/RarsTest.class
+exit "$err"
diff --git a/test/Test.java b/test/RarsTest.java
similarity index 68%
rename from test/Test.java
rename to test/RarsTest.java
index 5b690814..db0e3cce 100644
--- a/test/Test.java
+++ b/test/RarsTest.java
@@ -2,99 +2,140 @@
 import rars.api.Options;
 import rars.api.Program;
 import rars.riscv.*;
+import rars.simulator.ProgramArgumentList;
 import rars.simulator.Simulator;
 
 import java.io.*;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Iterator;
 
-public class Test {
+public class RarsTest {
+    boolean success = true;
+    StringBuilder total = new StringBuilder("\n");
+
     public static void main(String[] args){
+        RarsTest self = new RarsTest();
+        if (args.length != 0) {
+            Program p = self.setupProgram(true);
+            for (String arg : args) {
+                File file = new File(arg);
+                if (file.isDirectory()) {
+                    self.runDirectory(arg, p);
+                } else if (file.isFile()) {
+                    self.runFile(arg, p);
+                } else {
+                    System.out.println(arg + " bad file");
+                    self.success = false;
+                }
+            }
+            System.out.println(self.total);
+            System.exit(self.success ? 0 : 1);
+        }
+        self.checkPrograms();
+        self.checkBinary();
+        self.checkPseudo();
+        if (!self.success) {
+            System.exit(1);
+        }
+    }
+
+    Program setupProgram(boolean rv64) {
         Globals.initialize();
-        Globals.getSettings().setBooleanSettingNonPersistent(Settings.Bool.RV64_ENABLED,false);
-        InstructionSet.rv64 = false;
+        Globals.getSettings().setBooleanSettingNonPersistent(Settings.Bool.RV64_ENABLED,rv64);
+        InstructionSet.rv64 = rv64;
         Globals.instructionSet.populate();
         Options opt = new Options();
         opt.startAtMain = true;
-        opt.maxSteps = 1000;
-        Program p = new Program(opt);
-        File[] tests = new File("./test").listFiles(), riscv_tests = new File("./test/riscv-tests").listFiles(), riscv_tests_64 = new File("./test/riscv-tests-64").listFiles();
+        opt.maxSteps = 1000000;
+        return new Program(opt);
+    }
+
+    public void checkPrograms() {
+
+        // 32-bit tests
+        Program p = setupProgram(false);
+        runDirectory("./test", p);
+        runDirectory("./test/riscv-tests-32", p);
+
+        // 64-bit tests
+        p = setupProgram(true);
+        runDirectory("./test", p);
+        runDirectory("./test/riscv-tests-64", p);
+
+        System.out.println(total);
+    }
+
+    public void runDirectory(String directory, Program p) {
+        File[] tests = new File(directory).listFiles();
         if(tests == null){
-            System.out.println("./test doesn't exist");
+            System.out.println(directory + " doesn't exist");
+            success = false;
             return;
         }
-        StringBuilder total = new StringBuilder("\n");
         for(File test : tests){
             if(test.isFile() && test.getName().endsWith(".s")){
-                String errors = run(test.getPath(),p);
-                if(errors.equals("")) {
-                    System.out.print('.');
-                }else{
-                    System.out.print('X');
-                    total.append(errors).append('\n');
-                }
+                runFile(test.getPath(), p);
             }
         }
-        if(riscv_tests == null){
-            System.out.println("./test/riscv-tests doesn't exist");
-            return;
-        }
-        for(File test : riscv_tests){
-            if(test.isFile() && test.getName().endsWith(".s")){
-                String errors = run(test.getPath(),p);
-                if(errors.equals("")) {
-                    System.out.print('.');
-                }else{
-                    System.out.print('X');
-                    total.append(errors).append('\n');
-                }
-            }
-        }
-
+    }
 
-        if(riscv_tests_64 == null){
-            System.out.println("./test/riscv-tests-64 doesn't exist");
-            return;
+    public void runFile(String path, Program p) {
+        String errors = run(path, p);
+        if (errors.equals("")) {
+            System.out.print('.');
+        } else {
+            System.out.print('X');
+            total.append(errors).append('\n');
         }
-        Globals.getSettings().setBooleanSettingNonPersistent(Settings.Bool.RV64_ENABLED,true);
-        InstructionSet.rv64 = true;
-        Globals.instructionSet.populate();
-        for(File test : riscv_tests_64){
-            if(test.isFile() && test.getName().toLowerCase().endsWith(".s")){
-                String errors = run(test.getPath(),p);
-                if(errors.equals("")) {
-                    System.out.print('.');
-                }else{
-                    System.out.print('X');
-                    total.append(errors).append('\n');
-                }
-            }
-        }
-        System.out.println(total);
-        checkBinary();
-        checkPsuedo();
     }
+
     public static String run(String path, Program p){
         int[] errorlines = null;
-        String stdin = "", stdout = "", stderr ="";
+        String stdin = "", stdout = "", stderr ="", errorMessage = "", exitReason = "";
+        ArrayList programArgumentList = null;
+        ArrayList fileList = new ArrayList<>();
+        fileList.add(path);
+        int exitCode = 0;
         // TODO: better config system
         // This is just a temporary solution that should work for the tests I want to write
+        p.getOptions().selfModifyingCode = false;
         try {
-            BufferedReader br = new BufferedReader(new FileReader(path));
+            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path), "UTF-8"));
             String line = br.readLine();
-            while(line.startsWith("#")){
+            while(line != null){
                 if (line.startsWith("#error on lines:")) {
                     String[] linenumbers = line.replaceFirst("#error on lines:", "").split(",");
                     errorlines = new int[linenumbers.length];
                     for(int i = 0; i < linenumbers.length; i++){
                         errorlines[i] = Integer.parseInt(linenumbers[i].trim());
                     }
-                } else if (line.startsWith("stdin:")) {
+                } else if (line.startsWith("#lib:")) {
+                    String lib = line.replaceFirst("#lib:", "");
+                    fileList.add(Paths.get(path).getParent().resolve(lib).toString());
+                } else if (line.startsWith("#stdin:")) {
                     stdin = line.replaceFirst("#stdin:", "").replaceAll("\\\\n","\n");
                 } else if (line.startsWith("#stdout:")) {
-                    stdout = line.replaceFirst("#stdout:", "").replaceAll("\\\\n","\n");
+                    stdout = line.replaceFirst("#stdout:", "").replaceAll("\\\\n","\n").trim();
                 } else if (line.startsWith("#stderr:")) {
-                    stderr = line.replaceFirst("#stderr:", "").replaceAll("\\\\n","\n");
+                    stderr = line.replaceFirst("#stderr:", "").replaceAll("\\\\n","\n").trim();
+                } else if (line.startsWith("#exit:")) {
+                    exitReason = line.replaceFirst("#exit:", "");
+                    try {
+                        exitCode = Integer.parseInt(exitReason);
+                    } catch (NumberFormatException nfe) {
+                        exitCode = -1;
+                    }
+                } else if (line.startsWith("#args:")) {
+                    String args = line.replaceFirst("#args:", "");
+                    programArgumentList = new ProgramArgumentList(args).getProgramArgumentList();
+                } else if (line.startsWith("#error:")) {
+                    errorMessage = line.replaceFirst("#error:", "");
+                } else if (line.startsWith("#selfmod:")) {
+                    String selfmod = line.replaceFirst("#selfmod:", "");
+		            if (selfmod.equals("true")) {
+			            p.getOptions().selfModifyingCode = true;
+		            }
                 }
                 line = br.readLine();
             }
@@ -104,23 +145,27 @@ public static String run(String path, Program p){
             return "Error reading " + path;
         }
         try {
-            p.assemble(path);
+            p.assemble(fileList, path);
             if(errorlines != null){
-                return "Expected asssembly error, but successfully assembled " + path;
+                return "Expected assembly error, but successfully assembled " + path;
             }
-            p.setup(null,stdin);
+            p.setup(programArgumentList, stdin);
             Simulator.Reason r = p.simulate();
             if(r != Simulator.Reason.NORMAL_TERMINATION){
-                return "Ended abnormally while executing " + path;
+                if (r.toString().toLowerCase().equals(exitReason)) {
+                    return "";
+                } else {
+                    return "Ended abnormally " + r + " while executing " + path;
+                }
             }else{
-                if(p.getExitCode() != 42) {
-                    return "Final exit code was wrong for " + path;
+                if(p.getExitCode() != exitCode) {
+                    return "Final exit code was wrong for " + path + "\n Expected "+exitCode+" got "+p.getExitCode();
                 }
-                if(!p.getSTDOUT().equals(stdout)){
+                if(!p.getSTDOUT().trim().equals(stdout)){
                     return "STDOUT was wrong for " + path + "\n Expected \""+stdout+"\" got \""+p.getSTDOUT()+"\"";
                 }
-                if(!p.getSTDERR().equals(stderr)){
-                    return "STDERR was wrong for " + path;
+                if(!p.getSTDERR().trim().equals(stderr)){
+                    return "STDERR was wrong for " + path + "\n Expected \""+stderr+"\" got \""+p.getSTDERR()+"\"";
                 }
                 return "";
             }
@@ -141,11 +186,13 @@ public static String run(String path, Program p){
             }
             return "";
         } catch (SimulationException se){
-            return "Crashed while executing " + path;
+            if (se.error().getMessage().equals(errorMessage))
+                    return "";
+            return "Crashed while executing " + path + "; " + se.error().generateReport();
         }
     }
 
-    public static void checkBinary(){
+    public void checkBinary(){
         Options opt = new Options();
         opt.startAtMain = true;
         opt.maxSteps = 500;
@@ -228,7 +275,8 @@ public static void checkBinary(){
             }
         }
     }
-    public static void checkPsuedo(){
+
+    public void checkPseudo(){
         Options opt = new Options();
         opt.startAtMain = true;
         opt.maxSteps = 500;
diff --git a/test/RarsUnitTest.java b/test/RarsUnitTest.java
new file mode 100644
index 00000000..83b2e14b
--- /dev/null
+++ b/test/RarsUnitTest.java
@@ -0,0 +1,21 @@
+import org.junit.jupiter.api.Test;
+
+public class RarsUnitTest extends RarsTest {
+    @Override
+    @Test
+    public void checkBinary() {
+        super.checkBinary();
+    }
+
+    @Override
+    @Test
+    public void checkPseudo() {
+        super.checkPseudo();
+    }
+
+    @Override
+    @Test
+    public void checkPrograms() {
+        super.checkPrograms();
+    }
+}
diff --git a/test/SmokeTest.java b/test/SmokeTest.java
new file mode 100644
index 00000000..9f68f286
--- /dev/null
+++ b/test/SmokeTest.java
@@ -0,0 +1,11 @@
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class SmokeTest {
+    @Test
+    public void assertTrueTest() {
+        assertTrue(true);
+    }
+
+}
diff --git a/test/align.s b/test/align.s
new file mode 100644
index 00000000..9bccc42c
--- /dev/null
+++ b/test/align.s
@@ -0,0 +1,42 @@
+#exit:42
+	.data
+	# autoalign by default
+z:	.byte 0x11
+b:	.byte 0x12
+	.byte 0x13
+h:	.half 0x2222
+w:	.word 0x44444444
+d:	.dword 0x8888888888888888
+
+	.text
+	la s0, z
+	la s1, b
+	la s2, h
+	la s3, w
+	la s4, d
+
+	sub a0, s1, s0
+	li t0, 1
+	bne a0, t0, fail
+
+	sub a0, s2, s0
+	li t0, 4
+	bne a0, t0, fail
+
+	sub a0, s3, s0
+	li t0, 8
+	bne a0, t0, fail
+
+	sub a0, s4, s0
+	li t0, 16
+	bne a0, t0, fail
+
+	li a7, 93 # Exit2
+	li a0, 42
+	ecall
+
+fail:	
+	li a7, 93 # Exit2
+	li a0, 0
+	ecall
+	
diff --git a/test/cliff.s b/test/cliff.s
new file mode 100644
index 00000000..bef8827d
--- /dev/null
+++ b/test/cliff.s
@@ -0,0 +1 @@
+#exit:cliff_termination
diff --git a/test/csr.s b/test/csr.s
index 6114b966..ea25a774 100644
--- a/test/csr.s
+++ b/test/csr.s
@@ -1,3 +1,4 @@
+#exit:42
 .globl main
 .text
 main:
diff --git a/test/dword.s b/test/dword.s
new file mode 100644
index 00000000..147f8536
--- /dev/null
+++ b/test/dword.s
@@ -0,0 +1,26 @@
+#stdout:87654321HGFEDCBA2685009920
+#exit:42
+.data
+data:
+.eqv eqv, 0x3132333435363738
+.dword eqv
+.dword 0x4142434445464748
+
+data2: .dword data
+.byte 0
+
+.text
+li a7, 4 # PrintString
+la a0, data
+ecall
+
+la s1, data2
+li a7, 1 # PrintInt
+lw a0, 0(s1)
+ecall
+lw a0, 4(s1)
+ecall
+
+li a7, 93 # Exit2
+li a0, 42
+ecall
diff --git a/test/ebreak.s b/test/ebreak.s
new file mode 100644
index 00000000..ad93734b
--- /dev/null
+++ b/test/ebreak.s
@@ -0,0 +1,2 @@
+#exit:breakpoint
+ebreak
diff --git a/test/eqv_char.s b/test/eqv_char.s
new file mode 100644
index 00000000..a80e231f
--- /dev/null
+++ b/test/eqv_char.s
@@ -0,0 +1,9 @@
+#exit:42
+	.eqv SUBSTITUTE, 'a'    # a is 97
+
+	.text
+        li s0, SUBSTITUTE       # this must build
+
+        li a0, 42
+        li a7, 93
+        ecall
diff --git a/test/exception.s b/test/exception.s
index 60dccda8..ec8029f8 100644
--- a/test/exception.s
+++ b/test/exception.s
@@ -1,3 +1,4 @@
+#exit:42
 .globl main
 .text
 main:
diff --git a/test/exception_instruction_access_fault.s b/test/exception_instruction_access_fault.s
new file mode 100644
index 00000000..15d2c6c5
--- /dev/null
+++ b/test/exception_instruction_access_fault.s
@@ -0,0 +1,2 @@
+#error:Instruction load access error
+jr zero
diff --git a/test/exception_instruction_addr_misaligned.s b/test/exception_instruction_addr_misaligned.s
new file mode 100644
index 00000000..192eda4a
--- /dev/null
+++ b/test/exception_instruction_addr_misaligned.s
@@ -0,0 +1,4 @@
+#error:Instruction load alignment error
+auipc a0, 0
+addi a0, a0, 2
+jr a0
diff --git a/test/exception_load_access_fault.s b/test/exception_load_access_fault.s
new file mode 100644
index 00000000..0775591c
--- /dev/null
+++ b/test/exception_load_access_fault.s
@@ -0,0 +1,2 @@
+#error:Runtime exception at 0x00400000: address out of range 0x00000000
+lw a0, 0(zero)
diff --git a/test/exception_load_address_misaligned.s b/test/exception_load_address_misaligned.s
new file mode 100644
index 00000000..201bf839
--- /dev/null
+++ b/test/exception_load_address_misaligned.s
@@ -0,0 +1,6 @@
+#error:Runtime exception at 0x00400008: Load address not aligned to word boundary 0x10010001
+.data
+d: .word 42
+.text
+la a0, d
+lw a1, 1(a0)
diff --git a/test/exception_store_access_fault.s b/test/exception_store_access_fault.s
new file mode 100644
index 00000000..2034af57
--- /dev/null
+++ b/test/exception_store_access_fault.s
@@ -0,0 +1,2 @@
+#error:Runtime exception at 0x00400000: address out of range 0x00000000
+sw a0, 0(zero)
diff --git a/test/exception_store_address_misaligned.s b/test/exception_store_address_misaligned.s
new file mode 100644
index 00000000..1d4fcbe7
--- /dev/null
+++ b/test/exception_store_address_misaligned.s
@@ -0,0 +1,6 @@
+#error:Runtime exception at 0x00400008: Store address not aligned to word boundary 0x10010001
+.data
+d: .word 42
+.text
+la a0, d
+sw a1, 1(a0)
diff --git a/test/jalr.s b/test/jalr.s
index 3c3ae660..89383a14 100644
--- a/test/jalr.s
+++ b/test/jalr.s
@@ -1,3 +1,4 @@
+#exit:42
 .globl main
 .text
 main:
diff --git a/test/literal.s b/test/literal.s
new file mode 100644
index 00000000..a4065510
--- /dev/null
+++ b/test/literal.s
@@ -0,0 +1,15 @@
+#stdout:168
+#exit:42
+.text
+main:
+	li a0, 42
+	addi a0, a0, '*'
+	addi a0, a0, 0x2a
+	addi a0, a0, 0b101010
+	li a7, 1 # print integer
+	ecall
+
+success:
+	li a0, 42
+	li a7, 93
+	ecall
diff --git a/test/loop.s b/test/loop.s
index a7c8ceeb..4f9ea6d1 100644
--- a/test/loop.s
+++ b/test/loop.s
@@ -1,3 +1,4 @@
+#exit:42
 .globl main
 .text
 main:
diff --git a/test/loopchar.s b/test/loopchar.s
new file mode 100644
index 00000000..e1bac936
--- /dev/null
+++ b/test/loopchar.s
@@ -0,0 +1,14 @@
+#stdin:10\n20\n0
+#stdout:1020
+loop:
+	li a7, 5
+	ecall
+
+	beqz a0, end
+
+	li a7, 1
+	ecall
+	j loop
+end:
+	li a7, 10
+	ecall
diff --git a/test/loopint.s b/test/loopint.s
new file mode 100644
index 00000000..b244677e
--- /dev/null
+++ b/test/loopint.s
@@ -0,0 +1,15 @@
+#stdin:10\n20\n0
+#stdout:1020
+loop:
+	li a7, 5
+	ecall
+
+	beqz a0, end
+
+	li a7, 1
+	ecall
+	j loop
+
+end:
+	li a7, 10
+	ecall
diff --git a/test/loopstring.s b/test/loopstring.s
new file mode 100644
index 00000000..42172d71
--- /dev/null
+++ b/test/loopstring.s
@@ -0,0 +1,24 @@
+#stdin:Hello\nthe\nworld
+#stdout:Hello\nthe\nworld
+	.data
+buffer: .space 256
+
+	.text
+loop:
+	li a7, 8
+	la a0, buffer
+	li a1, 256
+	ecall
+
+	lb t0, 0(a0)
+	li t1, '\n'
+	beq t0, t1, end
+
+	li a7, 4
+	la a0, buffer
+	ecall
+	j loop
+
+end:
+	li a7, 10
+	ecall
diff --git a/test/max_steps.s b/test/max_steps.s
new file mode 100644
index 00000000..8e8f41e6
--- /dev/null
+++ b/test/max_steps.s
@@ -0,0 +1,2 @@
+#exit:max_steps
+loop: j loop
diff --git a/test/memory.s b/test/memory.s
index 2378a8ea..287129ea 100644
--- a/test/memory.s
+++ b/test/memory.s
@@ -1,3 +1,4 @@
+#exit:42
 .globl main
 .data
 buffer: .space 8
diff --git a/test/rars/simulator/BackStepperTest.java b/test/rars/simulator/BackStepperTest.java
new file mode 100644
index 00000000..b2114ed9
--- /dev/null
+++ b/test/rars/simulator/BackStepperTest.java
@@ -0,0 +1,65 @@
+package rars.simulator;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import rars.Globals;
+import rars.api.Program;
+import rars.riscv.hardware.Memory;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class BackStepperTest {
+    @AfterEach
+    void tearDown() {
+        Globals.program = null;
+        Globals.memory = null;
+    }
+
+    @Test
+    public void testSimulateRegister() throws Exception {
+        Program p = new Program();
+        p.assembleString("li a0, 42");
+        p.setup(null, null);
+        p.setRegisterValue("a0", 123);
+        Globals.program = p.getCode(); // Shouldn't have to do this...
+
+        assertEquals(123, p.getRegisterValue("a0"));
+        assertTrue(p.getCode().getBackStepper().empty());
+
+        Simulator.Reason reason = p.simulate();
+
+        assertFalse(p.getCode().getBackStepper().empty());
+        assertEquals(42, p.getRegisterValue("a0"));
+
+        p.getCode().getBackStepper().backStep();
+
+        assertTrue(p.getCode().getBackStepper().empty());
+        assertEquals(123, p.getRegisterValue("a0"));
+    }
+
+    @Test
+    public void testSimulateMemory() throws Exception {
+        Program p = new Program();
+        p.assembleString("sw a0, 0(a1)");
+        p.setup(null, null);
+        int dataSegment = Memory.dataBaseAddress;
+        p.setRegisterValue("a0", 42);
+        p.setRegisterValue("a1", dataSegment);
+        p.getMemory().setWord(dataSegment, 123);
+        Globals.program = p.getCode(); // Shouldn't have to do this...
+
+        assertEquals(123, p.getMemory().getWord(dataSegment));
+        assertTrue(p.getCode().getBackStepper().empty());
+
+        Simulator.Reason reason = p.simulate();
+        Globals.memory = p.getMemory(); // Neither this...
+
+        assertFalse(p.getCode().getBackStepper().empty());
+        assertEquals(42, p.getMemory().getWord(dataSegment));
+
+        p.getCode().getBackStepper().backStep();
+
+        assertTrue(p.getCode().getBackStepper().empty());
+        assertEquals(123, p.getMemory().getWord(dataSegment));
+    }
+}
\ No newline at end of file
diff --git a/test/rars/simulator/SimulatorTest.java b/test/rars/simulator/SimulatorTest.java
new file mode 100644
index 00000000..1ae7e6ed
--- /dev/null
+++ b/test/rars/simulator/SimulatorTest.java
@@ -0,0 +1,45 @@
+package rars.simulator;
+
+import org.junit.jupiter.api.Test;
+import rars.api.Program;
+import rars.riscv.hardware.Memory;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class SimulatorTest {
+
+    @Test
+    public void testSimulateRegister() throws Exception {
+        Program p = new Program();
+        p.assembleString("li a0, 42");
+        p.setup(null, null);
+        p.setRegisterValue("a0", 123);
+
+        assertEquals(123, p.getRegisterValue("a0"));
+
+        Simulator.Reason reason = p.simulate();
+
+        assertEquals(Simulator.Reason.CLIFF_TERMINATION, reason);
+        assertEquals(42, p.getRegisterValue("a0"));
+        assertEquals(0, p.getExitCode());
+    }
+
+    @Test
+    public void testSimulateMemory() throws Exception {
+        Program p = new Program();
+        p.assembleString("sw a0, 0(a1)");
+        p.setup(null, null);
+        int dataSegment = Memory.dataBaseAddress;
+        p.setRegisterValue("a0", 42);
+        p.setRegisterValue("a1", dataSegment);
+        p.getMemory().setWord(dataSegment, 123);
+
+        assertEquals(123, p.getMemory().getWord(dataSegment));
+
+        Simulator.Reason reason = p.simulate();
+
+        assertEquals(Simulator.Reason.CLIFF_TERMINATION, reason);
+        assertEquals(42, p.getMemory().getWord(dataSegment));
+        assertEquals(0, p.getExitCode());
+    }
+}
\ No newline at end of file
diff --git a/test/read.s b/test/read.s
new file mode 100644
index 00000000..ef978633
--- /dev/null
+++ b/test/read.s
@@ -0,0 +1,74 @@
+#stdin:hello\nworldXremain
+#stdout:11hello\nworld....\n1Xello\nworld....\n0Xello\nworld....\n6remainworld....\n0remainworld....\n
+#exit:42
+
+.eqv PrintInt, 1
+.eqv Read, 63
+.eqv PrintString, 4
+
+# Expect to read one and half line "hello\nworld"
+li a0, 0
+la a1, buf
+li a2, 11
+li a7, Read
+ecall
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read only a character
+li a0, 0
+la a1, buf
+li a2, 1
+li a7, Read
+ecall
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read nothing
+li a0, 0
+la a1, buf
+li a2, 0 # nothing
+li a7, Read
+ecall
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read what remains
+li a0, 0
+la a1, buf
+li a2, 12
+li a7, Read
+ecall
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read nothing, it's EOF
+li a0, 0
+la a1, buf
+li a2, 12
+li a7, Read
+ecall
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+li a0, 42 
+li a7, 93	# Exit2
+ecall
+
+.data
+buf: .string "...............\n"
diff --git a/test/readchar.s b/test/readchar.s
new file mode 100644
index 00000000..f1528981
--- /dev/null
+++ b/test/readchar.s
@@ -0,0 +1,25 @@
+#stdin:a b\n\n!
+#stdout:97a32 98b10\n10\n33!-1�-1�
+#exit:42
+
+.eqv PrintInt, 1
+.eqv ReadChar, 12
+.eqv PrintChar, 11
+
+li s0, 8
+loop:
+beqz s0, end
+addi s0, s0, -1
+li a7, ReadChar
+ecall
+li a7, PrintInt
+ecall
+# Note: lowest byte of -1 is ff, and U+FF is ÿ
+li a7, PrintChar
+ecall
+j loop
+
+end:
+li a0, 42 
+li a7, 93	# Exit2
+ecall
diff --git a/test/readintchar.s b/test/readintchar.s
new file mode 100644
index 00000000..ea658563
--- /dev/null
+++ b/test/readintchar.s
@@ -0,0 +1,12 @@
+li a7, 5 # ReadInt
+ecall
+li a7, 1 # PrintInt
+ecall
+li a7, 12 # ReadChar
+ecall
+li a7, 11 # PrintChar
+ecall
+li a7, 10 # Exit
+ecall
+#stdin:42\n*
+#stdout:42*
diff --git a/test/readstring.s b/test/readstring.s
new file mode 100644
index 00000000..386c0086
--- /dev/null
+++ b/test/readstring.s
@@ -0,0 +1,101 @@
+#stdin:hello\n\nworldNOTWORLD\nXXXX\nYYYY\nremain
+#stdout:0hello\n1\n2world34A5remain\n6\n
+#exit:42
+
+.eqv PrintInt, 1
+.eqv ReadString, 8
+.eqv PrintString, 4
+
+# Expect to read one line "hello\n"
+la a0, buf
+li a1, 256
+li a7, ReadString
+ecall
+li a0, 0
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read an empty line
+la a0, buf
+li a1, 256
+li a7, ReadString
+ecall
+li a0, 1
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read "world" only
+la a0, buf
+li a1, 6 # include space for '\0'
+li a7, ReadString
+ecall
+li a0, 2
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read nothing
+la a0, buf
+li a1, 1 # only space for a nullbyte
+li a7, ReadString
+ecall
+li a0, 3
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read nothing
+la a0, buf
+li a1, 'A'
+sb a1, 0(a0)
+sb zero, 1(a0) # Initialize buffer with "A\0"
+li a1, 0 # no space for a nullbyte
+li a7, ReadString
+ecall
+li a0, 4
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read the last line, a "\n" is added
+la a0, buf
+li a1, 256
+li a7, ReadString
+ecall
+li a0, 5
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+# Expect to read only an added "\n". ReadString has no concept of EOF
+la a0, buf
+li a1, 256
+li a7, ReadString
+ecall
+li a0, 6
+li a7, PrintInt
+ecall
+la a0, buf
+li a7, PrintString
+ecall
+
+li a0, 42 
+li a7, 93	# Exit2
+ecall
+
+.data
+buf: .space 256
diff --git a/test/riscv-tests/add.s b/test/riscv-tests-32/add.s
similarity index 99%
rename from test/riscv-tests/add.s
rename to test/riscv-tests-32/add.s
index 96660e1b..86cec8a2 100644
--- a/test/riscv-tests/add.s
+++ b/test/riscv-tests-32/add.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/addi.s b/test/riscv-tests-32/addi.s
similarity index 99%
rename from test/riscv-tests/addi.s
rename to test/riscv-tests-32/addi.s
index 34194b01..4b3e4911 100644
--- a/test/riscv-tests/addi.s
+++ b/test/riscv-tests-32/addi.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/and.s b/test/riscv-tests-32/and.s
similarity index 99%
rename from test/riscv-tests/and.s
rename to test/riscv-tests-32/and.s
index 8e5a216b..fea45de2 100644
--- a/test/riscv-tests/and.s
+++ b/test/riscv-tests-32/and.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/andi.s b/test/riscv-tests-32/andi.s
similarity index 99%
rename from test/riscv-tests/andi.s
rename to test/riscv-tests-32/andi.s
index 74322ba0..febd181f 100644
--- a/test/riscv-tests/andi.s
+++ b/test/riscv-tests-32/andi.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests-32/args.s b/test/riscv-tests-32/args.s
new file mode 100644
index 00000000..27132752
--- /dev/null
+++ b/test/riscv-tests-32/args.s
@@ -0,0 +1,15 @@
+#args:hello world
+#stdout:2helloworld
+mv s0, a0 # argc
+mv s1, a1 # argv
+
+li a7, 1
+ecall
+li a7, 4
+lw a0, 0(s1)
+ecall
+lw a0, 4(s1)
+ecall
+
+li a7, 10
+ecall
\ No newline at end of file
diff --git a/test/riscv-tests/div.s b/test/riscv-tests-32/div.s
similarity index 99%
rename from test/riscv-tests/div.s
rename to test/riscv-tests-32/div.s
index 8e711c36..a4fb03aa 100644
--- a/test/riscv-tests/div.s
+++ b/test/riscv-tests-32/div.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/divu.s b/test/riscv-tests-32/divu.s
similarity index 99%
rename from test/riscv-tests/divu.s
rename to test/riscv-tests-32/divu.s
index 7914f648..338eba13 100644
--- a/test/riscv-tests/divu.s
+++ b/test/riscv-tests-32/divu.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fadd.s b/test/riscv-tests-32/fadd.s
similarity index 99%
rename from test/riscv-tests/fadd.s
rename to test/riscv-tests-32/fadd.s
index f4c75529..b0124687 100644
--- a/test/riscv-tests/fadd.s
+++ b/test/riscv-tests-32/fadd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/faddd.s b/test/riscv-tests-32/faddd.s
similarity index 99%
rename from test/riscv-tests/faddd.s
rename to test/riscv-tests-32/faddd.s
index ac054cbd..d2ff241c 100644
--- a/test/riscv-tests/faddd.s
+++ b/test/riscv-tests-32/faddd.s
@@ -1,3 +1,4 @@
+#exit:42
 
 .text
 main:
diff --git a/test/riscv-tests/fclass.s b/test/riscv-tests-32/fclass.s
similarity index 99%
rename from test/riscv-tests/fclass.s
rename to test/riscv-tests-32/fclass.s
index 3d4d61e9..506ce56c 100644
--- a/test/riscv-tests/fclass.s
+++ b/test/riscv-tests-32/fclass.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fclassd.s b/test/riscv-tests-32/fclassd.s
similarity index 99%
rename from test/riscv-tests/fclassd.s
rename to test/riscv-tests-32/fclassd.s
index 9add288f..eea3e81c 100644
--- a/test/riscv-tests/fclassd.s
+++ b/test/riscv-tests-32/fclassd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
 
diff --git a/test/riscv-tests/fcmp.s b/test/riscv-tests-32/fcmp.s
similarity index 99%
rename from test/riscv-tests/fcmp.s
rename to test/riscv-tests-32/fcmp.s
index cfa05ef5..d39e831e 100644
--- a/test/riscv-tests/fcmp.s
+++ b/test/riscv-tests-32/fcmp.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fcmpd.s b/test/riscv-tests-32/fcmpd.s
similarity index 99%
rename from test/riscv-tests/fcmpd.s
rename to test/riscv-tests-32/fcmpd.s
index f9c3a7d7..a04b864c 100644
--- a/test/riscv-tests/fcmpd.s
+++ b/test/riscv-tests-32/fcmpd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/fcvt.s b/test/riscv-tests-32/fcvt.s
similarity index 99%
rename from test/riscv-tests/fcvt.s
rename to test/riscv-tests-32/fcvt.s
index 57433257..c6725739 100644
--- a/test/riscv-tests/fcvt.s
+++ b/test/riscv-tests-32/fcvt.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fcvt_w.s b/test/riscv-tests-32/fcvt_w.s
similarity index 99%
rename from test/riscv-tests/fcvt_w.s
rename to test/riscv-tests-32/fcvt_w.s
index aaa9d441..ac6bdd93 100644
--- a/test/riscv-tests/fcvt_w.s
+++ b/test/riscv-tests-32/fcvt_w.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fcvt_wd.s b/test/riscv-tests-32/fcvt_wd.s
similarity index 99%
rename from test/riscv-tests/fcvt_wd.s
rename to test/riscv-tests-32/fcvt_wd.s
index 0453c5e1..a8bf1840 100644
--- a/test/riscv-tests/fcvt_wd.s
+++ b/test/riscv-tests-32/fcvt_wd.s
@@ -1,3 +1,4 @@
+#exit:42
 
 .text
 main:
diff --git a/test/riscv-tests/fcvtd.s b/test/riscv-tests-32/fcvtd.s
similarity index 99%
rename from test/riscv-tests/fcvtd.s
rename to test/riscv-tests-32/fcvtd.s
index a5ecc39a..1f4ea2ce 100644
--- a/test/riscv-tests/fcvtd.s
+++ b/test/riscv-tests-32/fcvtd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/fdiv.s b/test/riscv-tests-32/fdiv.s
similarity index 99%
rename from test/riscv-tests/fdiv.s
rename to test/riscv-tests-32/fdiv.s
index 5ff2e29e..0e509b39 100644
--- a/test/riscv-tests/fdiv.s
+++ b/test/riscv-tests-32/fdiv.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fdivd.s b/test/riscv-tests-32/fdivd.s
similarity index 99%
rename from test/riscv-tests/fdivd.s
rename to test/riscv-tests-32/fdivd.s
index 3709735d..952244a2 100644
--- a/test/riscv-tests/fdivd.s
+++ b/test/riscv-tests-32/fdivd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/fmadd.s b/test/riscv-tests-32/fmadd.s
similarity index 99%
rename from test/riscv-tests/fmadd.s
rename to test/riscv-tests-32/fmadd.s
index f5eeb6cc..4d927d86 100644
--- a/test/riscv-tests/fmadd.s
+++ b/test/riscv-tests-32/fmadd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fmaddd.s b/test/riscv-tests-32/fmaddd.s
similarity index 99%
rename from test/riscv-tests/fmaddd.s
rename to test/riscv-tests-32/fmaddd.s
index b3ded18e..98b76e13 100644
--- a/test/riscv-tests/fmaddd.s
+++ b/test/riscv-tests-32/fmaddd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/fmin.s b/test/riscv-tests-32/fmin.s
similarity index 99%
rename from test/riscv-tests/fmin.s
rename to test/riscv-tests-32/fmin.s
index 67eb0161..5d141a91 100644
--- a/test/riscv-tests/fmin.s
+++ b/test/riscv-tests-32/fmin.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/fmind.s b/test/riscv-tests-32/fmind.s
similarity index 99%
rename from test/riscv-tests/fmind.s
rename to test/riscv-tests-32/fmind.s
index 7aa523bd..51b7cfea 100644
--- a/test/riscv-tests/fmind.s
+++ b/test/riscv-tests-32/fmind.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/ldst.s b/test/riscv-tests-32/ldst.s
similarity index 98%
rename from test/riscv-tests/ldst.s
rename to test/riscv-tests-32/ldst.s
index 56eabe0a..abb5e2b8 100644
--- a/test/riscv-tests/ldst.s
+++ b/test/riscv-tests-32/ldst.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/ldstd.s b/test/riscv-tests-32/ldstd.s
similarity index 99%
rename from test/riscv-tests/ldstd.s
rename to test/riscv-tests-32/ldstd.s
index eeac3596..606cc760 100644
--- a/test/riscv-tests/ldstd.s
+++ b/test/riscv-tests-32/ldstd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   la s0, tdat
diff --git a/test/riscv-tests/lui.s b/test/riscv-tests-32/lui.s
similarity index 98%
rename from test/riscv-tests/lui.s
rename to test/riscv-tests-32/lui.s
index 57f5808e..03cd50ec 100644
--- a/test/riscv-tests/lui.s
+++ b/test/riscv-tests-32/lui.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/move.s b/test/riscv-tests-32/move.s
similarity index 99%
rename from test/riscv-tests/move.s
rename to test/riscv-tests-32/move.s
index dc37a21f..52a9f5c3 100644
--- a/test/riscv-tests/move.s
+++ b/test/riscv-tests-32/move.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/mul.s b/test/riscv-tests-32/mul.s
similarity index 99%
rename from test/riscv-tests/mul.s
rename to test/riscv-tests-32/mul.s
index 2171ef57..1a825283 100644
--- a/test/riscv-tests/mul.s
+++ b/test/riscv-tests-32/mul.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/mulh.s b/test/riscv-tests-32/mulh.s
similarity index 99%
rename from test/riscv-tests/mulh.s
rename to test/riscv-tests-32/mulh.s
index 27cca46a..e112d0eb 100644
--- a/test/riscv-tests/mulh.s
+++ b/test/riscv-tests-32/mulh.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/mulhsu.s b/test/riscv-tests-32/mulhsu.s
similarity index 99%
rename from test/riscv-tests/mulhsu.s
rename to test/riscv-tests-32/mulhsu.s
index 749070ea..25f9e5eb 100644
--- a/test/riscv-tests/mulhsu.s
+++ b/test/riscv-tests-32/mulhsu.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/mulhu.s b/test/riscv-tests-32/mulhu.s
similarity index 99%
rename from test/riscv-tests/mulhu.s
rename to test/riscv-tests-32/mulhu.s
index 15badc35..9e167f6a 100644
--- a/test/riscv-tests/mulhu.s
+++ b/test/riscv-tests-32/mulhu.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/or.s b/test/riscv-tests-32/or.s
similarity index 99%
rename from test/riscv-tests/or.s
rename to test/riscv-tests-32/or.s
index 9df72ae5..58def350 100644
--- a/test/riscv-tests/or.s
+++ b/test/riscv-tests-32/or.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/ori.s b/test/riscv-tests-32/ori.s
similarity index 99%
rename from test/riscv-tests/ori.s
rename to test/riscv-tests-32/ori.s
index 3d1b357b..8d828c6f 100644
--- a/test/riscv-tests/ori.s
+++ b/test/riscv-tests-32/ori.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/recoding.s b/test/riscv-tests-32/recoding.s
similarity index 98%
rename from test/riscv-tests/recoding.s
rename to test/riscv-tests-32/recoding.s
index 6d1556a9..46540342 100644
--- a/test/riscv-tests/recoding.s
+++ b/test/riscv-tests-32/recoding.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/recodingd.s b/test/riscv-tests-32/recodingd.s
similarity index 99%
rename from test/riscv-tests/recodingd.s
rename to test/riscv-tests-32/recodingd.s
index d1920680..c0d60cd3 100644
--- a/test/riscv-tests/recodingd.s
+++ b/test/riscv-tests-32/recodingd.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   # Make sure infinities with different mantissas compare as equal.
diff --git a/test/riscv-tests/rem.s b/test/riscv-tests-32/rem.s
similarity index 99%
rename from test/riscv-tests/rem.s
rename to test/riscv-tests-32/rem.s
index b5239b38..6353cb46 100644
--- a/test/riscv-tests/rem.s
+++ b/test/riscv-tests-32/rem.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/remu.s b/test/riscv-tests-32/remu.s
similarity index 99%
rename from test/riscv-tests/remu.s
rename to test/riscv-tests-32/remu.s
index 1af97405..472d757b 100644
--- a/test/riscv-tests/remu.s
+++ b/test/riscv-tests-32/remu.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/simple.s b/test/riscv-tests-32/simple.s
similarity index 82%
rename from test/riscv-tests/simple.s
rename to test/riscv-tests-32/simple.s
index bc068447..e62dc7bf 100644
--- a/test/riscv-tests/simple.s
+++ b/test/riscv-tests-32/simple.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/sll.s b/test/riscv-tests-32/sll.s
similarity index 99%
rename from test/riscv-tests/sll.s
rename to test/riscv-tests-32/sll.s
index 85ed8220..6e6171da 100644
--- a/test/riscv-tests/sll.s
+++ b/test/riscv-tests-32/sll.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/slli.s b/test/riscv-tests-32/slli.s
similarity index 99%
rename from test/riscv-tests/slli.s
rename to test/riscv-tests-32/slli.s
index a7109bbf..84025740 100644
--- a/test/riscv-tests/slli.s
+++ b/test/riscv-tests-32/slli.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
 main:
   #-------------------------------------------------------------
diff --git a/test/riscv-tests/slt.s b/test/riscv-tests-32/slt.s
similarity index 99%
rename from test/riscv-tests/slt.s
rename to test/riscv-tests-32/slt.s
index e580ff23..8936cf5f 100644
--- a/test/riscv-tests/slt.s
+++ b/test/riscv-tests-32/slt.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/slti.s b/test/riscv-tests-32/slti.s
similarity index 99%
rename from test/riscv-tests/slti.s
rename to test/riscv-tests-32/slti.s
index 3959b131..df674bdf 100644
--- a/test/riscv-tests/slti.s
+++ b/test/riscv-tests-32/slti.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/sltiu.s b/test/riscv-tests-32/sltiu.s
similarity index 99%
rename from test/riscv-tests/sltiu.s
rename to test/riscv-tests-32/sltiu.s
index 9237f737..981cc213 100644
--- a/test/riscv-tests/sltiu.s
+++ b/test/riscv-tests-32/sltiu.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/sltu.s b/test/riscv-tests-32/sltu.s
similarity index 99%
rename from test/riscv-tests/sltu.s
rename to test/riscv-tests-32/sltu.s
index 8dcdf365..89b0db6d 100644
--- a/test/riscv-tests/sltu.s
+++ b/test/riscv-tests-32/sltu.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/sra.s b/test/riscv-tests-32/sra.s
similarity index 99%
rename from test/riscv-tests/sra.s
rename to test/riscv-tests-32/sra.s
index 9c84b7e1..0f666127 100644
--- a/test/riscv-tests/sra.s
+++ b/test/riscv-tests-32/sra.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/srai.s b/test/riscv-tests-32/srai.s
similarity index 99%
rename from test/riscv-tests/srai.s
rename to test/riscv-tests-32/srai.s
index 59478bb9..58230593 100644
--- a/test/riscv-tests/srai.s
+++ b/test/riscv-tests-32/srai.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/srl.s b/test/riscv-tests-32/srl.s
similarity index 99%
rename from test/riscv-tests/srl.s
rename to test/riscv-tests-32/srl.s
index ebce5af7..cb6b2151 100644
--- a/test/riscv-tests/srl.s
+++ b/test/riscv-tests-32/srl.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/srli.s b/test/riscv-tests-32/srli.s
similarity index 99%
rename from test/riscv-tests/srli.s
rename to test/riscv-tests-32/srli.s
index e0c1251c..4bb744ec 100644
--- a/test/riscv-tests/srli.s
+++ b/test/riscv-tests-32/srli.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/sub.s b/test/riscv-tests-32/sub.s
similarity index 99%
rename from test/riscv-tests/sub.s
rename to test/riscv-tests-32/sub.s
index 7dbe7b6b..35c8131b 100644
--- a/test/riscv-tests/sub.s
+++ b/test/riscv-tests-32/sub.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests-32/sysprintint.s b/test/riscv-tests-32/sysprintint.s
new file mode 100644
index 00000000..cee887d1
--- /dev/null
+++ b/test/riscv-tests-32/sysprintint.s
@@ -0,0 +1,39 @@
+#stdout:2147483647 0x7fffffff 01111111111111111111111111111111 2147483647\n-2147483648 0x80000000 10000000000000000000000000000000 2147483648\n-2147483648 0x80000000 10000000000000000000000000000000 2147483648\n
+#exit:42
+li s0, 0x7FFFFFFF
+jal printAll
+addi s0, s0, 1
+jal printAll
+neg s0, s0
+jal printAll
+
+li a0, 42
+li a7, 93
+ecall
+
+printAll:
+li a7, 1 # PrintInt
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, ' '
+ecall
+li a7, 34 # PrintIntHex
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, ' '
+ecall
+li a7, 35 # PrintIntBinary
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, ' '
+ecall
+li a7, 36 # PrintIntUnsigned
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, '\n'
+ecall
+ret
diff --git a/test/riscv-tests/xor.s b/test/riscv-tests-32/xor.s
similarity index 99%
rename from test/riscv-tests/xor.s
rename to test/riscv-tests-32/xor.s
index f64ebcdb..89277ec3 100644
--- a/test/riscv-tests/xor.s
+++ b/test/riscv-tests-32/xor.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests/xori.s b/test/riscv-tests-32/xori.s
similarity index 99%
rename from test/riscv-tests/xori.s
rename to test/riscv-tests-32/xori.s
index b87a140b..8e4cad2c 100644
--- a/test/riscv-tests/xori.s
+++ b/test/riscv-tests-32/xori.s
@@ -1,3 +1,4 @@
+#exit:42
 .text
  main:
 
diff --git a/test/riscv-tests-64/add.S b/test/riscv-tests-64/add.s
similarity index 99%
rename from test/riscv-tests-64/add.S
rename to test/riscv-tests-64/add.s
index 34f228c7..a196c14d 100644
--- a/test/riscv-tests-64/add.S
+++ b/test/riscv-tests-64/add.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/add.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # add.S
diff --git a/test/riscv-tests-64/addi.S b/test/riscv-tests-64/addi.s
similarity index 99%
rename from test/riscv-tests-64/addi.S
rename to test/riscv-tests-64/addi.s
index f314e968..fadcebda 100644
--- a/test/riscv-tests-64/addi.S
+++ b/test/riscv-tests-64/addi.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/addi.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # addi.S
diff --git a/test/riscv-tests-64/addiw.S b/test/riscv-tests-64/addiw.s
similarity index 99%
rename from test/riscv-tests-64/addiw.S
rename to test/riscv-tests-64/addiw.s
index b1c18c80..aa4b78aa 100644
--- a/test/riscv-tests-64/addiw.S
+++ b/test/riscv-tests-64/addiw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/addiw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # addiw.S
diff --git a/test/riscv-tests-64/addw.S b/test/riscv-tests-64/addw.s
similarity index 99%
rename from test/riscv-tests-64/addw.S
rename to test/riscv-tests-64/addw.s
index b4d88385..a078e5ae 100644
--- a/test/riscv-tests-64/addw.S
+++ b/test/riscv-tests-64/addw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/addw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # addw.S
diff --git a/test/riscv-tests-64/and.S b/test/riscv-tests-64/and.s
similarity index 99%
rename from test/riscv-tests-64/and.S
rename to test/riscv-tests-64/and.s
index f5347f25..c34363c6 100644
--- a/test/riscv-tests-64/and.S
+++ b/test/riscv-tests-64/and.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/and.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # and.S
diff --git a/test/riscv-tests-64/andi.S b/test/riscv-tests-64/andi.s
similarity index 99%
rename from test/riscv-tests-64/andi.S
rename to test/riscv-tests-64/andi.s
index 676475b3..0cee3a22 100644
--- a/test/riscv-tests-64/andi.S
+++ b/test/riscv-tests-64/andi.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/andi.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # andi.S
diff --git a/test/riscv-tests-64/args.s b/test/riscv-tests-64/args.s
new file mode 100644
index 00000000..f0d9806d
--- /dev/null
+++ b/test/riscv-tests-64/args.s
@@ -0,0 +1,15 @@
+#args:hello world
+#stdout:2helloworld
+mv s0, a0 # argc
+mv s1, a1 # argv
+
+li a7, 1
+ecall
+li a7, 4
+ld a0, 0(s1)
+ecall
+ld a0, 8(s1)
+ecall
+
+li a7, 10
+ecall
diff --git a/test/riscv-tests-64/lb.S b/test/riscv-tests-64/lb.s
similarity index 99%
rename from test/riscv-tests-64/lb.S
rename to test/riscv-tests-64/lb.s
index d91c8534..f8c45afc 100644
--- a/test/riscv-tests-64/lb.S
+++ b/test/riscv-tests-64/lb.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lb.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lb.S
diff --git a/test/riscv-tests-64/lbu.S b/test/riscv-tests-64/lbu.s
similarity index 99%
rename from test/riscv-tests-64/lbu.S
rename to test/riscv-tests-64/lbu.s
index 71baf4eb..a03c3a04 100644
--- a/test/riscv-tests-64/lbu.S
+++ b/test/riscv-tests-64/lbu.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lbu.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lbu.S
diff --git a/test/riscv-tests-64/ld.S b/test/riscv-tests-64/ld.s
similarity index 99%
rename from test/riscv-tests-64/ld.S
rename to test/riscv-tests-64/ld.s
index 0e142ffd..f04ac62d 100644
--- a/test/riscv-tests-64/ld.S
+++ b/test/riscv-tests-64/ld.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/ld.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # ld.S
diff --git a/test/riscv-tests-64/lh.S b/test/riscv-tests-64/lh.s
similarity index 99%
rename from test/riscv-tests-64/lh.S
rename to test/riscv-tests-64/lh.s
index 9006d3fe..cf8bb874 100644
--- a/test/riscv-tests-64/lh.S
+++ b/test/riscv-tests-64/lh.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lh.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lh.S
diff --git a/test/riscv-tests-64/lhu.S b/test/riscv-tests-64/lhu.s
similarity index 99%
rename from test/riscv-tests-64/lhu.S
rename to test/riscv-tests-64/lhu.s
index bf98af12..387eaa09 100644
--- a/test/riscv-tests-64/lhu.S
+++ b/test/riscv-tests-64/lhu.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lhu.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lhu.S
diff --git a/test/riscv-tests-64/lui.S b/test/riscv-tests-64/lui.s
similarity index 99%
rename from test/riscv-tests-64/lui.S
rename to test/riscv-tests-64/lui.s
index 00759079..62ceb999 100644
--- a/test/riscv-tests-64/lui.S
+++ b/test/riscv-tests-64/lui.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lui.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lui.S
diff --git a/test/riscv-tests-64/lw.S b/test/riscv-tests-64/lw.s
similarity index 99%
rename from test/riscv-tests-64/lw.S
rename to test/riscv-tests-64/lw.s
index 75e71ecf..33d2c9be 100644
--- a/test/riscv-tests-64/lw.S
+++ b/test/riscv-tests-64/lw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lw.S
diff --git a/test/riscv-tests-64/lwu.S b/test/riscv-tests-64/lwu.s
similarity index 99%
rename from test/riscv-tests-64/lwu.S
rename to test/riscv-tests-64/lwu.s
index 03f1248c..502c2418 100644
--- a/test/riscv-tests-64/lwu.S
+++ b/test/riscv-tests-64/lwu.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/lwu.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # lwu.S
diff --git a/test/riscv-tests-64/or.S b/test/riscv-tests-64/or.s
similarity index 99%
rename from test/riscv-tests-64/or.S
rename to test/riscv-tests-64/or.s
index 730060ab..7784524f 100644
--- a/test/riscv-tests-64/or.S
+++ b/test/riscv-tests-64/or.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/or.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # or.S
diff --git a/test/riscv-tests-64/ori.S b/test/riscv-tests-64/ori.s
similarity index 99%
rename from test/riscv-tests-64/ori.S
rename to test/riscv-tests-64/ori.s
index 470bd2c2..4d129fb1 100644
--- a/test/riscv-tests-64/ori.S
+++ b/test/riscv-tests-64/ori.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/ori.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # ori.S
diff --git a/test/riscv-tests-64/sb.S b/test/riscv-tests-64/sb.s
similarity index 99%
rename from test/riscv-tests-64/sb.S
rename to test/riscv-tests-64/sb.s
index cc6761de..3f9f6422 100644
--- a/test/riscv-tests-64/sb.S
+++ b/test/riscv-tests-64/sb.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sb.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sb.S
diff --git a/test/riscv-tests-64/sd.S b/test/riscv-tests-64/sd.s
similarity index 99%
rename from test/riscv-tests-64/sd.S
rename to test/riscv-tests-64/sd.s
index 6818aa3b..4e10b49e 100644
--- a/test/riscv-tests-64/sd.S
+++ b/test/riscv-tests-64/sd.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sd.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sd.S
diff --git a/test/riscv-tests-64/sh.S b/test/riscv-tests-64/sh.s
similarity index 99%
rename from test/riscv-tests-64/sh.S
rename to test/riscv-tests-64/sh.s
index 7bdebece..87f30dbe 100644
--- a/test/riscv-tests-64/sh.S
+++ b/test/riscv-tests-64/sh.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sh.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sh.S
diff --git a/test/riscv-tests-64/simple.S b/test/riscv-tests-64/simple.s
similarity index 99%
rename from test/riscv-tests-64/simple.S
rename to test/riscv-tests-64/simple.s
index f8baa736..ca3ff60b 100644
--- a/test/riscv-tests-64/simple.S
+++ b/test/riscv-tests-64/simple.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/simple.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # simple.S
diff --git a/test/riscv-tests-64/sll.S b/test/riscv-tests-64/sll.s
similarity index 99%
rename from test/riscv-tests-64/sll.S
rename to test/riscv-tests-64/sll.s
index 641e90be..cd39f512 100644
--- a/test/riscv-tests-64/sll.S
+++ b/test/riscv-tests-64/sll.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sll.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sll.S
diff --git a/test/riscv-tests-64/slli.S b/test/riscv-tests-64/slli.s
similarity index 99%
rename from test/riscv-tests-64/slli.S
rename to test/riscv-tests-64/slli.s
index 0829bfe5..1e58724b 100644
--- a/test/riscv-tests-64/slli.S
+++ b/test/riscv-tests-64/slli.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/slli.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # slli.S
diff --git a/test/riscv-tests-64/slliw.S b/test/riscv-tests-64/slliw.s
similarity index 99%
rename from test/riscv-tests-64/slliw.S
rename to test/riscv-tests-64/slliw.s
index 95875b23..930c7e27 100644
--- a/test/riscv-tests-64/slliw.S
+++ b/test/riscv-tests-64/slliw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/slliw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # slliw.S
diff --git a/test/riscv-tests-64/sllw.S b/test/riscv-tests-64/sllw.s
similarity index 99%
rename from test/riscv-tests-64/sllw.S
rename to test/riscv-tests-64/sllw.s
index 6697920f..934961cc 100644
--- a/test/riscv-tests-64/sllw.S
+++ b/test/riscv-tests-64/sllw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sllw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sllw.S
diff --git a/test/riscv-tests-64/slt.S b/test/riscv-tests-64/slt.s
similarity index 99%
rename from test/riscv-tests-64/slt.S
rename to test/riscv-tests-64/slt.s
index 28431cbc..71130526 100644
--- a/test/riscv-tests-64/slt.S
+++ b/test/riscv-tests-64/slt.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/slt.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # slt.S
diff --git a/test/riscv-tests-64/slti.S b/test/riscv-tests-64/slti.s
similarity index 99%
rename from test/riscv-tests-64/slti.S
rename to test/riscv-tests-64/slti.s
index d490e4b8..ca44d723 100644
--- a/test/riscv-tests-64/slti.S
+++ b/test/riscv-tests-64/slti.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/slti.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # slti.S
diff --git a/test/riscv-tests-64/sltiu.S b/test/riscv-tests-64/sltiu.s
similarity index 99%
rename from test/riscv-tests-64/sltiu.S
rename to test/riscv-tests-64/sltiu.s
index b06d633e..a29b042e 100644
--- a/test/riscv-tests-64/sltiu.S
+++ b/test/riscv-tests-64/sltiu.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sltiu.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sltiu.S
diff --git a/test/riscv-tests-64/sltu.S b/test/riscv-tests-64/sltu.s
similarity index 99%
rename from test/riscv-tests-64/sltu.S
rename to test/riscv-tests-64/sltu.s
index b804473b..d492e361 100644
--- a/test/riscv-tests-64/sltu.S
+++ b/test/riscv-tests-64/sltu.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sltu.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sltu.S
diff --git a/test/riscv-tests-64/sra.S b/test/riscv-tests-64/sra.s
similarity index 99%
rename from test/riscv-tests-64/sra.S
rename to test/riscv-tests-64/sra.s
index a62be65d..c1ea62f0 100644
--- a/test/riscv-tests-64/sra.S
+++ b/test/riscv-tests-64/sra.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sra.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sra.S
diff --git a/test/riscv-tests-64/srai.S b/test/riscv-tests-64/srai.s
similarity index 99%
rename from test/riscv-tests-64/srai.S
rename to test/riscv-tests-64/srai.s
index 9e54a162..736e170d 100644
--- a/test/riscv-tests-64/srai.S
+++ b/test/riscv-tests-64/srai.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/srai.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # srai.S
diff --git a/test/riscv-tests-64/sraiw.S b/test/riscv-tests-64/sraiw.s
similarity index 99%
rename from test/riscv-tests-64/sraiw.S
rename to test/riscv-tests-64/sraiw.s
index 905c98b1..d079760c 100644
--- a/test/riscv-tests-64/sraiw.S
+++ b/test/riscv-tests-64/sraiw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sraiw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sraiw.S
diff --git a/test/riscv-tests-64/sraw.S b/test/riscv-tests-64/sraw.s
similarity index 99%
rename from test/riscv-tests-64/sraw.S
rename to test/riscv-tests-64/sraw.s
index 5792a850..9db63c81 100644
--- a/test/riscv-tests-64/sraw.S
+++ b/test/riscv-tests-64/sraw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sraw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sraw.S
diff --git a/test/riscv-tests-64/srl.S b/test/riscv-tests-64/srl.s
similarity index 99%
rename from test/riscv-tests-64/srl.S
rename to test/riscv-tests-64/srl.s
index d921f591..30bb88c5 100644
--- a/test/riscv-tests-64/srl.S
+++ b/test/riscv-tests-64/srl.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/srl.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # srl.S
diff --git a/test/riscv-tests-64/srli.S b/test/riscv-tests-64/srli.s
similarity index 99%
rename from test/riscv-tests-64/srli.S
rename to test/riscv-tests-64/srli.s
index 06b16d53..bf483a43 100644
--- a/test/riscv-tests-64/srli.S
+++ b/test/riscv-tests-64/srli.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/srli.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # srli.S
diff --git a/test/riscv-tests-64/srliw.S b/test/riscv-tests-64/srliw.s
similarity index 99%
rename from test/riscv-tests-64/srliw.S
rename to test/riscv-tests-64/srliw.s
index 221b0734..fd0d6487 100644
--- a/test/riscv-tests-64/srliw.S
+++ b/test/riscv-tests-64/srliw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/srliw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # srliw.S
diff --git a/test/riscv-tests-64/srlw.S b/test/riscv-tests-64/srlw.s
similarity index 99%
rename from test/riscv-tests-64/srlw.S
rename to test/riscv-tests-64/srlw.s
index 1d4b9a98..9854398d 100644
--- a/test/riscv-tests-64/srlw.S
+++ b/test/riscv-tests-64/srlw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/srlw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # srlw.S
diff --git a/test/riscv-tests-64/sub.S b/test/riscv-tests-64/sub.s
similarity index 99%
rename from test/riscv-tests-64/sub.S
rename to test/riscv-tests-64/sub.s
index b4c8c578..55e43ea6 100644
--- a/test/riscv-tests-64/sub.S
+++ b/test/riscv-tests-64/sub.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sub.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sub.S
diff --git a/test/riscv-tests-64/subw.S b/test/riscv-tests-64/subw.s
similarity index 99%
rename from test/riscv-tests-64/subw.S
rename to test/riscv-tests-64/subw.s
index 8f3ed515..7d69f9ac 100644
--- a/test/riscv-tests-64/subw.S
+++ b/test/riscv-tests-64/subw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/subw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # subw.S
diff --git a/test/riscv-tests-64/sw.S b/test/riscv-tests-64/sw.s
similarity index 99%
rename from test/riscv-tests-64/sw.S
rename to test/riscv-tests-64/sw.s
index 4bcc8efe..0461d401 100644
--- a/test/riscv-tests-64/sw.S
+++ b/test/riscv-tests-64/sw.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/sw.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # sw.S
diff --git a/test/riscv-tests-64/sysprintint.s b/test/riscv-tests-64/sysprintint.s
new file mode 100644
index 00000000..d9e894e2
--- /dev/null
+++ b/test/riscv-tests-64/sysprintint.s
@@ -0,0 +1,45 @@
+#stdout:2147483647 0x000000007fffffff 0000000000000000000000000000000001111111111111111111111111111111 2147483647\n2147483648 0x0000000080000000 0000000000000000000000000000000010000000000000000000000000000000 2147483648\n-2147483648 0xffffffff80000000 1111111111111111111111111111111110000000000000000000000000000000 18446744071562067968\n9223372036854775807 0x7fffffffffffffff 0111111111111111111111111111111111111111111111111111111111111111 9223372036854775807\n-9223372036854775808 0x8000000000000000 1000000000000000000000000000000000000000000000000000000000000000 9223372036854775808\n-9223372036854775808 0x8000000000000000 1000000000000000000000000000000000000000000000000000000000000000 9223372036854775808\n
+#exit:42
+li s0, 0x7FFFFFFF
+jal printAll
+addi s0, s0, 1
+jal printAll
+neg s0, s0
+jal printAll
+li s0, 0x7FFFFFFFFFFFFFFF
+jal printAll
+addi s0, s0, 1
+jal printAll
+neg s0, s0
+jal printAll
+
+li a0, 42
+li a7, 93
+ecall
+
+printAll:
+li a7, 1 # PrintInt
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, ' '
+ecall
+li a7, 34 # PrintIntHex
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, ' '
+ecall
+li a7, 35 # PrintIntBinary
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, ' '
+ecall
+li a7, 36 # PrintIntUnsigned
+mv a0, s0
+ecall
+li a7, 11 # PrintChar
+li a0, '\n'
+ecall
+ret
diff --git a/test/riscv-tests-64/sysreadint.s b/test/riscv-tests-64/sysreadint.s
new file mode 100644
index 00000000..db620c27
--- /dev/null
+++ b/test/riscv-tests-64/sysreadint.s
@@ -0,0 +1,29 @@
+#stdin:1\n-1\n123456789\n2410117871984078658\n
+#exit:42
+	li a7, 5 # ReadInt
+
+	ecall
+	li a1, 1
+	bne a0, a1, fail
+
+	ecall
+	li a1, -1
+	bne a0, a1, fail
+
+	ecall
+	li a1, 123456789
+	bne a0, a1, fail
+
+	ecall
+	li a1, 2410117871984078658
+	bne a0, a1, fail
+
+pass:
+	li a0, 42
+	li a7, 93
+	ecall
+
+fail:
+	li a0, 0
+	li a7, 93
+	ecall
diff --git a/test/riscv-tests-64/xor.S b/test/riscv-tests-64/xor.s
similarity index 99%
rename from test/riscv-tests-64/xor.S
rename to test/riscv-tests-64/xor.s
index 8d54f518..d91af8b1 100644
--- a/test/riscv-tests-64/xor.S
+++ b/test/riscv-tests-64/xor.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/xor.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # xor.S
diff --git a/test/riscv-tests-64/xori.S b/test/riscv-tests-64/xori.s
similarity index 99%
rename from test/riscv-tests-64/xori.S
rename to test/riscv-tests-64/xori.s
index e3933b3c..65575920 100644
--- a/test/riscv-tests-64/xori.S
+++ b/test/riscv-tests-64/xori.s
@@ -6,6 +6,7 @@
 # 32 "" 2
 # 1 "isa/rv64ui/xori.S"
 # See LICENSE for license details.
+#exit:42
 
 #*****************************************************************************
 # xori.S
diff --git a/test/riscv-tests/LICENSE b/test/riscv-tests/LICENSE
deleted file mode 100644
index 48fe522a..00000000
--- a/test/riscv-tests/LICENSE
+++ /dev/null
@@ -1,24 +0,0 @@
-Copyright (c) 2012-2015, The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. Neither the name of the Regents nor the
-   names of its contributors may be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
-SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
-OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
-HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
-MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
diff --git a/test/riscv-tests/readme.txt b/test/riscv-tests/readme.txt
deleted file mode 100644
index e919b6d1..00000000
--- a/test/riscv-tests/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-The tests in this directory were generated and modified from the riscv-tests repository. They cover basic conformance of instructions to the specification.
diff --git a/test/selfmod.s b/test/selfmod.s
index 94b9f320..8b2f965f 100644
--- a/test/selfmod.s
+++ b/test/selfmod.s
@@ -1,5 +1,5 @@
-
-# TODO: make this run with self modifications 
+#exit:42
+#selfmod:true
 .text 
 main:
 	la s0, toload
diff --git a/test/selfmod_fail.s b/test/selfmod_fail.s
new file mode 100644
index 00000000..22b07dd5
--- /dev/null
+++ b/test/selfmod_fail.s
@@ -0,0 +1,59 @@
+#error:Instruction load access error
+.text 
+main:
+	la s0, toload
+	la s1, torun
+	
+	li a0, 2
+	call toload
+	
+	# First copy by word to data
+	lw t0, (s0)
+	sw t0, (s1)
+	lw t0, 4(s0)
+	sw t0, 4(s1)
+	
+	# try running it
+	call torun
+	
+	# Copy by byte to data
+	mv s2, a0
+	mv a0, s0
+	mv a1, s1
+	call copy
+	
+	mv a0, s2 
+	call torun
+	
+	# copy to .text
+	mv s2, a0
+	la a0, torun
+	la a1, main
+	call copy
+
+	mv a0, s2 
+	call main
+
+	
+	li a7, 93
+	ecall
+	
+toload:
+	addi a0, a0, 10
+	ret
+	
+copy:
+	li t0, 0
+	li t3, 8
+loop:
+	add t1, a0, t0
+	lb t1, (t1)
+	add t2, a1, t0
+	sb t1, (t2)
+	addi t0, t0, 1
+	blt t0, t3, loop
+	ret
+
+.data
+torun:
+	.space 8
diff --git a/test/selfmod_read.s b/test/selfmod_read.s
new file mode 100644
index 00000000..f7e4f742
--- /dev/null
+++ b/test/selfmod_read.s
@@ -0,0 +1,8 @@
+# Test read-only in the code segment (should not require selfmod to be set)
+#stdout:1050771
+	.text
+foo:	li a7, 1 # PrintInt
+	lw a0, foo
+	ecall
+	li a7, 10
+	ecall
diff --git a/test/success.s b/test/success.s
index c100f7e3..73b4ecce 100644
--- a/test/success.s
+++ b/test/success.s
@@ -1,3 +1,4 @@
+#exit:42
 .globl main
 .text
 main:
diff --git a/test/test_printf.s b/test/test_printf.s
new file mode 100644
index 00000000..aa45f58a
--- /dev/null
+++ b/test/test_printf.s
@@ -0,0 +1,14 @@
+#lib:../examples/printf.s
+#lib:../examples/printstr.s
+#lib:../examples/printnum.s
+#stdout:Hello_World!42
+
+	la a0, hello_world
+	li a1, 42
+	call printf
+
+	li a7, 10
+	ecall
+
+	.data
+hello_world: .string "Hello_World!%d\n"
diff --git a/test/unicode.s b/test/unicode.s
index 715eef82..b0aa5f51 100644
--- a/test/unicode.s
+++ b/test/unicode.s
@@ -1,4 +1,5 @@
 #stdout:© █ T ★ \n
+#exit:42
 .data
 test1:
 .string "© █ \u0054 \u2605 \n"
diff --git a/test/unicode_fail.s b/test/unicode_fail.s
index 03633e33..dd4dbe3b 100644
--- a/test/unicode_fail.s
+++ b/test/unicode_fail.s
@@ -1,4 +1,5 @@
-#error on lines: 4
+#error on lines: 5
+#exit:42
 .data
 test1:
 .string "© █ \u0054 \u2605 \n\u37"