Basilio/js/TI.ts

33 lines
865 B
TypeScript
Raw Normal View History

2015-01-22 21:32:46 +00:00
/// <reference path="Byte.ts" />
2015-01-23 19:46:23 +00:00
/// <reference path="LCD.ts" />
2015-01-25 20:06:11 +00:00
/// <reference path="Memory.ts" />
/// <reference path="Registers.ts" />
/// <reference path="ops/0x0.ts" />
interface opcode {
(args: Byte[]): number[];
// opcodes receive an array of four bytes from memory starting at the point of the program counter
// opcodes return an array,
// first value is the program counter increment (size of instruction)
// second value is the number of T-States taken by the instruction
}
2015-01-22 21:32:46 +00:00
class TI {
2015-01-25 20:06:11 +00:00
public static Opcodes: opcode[] = [];
2015-01-22 21:32:46 +00:00
2015-01-27 20:11:57 +00:00
static PerformOperation(data: Byte[]) {
this.Opcodes[data[0].Get()](data);
}
2015-01-22 21:32:46 +00:00
static Init() {
2015-01-23 19:46:23 +00:00
LCD.Init();
2015-01-25 20:06:11 +00:00
var a = new Byte(0xF0);
var b = new Byte(10);
//a.Sub(b);
2015-01-27 20:11:57 +00:00
//alert(a.Get());
2015-01-25 20:06:11 +00:00
a.ShiftLeft(true);
2015-01-27 20:11:57 +00:00
//alert(a.Get());
2015-01-22 21:32:46 +00:00
}
2015-01-25 20:06:11 +00:00
}