MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / intrpt_read

Function intrpt_read

core/interrupt.c:35–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34const uint32_t revision = 0x00010900;
35static uint8_t intrpt_read(uint16_t pio, bool peek) {
36 uint16_t index = pio >> 2 & 0x3F;
37 uint8_t request = pio >> 5 & 1;
38 uint8_t bit_offset = (pio & 3) << 3;
39
40 uint8_t value = 0;
41
42 (void)peek;
43
44 switch(index) {
45 case 0:
46 case 8:
47 value = read8(intrpt[request].status, bit_offset);
48 break;
49 case 1:
50 case 9:
51 value = read8(intrpt[request].enabled, bit_offset);
52 break;
53 case 3:
54 case 11:
55 value = read8(intrpt[request].latched, bit_offset);
56 break;
57 case 4:
58 case 12:
59 value = read8(intrpt[request].inverted, bit_offset);
60 break;
61 case 5:
62 case 13:
63 value = read8(intrpt[request].status & intrpt[request].enabled, bit_offset);
64 break;
65 case 20:
66 value = read8(revision, bit_offset);
67 break;
68 case 21:
69 value = (bit_offset & 16) ? 0 : 22;
70 break;
71 default:
72 break;
73 }
74 return value;
75}
76
77static void intrpt_write(uint16_t pio, uint8_t value, bool poke) {
78 uint16_t index = pio >> 2 & 0x3F;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected