Mercurial > repos > blastem
comparison mame_z80/z80.c @ 1768:63256371046f mame_interp
Couple of fixes for using MAME Z80 core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 01 Mar 2019 08:17:57 -0800 |
parents | 2e57910fd641 |
children |
comparison
equal
deleted
inserted
replaced
1758:95e387e1d63c | 1768:63256371046f |
---|---|
421 ***************************************************************/ | 421 ***************************************************************/ |
422 static inline uint8_t in(z80_device *z80, uint16_t port) | 422 static inline uint8_t in(z80_device *z80, uint16_t port) |
423 { | 423 { |
424 memmap_chunk const *map_tmp = z80->options->gen.memmap; | 424 memmap_chunk const *map_tmp = z80->options->gen.memmap; |
425 uint32_t chunks_tmp = z80->options->gen.memmap_chunks; | 425 uint32_t chunks_tmp = z80->options->gen.memmap_chunks; |
426 uint32_t mask_tmp = z80->options->gen.address_mask; | |
426 z80->options->gen.memmap = z80->options->iomap; | 427 z80->options->gen.memmap = z80->options->iomap; |
427 z80->options->gen.memmap_chunks = z80->options->io_chunks; | 428 z80->options->gen.memmap_chunks = z80->options->io_chunks; |
429 z80->options->gen.address_mask = z80->options->io_address_mask; | |
428 uint8_t value = read_byte(port, (void **)z80->mem_pointers, &z80->options->gen, z80); | 430 uint8_t value = read_byte(port, (void **)z80->mem_pointers, &z80->options->gen, z80); |
429 z80->options->gen.memmap = map_tmp; | 431 z80->options->gen.memmap = map_tmp; |
430 z80->options->gen.memmap_chunks = chunks_tmp; | 432 z80->options->gen.memmap_chunks = chunks_tmp; |
433 z80->options->gen.address_mask = mask_tmp; | |
431 return value; | 434 return value; |
432 } | 435 } |
433 | 436 |
434 /*************************************************************** | 437 /*************************************************************** |
435 * Output a byte to given I/O port | 438 * Output a byte to given I/O port |
3547 take_nmi(z80); | 3550 take_nmi(z80); |
3548 else */ | 3551 else */ |
3549 if (z80->m_icount <= int_icount && z80->m_iff1 && !z80->m_after_ei) { | 3552 if (z80->m_icount <= int_icount && z80->m_iff1 && !z80->m_after_ei) { |
3550 take_interrupt(z80); | 3553 take_interrupt(z80); |
3551 z80->current_cycle = target_cycle - z80->m_icount * z80->options->gen.clock_divider; | 3554 z80->current_cycle = target_cycle - z80->m_icount * z80->options->gen.clock_divider; |
3552 z80->next_int_pulse(z80); | 3555 if (z80->next_int_pulse) { |
3556 z80->next_int_pulse(z80); | |
3557 } | |
3553 if (z80->int_pulse_start < target_cycle) { | 3558 if (z80->int_pulse_start < target_cycle) { |
3554 int_icount = (z80->int_pulse_start < z80->current_cycle) ? z80->m_icount | 3559 int_icount = (z80->int_pulse_start < z80->current_cycle) ? z80->m_icount |
3555 : ((z80->int_pulse_start - z80->current_cycle) + z80->options->gen.clock_divider - 1) / z80->options->gen.clock_divider; | 3560 : ((z80->int_pulse_start - z80->current_cycle) + z80->options->gen.clock_divider - 1) / z80->options->gen.clock_divider; |
3556 } | 3561 } |
3557 } | 3562 } |
3558 | 3563 |
3559 z80->m_after_ei = 0; | 3564 z80->m_after_ei = 0; |
3560 z80->m_after_ldair = 0; | 3565 z80->m_after_ldair = 0; |
3561 | 3566 |
3562 PRVPC = PCD; | 3567 PRVPC = PCD; |
3568 /*printf("Z80: %X - A: %X, B: %X, C: %X D: %X, E: %X, H: %X, L: %X, SP: %X, IX: %X, IY: %X @ %d\n", | |
3569 PCD, A, B, C, D, E, H, L, SPD, IXD, IYD, target_cycle - z80->m_icount * z80->options->gen.clock_divider);*/ | |
3563 //debugger_instruction_hook(this, PCD); | 3570 //debugger_instruction_hook(this, PCD); |
3564 z80->m_r++; | 3571 z80->m_r++; |
3565 EXEC(op,rop(z80)); | 3572 EXEC(op,rop(z80)); |
3566 if (z80->busreq) { | 3573 if (z80->busreq) { |
3567 z80->busack = 1; | 3574 z80->busack = 1; |