Skip to content

Commit

Permalink
Merge pull request #3 from Vidminas/master
Browse files Browse the repository at this point in the history
Fixed hdpi scaling and more warnings
  • Loading branch information
qaisjp authored Oct 7, 2018
2 parents 0ca669c + 4d01aee commit 4322cf3
Show file tree
Hide file tree
Showing 51 changed files with 305 additions and 325 deletions.
121 changes: 31 additions & 90 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@

# Created by https://www.gitignore.io/api/java,intellij,jetbrains

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files:
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle:
# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-debug/
cmake-build-*/

# Mongo Explorer plugin:
# Mongo Explorer plugin
.idea/**/mongoSettings.xml

## File-based project format:
# File-based project format
*.iws

## Plugin-specific files:

# IntelliJ
/out/
out/

# mpeltonen/sbt-idea plugin
.idea_modules/
Expand All @@ -46,88 +53,22 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# Editor-based Rest Client
.idea/httpRequests

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# Sonarlint plugin
.idea/sonarlint
# -----------------------------------------------------

### Java ###
# Compiled class file
# Compiled java classes
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:

# Sensitive or high-churn files:

# Gradle:

# CMake

# Mongo Explorer plugin:

## File-based project format:

## Plugin-specific files:

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Ruby plugin and RubyMine

# Crashlytics plugin (for Android Studio and IntelliJ)

### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin

# End of https://www.gitignore.io/api/java,intellij,jetbrains
# Created java archive
Mars.jar
31 changes: 1 addition & 30 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 39 additions & 1 deletion CreateMarsJar.bat
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
jar cmf mainclass.txt Mars.jar PseudoOps.txt Config.properties Syscall.properties Settings.properties MARSlicense.txt mainclass.txt MipsXRayOpcode.xml registerDatapath.xml controlDatapath.xml ALUcontrolDatapath.xml CreateMarsJar.bat CreateMarsJar.sh Mars.java Mars.class docs help images mars
@echo off
setlocal

rem We use the value the JAVACMD environment variable, if defined
rem and then try JAVA_HOME
set "_JAVACMD=%JAVACMD%"
if "%_JAVACMD"=="" (
if not "%JAVA_HOME%"=="" (
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
)
)
if "%_JAVACMD%"=="" set _JAVACMD=java

rem Parses x out of 1.x; for example 8 out of java version 1.8.0_xx
rem Otherwise, parses the major version; 9 out of java version 9-ea
set JAVA_VERSION=0
for /f "tokens=3" %%g in ('%_JAVACMD% -Xms32M -Xmx32M -version 2^>^&1 ^| findstr /i "version"') do (
set JAVA_VERSION=%%g
)
set JAVA_VERSION=%JAVA_VERSION:"=%
for /f "delims=.-_ tokens=1-2" %%v in ("%JAVA_VERSION%") do (
if /I "%%v" EQU "1" (
set JAVA_VERSION=%%w
) else (
set JAVA_VERSION=%%v
)
)

if %JAVA_VERSION% > 9 (
echo "Compiling Mars with default javac"
dir /s /B *.java > sources.txt
javac @sources.txt
jar cfm Mars.jar META-INF/MANIFEST.MF README.md LICENSE.md PseudoOps.txt Config.properties Syscall.properties Settings.properties MipsXRayOpcode.xml registerDatapath.xml controlDatapath.xml ALUcontrolDatapath.xml CreateMarsJar.bat CreateMarsJar.sh Mars.java Mars.class docs help images mars
) else (
echo "Could not find an appropriate Java installation"
)

@echo "CreateMarsJar finished"
endlocal
31 changes: 29 additions & 2 deletions CreateMarsJar.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
#!/usr/bin/env bash
# If you can't generate due of permissions, do a "chmod +x CreateMarsJar.sh".
jar cmf mainclass.txt Mars.jar PseudoOps.txt Config.properties Syscall.properties Settings.properties MARSlicense.txt mainclass.txt MipsXRayOpcode.xml registerDatapath.xml controlDatapath.xml ALUcontrolDatapath.xml CreateMarsJar.bat CreateMarsJar.sh Mars.java Mars.class docs help images mars

if type -p java; then
echo "Found Java executable in PATH"
_java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo "Found Java executable in JAVA_HOME"
_java="$JAVA_HOME/bin/java"
else
echo "Could not find an installation of Java"
fi

if [[ "$_java" ]]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "version $version"

IFS=. read major minor extra <<< "$version";

if ((major > 9 || (major == 1 && minor > 9))); then
echo "Compiling Mars with default javac"
find . -name "*.java" | xargs javac
else
echo "Attempting to compile Mars with java-10"
find . -name "*.java" | xargs /usr/lib/jvm/java-10/bin/javac
fi
fi

jar cfm Mars.jar META-INF/MANIFEST.MF README.md LICENSE.md PseudoOps.txt Config.properties Syscall.properties Settings.properties MipsXRayOpcode.xml registerDatapath.xml controlDatapath.xml ALUcontrolDatapath.xml CreateMarsJar.bat CreateMarsJar.sh Mars.java Mars.class docs help images mars

echo "CreateMarsJar finished"
3 changes: 1 addition & 2 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Manifest-Version: 1.0
Created-By: 1.8.0_181 (Oracle Corporation)
Class-Path: .
Created-By: 1.6.0_33 (Sun Microsystems Inc.)
Main-Class: Mars

2 changes: 1 addition & 1 deletion PseudoOps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

not $t1,$t2 nor RG1, RG2, $0 #Bitwise NOT (bit inversion)

# Here are some "convenience" arithmetic pseduo-ops. But do they encourage sloppy programming?
# Here are some "convenience" arithmetic pseudo-ops. But do they encourage sloppy programming?
add $t1,$t2,-100 addi RG1, RG2, VL3 #ADDition : set $t1 to ($t2 plus 16-bit immediate)
add $t1,$t2,100000 lui $1, VHL3 ori $1, $1, VL3U add RG1, RG2, $1 #ADDition : set $t1 to ($t2 plus 32-bit immediate)
addu $t1,$t2,100000 lui $1, VHL3 ori $1, $1, VL3U addu RG1, RG2, $1 #ADDition Unsigned : set $t1 to ($t2 plus 32-bit immediate), no overflow
Expand Down
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,22 @@ This project is a fork of MARS 4.5. Pull requests are very much welcomed.

## Documentation (included in the repo)
- Go to the [documentation][7].
- In order to run or compile this project **you must have the Java 1.8 (or later) SDK installed on your computer**.
- In order to run or compile this project **you must have JRE/JDK 10 (or later) installed on your computer**.

## How to run MARS
- **Desktop**:
- Save the jar file on the desktop
- Run MARS by double-clicking the icon

- **Command line using jar file**:
- **Command line**:
- Save the jar file in some folder
- Rename the jar file to "Mars.jar" for convenience
- Open a command line shell in that folder
- Run MARS with the command `java -jar Mars.jar`

- **Command line using Java classes**:
- Save the jar file in some folder
- Rename the jar file to "Mars.jar" for convenience
- Open a command line shell in that folder
- Rename the jar file to "Mars.jar" for convenience
- Extract MARS files with the command `jar -xf Mars.jar`
- Run MARS with the command `java Mars`
- Run MARS by executing `./RunMars.sh` (If you can't due to permissions, run `chmod +x RunMars.sh`)

## How to compile
- **Windows**: execute "CreateMarsJar.bat" file to generate an executable.
- **GNU/Linux** and **Mac**: `find . -name "*.java" | xargs javac` then execute the "CreateMarsJar.sh" to generate an executable. If you can't due of permissions, run `chmod +x CreateMarsJar.sh`.
- **GNU/Linux** and **Mac**: execute "CreateMarsJar.sh" to generate a java archive. If you can't due to permissions, run `chmod +x CreateMarsJar.sh`.

## License
[MIT][2]. Check the [LICENSE][3] file. All the credits go to the original developers.
Expand Down
26 changes: 26 additions & 0 deletions RunMars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

if type -p java; then
echo "Found Java executable in PATH"
_java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo "Found Java executable in JAVA_HOME"
_java="$JAVA_HOME/bin/java"
else
echo "Could not find an installation of Java"
fi

if [[ "$_java" ]]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "version $version"

IFS=. read major minor extra <<< "$version";

if ((major > 9 || (major == 1 && minor > 9))); then
echo "Running Mars with default JRE"
java -jar Mars.jar
else
echo "Attempting to run Mars with java-10"
/usr/lib/jvm/java-10/bin/java -jar Mars.jar
fi
fi
9 changes: 8 additions & 1 deletion Settings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ LabelWindowVisibility = false
LoadExceptionHandler = false
ProgramArguments = false
RegistersHighlighting = true
StartAtMain = false
StartAtMain = true
WarningsAreErrors = false
PopupInstructionGuidance = true
EditorPopupPrefixLength = 2
Expand All @@ -31,3 +31,10 @@ DataSegmentHighlightForeground = 0
RegisterHighlightBackground = 0x0099cc55
RegisterHighlightForeground = 0

EditorFontSize = 12
EvenRowFontSize = 12
OddRowFontSize = 12
TextSegmentHighlightFontSize = 12
TextSegmentDelayslotHighightFontSize = 12
DataSegmentHighlightFontSize = 12
RegisterHighlightFontSize = 12
2 changes: 0 additions & 2 deletions mainclass.txt

This file was deleted.

Loading

0 comments on commit 4322cf3

Please sign in to comment.