src/mess/drivers/cdi.c
| r5871 | r5872 | |
| 437 | 437 | break; |
| 438 | 438 | case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: // INTERRUPT |
| 439 | 439 | case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f: |
| 440 | | verboselog(machine, 6, "%08x: %08x: ICA: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd ); |
| 440 | verboselog(machine, 5, "%08x: %08x: ICA: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd ); |
| 441 | 441 | mcd212.channel[1].csrr |= 1 << (2 - channel); |
| 442 | 442 | // TODO |
| 443 | 443 | // mcd212_check_interrupts |
| r5871 | r5872 | |
| 502 | 502 | break; |
| 503 | 503 | case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: // INTERRUPT |
| 504 | 504 | case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f: |
| 505 | | verboselog(machine, 6, "%08x: %08x: DCA: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd ); |
| 505 | verboselog(machine, 5, "%08x: %08x: DCA: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd ); |
| 506 | 506 | mcd212.channel[1].csrr |= 1 << (2 - channel); |
| 507 | 507 | // TODO |
| 508 | 508 | // mcd212_check_interrupts |
| r5871 | r5872 | |
| 721 | 721 | UINT16 timer0; |
| 722 | 722 | UINT16 timer1; |
| 723 | 723 | UINT16 timer2; |
| 724 | emu_timer* timer0_timer; |
| 724 | 725 | } scc68070_timer_regs_t; |
| 725 | 726 | |
| 726 | 727 | #define TSR_OV0 0x80 |
| r5871 | r5872 | |
| 853 | 854 | |
| 854 | 855 | scc68070_regs_t scc68070_regs; |
| 855 | 856 | |
| 857 | static void scc68070_set_timer_callback(int channel) |
| 858 | { |
| 859 | UINT32 compare = 0; |
| 860 | attotime period; |
| 861 | switch(channel) |
| 862 | { |
| 863 | case 0: |
| 864 | compare = 0x10000 - scc68070_regs.timers.timer0; |
| 865 | period = attotime_mul(ATTOTIME_IN_HZ(1000000), compare); |
| 866 | timer_adjust_oneshot(scc68070_regs.timers.timer0_timer, period, 0); |
| 867 | break; |
| 868 | default: |
| 869 | fatalerror( "Unsupported timer channel to scc68070_set_timer_callback!\n" ); |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | TIMER_CALLBACK( scc68070_timer0_callback ) |
| 874 | { |
| 875 | scc68070_regs.timers.timer0 = scc68070_regs.timers.reload_register; |
| 876 | if(scc68070_regs.picr1 & 7) |
| 877 | { |
| 878 | scc68070_regs.timers.timer_status_register |= TSR_OV0; |
| 879 | //printf( "Pulling line %d\n", 1 + ((scc68070_regs.picr1 & 7) - 1) ); |
| 880 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + ((scc68070_regs.picr1 & 7) - 1), ASSERT_LINE); |
| 881 | } |
| 882 | scc68070_set_timer_callback(0); |
| 883 | } |
| 884 | |
| 856 | 885 | static READ16_HANDLER( scc68070_periphs_r ) |
| 857 | 886 | { |
| 858 | 887 | switch(offset) |
| r5871 | r5872 | |
| 1195 | 1224 | if(ACCESSING_BITS_0_7) |
| 1196 | 1225 | { |
| 1197 | 1226 | verboselog(space->machine, 2, "scc68070_periphs_w: Timer Status Register: %04x & %04x\n", data, mem_mask); |
| 1198 | | scc68070_regs.timers.timer_status_register = data & 0x00ff; |
| 1227 | scc68070_regs.timers.timer_status_register &= ~(data & 0x00ff); |
| 1228 | if(scc68070_regs.picr1 & 7) |
| 1229 | { |
| 1230 | cputag_set_input_line(space->machine, "maincpu", M68K_IRQ_1 + ((scc68070_regs.picr1 & 7) - 1), CLEAR_LINE); |
| 1231 | } |
| 1199 | 1232 | } |
| 1200 | 1233 | if(ACCESSING_BITS_8_15) |
| 1201 | 1234 | { |
| r5871 | r5872 | |
| 1210 | 1243 | case 0x2024/2: |
| 1211 | 1244 | verboselog(space->machine, 2, "scc68070_periphs_w: Timer 0: %04x & %04x\n", data, mem_mask); |
| 1212 | 1245 | COMBINE_DATA(&scc68070_regs.timers.timer0); |
| 1246 | scc68070_set_timer_callback(0); |
| 1213 | 1247 | break; |
| 1214 | 1248 | case 0x2026/2: |
| 1215 | 1249 | verboselog(space->machine, 2, "scc68070_periphs_w: Timer 1: %04x & %04x\n", data, mem_mask); |
| r5871 | r5872 | |
| 1390 | 1424 | AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_BASE(&ram2) |
| 1391 | 1425 | AM_RANGE(0x00301400, 0x00301403) AM_READ( magic_r ) |
| 1392 | 1426 | AM_RANGE(0x00310004, 0x00310007) AM_READ( magic_2_r ) |
| 1427 | AM_RANGE(0x00320000, 0x0032ffff) AM_RAM |
| 1393 | 1428 | AM_RANGE(0x00400000, 0x0047ffff) AM_ROM AM_REGION("maincpu", 0) |
| 1394 | 1429 | AM_RANGE(0x004fffe0, 0x004fffff) AM_READWRITE(mcd212_r, mcd212_w) |
| 1395 | 1430 | AM_RANGE(0x00500000, 0x0057ffff) AM_RAM |
| r5871 | r5872 | |
| 1412 | 1447 | UINT16 *dst = ram; |
| 1413 | 1448 | memcpy (dst, src, 0x80000); |
| 1414 | 1449 | device_reset(cputag_get_cpu(machine, "maincpu")); |
| 1450 | |
| 1451 | scc68070_regs.timers.timer0_timer = timer_alloc(machine, scc68070_timer0_callback, 0); |
| 1415 | 1452 | } |
| 1416 | 1453 | |
| 1417 | 1454 | /************************* |