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

Function sha256_write

core/sha256.c:122–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122static void sha256_write(uint16_t pio, uint8_t byte, bool poke) {
123 uint16_t index = pio >> 2;
124 uint8_t bit_offset = (pio & 3) << 3;
125
126 if (!poke) {
127 if (protected_ports_unlocked()) {
128 sha256.last = index;
129 } else {
130 return; /* writes are ignored when mmio is locked */
131 }
132 }
133
134 if (!pio && flash_unlocked()) {
135 if (byte & 0x10) {
136 memset(sha256.state, 0, sizeof(sha256.state));
137 } else {
138 if ((byte & 0xE) == 0xA) /* 0A or 0B: first block */
139 initialize();
140 if ((byte & 0xA) == 0xA) /* 0E or 0F: subsequent blocks */
141 process_block();
142 }
143 } else if (index >= 0x10 >> 2 && index < 0x50 >> 2) {
144 write8(sha256.block[index - (0x10 >> 2)], bit_offset, byte);
145 }
146}
147
148static const eZ80portrange_t device = {
149 .read = sha256_read,

Callers

nothing calls this directly

Calls 4

protected_ports_unlockedFunction · 0.85
flash_unlockedFunction · 0.85
initializeFunction · 0.85
process_blockFunction · 0.85

Tested by

no test coverage detected