-
Notifications
You must be signed in to change notification settings - Fork 0
/
kw11.cpp
43 lines (37 loc) · 851 Bytes
/
kw11.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
#include "kw11.h"
#include "avr11.h"
#include "kb11.h"
#include <iostream>
#include <signal.h>
#include <Arduino.h>
extern KB11 cpu;
void kw11alarm(int) { cpu.unibus.kw11.tick(); }
KW11::KW11() {
}
void KW11::write16(uint32_t a, uint16_t v) {
switch (a) {
case 0777546:
// Serial.printf("kw11: csr write %06o\n", v);
csr = v;
return;
default:
Serial.printf("kw11: write to invalid address %06o\n", a);
trap(INTBUS);
}
}
uint16_t KW11::read16(uint32_t a) {
switch (a) {
case 0777546:
// Serial.printf("kw11: csr read %06o\n", csr);
return csr;
default:
Serial.printf("kw11: read from invalid address %06o\n", a);
trap(INTBUS);
}
}
void KW11::tick() {
csr |= (1 << 7);
if (csr & (1 << 6)) {
cpu.interrupt(INTCLOCK, 6);
}
}