-
Notifications
You must be signed in to change notification settings - Fork 0
/
kt11.cpp
56 lines (54 loc) · 1.39 KB
/
kt11.cpp
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
#include "kt11.h"
#include <stdint.h>
#include <stdio.h>
uint16_t KT11::read16(const uint32_t a) {
// printf("kt11:read16: %06o\n", a);
const auto i = ((a & 017) >> 1);
switch (a & ~017) {
case 0772200:
return pages[01][i].pdr;
case 0772240:
return pages[01][i].par;
case 0772300:
return pages[00][i].pdr;
case 0772340:
return pages[00][i].par;
case 0777600:
return pages[03][i].pdr;
case 0777640:
return pages[03][i].par;
default:
// printf("mmu::read16 invalid read from %06o\n", a);
trap(004); // intbus
}
}
void KT11::write16(const uint32_t a, const uint16_t v) {
// printf("kt11:write16: %06o %06o\n", a, v);
const auto i = ((a & 017) >> 1);
switch (a & ~017) {
case 0772200:
pages[01][i].pdr = v & 077416;
break;
case 0772240:
pages[01][i].par = v;
pages[01][i].pdr &= ~0100;
break;
case 0772300:
pages[00][i].pdr = v & 077416;
break;
case 0772340:
pages[00][i].par = v;
pages[00][i].pdr &= ~0100;
break;
case 0777600:
pages[03][i].pdr = v & 077416;
break;
case 0777640:
pages[03][i].par = v;
pages[03][i].pdr &= ~0100;
break;
default:
// printf("mmu::write16 write to invalid address %06o\n", a);
trap(004); // intbus
}
}