src/mess/drivers/pockstat.c
| r6311 | r6312 | |
| 58 | 58 | |
| 59 | 59 | #define VERBOSE_LEVEL (0) |
| 60 | 60 | |
| 61 | | #define ENABLE_VERBOSE_LOG (0) |
| 61 | #define ENABLE_VERBOSE_LOG (1) |
| 62 | 62 | |
| 63 | 63 | #if ENABLE_VERBOSE_LOG |
| 64 | 64 | INLINE void ATTR_PRINTF(3,4) verboselog( running_machine *machine, int n_level, const char *s_fmt, ... ) |
| r6311 | r6312 | |
| 281 | 281 | |
| 282 | 282 | static UINT32 ps_intc_get_interrupt_line(running_machine *machine, UINT32 line) |
| 283 | 283 | { |
| 284 | | return intc_regs.hold & line; |
| 284 | return intc_regs.status & line; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | static void ps_intc_set_interrupt_line(running_machine *machine, UINT32 line, int state) |
| r6311 | r6312 | |
| 291 | 291 | if(state) |
| 292 | 292 | { |
| 293 | 293 | intc_regs.status |= line & PS_INT_STATUS_MASK; |
| 294 | | line &= intc_regs.enable; |
| 295 | | line &= ~intc_regs.mask; |
| 296 | | intc_regs.hold |= line; |
| 294 | intc_regs.hold |= line &~ PS_INT_STATUS_MASK; |
| 295 | //printf( " Setting %08x, status = %08x, hold = %08x\n", line, intc_regs.status, intc_regs.hold ); |
| 297 | 296 | } |
| 298 | 297 | else |
| 299 | 298 | { |
| 300 | 299 | intc_regs.status &= ~line; |
| 301 | 300 | intc_regs.hold &= ~line; |
| 301 | //printf( "Clearing %08x, status = %08x, hold = %08x\n", line, intc_regs.status, intc_regs.hold ); |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | | if(intc_regs.hold & PS_INT_IRQ_MASK) |
| 304 | if(intc_regs.hold & intc_regs.enable & PS_INT_IRQ_MASK) |
| 305 | 305 | { |
| 306 | 306 | cpu_set_input_line(cputag_get_cpu(machine, "maincpu"), ARM7_IRQ_LINE, ASSERT_LINE); |
| 307 | 307 | } |
| r6311 | r6312 | |
| 309 | 309 | { |
| 310 | 310 | cpu_set_input_line(cputag_get_cpu(machine, "maincpu"), ARM7_IRQ_LINE, CLEAR_LINE); |
| 311 | 311 | } |
| 312 | | if(intc_regs.hold & PS_INT_FIQ_MASK) |
| 312 | if(intc_regs.hold & intc_regs.enable & PS_INT_FIQ_MASK) |
| 313 | 313 | { |
| 314 | 314 | cpu_set_input_line(cputag_get_cpu(machine, "maincpu"), ARM7_FIRQ_LINE, ASSERT_LINE); |
| 315 | 315 | } |
| r6311 | r6312 | |
| 357 | 357 | break; |
| 358 | 358 | case 0x0008/4: |
| 359 | 359 | verboselog(space->machine, 0, "ps_intc_w: Interrupt Enable = %08x & %08x\n", data, mem_mask ); |
| 360 | | COMBINE_DATA(&intc_regs.enable); |
| 361 | | intc_regs.mask &= ~intc_regs.enable; |
| 360 | intc_regs.enable |= data; |
| 361 | //COMBINE_DATA(&intc_regs.enable); |
| 362 | intc_regs.status &= intc_regs.enable; |
| 363 | intc_regs.hold &= intc_regs.enable; |
| 364 | ps_intc_set_interrupt_line(space->machine, 0, 0); |
| 362 | 365 | break; |
| 363 | 366 | case 0x000c/4: |
| 364 | 367 | verboselog(space->machine, 0, "ps_intc_w: Interrupt Mask = %08x & %08x\n", data, mem_mask ); |
| 368 | intc_regs.enable &= ~data; |
| 365 | 369 | COMBINE_DATA(&intc_regs.mask); |
| 366 | | intc_regs.enable &= ~intc_regs.mask; |
| 370 | intc_regs.status &= intc_regs.enable; |
| 371 | intc_regs.hold &= intc_regs.enable; |
| 372 | ps_intc_set_interrupt_line(space->machine, 0, 0); |
| 367 | 373 | break; |
| 368 | 374 | case 0x0010/4: |
| 369 | 375 | verboselog(space->machine, 0, "ps_intc_w: Interrupt Acknowledge = %08x & %08x\n", data, mem_mask ); |
| r6311 | r6312 | |
| 423 | 429 | verboselog(space->machine, 0, "ps_timer_r: Timer %d Count = %08x & %08x\n", offset / (0x10/4), timer_regs.timer[offset / (0x10/4)].count, mem_mask ); |
| 424 | 430 | if(timer_regs.timer[offset / (0x10/4)].control & 4) |
| 425 | 431 | { |
| 426 | | timer_regs.timer[offset / (0x10/4)].count -= 0x100; |
| 432 | timer_regs.timer[offset / (0x10/4)].count -= 0x10; |
| 427 | 433 | if(timer_regs.timer[offset / (0x10/4)].count > timer_regs.timer[offset / (0x10/4)].period) |
| 428 | 434 | { |
| 429 | 435 | timer_regs.timer[offset / (0x10/4)].count = timer_regs.timer[offset / (0x10/4)].period; |
| r6311 | r6312 | |
| 783 | 789 | } |
| 784 | 790 | } |
| 785 | 791 | |
| 792 | static READ32_HANDLER( ps_audio_r ) |
| 793 | { |
| 794 | verboselog(space->machine, 0, "ps_audio_r: Unknown Read: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), 0x10, mem_mask); |
| 795 | return 0x10; |
| 796 | } |
| 797 | |
| 798 | static WRITE32_HANDLER( ps_audio_w ) |
| 799 | { |
| 800 | verboselog(space->machine, 0, "ps_audio_w: Unknown Write: %08x = %08x & %08x\n", 0xd800000 + (offset << 2), data, mem_mask); |
| 801 | } |
| 802 | |
| 786 | 803 | static ADDRESS_MAP_START(pockstat_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 787 | 804 | AM_RANGE(0x00000000, 0x000007ff) AM_RAM |
| 788 | 805 | AM_RANGE(0x02000000, 0x02ffffff) AM_READ(ps_rombank_r) |
| r6311 | r6312 | |
| 795 | 812 | AM_RANGE(0x0b800000, 0x0b80000f) AM_READWRITE(ps_rtc_r, ps_rtc_w) |
| 796 | 813 | AM_RANGE(0x0d000000, 0x0d000003) AM_READWRITE(ps_lcd_r, ps_lcd_w) |
| 797 | 814 | AM_RANGE(0x0d000100, 0x0d00017f) AM_RAM AM_BASE(&lcd_buffer) |
| 815 | AM_RANGE(0x0d80000c, 0x0d80000f) AM_READWRITE(ps_audio_r, ps_audio_w) |
| 798 | 816 | ADDRESS_MAP_END |
| 799 | 817 | |
| 800 | 818 | /* Input ports */ |