-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcode11.h
46 lines (44 loc) · 982 Bytes
/
code11.h
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
static BYTE8 a,x,y,status,lastStatus,pa,pb,pc,ca,cb,cs,sr,cl,sl,o,_temp;
static BYTE8 dataMemory[128],r[11];
#define READ_KEYS ('K')
#define WRITE_O ('O')
#define WRITE_R ('R')
static void tms1100reset() {
ca = cb = cs = 0;
pa = pb = 0xF;pc = 0;
o = 0;hardwareIO(WRITE_O,o,0);
int i;
for (i = 0;i <= 10;i++) {
r[i] = 0;hardwareIO(WRITE_R,i,0);
}
a = a & 0xF;x = x & 7;y = y & 0xF;sr = sr & 0x3F;
cl = cl & 1;sl = sl & 1;lastStatus = lastStatus & 1;
status = status & 1;
for (i = 0;i <= 0x80;i++)
dataMemory[i] = dataMemory[i] & 0xF;
}
static void brCommand(int address) {
if (cl == 0){
ca = cb;pa = pb;pc = address;
} else {
ca = cb;pc = address;
}
}
static void callCommand(int address) {
if (cl == 0){
cs = ca;ca = cb;
int temp = pa;pa = pb;pb = temp;
sr = pc;pc = address;
cl = 1;
} else {
ca = cb;pb = pa;pc = address;
}
}
static void retnCommand() {
if (cl != 0){
pc = sr;pa = pb;ca = cs;
cl = 0;
} else {
pa = pb;
}
}