forked from vaguilar/js-y86
-
Notifications
You must be signed in to change notification settings - Fork 10
/
assem.js
61 lines (46 loc) · 1.09 KB
/
assem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var ASSEM = [];
(function () {
function padq (n) { if (n.length === 8) return n; else return toBigEndian(padHex(n, 8)); }
ASSEM[0] = function () {
return '00';
};
ASSEM[1] = function () {
return '10';
};
ASSEM[2] = function () {
return '2' + this.fn + this.rA + this.rB;
};
ASSEM[3] = function () {
return '30f' + this.rB + padq(this.V);
};
ASSEM[4] = function () {
return '40' + this.rA + this.rB + padq(this.D);
};
ASSEM[5] = function () {
return '50' + this.rA + this.rB + padq(this.D);
};
ASSEM[6] = function () {
return '6' + this.fn + this.rA + this.rB;
};
ASSEM[7] = function () {
return '7' + this.fn + padq(this.Dest);
};
ASSEM[8] = function () {
return '80' + padq(this.Dest);
};
ASSEM[9] = function () {
return '90';
};
ASSEM[10] = function () {
return 'a0' + this.rA + 'f';
};
ASSEM[11] = function () {
return 'b0' + this.rA + 'f';
};
ASSEM[12] = function () { // iaddl, isubl, iandl, ixorl
return 'c' + this.fn + 'f' + this.rB + padq(this.V);
};
ASSEM[15] = function () {
return 'f' + this.fn;
}
})();