forked from aap/pdp11
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmem.c
More file actions
38 lines (35 loc) · 722 Bytes
/
Copy pathmem.c
File metadata and controls
38 lines (35 loc) · 722 Bytes
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
#include "11.h"
int
dati_mem(Bus *bus, void *dev)
{
Memory *mem = dev;
uint32 waddr = bus->addr>>1;
if(waddr >= mem->start && waddr < mem->end){
bus->data = mem->mem[waddr-mem->start];
return 0;
}
return 1;
}
int
dato_mem(Bus *bus, void *dev)
{
Memory *mem = dev;
uint32 waddr = bus->addr>>1;
if(waddr >= mem->start && waddr < mem->end){
mem->mem[waddr-mem->start] = bus->data;
return 0;
}
return 1;
}
int
datob_mem(Bus *bus, void *dev)
{
Memory *mem = dev;
uint32 waddr = bus->addr>>1;
if(waddr >= mem->start && waddr < mem->end){
mem->mem[waddr-mem->start] &= (bus->addr&1) ? 0377 : ~0377;
mem->mem[waddr-mem->start] |= bus->data & ((bus->addr&1) ? ~0377 : 0377);
return 0;
}
return 1;
}