Initial commit
18
.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# ant
|
||||
bin
|
||||
build
|
||||
gen
|
||||
out
|
||||
lib
|
||||
|
||||
# intellij
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# eclipse
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
.DS_Store
|
||||
local.properties
|
||||
.gradle
|
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
36
app/build.gradle
Normal file
@ -0,0 +1,36 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "21.1.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "android.emu6502"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 22
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:design:22.2.0'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
compile 'com.android.support:cardview-v7:22.2.0'
|
||||
compile 'org.jetbrains.kotlin:kotlin-stdlib:0.12.213'
|
||||
compile "org.jetbrains.kotlin:kotlin-android-sdk-annotations:0.12.213"
|
||||
compile "org.jetbrains.kotlin:kotlin-reflect:0.12.213"
|
||||
compile 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT'
|
||||
compile 'com.facebook.stetho:stetho:1.1.1'
|
||||
}
|
17
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/felipe_lima/Library/Android/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -0,0 +1,14 @@
|
||||
package felipecsl.com.emu6502;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
21
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="android.emu6502" >
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:name=".Emu6502Application"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name=".app.MainActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
16
app/src/main/java/android/emu6502/Emu6502Application.java
Normal file
@ -0,0 +1,16 @@
|
||||
package android.emu6502;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.facebook.stetho.Stetho;
|
||||
|
||||
public class Emu6502Application extends Application {
|
||||
|
||||
@Override public void onCreate() {
|
||||
super.onCreate();
|
||||
Stetho.initialize(
|
||||
Stetho.newInitializerBuilder(this)
|
||||
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
|
||||
.build());
|
||||
}
|
||||
}
|
259
app/src/main/kotlin/android/emu6502/Assembler.kt
Normal file
@ -0,0 +1,259 @@
|
||||
package android.emu6502
|
||||
|
||||
import android.emu6502.instructions.Instruction
|
||||
import android.emu6502.instructions.Opcodes
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class Assembler(private var labels: Labels,
|
||||
private var memory: Memory,
|
||||
private var symbols: Symbols) {
|
||||
|
||||
private var defaultCodePC = 0
|
||||
private var codeLen = 0
|
||||
private var codeAssembledOK = false
|
||||
private var BOOTSTRAP_ADDRESS = 0x600
|
||||
|
||||
fun assembleCode(lines: Array<String>): Boolean {
|
||||
lines.forEach { line ->
|
||||
if (!assembleLine(line)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private fun assembleLine(line: String): Boolean {
|
||||
var input = line
|
||||
var command: String
|
||||
var param: String
|
||||
var addr: Int
|
||||
|
||||
// Find command or label
|
||||
if (input.matches("^\\w+:".toRegex())) {
|
||||
if (line.matches("^\\w+:[\\s]*\\w+.*$".toRegex())) {
|
||||
input = input.replace("^\\w+:[\\s]*(.*)$".toRegex(), "$1")
|
||||
command = input.replace("^(\\w+).*$".toRegex(), "$1")
|
||||
} else {
|
||||
command = ""
|
||||
}
|
||||
} else {
|
||||
command = input.replace("^(\\w+).*$".toRegex(), "$1")
|
||||
}
|
||||
|
||||
// Nothing to do for blank lines
|
||||
if (command.equals("")) {
|
||||
return true
|
||||
}
|
||||
|
||||
command = command.toUpperCase()
|
||||
|
||||
if (input.matches("^\\*\\s*=\\s*\$?[0-9a-f]*$".toRegex())) {
|
||||
// equ spotted
|
||||
param = input.replace("^\\s*\\*\\s*=\\s*".toRegex(), "")
|
||||
if (param[0].equals("$")) {
|
||||
param = param.replace("^\$".toRegex(), "")
|
||||
addr = Integer.parseInt(param, 16)
|
||||
} else {
|
||||
addr = Integer.parseInt(param, 10)
|
||||
}
|
||||
if ((addr < 0) || (addr > 0xffff)) {
|
||||
throw IllegalStateException("Unable to relocate code outside 64k memory")
|
||||
}
|
||||
defaultCodePC = addr
|
||||
return true
|
||||
}
|
||||
|
||||
if (input.matches("^\\w+\\s+.*?$".toRegex())) {
|
||||
param = input.replace("^\\w+\\s+(.*?)".toRegex(), "$1")
|
||||
} else if (input.matches("^\\w+$".toRegex())) {
|
||||
param = ""
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
param = param.replace("[ ]".toRegex(), "")
|
||||
|
||||
if (command === "DCB") {
|
||||
return DCB(param)
|
||||
}
|
||||
|
||||
val opcode = Opcodes.MAP.get(Instruction.valueOf(command))
|
||||
|
||||
if (opcode != null) {
|
||||
if (checkImmediate(param, opcode[0])) {
|
||||
return true
|
||||
}
|
||||
if (checkZeroPage(param, opcode[1])) {
|
||||
return true
|
||||
}
|
||||
if (checkZeroPageX(param, opcode[2])) {
|
||||
return true
|
||||
}
|
||||
if (checkZeroPageY(param, opcode[3])) {
|
||||
return true
|
||||
}
|
||||
if (checkAbsolute(param, opcode[4])) {
|
||||
return true
|
||||
}
|
||||
if (checkAbsoluteX(param, opcode[5])) {
|
||||
return true
|
||||
}
|
||||
if (checkAbsoluteY(param, opcode[6])) {
|
||||
return true
|
||||
}
|
||||
if (checkIndirect(param, opcode[7])) {
|
||||
return true
|
||||
}
|
||||
if (checkIndirectX(param, opcode[8])) {
|
||||
return true
|
||||
}
|
||||
if (checkIndirectY(param, opcode[9])) {
|
||||
return true
|
||||
}
|
||||
if (checkSingle(param, opcode[10])) {
|
||||
return true
|
||||
}
|
||||
if (checkBranch(param, opcode[11])) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun DCB(param: String): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkBranch(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkAbsolute(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkIndirectY(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkIndirectX(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkIndirect(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkAbsoluteY(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkAbsoluteX(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkZeroPageY(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkZeroPageX(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkZeroPage(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
private fun checkImmediate(param: String, opcode: Int): Boolean {
|
||||
val pattern = Pattern.compile("^#([\\w\$]+)$")
|
||||
val matcher = pattern.matcher(param)
|
||||
if (matcher.find()) {
|
||||
var operand = tryParseByteOperand(matcher.group(1))
|
||||
if (operand >= 0) {
|
||||
pushByte(opcode)
|
||||
pushByte(operand)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// Label lo/hi
|
||||
if (param.matches("^#[<>]\\w+$".toRegex())) {
|
||||
var label = param.replace("^#[<>](\\w+)$".toRegex(), "$1")
|
||||
var hilo = param.replace("^#([<>]).*$".toRegex(), "$1")
|
||||
pushByte(opcode)
|
||||
if (labels.find(label)) {
|
||||
var addr = labels.getPC(label)
|
||||
when (hilo) {
|
||||
">" -> {
|
||||
pushByte(addr.shr(8).and(0xFF))
|
||||
}
|
||||
"<" -> {
|
||||
pushByte(addr.and(0xFF))
|
||||
}
|
||||
else -> return false
|
||||
}
|
||||
} else {
|
||||
pushByte(0x00)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Try to parse the given parameter as a byte operand.
|
||||
// Returns the (positive) value if successful, otherwise -1
|
||||
private fun tryParseByteOperand(param: String): Int {
|
||||
var value: Int = 0
|
||||
var parameter = param;
|
||||
|
||||
if (parameter.matches("^\\w+$".toRegex())) {
|
||||
var lookupVal = symbols.lookup(parameter) // Substitute symbol by actual value, then proceed
|
||||
if (lookupVal != null) {
|
||||
parameter = lookupVal
|
||||
}
|
||||
}
|
||||
|
||||
// Is it a hexadecimal operand?
|
||||
var pattern = Pattern.compile("^\$([0-9a-f]{1,2})$")
|
||||
var matcher = pattern.matcher(parameter)
|
||||
if (matcher.find()) {
|
||||
value = Integer.parseInt(matcher.group(1), 16)
|
||||
} else {
|
||||
// Is it a decimal operand?
|
||||
pattern = Pattern.compile("^([0-9]{1,3})$")
|
||||
matcher = pattern.matcher(parameter)
|
||||
if (matcher.find()) {
|
||||
value = Integer.parseInt(matcher.group(1), 10)
|
||||
}
|
||||
}
|
||||
|
||||
// Validate range
|
||||
if (value >= 0 && value <= 0xff) {
|
||||
return value
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
private fun pushByte(value: Int) {
|
||||
memory.set(defaultCodePC, value.and(0xFF))
|
||||
defaultCodePC++
|
||||
codeLen++
|
||||
}
|
||||
|
||||
private fun checkSingle(param: String, opcode: Int): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
56
app/src/main/kotlin/android/emu6502/CPU.kt
Normal file
@ -0,0 +1,56 @@
|
||||
package android.emu6502
|
||||
|
||||
import android.emu6502.instructions.BaseInstruction
|
||||
import android.emu6502.instructions.ORA
|
||||
import java.util.HashMap
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
class CPU(private val memory: Memory) {
|
||||
// Accumulator
|
||||
private var A: Byte = 0
|
||||
// Registers
|
||||
private var X: Byte = 0
|
||||
private var Y: Byte = 0
|
||||
// Program counter
|
||||
private var PC = 0x600
|
||||
// Stack pointer
|
||||
private var SP = 0xFF
|
||||
private var flags: Byte = 0
|
||||
private var isRunning = false
|
||||
private var debug = false
|
||||
private var monitoring = false
|
||||
|
||||
private val instructionList: HashMap<Int, KMemberFunction0<BaseInstruction, Unit>> = HashMap()
|
||||
|
||||
fun execute() {
|
||||
setRandomByte()
|
||||
executeNextInstruction()
|
||||
|
||||
if (PC == 0 || !isRunning) {
|
||||
stop()
|
||||
// message("Program end at PC=$" + addr2hex(regPC - 1))
|
||||
// ui.stop()
|
||||
}
|
||||
}
|
||||
|
||||
private fun stop() {
|
||||
isRunning = false
|
||||
}
|
||||
|
||||
private fun executeNextInstruction() {
|
||||
val instruction = Integer.valueOf(popByte().toInt().toString(), 16)
|
||||
val function = instructionList.get(instruction)
|
||||
ORA(instructionList).function()
|
||||
// else {
|
||||
// instructions.ierr()
|
||||
// }
|
||||
}
|
||||
|
||||
private fun popByte(): Byte {
|
||||
return memory.get((PC++).and(0xff));
|
||||
}
|
||||
|
||||
private fun setRandomByte() {
|
||||
memory.set(0xfe, Math.floor(Math.random() * 256).toInt())
|
||||
}
|
||||
}
|
13
app/src/main/kotlin/android/emu6502/Labels.kt
Normal file
@ -0,0 +1,13 @@
|
||||
package android.emu6502
|
||||
|
||||
class Labels {
|
||||
fun getPC(label: String): Int {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun find(label: String): Boolean {
|
||||
throw UnsupportedOperationException(
|
||||
"not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
13
app/src/main/kotlin/android/emu6502/Memory.kt
Normal file
@ -0,0 +1,13 @@
|
||||
package android.emu6502
|
||||
|
||||
class Memory {
|
||||
private val mem = ByteArray(65536)
|
||||
|
||||
public fun get(addr: Int): Byte {
|
||||
return mem[addr]
|
||||
}
|
||||
|
||||
public fun set(addr: Int, value: Int) {
|
||||
mem[addr] = value.toByte()
|
||||
}
|
||||
}
|
13
app/src/main/kotlin/android/emu6502/Symbols.kt
Normal file
@ -0,0 +1,13 @@
|
||||
package android.emu6502
|
||||
|
||||
class Symbols {
|
||||
private val table: Map<String, String> = emptyMap()
|
||||
|
||||
fun lookup(key: String): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
fun add(key: String, value: String) {
|
||||
|
||||
}
|
||||
}
|
54
app/src/main/kotlin/android/emu6502/app/MainActivity.kt
Normal file
@ -0,0 +1,54 @@
|
||||
package android.emu6502.app
|
||||
|
||||
import android.emu6502.R
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.FloatingActionButton
|
||||
import android.support.v7.app.ActionBar
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.TextView
|
||||
import butterknife.bindView
|
||||
|
||||
public class MainActivity : AppCompatActivity() {
|
||||
|
||||
val toolbar: Toolbar by bindView(R.id.toolbar)
|
||||
val txtA: TextView by bindView(R.id.A)
|
||||
val txtX: TextView by bindView(R.id.X)
|
||||
val txtY: TextView by bindView(R.id.Y)
|
||||
val txtSP: TextView by bindView(R.id.SP)
|
||||
val txtPC: TextView by bindView(R.id.PC)
|
||||
val txtFlags: TextView by bindView(R.id.PC)
|
||||
val fab: FloatingActionButton by bindView(R.id.fab)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
var ab: ActionBar = getSupportActionBar()
|
||||
ab.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_main, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
val id = item!!.getItemId()
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package android.emu6502.instructions
|
||||
|
||||
enum class AddressingMode {
|
||||
IMMEDIATE, ZERO_PAGE, ZERO_PAGE_X, ABSOLUTE, ABSOLUTE_X, ABSOLUTE_Y, INDIRECT_X, INDIRECT_Y
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package android.emu6502.instructions
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
open class BaseInstruction(private val instruction: Instruction,
|
||||
private val instructionList: HashMap<Int, kotlin.reflect.KMemberFunction0<BaseInstruction, Unit>>) {
|
||||
|
||||
init {
|
||||
val opcodes: IntArray = Opcodes.MAP[instruction] as IntArray
|
||||
val methods = arrayOf(::immediate, ::zeroPage, ::zeroPageX, ::zeroPageY, ::absolute,
|
||||
::absoluteX, ::absoluteY, ::indirect, ::indirectX, ::indirectY, ::single, ::branch)
|
||||
|
||||
opcodes.forEachIndexed { i, opcode ->
|
||||
if (opcode != 0xff) {
|
||||
instructionList.put(opcodes[i], methods[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun immediate() {
|
||||
}
|
||||
|
||||
fun zeroPage() {
|
||||
}
|
||||
|
||||
fun zeroPageX() {
|
||||
}
|
||||
|
||||
fun zeroPageY() {
|
||||
}
|
||||
|
||||
fun absolute() {
|
||||
}
|
||||
|
||||
fun absoluteX() {
|
||||
}
|
||||
|
||||
fun absoluteY() {
|
||||
}
|
||||
|
||||
fun indirect() {
|
||||
}
|
||||
|
||||
fun indirectX() {
|
||||
}
|
||||
|
||||
fun indirectY() {
|
||||
}
|
||||
|
||||
fun single() {
|
||||
}
|
||||
|
||||
fun branch() {
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package android.emu6502.instructions
|
||||
|
||||
enum class Instruction {
|
||||
ADC, AND, ASL, BIT, BPL, BMI, BVC, BVS, BCC, BCS, BNE, BEQ, BRK, CMP, CPX, CPY, DEC, EOR, CLC,
|
||||
SEC, CLI, SEI, CLV, CLD, SED, INC, JMP, JSR, LDA, LDX, LDY, LSR, NOP, ORA, TAX, TXA, DEX, INX,
|
||||
TAY, TYA, DEY, INY, ROR, ROL, RTI, RTS, SBC, STA, TXS, TSX, PHA, PLA, PHP, PLP, STX, STY, XXX
|
||||
}
|
8
app/src/main/kotlin/android/emu6502/instructions/ORA.kt
Normal file
@ -0,0 +1,8 @@
|
||||
package android.emu6502.instructions
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
/** bitwise OR with Accumulator */
|
||||
class ORA(instructionList: HashMap<Int, kotlin.reflect.KMemberFunction0<BaseInstruction, Unit>>)
|
||||
: BaseInstruction(Instruction.ORA, instructionList) {
|
||||
}
|
66
app/src/main/kotlin/android/emu6502/instructions/Opcodes.kt
Normal file
@ -0,0 +1,66 @@
|
||||
package android.emu6502.instructions
|
||||
|
||||
final class Opcodes {
|
||||
companion object {
|
||||
public val MAP: Map<Instruction, IntArray> = hashMapOf(
|
||||
/* Name, Imm, ZP, ZPX, ZPY, ABS, ABSX, ABSY, IND, INDX, INDY, SNGL, BRA */
|
||||
Pair(Instruction.ADC, intArrayOf(0x69, 0x65, 0x75, 0xff, 0x6d, 0x7d, 0x79, 0xff, 0x61, 0x71, 0xff, 0xff)),
|
||||
Pair(Instruction.AND, intArrayOf(0x29, 0x25, 0x35, 0xff, 0x2d, 0x3d, 0x39, 0xff, 0x21, 0x31, 0xff, 0xff)),
|
||||
Pair(Instruction.ASL, intArrayOf(0xff, 0x06, 0x16, 0xff, 0x0e, 0x1e, 0xff, 0xff, 0xff, 0xff, 0x0a, 0xff)),
|
||||
Pair(Instruction.BIT, intArrayOf(0xff, 0x24, 0xff, 0xff, 0x2c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.BPL, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x10)),
|
||||
Pair(Instruction.BMI, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x30)),
|
||||
Pair(Instruction.BVC, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50)),
|
||||
Pair(Instruction.BVS, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x70)),
|
||||
Pair(Instruction.BCC, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x90)),
|
||||
Pair(Instruction.BCS, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0)),
|
||||
Pair(Instruction.BNE, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd0)),
|
||||
Pair(Instruction.BEQ, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0)),
|
||||
Pair(Instruction.BRK, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff)),
|
||||
Pair(Instruction.CMP, intArrayOf(0xc9, 0xc5, 0xd5, 0xff, 0xcd, 0xdd, 0xd9, 0xff, 0xc1, 0xd1, 0xff, 0xff)),
|
||||
Pair(Instruction.CPX, intArrayOf(0xe0, 0xe4, 0xff, 0xff, 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.CPY, intArrayOf(0xc0, 0xc4, 0xff, 0xff, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.DEC, intArrayOf(0xff, 0xc6, 0xd6, 0xff, 0xce, 0xde, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.EOR, intArrayOf(0x49, 0x45, 0x55, 0xff, 0x4d, 0x5d, 0x59, 0xff, 0x41, 0x51, 0xff, 0xff)),
|
||||
Pair(Instruction.CLC, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x18, 0xff)),
|
||||
Pair(Instruction.SEC, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x38, 0xff)),
|
||||
Pair(Instruction.CLI, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x58, 0xff)),
|
||||
Pair(Instruction.SEI, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x78, 0xff)),
|
||||
Pair(Instruction.CLV, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb8, 0xff)),
|
||||
Pair(Instruction.CLD, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0xff)),
|
||||
Pair(Instruction.SED, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff)),
|
||||
Pair(Instruction.INC, intArrayOf(0xff, 0xe6, 0xf6, 0xff, 0xee, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.JMP, intArrayOf(0xff, 0xff, 0xff, 0xff, 0x4c, 0xff, 0xff, 0x6c, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.JSR, intArrayOf(0xff, 0xff, 0xff, 0xff, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.LDA, intArrayOf(0xa9, 0xa5, 0xb5, 0xff, 0xad, 0xbd, 0xb9, 0xff, 0xa1, 0xb1, 0xff, 0xff)),
|
||||
Pair(Instruction.LDX, intArrayOf(0xa2, 0xa6, 0xff, 0xb6, 0xae, 0xff, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.LDY, intArrayOf(0xa0, 0xa4, 0xb4, 0xff, 0xac, 0xbc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.LSR, intArrayOf(0xff, 0x46, 0x56, 0xff, 0x4e, 0x5e, 0xff, 0xff, 0xff, 0xff, 0x4a, 0xff)),
|
||||
Pair(Instruction.NOP, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xea, 0xff)),
|
||||
Pair(Instruction.ORA, intArrayOf(0x09, 0x05, 0x15, 0xff, 0x0d, 0x1d, 0x19, 0xff, 0x01, 0x11, 0xff, 0xff)),
|
||||
Pair(Instruction.TAX, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0xff)),
|
||||
Pair(Instruction.TXA, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8a, 0xff)),
|
||||
Pair(Instruction.DEX, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0xff)),
|
||||
Pair(Instruction.INX, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0xff)),
|
||||
Pair(Instruction.TAY, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa8, 0xff)),
|
||||
Pair(Instruction.TYA, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x98, 0xff)),
|
||||
Pair(Instruction.DEY, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xff)),
|
||||
Pair(Instruction.INY, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc8, 0xff)),
|
||||
Pair(Instruction.ROR, intArrayOf(0xff, 0x66, 0x76, 0xff, 0x6e, 0x7e, 0xff, 0xff, 0xff, 0xff, 0x6a, 0xff)),
|
||||
Pair(Instruction.ROL, intArrayOf(0xff, 0x26, 0x36, 0xff, 0x2e, 0x3e, 0xff, 0xff, 0xff, 0xff, 0x2a, 0xff)),
|
||||
Pair(Instruction.RTI, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x40, 0xff)),
|
||||
Pair(Instruction.RTS, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x60, 0xff)),
|
||||
Pair(Instruction.SBC, intArrayOf(0xe9, 0xe5, 0xf5, 0xff, 0xed, 0xfd, 0xf9, 0xff, 0xe1, 0xf1, 0xff, 0xff)),
|
||||
Pair(Instruction.STA, intArrayOf(0xff, 0x85, 0x95, 0xff, 0x8d, 0x9d, 0x99, 0xff, 0x81, 0x91, 0xff, 0xff)),
|
||||
Pair(Instruction.TXS, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9a, 0xff)),
|
||||
Pair(Instruction.TSX, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xba, 0xff)),
|
||||
Pair(Instruction.PHA, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x48, 0xff)),
|
||||
Pair(Instruction.PLA, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x68, 0xff)),
|
||||
Pair(Instruction.PHP, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x08, 0xff)),
|
||||
Pair(Instruction.PLP, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x28, 0xff)),
|
||||
Pair(Instruction.STX, intArrayOf(0xff, 0x86, 0xff, 0x96, 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.STY, intArrayOf(0xff, 0x84, 0x94, 0xff, 0x8c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
|
||||
Pair(Instruction.XXX, intArrayOf(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff))
|
||||
);
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-xxxhdpi/ic_play_arrow_white_48dp.png
Normal file
After Width: | Height: | Size: 605 B |
156
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,156 @@
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context="emu6502.app.MainActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<include layout="@layout/toolbar" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_margin="@dimen/card_margin">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtInstructions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="LDA #$80\nSTA $01\nADC $01"
|
||||
android:fontFamily="monospace"
|
||||
android:textSize="14sp"
|
||||
android:gravity="top" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnReset"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Reset" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/A"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:fontFamily="monospace"
|
||||
android:text="A=$00" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/X"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:fontFamily="monospace"
|
||||
android:text="X=$00" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Y"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="monospace"
|
||||
android:text="Y=$00" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/SP"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:fontFamily="monospace"
|
||||
android:text="SP=$ff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/PC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:fontFamily="monospace"
|
||||
android:text="PC=$0600"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/flags"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="monospace"
|
||||
android:text="00110000" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:src="@drawable/ic_play_arrow_white_48dp"
|
||||
app:elevation="3dp" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
8
app/src/main/res/layout/toolbar.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<android.support.v7.widget.Toolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="5dp"/>
|
6
app/src/main/res/menu/menu_main.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools" tools:context="emu6502.app.MainActivity">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_play_arrow_white_48dp.png
Normal file
After Width: | Height: | Size: 283 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_play_arrow_white_48dp.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_play_arrow_white_48dp.png
Normal file
After Width: | Height: | Size: 461 B |
6
app/src/main/res/values-w820dp/dimens.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
9
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="primary">#4A90E2</color>
|
||||
<color name="primaryDark">#ff274b76</color>
|
||||
<color name="accent">#e395000a</color>
|
||||
<color name="light_gray">#cccccc</color>
|
||||
<color name="lightest_gray">#dddddd</color>
|
||||
<color name="black_translucid">#20000000</color>
|
||||
</resources>
|
7
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="card_margin">16dp</dimen>
|
||||
</resources>
|
4
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">6502 Android Emulator</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
</resources>
|
11
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorPrimaryDark">@color/primaryDark</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
21
build.gradle
Normal file
@ -0,0 +1,21 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.2.3'
|
||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.213'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||
}
|
||||
}
|
18
gradle.properties
Normal file
@ -0,0 +1,18 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Sun Jun 07 17:48:47 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
|
164
gradlew
vendored
Executable file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
1
settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':app'
|