diff --git a/distrib/globals.js b/distrib/globals.js
index e7631b8..fa843a4 100644
--- a/distrib/globals.js
+++ b/distrib/globals.js
@@ -39,6 +39,10 @@ var _KernelBuffers = null; // when clearly 'any' is not what we want. There is l
// Standard input and output
var _StdIn; // Same "to null or not to null" issue as above.
var _StdOut;
+// var _MemoryArrayUser = new TSOS.memory();
+var _MemoryArrayIndex = null;
+var _MainMemoryElement = null;
+var _MemoryArray = Array.apply(null, new Array(256).map)(String.prototype.valueOf(), "00");
// UI
var _Console;
var _OsShell;
diff --git a/distrib/host/cpu.js b/distrib/host/cpu.js
index 26fdc3c..fca7107 100644
--- a/distrib/host/cpu.js
+++ b/distrib/host/cpu.js
@@ -1,4 +1,5 @@
-///
+///
+///
/* ------------
CPU.ts
@@ -42,6 +43,143 @@ var TSOS;
_Kernel.krnTrace('CPU cycle');
// TODO: Accumulate CPU usage and profiling statistics here.
// Do the real work here. Be sure to set this.isExecuting appropriately.
+ this.OPCommands(_MemoryArray[this.PC]);
+ };
+ Cpu.prototype.updateConsole = function () {
+ _MainMemoryElement = _MainMemoryElement + "\n" + "\n";
+ _MainMemoryElement = _MainMemoryElement + "PC: " + this.PC + "\n";
+ _MainMemoryElement = _MainMemoryElement + "Acc: " + this.Acc + "\n";
+ _MainMemoryElement = _MainMemoryElement + "Xreg: " + this.Xreg + "\n";
+ _MainMemoryElement = _MainMemoryElement + "Yreg: " + this.Yreg + "\n";
+ _MainMemoryElement = _MainMemoryElement + "Zflag: " + this.Zflag + "\n";
+ };
+ Cpu.prototype.loadInits = function (PC, Acc, Xreg, Yreg, Zflag) {
+ this.PC = PC;
+ this.Acc = Acc;
+ this.Xreg = Yreg;
+ this.Zflag = Zflag;
+ };
+ Cpu.prototype.OPCommands = function (givenCommand) {
+ switch (givenCommand) {
+ case "A9": {
+ this.Acc = parseInt("0x" + (_MemoryArray[this.PC + 1]));
+ this.PC = this.PC + 2;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "AD": {
+ var PreOP = this.PC;
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ this.Acc = parseInt("0x" + _MemoryArray[this.PC]);
+ this.PC = PreOP + 3;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "8D": {
+ var memoryPointer = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ if (this.Acc < 16) {
+ _MemoryArray[memoryPointer] = "0" + this.Acc;
+ }
+ else {
+ _MemoryArray[memoryPointer] = this.Acc;
+ }
+ this.PC = this.PC + 3;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "6D": {
+ var PreOP = this.PC;
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ this.Acc = this.Acc + parseInt("0x" + _MemoryArray[this.PC]);
+ this.PC = PreOP + 3;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "A2": {
+ this.Xreg = parseInt("0x" + (_MemoryArray[this.PC + 1]));
+ this.PC = this.PC + 2;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "AE": {
+ var PreOP = this.PC;
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ this.Xreg = parseInt("0x" + _MemoryArray[this.PC]);
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "A0": {
+ this.Yreg = parseInt("0x" + (_MemoryArray[this.PC + 1]));
+ this.PC = this.PC + 2;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "AC": {
+ var PreOP = this.PC;
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ this.Yreg = parseInt("0x" + _MemoryArray[this.PC]);
+ this.PC = PreOP + 3;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "EA": {
+ this.PC = this.PC + 1;
+ break;
+ }
+ case "00": {
+ this.isExecuting = false;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "EC": {
+ var PreOP = this.PC;
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ var CompareVar = parseInt("0x" + _MemoryArray[this.PC]);
+ if (CompareVar = this.Xreg) {
+ this.Zflag = 1;
+ }
+ this.PC = PreOP + 3;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "D0": {
+ if (this.Zflag == 0) {
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ }
+ else {
+ this.PC = this.PC + 1;
+ }
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "EE": {
+ var PreOP = this.PC;
+ this.PC = parseInt("0x" + _MemoryArray[this.PC + 2] + _MemoryArray[this.PC + 1]);
+ var adder = parseInt("0x" + _MemoryArray[this.PC]);
+ adder = adder + 0x0001;
+ _MemoryArray[this.PC] = adder.toString().replace("0x", "");
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ case "FF": {
+ if (this.Xreg == 0x01) {
+ _DrawingContext.putText(this.Yreg);
+ _DrawingContext.advanceLine();
+ }
+ if (this.Xreg == 0x02) {
+ _DrawingContext.putText(this.Yreg.toString());
+ _DrawingContext.advanceLine();
+ }
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ default: {
+ _StdOut.putText("This does not work " + _MemoryArray[this.PC]);
+ this.isExecuting = false;
+ _MemoryArrayUser.memoryUpdater();
+ break;
+ }
+ }
};
return Cpu;
})();
diff --git a/distrib/host/memory.js b/distrib/host/memory.js
new file mode 100644
index 0000000..5e7f37a
--- /dev/null
+++ b/distrib/host/memory.js
@@ -0,0 +1,28 @@
+/**
+ * Created by thorwald on 10/17/15.
+ */
+///
+var TSOS;
+(function (TSOS) {
+ var memory = (function () {
+ function memory() {
+ }
+ memory.prototype.memory = function () {
+ var plusone = 0;
+ };
+ memory.prototype.load = function (memoryItem) {
+ _MemoryArray[_MemoryArrayIndex] = memoryItem;
+ _MemoryArrayIndex++;
+ this.memoryUpdater();
+ };
+ memory.prototype.memoryUpdater = function () {
+ var i = 0;
+ _MainMemoryElement = "";
+ for (i = 0; i < _MemoryArray.length; i++) {
+ _MainMemoryElement = _MainMemoryElement + _MemoryArray[i] + " ";
+ }
+ };
+ return memory;
+ })();
+ TSOS.memory = memory;
+})(TSOS || (TSOS = {}));
diff --git a/distrib/os/console.js b/distrib/os/console.js
index 8162cc2..a63866e 100644
--- a/distrib/os/console.js
+++ b/distrib/os/console.js
@@ -50,6 +50,11 @@ var TSOS;
tabIncrease = tabIncrease + 4;
alert(chr);
}
+ else if (chr === String.fromCharCode(8)) {
+ var characterRemoval = this.buffer.charAt(this.buffer.length - 1);
+ this.buffer = this.buffer.charAt(this.buffer.length - 1);
+ this.Backspace(characterRemoval);
+ }
else {
// This is a "normal" character, so ...
// ... draw it on the screen...
@@ -96,6 +101,14 @@ var TSOS;
_FontHeightMargin;
}
};
+ Console.prototype.Backspace = function (char) {
+ var characterLength = _DrawingContext.measureText(this.currentFont, this.currentFontSize, char);
+ var verticalHeight = _DefaultFontSize + _FontHeightMargin;
+ _DrawingContext.clearRect(this.currentXPosition - characterLength, ((this.currentYPosition - verticalHeight) + 5), characterLength, verticalHeight);
+ if (this.currentXPosition > 0) {
+ this.currentXPosition = this.currentXPosition - characterLength;
+ }
+ };
return Console;
})();
TSOS.Console = Console;
diff --git a/distrib/os/deviceDriverKeyboard.js b/distrib/os/deviceDriverKeyboard.js
index 0e32501..6cfa553 100644
--- a/distrib/os/deviceDriverKeyboard.js
+++ b/distrib/os/deviceDriverKeyboard.js
@@ -34,6 +34,10 @@ var TSOS;
_Kernel.krnTrace("Key code:" + keyCode + " shifted:" + isShifted);
var chr = "";
// Check to see if we even want to deal with the key that was pressed.
+ if (keyCode == 8) {
+ chr = String.fromCharCode(keyCode);
+ _KernelInputQueue.enqueue(chr);
+ }
if (((keyCode >= 65) && (keyCode <= 90)) ||
((keyCode >= 97) && (keyCode <= 123))) {
// Determine the character we want to display.
diff --git a/distrib/os/memory.js b/distrib/os/memory.js
new file mode 100644
index 0000000..2072719
--- /dev/null
+++ b/distrib/os/memory.js
@@ -0,0 +1,27 @@
+/**
+ * Created by thorwald on 10/17/15.
+ */
+var TSOS;
+(function (TSOS) {
+ var memory = (function () {
+ function memory() {
+ }
+ memory.prototype.memory = function () {
+ var plusone = 0;
+ };
+ memory.prototype.load = function (memoryItem) {
+ _MemoryArray[_MemoryArrayIndex] = memoryItem;
+ _MemoryArrayIndex++;
+ this.memoryUpdater();
+ };
+ memory.prototype.memoryUpdater = function () {
+ var i = 0;
+ _MainMemoryElement = "";
+ for (i = 0; i < _MemoryArray.length; i++) {
+ _MainMemoryElement = _MainMemoryElement + _MemoryArray[i] + " ";
+ }
+ };
+ return memory;
+ })();
+ TSOS.memory = memory;
+})(TSOS || (TSOS = {}));
diff --git a/index.html b/index.html
index ed356b7..b37e961 100755
--- a/index.html
+++ b/index.html
@@ -41,9 +41,34 @@
}
}
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+
+=======
+
+
+
+>>>>>>> parent of 982fe96... load
+=======
+
+
+
+>>>>>>> parent of 982fe96... load
+=======
+
+
+
+>>>>>>> parent of 982fe96... load
+=======
+>>>>>>> parent of 982fe96... load
@@ -90,7 +115,6 @@
fillstyle="Blue">
-
+