-
Notifications
You must be signed in to change notification settings - Fork 0
/
assembler.js
97 lines (92 loc) · 939 Bytes
/
assembler.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var opTable = new HashTable({
add: {
opCode: '18'
},
and: {
opCode: '40'
},
comp: {
opCode: '28'
},
div: {
opCode: '24'
},
j: {
opCode: '3C'
},
jeq: {
opCode: '30'
},
jgt: {
opCode: '34'
},
jlt: {
opCode: '38'
},
jsub: {
opCode: '48'
},
lda: {
opCode: '00'
},
ldch: {
opCode: '50'
},
ldl: {
opCode: '08'
},
ldx: {
opCode: '04'
},
mul: {
opCode: '20'
},
or: {
opCode: '44'
},
rd: {
opCode: 'D8'
},
rsub: {
opCode: '4C'
},
sta: {
opCode: '0C'
},
stch: {
opCode: '54'
},
stl: {
opCode: '14'
},
stx: {
opCode: '10'
},
sub: {
opCode: '1C'
},
td: {
opCode: 'E0'
},
tix: {
opCode: '2C'
},
wd: {
opCode: 'DC'
}
});
var dirTable = new HashTable({
start: {},
end: {},
resw: {},
resb: {},
byte: {},
word: {},
ltorg: {},
equ: {}
});
var symTable = new HashTable({});
var locCtr = 0,
progStart = 0,
progLength = 0,
programName = "prog";