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

Function flash_read

core/flash.c:202–256  ·  view source on GitHub ↗

Read from the 0x1000 range of ports */

Source from the content-addressed store, hash-verified

200
201/* Read from the 0x1000 range of ports */
202static uint8_t flash_read(const uint16_t pio, bool peek) {
203 uint8_t value;
204 if (asic.serFlash) {
205 if (pio & 0x800) {
206 uint16_t index = pio & 0x7FF;
207 if (index < 0x10) {
208 value = flash.command[index];
209 } else {
210 switch (index) {
211 case 0x18:
212 value = flash.commandStatus[0] >> 1 & 3;
213 break;
214 case 0x24:
215 value = flash.commandStatus[0] >> 0 & 1;
216 break;
217 case 0x2C: case 0x2D: case 0x2E: case 0x2F:
218 value = flash.maskReg[index - 0x2C];
219 break;
220 case 0x30:
221 value = 0x04;
222 break;
223 case 0x31:
224 value = 0xB4;
225 break;
226 case 0x32:
227 value = 0x0E;
228 break;
229 case 0x33:
230 value = 0x1F;
231 break;
232 case 0x100:
233 if (!(flash.command[0xC] & 1 << 1) && flash.commandLength) {
234 value = flash_read_command(peek);
235 if (!peek) {
236 flash_command_byte_transferred();
237 }
238 } else {
239 value = 0;
240 }
241 break;
242 default:
243 value = 0;
244 break;
245 }
246 }
247 } else {
248 uint8_t index = pio & 0x7F;
249 value = flash.ports[index];
250 }
251 } else {
252 uint8_t index = pio;
253 value = flash.ports[index];
254 }
255 return value;
256}
257
258/* Write to the 0x1000 range of ports */
259static void flash_write(const uint16_t pio, const uint8_t byte, bool poke) {

Callers

nothing calls this directly

Calls 2

flash_read_commandFunction · 0.85

Tested by

no test coverage detected