src/mess/machine/at29040.c
| r8244 | r8245 | |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /* |
| 272 | | write a byte to FEEPROM |
| 272 | Write a byte to FEEPROM |
| 273 | 273 | */ |
| 274 | 274 | void at29c040a_w(int id, offs_t offset, UINT8 data) |
| 275 | 275 | { |
| 276 | 276 | offset &= ADDRESS_MASK; |
| 277 | | |
| 277 | |
| 278 | /* The special CFI commands assume a smaller address space according */ |
| 279 | /* to the specification ("address format A14-A0") */ |
| 280 | offs_t cfi_offset = offset & 0x7fff; |
| 281 | |
| 278 | 282 | if (at29c040a[id].s_enabling_bbl) |
| 279 | 283 | { |
| 280 | 284 | at29c040a[id].s_enabling_bbl = FALSE; |
| r8244 | r8245 | |
| 296 | 300 | switch (at29c040a[id].s_cmd) |
| 297 | 301 | { |
| 298 | 302 | case s_cmd_0: |
| 299 | | if ((offset == 0x5555) && (data == 0xaa)) |
| 303 | if ((cfi_offset == 0x5555) && (data == 0xaa)) |
| 300 | 304 | at29c040a[id].s_cmd = s_cmd_1; |
| 301 | 305 | else |
| 302 | 306 | { |
| r8244 | r8245 | |
| 306 | 310 | break; |
| 307 | 311 | |
| 308 | 312 | case s_cmd_1: |
| 309 | | if ((offset == 0x2aaa) && (data == 0x55)) |
| 313 | if ((cfi_offset == 0x2aaa) && (data == 0x55)) |
| 310 | 314 | at29c040a[id].s_cmd = s_cmd_2; |
| 311 | 315 | else |
| 312 | 316 | { |
| r8244 | r8245 | |
| 316 | 320 | break; |
| 317 | 321 | |
| 318 | 322 | case s_cmd_2: |
| 319 | | if (offset == 0x5555) |
| 323 | if (cfi_offset == 0x5555) |
| 320 | 324 | { |
| 321 | 325 | /* exit programming mode */ |
| 322 | 326 | at29c040a[id].s_pgm = s_pgm_0; |