diff --git a/js/Byte.js b/js/Byte.js
index d0ddec6..cab47e0 100644
--- a/js/Byte.js
+++ b/js/Byte.js
@@ -116,10 +116,49 @@ var Word = (function () {
//return new Word(overflow[0].Get() + this.value[0].Add(overflow[1]).Get());
};
- Word.prototype.AddByte = function (value) {
- value = typeof value != "number" ? value.Get() : value;
+ Word.prototype.Sub = function (value) {
+ value = typeof value == "number" ? new Word(value) : value;
+ return this.Add(value.Neg());
+ };
+
+ Word.prototype.AddByte = function (value, signed) {
+ if (typeof signed === "undefined") { signed = false; }
+ value = typeof value != "number" ? new Word((value.Test(7) && signed ? 0xFF00 : 0x0000) | value.Get()) : new Word(value);
return this.Add(value);
};
+
+ Word.prototype.SubByte = function (value) {
+ value = typeof value != "number" ? new Byte(value) : value;
+ return this.AddByte(value.Neg(), true);
+ };
+
+ Word.prototype.Not = function () {
+ this.value[0].Not();
+ this.value[1].Not();
+ };
+
+ Word.prototype.And = function (value) {
+ value = typeof value == "number" ? new Word(value) : value;
+ this.value[0].And(value.High());
+ this.value[1].And(value.Low());
+ };
+
+ Word.prototype.Or = function (value) {
+ value = typeof value == "number" ? new Word(value) : value;
+ this.value[0].Or(value.High());
+ this.value[1].Or(value.Low());
+ };
+
+ Word.prototype.Xor = function (value) {
+ value = typeof value == "number" ? new Word(value) : value;
+ this.value[0].Xor(value.High());
+ this.value[1].Xor(value.Low());
+ };
+
+ Word.prototype.Neg = function () {
+ this.Not();
+ this.Add(1);
+ };
return Word;
})();
//# sourceMappingURL=Byte.js.map
diff --git a/js/Byte.js.map b/js/Byte.js.map
index f9a9009..64bb37a 100644
--- a/js/Byte.js.map
+++ b/js/Byte.js.map
@@ -1 +1 @@
-{"version":3,"file":"Byte.js","sourceRoot":"","sources":["Byte.ts"],"names":["Byte","Byte.constructor","Byte.Add","Byte.Sub","Byte.Get","Byte.Set","Byte.Neg","Byte.And","Byte.Or","Byte.Xor","Byte.Not","Byte.Bit","Byte.Test","Byte.ShiftLeft","Byte.ShiftRight","Word","Word.constructor","Word.Get","Word.High","Word.Low","Word.Set","Word.SetHigh","Word.SetLow","Word.Add","Word.AddByte"],"mappings":"AAAA;IAGIA,cAAmBA,IAAgBA;QAAhBC,mCAAAA,IAAIA,GAAWA,CAACA;AAAAA,QAC/BA,IAAIA,CAACA,KAAKA,GAAGA,IAAIA,GAAGA,IAAIA,GAAGA,CAACA,IAAIA,GAAGA,CAACA,GAAGA,IAAIA,GAAGA,CAACA,CAACA;IACpDA,CAACA;IAIDD,qBAAAA,UAAWA,GAAQA;QACfE,GAAGA,GAAGA,OAAOA,GAAGA,IAAIA,QAAQA,GAAGA,IAAIA,IAAIA,CAACA,GAAGA,CAACA,GAAGA,GAAGA;QAClDA,IAAIA,IAAIA,GAAGA,IAAIA,CAACA,KAAKA,GAAGA,GAAGA,CAACA,GAAGA,CAACA,CAACA;QACjCA,IAAIA,CAACA,KAAKA,GAAGA,IAAIA,GAAGA,IAAIA;QACxBA,OAAOA,IAAIA,IAAIA,CAACA,IAAIA,GAAGA,GAAGA,GAAGA,IAAIA,GAAGA,GAAGA,GAAGA,CAACA,CAACA;IAChDA,CAACA;;IAIDF,qBAAAA,UAAWA,GAAQA;QACfG,GAAGA,GAAGA,OAAOA,GAAGA,IAAIA,QAAQA,GAAGA,IAAIA,IAAIA,CAACA,GAAGA,CAACA,GAAGA,GAAGA;QAClDA,OAAOA,IAAIA,CAACA,GAAGA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA,CAACA;IAC9BA,CAACA;;IAEDH,qBAAAA;QACII,OAAOA,IAAIA,CAACA,KAAKA;IACrBA,CAACA;;IAIDJ,qBAAAA,UAAWA,GAAQA;QACfK,IAAIA,CAACA,KAAKA,GAAGA,OAAOA,GAAGA,IAAIA,QAAQA,GAAGA,GAAGA,GAAGA,IAAIA,GAAGA,GAAGA,CAACA,GAAGA,CAACA,CAACA;IAChEA,CAACA;;IAEDL,qBAAAA,UAAWA,IAAqBA;QAArBM,mCAAAA,IAAIA,GAAYA,KAAKA;AAA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A,UAAWA,KAAUA;QACjBQ,KAAKA,GAAGA,OAAOA,KAAKA,IAAIA,QAAQA,GAAGA,IAAIA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,KAAKA;QAC1DA,IAAIA,IAAIA,GAAGA,IAAIA,CAACA,GAAGA,CAACA,CAACA,GAAGA,KAAKA,CAACA,GAAGA,CAACA,CAACA;QACnCA,IAAIA,CAACA,GAAGA,CAACA,IAAIA,CAACA;QACdA,OAAOA,IAAIA,IAAIA,CAACA,IAAIA,GAAGA,MAAMA,GAAGA,IAAIA,GAAGA,MAAMA,GAAGA,CAACA,CAACA;QAClDA,mFAAmFA;QACnFA,4EAA4EA;IAChFA,CAACA;;IAIDR,yBAAAA,UAAeA,KAAUA;QACrBS,KAAKA,GAAGA,OAAOA,KAAKA,IAAIA,QAAQA,GAAGA,KAAKA,CAACA,GAAGA,CAACA,CAACA,GAAGA,KAAKA;QACtDA,OAAOA,IAAIA,CAACA,GAAGA,CAACA,KAAKA,CAACA;IAC1BA,CAACA;IACLT,YAACA;AAADA,CAACA,IAAA"}
\ No newline at end of file
+{"version":3,"file":"Byte.js","sourceRoot":"","sources":["Byte.ts"],"names":["Byte","Byte.constructor","Byte.Add","Byte.Sub","Byte.Get","Byte.Set","Byte.Neg","Byte.And","Byte.Or","Byte.Xor","Byte.Not","Byte.Bit","Byte.Test","Byte.ShiftLeft","Byte.ShiftRight","Word","Word.constructor","Word.Get","Word.High","Word.Low","Word.Set","Word.SetHigh","Word.SetLow","Word.Add","Word.Sub","Word.AddByte","Word.SubByte","Word.Not","Word.And","Word.Or","Word.Xor","Word.Neg"],"mappings":"AAAA;IAGIA,cAAmBA,IAAgBA;QAAhBC,mCAAAA,IAAIA,GAAWA,CAACA;AAAAA,QAC/BA,IAAIA,CAACA,KAAKA,GAAGA,IAAIA,GAAGA,IAAIA,GAAGA,CAACA,IAAIA,GAAGA,CAACA,GAAGA,IAAIA,GAAGA,CAACA,CAACA;IACpDA,CAACA;IAIDD,qBAAAA,U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GAAGA,OAAOA,KAAKA,IAAIA,QAAQA,GAAGA,IAAIA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,KAAKA;QAC1DA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA,CAACA,GAAGA,CAACA,KAAKA,CAACA,IAAIA,CAACA,CAACA,CAACA;QAC/BA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA,CAACA,GAAGA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA,CAACA;IAClCA,CAACA;;IAIDb,oBAAAA,UAAUA,KAAUA;QAChBc,KAAKA,GAAGA,OAAOA,KAAKA,IAAIA,QAAQA,GAAGA,IAAIA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,KAAKA;QAC1DA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA,CAACA,EAAEA,CAACA,KAAKA,CAACA,IAAIA,CAACA,CAACA,CAACA;QAC9BA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA,CAACA,EAAEA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA,CAACA;IACjCA,CAACA;;IAIDd,qBAAAA,UAAWA,KAAUA;QACjBe,KAAKA,GAAGA,OAAOA,KAAKA,IAAIA,QAAQA,GAAGA,IAAIA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,KAAKA;QAC1DA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA,CAACA,GAAGA,CAACA,KAAKA,CAACA,IAAIA,CAACA,CAACA,CAACA;QAC/BA,IAAIA,CAACA,KAAKA,CAACA,CAACA,CAACA,CAACA,GAAGA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA,CAACA;IAClCA,CAACA;;IAEDf,qBAAAA;QACIgB,IAAIA,CAACA,GAAGA,CAACA,CAACA;QACVA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA;IACfA,CAACA;IACLhB,YAACA;AAADA,CAACA,IAAA"}
\ No newline at end of file
diff --git a/js/Byte.ts b/js/Byte.ts
index 3deb368..df081f4 100644
--- a/js/Byte.ts
+++ b/js/Byte.ts
@@ -137,10 +137,58 @@ class Word {
//return new Word(overflow[0].Get() + this.value[0].Add(overflow[1]).Get());
}
- public AddByte(value: number): Word;
- public AddByte(value: Byte): Word;
- public AddByte(value: any): Word {
- value = typeof value != "number" ? value.Get() : value;
+ public Sub(value: number): Word;
+ public Sub(value: Word): Word;
+ public Sub(value: any): Word {
+ value = typeof value == "number" ? new Word(value) : value;
+ return this.Add(value.Neg());
+ }
+
+ public AddByte(value: number, signed: boolean): Word;
+ public AddByte(value: Byte, signed: boolean): Word;
+ public AddByte(value: any, signed: boolean = false): Word {
+ value = typeof value != "number" ? new Word((value.Test(7) && signed ? 0xFF00 : 0x0000) | value.Get()) : new Word(value);
return this.Add(value);
}
+
+ public SubByte(value: number): Word;
+ public SubByte(value: Byte): Word;
+ public SubByte(value: any): Word {
+ value = typeof value != "number" ? new Byte(value) : value;
+ return this.AddByte(value.Neg(), true);
+ }
+
+ public Not() {
+ this.value[0].Not();
+ this.value[1].Not();
+ }
+
+ public And(value: number);
+ public And(value: Word);
+ public And(value: any) {
+ value = typeof value == "number" ? new Word(value) : value;
+ this.value[0].And(value.High());
+ this.value[1].And(value.Low());
+ }
+
+ public Or(value: number);
+ public Or(value: Word);
+ public Or(value: any) {
+ value = typeof value == "number" ? new Word(value) : value;
+ this.value[0].Or(value.High());
+ this.value[1].Or(value.Low());
+ }
+
+ public Xor(value: number);
+ public Xor(value: Word);
+ public Xor(value: any) {
+ value = typeof value == "number" ? new Word(value) : value;
+ this.value[0].Xor(value.High());
+ this.value[1].Xor(value.Low());
+ }
+
+ public Neg() {
+ this.Not();
+ this.Add(1);
+ }
}
\ No newline at end of file
diff --git a/js/Registers.js b/js/Registers.js
index d77b383..99d7ddf 100644
--- a/js/Registers.js
+++ b/js/Registers.js
@@ -60,7 +60,9 @@ var Registers = (function () {
}
};
- Registers.Exchange = function (a, b) {
+ Registers.SetRegisterPair = function (pair, value) {
+ Registers.byteRegisters[pair[0]] = value.High();
+ Registers.byteRegisters[pair[1]] = value.Low();
};
Registers.byteRegisters = [];
Registers.shadowRegisters = [];
diff --git a/js/Registers.js.map b/js/Registers.js.map
index b13b4ac..d93b4f5 100644
--- a/js/Registers.js.map
+++ b/js/Registers.js.map
@@ -1 +1 @@
-{"version":3,"file":"Registers.js","sourceRoot":"","sources":["Registers.ts"],"names":["Flags","Registers","Registers.constructor","Registers.Init","Registers.GenerateWord","Registers.SetFlag","Registers.GetFlag","Registers.ExchangeAFShadow","Registers.ExchangeShadow","Registers.Exchange"],"mappings":"AAAA,gCAAgC;AAEhC,IAAK,KAAK;AAA8D,CAAxE,UAAK,KAAK;IAAGA,mCAAKA;IAAEA,qCAAMA;IAAEA,qCAAMA;IAAEA,uCAAOA;IAAEA,iCAAIA;IAAEA,uCAAOA;IAAEA,iCAAIA;IAAEA,iCAAIA;0BAAE;;AAExE;IAAAC;IAuDAC,CAACA;AAAAD,IAjDGA,iBAAAA;QACIE,SAASA,CAACA,aAAaA,CAACA,KAAKA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAACA,CAACA;QAC5CA,SAASA,CAACA,aAAaA,CAACA,KAAKA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAACA,CAACA;QAC5CA,SAASA,CAACA,aAAaA,CAACA,KAAKA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAACA,CAACA;QAC5CA,SAASA,CAACA,aAAaA,CAACA,KAAKA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAACA,CAACA;;QAE5CA,IAAIA,GAAGA,GAAGA,YAAYA;QACtBA,KAAIA,IAAIA,CAACA,EAAEA,CAACA,GAAGA,GAAGA,CAACA,MAAMA,EAAEA,CAACA,EAAEA;YAC1BA,SAASA,CAACA,aAAaA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,CAACA,CAACA,CAACA;;QAElDA,SAASA,CAACA,eAAeA,CAACA,IAAIA,CAACA,GAA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GAAGA,CAACA,GAAGA,CAACA,CAACA;IAC5CA,CAACA;;IAEDN,2BAAAA;QACIO,IAAIA,IAAIA,GAAGA,CAACA,IAAIA,EAAEA,IAAIA,EAAEA,IAAIA,CAACA;QAC7BA,KAAIA,IAAIA,GAAGA,IAAIA,IAAIA,CAAEA;YACjBA,IAAIA,GAAGA,GAAGA,SAASA,CAACA,eAAeA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA;YAC9CA,SAASA,CAACA,eAAeA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,GAAGA,CAACA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,EAAEA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;YACtHA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,GAAGA,GAAGA,CAACA,IAAIA,CAACA,CAACA;YAClDA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,GAAGA,GAAGA,CAACA,GAAGA,CAACA,CAACA;SACpDA;IACLA,CAACA;;IAEDP,qBAAAA,UAAuBA,CAASA,EAAEA,CAASA;IAE3CQ,CAACA;IArDDR,0BAAsCA,EAAEA;IACxCA,4BAAwCA,EAAEA;IAC1CA,2BAAqCA,IAAIA,IAAIA,CAACA,CAACA,CAACA;IAChDA,yBAAmCA,IAAIA,IAAIA,CAACA,CAACA,CAACA;IAmDlDA,iBAACA;AAADA,CAACA,IAAA"}
\ No newline at end of file
+{"version":3,"file":"Registers.js","sourceRoot":"","sources":["Registers.ts"],"names":["Flags","Registers","Registers.constructor","Registers.Init","Registers.GenerateWord","Registers.SetFlag","Registers.GetFlag","Registers.ExchangeAFShadow","Registers.ExchangeShadow","Registers.SetRegisterPair"],"mappings":"AAAA,gC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,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,EAAEA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;YACtHA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,GAAGA,GAAGA,CAACA,IAAIA,CAACA,CAACA;YAClDA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,CAACA,GAAGA,GAAGA,CAACA,GAAGA,CAACA,CAACA;SACpDA;IACLA,CAACA;;IAEDP,4BAAAA,UAA8BA,IAAYA,EAAEA,KAAWA;QACnDQ,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA,GAAGA,KAAKA,CAACA,IAAIA,CAACA,CAACA;QAC/CA,SAASA,CAACA,aAAaA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA,GAAGA,KAAKA,CAACA,GAAGA,CAACA,CAACA;IAClDA,CAACA;IAtDDR,0BAAsCA,EAAEA;IACxCA,4BAAwCA,EAAEA;IAC1CA,2BAAqCA,IAAIA,IAAIA,CAACA,CAACA,CAACA;IAChDA,yBAAmCA,IAAIA,IAAIA,CAACA,CAACA,CAACA;IAoDlDA,iBAACA;AAADA,CAACA,IAAA"}
\ No newline at end of file
diff --git a/js/Registers.ts b/js/Registers.ts
index 02aad21..08e01ab 100644
--- a/js/Registers.ts
+++ b/js/Registers.ts
@@ -54,7 +54,8 @@ class Registers {
}
}
- public static Exchange(a: string, b: string) {
-
+ public static SetRegisterPair(pair: string, value: Word) {
+ Registers.byteRegisters[pair[0]] = value.High();
+ Registers.byteRegisters[pair[1]] = value.Low();
}
}
\ No newline at end of file
diff --git a/js/TI.js b/js/TI.js
index 3ea7ec2..47723f0 100644
--- a/js/TI.js
+++ b/js/TI.js
@@ -12,7 +12,9 @@ var TI = (function () {
};
TI.Init = function () {
+ Registers.Init();
LCD.Init();
+ Memory.Init();
var a = new Byte(0xF0);
var b = new Byte(10);
diff --git a/js/TI.js.map b/js/TI.js.map
index b814d13..09c9081 100644
--- a/js/TI.js.map
+++ b/js/TI.js.map
@@ -1 +1 @@
-{"version":3,"file":"TI.js","sourceRoot":"","sources":["TI.ts"],"names":["TI","TI.constructor","TI.PerformOperation","TI.Init"],"mappings":"AAAA,gCAAgC;AAChC,+BAA+B;AAC/B,kCAAkC;AAClC,qCAAqC;AACrC,mCAAmC;;AAUnC;IAAAA;IAgBAC,CAACA;AAAAD,IAbGA,sBAAAA,UAAwBA,IAAYA;QAChCE,IAAIA,CAACA,OAAOA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,IAAIA,CAACA;IACrCA,CAACA;;IAEDF,UAAAA;QACIG,GAAGA,CAACA,IAAIA,CAACA,CAACA;QACVA,IAAIA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,IAAIA,CAACA;QACtBA,IAAIA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,EAAEA,CAACA;;QACpBA,WAAWA;QACXA,iBAAiBA;QACjBA,CAACA,CAACA,SAASA,CAACA,IAAIA,CAACA;QACjBA,iBAAiBA;IACrBA,CAACA;IAdDH,aAAkCA,EAAEA;IAexCA,UAACA;AAADA,CAACA,IAAA"}
\ No newline at end of file
+{"version":3,"file":"TI.js","sourceRoot":"","sources":["TI.ts"],"names":["TI","TI.constructor","TI.PerformOperation","TI.Init"],"mappings":"AAAA,gCAAgC;AAChC,+BAA+B;AAC/B,kCAAkC;AAClC,qCAAqC;AACrC,mCAAmC;;AAUnC;IAAAA;IAkBAC,CAACA;AAAAD,IAfGA,sBAAAA,UAAwBA,IAAYA;QAChCE,IAAIA,CAACA,OAAOA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA,CAACA,IAAIA,CAACA;IACrCA,CAACA;;IAEDF,UAAAA;QACIG,SAASA,CAACA,IAAIA,CAACA,CAACA;QAChBA,GAAGA,CAACA,IAAIA,CAACA,CAACA;QACVA,MAAMA,CAACA,IAAIA,CAACA,CAACA;QACbA,IAAIA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,IAAIA,CAACA;QACtBA,IAAIA,CAACA,GAAGA,IAAIA,IAAIA,CAACA,EAAEA,CAACA;;QACpBA,WAAWA;QACXA,iBAAiBA;QACjBA,CAACA,CAACA,SAASA,CAACA,IAAIA,CAACA;QACjBA,iBAAiBA;IACrBA,CAACA;IAhBDH,aAAkCA,EAAEA;IAiBxCA,UAACA;AAADA,CAACA,IAAA"}
\ No newline at end of file
diff --git a/js/TI.ts b/js/TI.ts
index f9e2b28..e4cf2d2 100644
--- a/js/TI.ts
+++ b/js/TI.ts
@@ -20,7 +20,9 @@ class TI {
}
static Init() {
+ Registers.Init();
LCD.Init();
+ Memory.Init();
var a = new Byte(0xF0);
var b = new Byte(10);
//a.Sub(b);
diff --git a/js/ops/0x0.js b/js/ops/0x0.js
index 3f4d739..32247e6 100644
--- a/js/ops/0x0.js
+++ b/js/ops/0x0.js
@@ -8,8 +8,7 @@ TI.Opcodes[0x00] = function (args) {
};
TI.Opcodes[0x01] = function (args) {
- Registers.byteRegisters["B"] = args[2];
- Registers.byteRegisters["C"] = args[1];
+ Registers.SetRegisterPair("BC", new Word(args[2], args[1]));
return [3, 10];
};
@@ -19,8 +18,10 @@ TI.Opcodes[0x02] = function (args) {
};
TI.Opcodes[0x03] = function (args) {
- // inc bc
- return [1, 4];
+ var tmp = Registers.GenerateWord("B", "C");
+ tmp.Add(1);
+ Registers.SetRegisterPair("BC", tmp);
+ return [1, 6];
};
TI.Opcodes[0x04] = function (args) {
@@ -57,7 +58,13 @@ TI.Opcodes[0x08] = function (args) {
};
TI.Opcodes[0x09] = function (args) {
- // add hl, bc
+ var tmp = [Registers.GenerateWord("H", "L"), Registers.GenerateWord("B", "C")];
+ var overflow = tmp[0].Add(tmp[1]);
+ Registers.SetRegisterPair("HL", tmp[0]);
+ Registers.SetFlag(1 /* ADDSUB */, false);
+ Registers.SetFlag(0 /* CARRY */, overflow.Get() != 0);
+
+ // todo check if flags are set correctly
return [1, 11];
};
@@ -67,8 +74,10 @@ TI.Opcodes[0x0A] = function (args) {
};
TI.Opcodes[0x0B] = function (args) {
- // dec bc
- return [1, 4];
+ var tmp = Registers.GenerateWord("B", "C");
+ tmp.Sub(1);
+ Registers.SetRegisterPair("BC", tmp);
+ return [1, 6];
};
TI.Opcodes[0x0C] = function (args) {
@@ -81,4 +90,21 @@ TI.Opcodes[0x0C] = function (args) {
Registers.SetFlag(7 /* SIGN */, Registers.byteRegisters["C"].Test(7));
return [1, 4];
};
+
+TI.Opcodes[0x0D] = function (args) {
+ // dec c
+ return [1, 4];
+};
+
+TI.Opcodes[0x0E] = function (args) {
+ Registers.byteRegisters["A"] = args[1];
+ return [2, 7];
+};
+
+TI.Opcodes[0x0F] = function (args) {
+ Registers.SetFlag(0 /* CARRY */, Registers.byteRegisters["A"].ShiftRight(true));
+ Registers.SetFlag(1 /* ADDSUB */, false);
+ Registers.SetFlag(4 /* HALF */, false);
+ return [1, 4];
+};
//# sourceMappingURL=0x0.js.map
diff --git a/js/ops/0x0.js.map b/js/ops/0x0.js.map
index 633e98b..d839bf7 100644
--- a/js/ops/0x0.js.map
+++ b/js/ops/0x0.js.map
@@ -1 +1 @@
-{"version":3,"file":"0x0.js","sourceRoot":"","sources":["0x0.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,kCAAkC;AAClC,qCAAqC;AACrC,wCAAwC;AACxC,iCAAiC;AAEjC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;IACpC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC;;AAED,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;IACpC,SAAS,CAAC,aAAa,CAAC,GA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YAAU,EAAE,KAAK,CAAC;IACpC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC"}
\ No newline at end of file
diff --git a/js/ops/0x0.ts b/js/ops/0x0.ts
index 0baccc0..162bbfd 100644
--- a/js/ops/0x0.ts
+++ b/js/ops/0x0.ts
@@ -9,8 +9,7 @@ TI.Opcodes[0x00] = function(args: Byte[]): number[] {
};
TI.Opcodes[0x01] = function(args: Byte[]): number[] {
- Registers.byteRegisters["B"] = args[2];
- Registers.byteRegisters["C"] = args[1];
+ Registers.SetRegisterPair("BC", new Word(args[2], args[1]));
return [3, 10];
};
@@ -20,8 +19,10 @@ TI.Opcodes[0x02] = function(args: Byte[]): number[] {
};
TI.Opcodes[0x03] = function(args: Byte[]): number[] {
- // inc bc
- return [1, 4];
+ var tmp = Registers.GenerateWord("B", "C");
+ tmp.Add(1);
+ Registers.SetRegisterPair("BC", tmp);
+ return [1, 6];
};
TI.Opcodes[0x04] = function(args: Byte[]): number[] {
@@ -31,7 +32,7 @@ TI.Opcodes[0x04] = function(args: Byte[]): number[] {
Registers.SetFlag(Flags.ZERO, over.Get() != 0);
Registers.SetFlag(Flags.PARITY, tmp.Test(7) == false && Registers.byteRegisters["B"].Test(7) == true);
Registers.SetFlag(Flags.HALF, (tmp.Get() & 0x0F) == 0x0F);
- Registers.SetFlag(Flags.SIGN, Registers.byteRegisters["B"].Test(7))
+ Registers.SetFlag(Flags.SIGN, Registers.byteRegisters["B"].Test(7));
return [1, 4];
};
@@ -58,7 +59,12 @@ TI.Opcodes[0x08] = function(args: Byte[]): number[] {
};
TI.Opcodes[0x09] = function(args: Byte[]): number[] {
- // add hl, bc
+ var tmp = [Registers.GenerateWord("H", "L"), Registers.GenerateWord("B","C")];
+ var overflow = tmp[0].Add(tmp[1]);
+ Registers.SetRegisterPair("HL", tmp[0]);
+ Registers.SetFlag(Flags.ADDSUB, false);
+ Registers.SetFlag(Flags.CARRY, overflow.Get() != 0);
+ // todo check if flags are set correctly
return [1, 11];
};
@@ -68,8 +74,10 @@ TI.Opcodes[0x0A] = function(args: Byte[]): number[] {
};
TI.Opcodes[0x0B] = function(args: Byte[]): number[] {
- // dec bc
- return [1, 4];
+ var tmp = Registers.GenerateWord("B", "C");
+ tmp.Sub(1);
+ Registers.SetRegisterPair("BC", tmp);
+ return [1, 6];
};
TI.Opcodes[0x0C] = function(args: Byte[]): number[] {
@@ -79,6 +87,23 @@ TI.Opcodes[0x0C] = function(args: Byte[]): number[] {
Registers.SetFlag(Flags.ZERO, over.Get() != 0);
Registers.SetFlag(Flags.PARITY, tmp.Test(7) == false && Registers.byteRegisters["C"].Test(7) == true);
Registers.SetFlag(Flags.HALF, (tmp.Get() & 0x0F) == 0x0F);
- Registers.SetFlag(Flags.SIGN, Registers.byteRegisters["C"].Test(7))
+ Registers.SetFlag(Flags.SIGN, Registers.byteRegisters["C"].Test(7));
+ return [1, 4];
+};
+
+TI.Opcodes[0x0D] = function(args: Byte[]): number[] {
+ // dec c
+ return [1, 4];
+};
+
+TI.Opcodes[0x0E] = function(args: Byte[]): number[] {
+ Registers.byteRegisters["A"] = args[1];
+ return [2, 7];
+};
+
+TI.Opcodes[0x0F] = function(args: Byte[]): number[] {
+ Registers.SetFlag(Flags.CARRY, Registers.byteRegisters["A"].ShiftRight(true));
+ Registers.SetFlag(Flags.ADDSUB, false);
+ Registers.SetFlag(Flags.HALF, false);
return [1, 4];
};
\ No newline at end of file
diff --git a/js/ops/0x1.js b/js/ops/0x1.js
index fd6ad69..7840f15 100644
--- a/js/ops/0x1.js
+++ b/js/ops/0x1.js
@@ -3,4 +3,32 @@
///
///
///
+TI.Opcodes[0x10] = function (args) {
+ Registers.byteRegisters["B"].Sub(1);
+ if (Registers.byteRegisters["B"].Get() != 0) {
+ Registers.programCounter.AddByte(args[1], true);
+ return [0, 13];
+ } else
+ return [2, 8];
+};
+
+TI.Opcodes[0x11] = function (args) {
+ Registers.SetRegisterPair("DE", new Word(args[2], args[1]));
+ return [3, 10];
+};
+
+TI.Opcodes[0x12] = function (args) {
+ Memory.Set(Registers.GenerateWord("D", "E"), Registers.byteRegisters["A"]);
+ return [1, 7];
+};
+
+TI.Opcodes[0x13] = function (args) {
+ var tmp = Registers.GenerateWord("D", "E");
+ tmp.Add(1);
+ Registers.SetRegisterPair("DE", tmp);
+ return [1, 6];
+};
+
+TI.Opcodes[0x13] = function (args) {
+};
//# sourceMappingURL=0x1.js.map
diff --git a/js/ops/0x1.js.map b/js/ops/0x1.js.map
index 904fed2..91c8f25 100644
--- a/js/ops/0x1.js.map
+++ b/js/ops/0x1.js.map
@@ -1 +1 @@
-{"version":3,"file":"0x1.js","sourceRoot":"","sources":["0x1.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,kCAAkC;AAClC,qCAAqC;AACrC,wCAAwC;AACxC,iCAAiC"}
\ No newline at end of file
+{"version":3,"file":"0x1.js","sourceRoot":"","sources":["0x1.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,kCAAkC;AAClC,qCAAqC;AACrC,wCAAwC;AACxC,iCAAiC;AAEjC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;IACpC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,IAAG,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAE;QACxC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QAC/C,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;KACjB;QAAM,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzB,CAAC;;AAED,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;IACpC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;AAClB,CAAC;;AAED,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;IACpC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC1E,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC;;AAED,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;IACpC,IAAI,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,EAAC,GAAG,CAAC;IACzC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACV,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC;IACpC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACjB,CAAC;;AAED,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAS,IAAY;AAExC,CAAC"}
\ No newline at end of file
diff --git a/js/ops/0x1.ts b/js/ops/0x1.ts
index de2fbef..9cfb2f9 100644
--- a/js/ops/0x1.ts
+++ b/js/ops/0x1.ts
@@ -2,4 +2,33 @@
///
///
///
-///
\ No newline at end of file
+///
+
+TI.Opcodes[0x10] = function(args: Byte[]): number[] {
+ Registers.byteRegisters["B"].Sub(1);
+ if(Registers.byteRegisters["B"].Get() != 0) {
+ Registers.programCounter.AddByte(args[1], true);
+ return [0, 13];
+ } else return [2, 8];
+};
+
+TI.Opcodes[0x11] = function(args: Byte[]): number[] {
+ Registers.SetRegisterPair("DE", new Word(args[2], args[1]));
+ return [3, 10];
+};
+
+TI.Opcodes[0x12] = function(args: Byte[]): number[] {
+ Memory.Set(Registers.GenerateWord("D", "E"), Registers.byteRegisters["A"]);
+ return [1, 7];
+};
+
+TI.Opcodes[0x13] = function(args: Byte[]): number[] {
+ var tmp = Registers.GenerateWord("D","E");
+ tmp.Add(1);
+ Registers.SetRegisterPair("DE", tmp);
+ return [1, 6];
+};
+
+TI.Opcodes[0x13] = function(args: Byte[]): number[] {
+
+};
\ No newline at end of file
diff --git a/js/ops/generic.js b/js/ops/generic.js
new file mode 100644
index 0000000..10ea2ad
--- /dev/null
+++ b/js/ops/generic.js
@@ -0,0 +1,21 @@
+///
+///
+///
+///
+///
+function IncrementRegister(reg) {
+ if (reg.length == 1) {
+ var tmp = Registers.byteRegisters[reg];
+ var over = Registers.byteRegisters[reg].Add(1);
+ Registers.SetFlag(1 /* ADDSUB */, false);
+ Registers.SetFlag(6 /* ZERO */, over.Get() != 0);
+ Registers.SetFlag(2 /* PARITY */, tmp.Test(7) == false && Registers.byteRegisters[reg].Test(7) == true);
+ Registers.SetFlag(4 /* HALF */, (tmp.Get() & 0x0F) == 0x0F);
+ Registers.SetFlag(7 /* SIGN */, Registers.byteRegisters[reg].Test(7));
+ } else {
+ var tmp = Registers.GenerateWord(reg[0], reg[1]);
+ tmp.Add(1);
+ Registers.SetRegisterPair(reg, tmp);
+ }
+}
+//# sourceMappingURL=generic.js.map
diff --git a/js/ops/generic.js.map b/js/ops/generic.js.map
new file mode 100644
index 0000000..61628b2
--- /dev/null
+++ b/js/ops/generic.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"generic.js","sourceRoot":"","sources":["generic.ts"],"names":["IncrementRegister"],"mappings":"AAAA,mCAAmC;AACnC,kCAAkC;AAClC,qCAAqC;AACrC,wCAAwC;AACxC,iCAAiC;AAEjC,SAAS,iBAAiB,CAAC,GAAW;IAClCA,IAAGA,GAAGA,CAACA,MAAMA,IAAIA,CAACA,CAAEA;QAChBA,IAAIA,GAAGA,GAAGA,SAASA,CAACA,aAAaA,CAACA,GAAGA,CAACA;QACtCA,IAAIA,IAAIA,GAAGA,SAASA,CAACA,aAAaA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,CAACA;QAC9CA,SAASA,CAACA,OAAOA,CAACA,cAAYA,EAAEA,KAAKA,CAACA;QACtCA,SAASA,CAACA,OAAOA,CAACA,YAAUA,EAAEA,IAAIA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA;QAC9CA,SAASA,CAACA,OAAOA,CAACA,cAAYA,EAAEA,GAAGA,CAACA,IAAIA,CAACA,CAACA,CAACA,IAAIA,KAAKA,IAAIA,SAASA,CAACA,aAAaA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA,IAAIA,IAAIA,CAACA;QACrGA,SAASA,CAACA,OAAOA,CAACA,YAAUA,EAAEA,CAACA,GAAGA,CAACA,GAAGA,CAACA,CAACA,GAAGA,IAAIA,CAACA,IAAIA,IAAIA,CAACA;QACzDA,SAASA,CAACA,OAAOA,CAACA,YAAUA,EAAEA,SAASA,CAACA,aAAaA,CAACA,GAAGA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA,CAACA;KACtEA,KAAMA;QACHA,IAAIA,GAAGA,GAAGA,SAASA,CAACA,YAAYA,CAACA,GAAGA,CAACA,CAACA,CAACA,EAACA,GAAGA,CAACA,CAACA,CAACA,CAACA;QAC/CA,GAAGA,CAACA,GAAGA,CAACA,CAACA,CAACA;QACVA,SAASA,CAACA,eAAeA,CAACA,GAAGA,EAAEA,GAAGA,CAACA;KACtCA;AACLA,CAACA"}
\ No newline at end of file
diff --git a/js/ops/generic.ts b/js/ops/generic.ts
new file mode 100644
index 0000000..e5c1e91
--- /dev/null
+++ b/js/ops/generic.ts
@@ -0,0 +1,21 @@
+///
+///
+///
+///
+///
+
+function IncrementRegister(reg: string) {
+ if(reg.length == 1) {
+ var tmp = Registers.byteRegisters[reg];
+ var over = Registers.byteRegisters[reg].Add(1);
+ Registers.SetFlag(Flags.ADDSUB, false);
+ Registers.SetFlag(Flags.ZERO, over.Get() != 0);
+ Registers.SetFlag(Flags.PARITY, tmp.Test(7) == false && Registers.byteRegisters[reg].Test(7) == true);
+ Registers.SetFlag(Flags.HALF, (tmp.Get() & 0x0F) == 0x0F);
+ Registers.SetFlag(Flags.SIGN, Registers.byteRegisters[reg].Test(7));
+ } else {
+ var tmp = Registers.GenerateWord(reg[0],reg[1]);
+ tmp.Add(1);
+ Registers.SetRegisterPair(reg, tmp);
+ }
+}
\ No newline at end of file