src/mess/drivers/cdi.c
| r5914 | r5915 | |
| 57 | 57 | |
| 58 | 58 | static UINT16 *planea; |
| 59 | 59 | static UINT16 *planeb; |
| 60 | | static UINT16 *cdic_ram; |
| 61 | 60 | |
| 61 | emu_timer *test_timer; |
| 62 | |
| 63 | emu_timer *mouse_timer; |
| 64 | |
| 62 | 65 | #define ENABLE_UART_PRINTING (0) |
| 63 | 66 | |
| 64 | 67 | #define VERBOSE_LEVEL (6) |
| r5914 | r5915 | |
| 76 | 79 | } |
| 77 | 80 | } |
| 78 | 81 | |
| 79 | | /************************* |
| 80 | | * Helpful test functions * |
| 81 | | *************************/ |
| 82 | | |
| 83 | | emu_timer *test_timer; |
| 84 | | |
| 85 | | TIMER_CALLBACK( test_timer_callback ) |
| 86 | | { |
| 87 | | // This function manually triggers the SLAVE interrupt request. Currently, it is the only input trigger that will do anything more than |
| 88 | | // what the driver does otherwise. |
| 89 | | static UINT8 stage = 0; |
| 90 | | if(stage == 0) |
| 91 | | { |
| 92 | | stage++; |
| 93 | | //cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 60); |
| 94 | | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, ASSERT_LINE); |
| 95 | | timer_adjust_oneshot(test_timer, ATTOTIME_IN_HZ(10000), 0); |
| 96 | | } |
| 97 | | else |
| 98 | | { |
| 99 | | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, CLEAR_LINE); |
| 100 | | stage = 0; |
| 101 | | } |
| 102 | | } |
| 103 | | |
| 104 | 82 | /*********************** |
| 105 | 83 | * On-board peripherals * |
| 106 | 84 | ***********************/ |
| r5914 | r5915 | |
| 380 | 358 | { |
| 381 | 359 | verboselog(space->machine, 2, "scc68070_periphs_r: UART Mode Register: %04x & %04x\n", scc68070_regs.uart.mode_register, mem_mask); |
| 382 | 360 | } |
| 383 | | return scc68070_regs.uart.mode_register; |
| 361 | return scc68070_regs.uart.mode_register | 0x20; |
| 384 | 362 | case 0x2012/2: |
| 385 | 363 | if(ACCESSING_BITS_0_7) |
| 386 | 364 | { |
| 387 | 365 | verboselog(space->machine, 2, "scc68070_periphs_r: UART Status Register: %04x & %04x\n", scc68070_regs.uart.status_register, mem_mask); |
| 388 | 366 | } |
| 389 | | return scc68070_regs.uart.status_register | USR_TXRDY | USR_RXRDY; |
| 367 | return scc68070_regs.uart.status_register /*| USR_TXEMT*/ | USR_TXRDY | (1 << 1) | USR_RXRDY; |
| 390 | 368 | case 0x2014/2: |
| 391 | 369 | if(ACCESSING_BITS_0_7) |
| 392 | 370 | { |
| 393 | 371 | verboselog(space->machine, 2, "scc68070_periphs_r: UART Clock Select: %04x & %04x\n", scc68070_regs.uart.clock_select, mem_mask); |
| 394 | 372 | } |
| 395 | | return scc68070_regs.uart.clock_select; |
| 373 | return scc68070_regs.uart.clock_select | 0x08; |
| 396 | 374 | case 0x2016/2: |
| 397 | 375 | if(ACCESSING_BITS_0_7) |
| 398 | 376 | { |
| 399 | 377 | verboselog(space->machine, 2, "scc68070_periphs_r: UART Command Register: %02x & %04x\n", scc68070_regs.uart.command_register, mem_mask); |
| 400 | 378 | } |
| 401 | | return scc68070_regs.uart.command_register; |
| 379 | return scc68070_regs.uart.command_register | 0x80; |
| 402 | 380 | case 0x2018/2: |
| 403 | 381 | if(ACCESSING_BITS_0_7) |
| 404 | 382 | { |
| r5914 | r5915 | |
| 409 | 387 | if(ACCESSING_BITS_0_7) |
| 410 | 388 | { |
| 411 | 389 | verboselog(space->machine, 2, "scc68070_periphs_r: UART Receive Holding Register: %02x & %04x\n", scc68070_regs.uart.receive_holding_register, mem_mask); |
| 390 | return scc68070_regs.uart.receive_holding_register; |
| 412 | 391 | } |
| 413 | | return scc68070_regs.uart.receive_holding_register; |
| 392 | return 0; |
| 414 | 393 | |
| 415 | 394 | // Timers: 80002020 to 80002029 |
| 416 | 395 | case 0x2020/2: |
| r5914 | r5915 | |
| 659 | 638 | case 0x2018/2: |
| 660 | 639 | if(ACCESSING_BITS_0_7) |
| 661 | 640 | { |
| 662 | | verboselog(space->machine, 2, "scc68070_periphs_w: UART Transmit Holding Register: %04x & %04x\n", data, mem_mask); |
| 663 | | if(data >= 0x20 && data < 0x7f) |
| 641 | verboselog(space->machine, 2, "scc68070_periphs_w: UART Transmit Holding Register: %04x & %04x: %c\n", data, mem_mask, (data >= 0x20 && data < 0x7f) ? (data & 0x00ff) : ' '); |
| 642 | if((data >= 0x20 && data < 0x7f) || data == 0x08) |
| 664 | 643 | { |
| 665 | 644 | printf( "%c", data & 0x00ff ); |
| 666 | 645 | } |
| 646 | if(data == 0x0d) |
| 647 | { |
| 648 | printf( "\n" ); |
| 649 | } |
| 667 | 650 | scc68070_regs.uart.transmit_holding_register = data & 0x00ff; |
| 668 | 651 | } |
| 669 | 652 | break; |
| r5914 | r5915 | |
| 869 | 852 | } |
| 870 | 853 | } |
| 871 | 854 | |
| 855 | #if ENABLE_UART_PRINTING |
| 856 | static READ16_HANDLER( uart_loopback_enable ) |
| 857 | { |
| 858 | return 0x1234; |
| 859 | } |
| 860 | #endif |
| 861 | |
| 862 | typedef struct |
| 863 | { |
| 864 | UINT16 unknown0x3ffa; |
| 865 | } cdic_regs_t; |
| 866 | |
| 867 | cdic_regs_t cdic_regs; |
| 868 | |
| 872 | 869 | static READ16_HANDLER( cdic_r ) |
| 873 | 870 | { |
| 871 | offset += 0x3c80/2; |
| 874 | 872 | verboselog(space->machine, 0, "cdic_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", offset*2, mem_mask); |
| 875 | | if(offset == 0x1400/2 || offset == 0x1402/2) |
| 873 | switch(offset) |
| 876 | 874 | { |
| 877 | | #if ENABLE_UART_PRINTING |
| 878 | | return 0x1234; |
| 879 | | #endif |
| 875 | case 0x3ffa/2: |
| 876 | return 0xd7fe; |
| 877 | default: |
| 878 | return 0; |
| 880 | 879 | } |
| 881 | | if(offset == 0x3ff6/2) |
| 882 | | { |
| 883 | | //return 0x8000; |
| 884 | | } |
| 885 | | if(offset == 0x3ffe/2) |
| 886 | | { |
| 887 | | //return 0x8000; |
| 888 | | } |
| 889 | | return cdic_ram[offset]; |
| 890 | 880 | } |
| 891 | 881 | |
| 892 | 882 | static WRITE16_HANDLER( cdic_w ) |
| 893 | 883 | { |
| 884 | offset += 0x3c80/2; |
| 894 | 885 | verboselog(space->machine, 0, "cdic_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", offset*2, data, mem_mask); |
| 895 | | //COMBINE_DATA(&cdic_ram[offset]); |
| 896 | 886 | } |
| 897 | 887 | |
| 898 | 888 | UINT8 slave_register; |
| r5914 | r5915 | |
| 900 | 890 | |
| 901 | 891 | static READ16_HANDLER( slave_r ) |
| 902 | 892 | { |
| 903 | | static UINT32 read_count = 0; |
| 904 | 893 | static UINT32 return_count = 0; |
| 905 | 894 | verboselog(space->machine, 0, "slave_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", offset*2, mem_mask); |
| 906 | 895 | if(offset == 0x00) |
| r5914 | r5915 | |
| 908 | 897 | switch(slave_register) |
| 909 | 898 | { |
| 910 | 899 | case 0xf7: |
| 911 | | switch(read_count) |
| 900 | { |
| 901 | static UINT16 x = 0; |
| 902 | static UINT16 y = 0; |
| 903 | static UINT8 bytes[4] = { 0, 0, 0, 0 }; |
| 904 | return_count %= 4; |
| 905 | if(return_count == 0) |
| 912 | 906 | { |
| 913 | | case 0: |
| 914 | | switch(return_count) |
| 915 | | { |
| 916 | | case 0: |
| 917 | | case 1: |
| 918 | | case 2: |
| 919 | | case 3: |
| 920 | | return_count++; |
| 921 | | if(return_count == 4) |
| 922 | | { |
| 923 | | read_count++; |
| 924 | | return_count = 0; |
| 925 | | } |
| 926 | | return 0; |
| 927 | | } |
| 928 | | break; |
| 929 | | case 1: |
| 930 | | switch(return_count) |
| 931 | | { |
| 932 | | case 0: |
| 933 | | return_count++; |
| 934 | | return 0x35; |
| 935 | | case 1: |
| 936 | | return_count++; |
| 937 | | return 0x0d; |
| 938 | | case 2: |
| 939 | | return_count++; |
| 940 | | return 0x03; |
| 941 | | case 3: |
| 942 | | return_count = 0; |
| 943 | | read_count = 0; |
| 944 | | return 0x70; |
| 945 | | } |
| 946 | | break; |
| 947 | | default: |
| 948 | | return 0; |
| 949 | | break; |
| 907 | x = input_port_read(space->machine, "MOUSEX"); |
| 908 | y = input_port_read(space->machine, "MOUSEY"); |
| 909 | bytes[0] = (x & 0x380) >> 7; |
| 910 | bytes[1] = x & 0x7f; |
| 911 | bytes[2] = (y & 0x380) >> 7; |
| 912 | bytes[3] = y & 0x7f; |
| 950 | 913 | } |
| 951 | | break; |
| 914 | return bytes[return_count++]; |
| 915 | } |
| 952 | 916 | default: |
| 953 | 917 | break; |
| 954 | 918 | } |
| 955 | 919 | return 0x0000; |
| 956 | 920 | } |
| 957 | | if(offset == 0x02) |
| 921 | else if(offset == 0x02) |
| 958 | 922 | { |
| 959 | 923 | if(slave_read_index == 0) |
| 960 | 924 | { |
| r5914 | r5915 | |
| 973 | 937 | } |
| 974 | 938 | } |
| 975 | 939 | } |
| 940 | else if(offset == 0x03) |
| 941 | { |
| 942 | switch(slave_register) |
| 943 | { |
| 944 | case 0xfa: |
| 945 | switch(slave_read_index) |
| 946 | { |
| 947 | case 0: |
| 948 | slave_read_index++; |
| 949 | return 0xa4; |
| 950 | case 1: |
| 951 | slave_read_index++; |
| 952 | return 0x7a; |
| 953 | case 2: |
| 954 | slave_read_index++; |
| 955 | return 0x3b; |
| 956 | case 3: |
| 957 | slave_read_index++; |
| 958 | if(slave_read_index == 4) |
| 959 | { |
| 960 | slave_read_index = 0; |
| 961 | } |
| 962 | return 0x1c; |
| 963 | default: |
| 964 | return 0; |
| 965 | } |
| 966 | break; |
| 967 | default: |
| 968 | break; |
| 969 | } |
| 970 | return 0x0000; |
| 971 | } |
| 976 | 972 | return 0; |
| 977 | 973 | } |
| 978 | 974 | |
| 979 | 975 | static WRITE16_HANDLER( slave_w ) |
| 980 | 976 | { |
| 981 | 977 | verboselog(space->machine, 0, "slave_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", offset*2, data, mem_mask); |
| 978 | if(offset == 0x00) |
| 979 | { |
| 980 | if(ACCESSING_BITS_0_7) |
| 981 | { |
| 982 | //if((data & 0x00ff) == 0xe3) |
| 983 | //{ |
| 984 | //slave_register = 0xf7; |
| 985 | //slave_read_index = 0; |
| 986 | //timer_adjust_oneshot(test_timer, ATTOTIME_IN_HZ(1), 0); |
| 987 | //} |
| 988 | } |
| 989 | } |
| 982 | 990 | if(offset == 0x03) |
| 983 | 991 | { |
| 984 | 992 | if(ACCESSING_BITS_0_7) |
| 985 | 993 | { |
| 986 | 994 | slave_register = data & 0x00ff; |
| 987 | 995 | slave_read_index = 0; |
| 988 | | if(slave_register == 0xf7) |
| 996 | if(slave_register == 0xf7) // Activate input polling? |
| 989 | 997 | { |
| 990 | | timer_adjust_oneshot(test_timer, ATTOTIME_IN_HZ(10000), 0); |
| 998 | timer_adjust_oneshot(mouse_timer, ATTOTIME_IN_HZ(60), 0); |
| 991 | 999 | } |
| 992 | 1000 | } |
| 993 | 1001 | } |
| r5914 | r5915 | |
| 1003 | 1011 | |
| 1004 | 1012 | static READ16_HANDLER( m48t08_r ) |
| 1005 | 1013 | { |
| 1006 | | verboselog(space->machine, 4, "m48t08_r: %04x = %02x & %04x\n", offset, m48t08.nvram[offset], mem_mask ); |
| 1014 | verboselog(space->machine, 11, "m48t08_r: %04x = %02x & %04x\n", offset, m48t08.nvram[offset], mem_mask ); |
| 1007 | 1015 | return m48t08.nvram[offset] << 8; |
| 1008 | 1016 | } |
| 1009 | 1017 | |
| 1010 | 1018 | static WRITE16_HANDLER( m48t08_w ) |
| 1011 | 1019 | { |
| 1012 | | verboselog(space->machine, 4, "m48t08_w: %04x = %02x\n", offset, data >> 8); |
| 1020 | verboselog(space->machine, 11, "m48t08_w: %04x = %02x\n", offset, data >> 8); |
| 1013 | 1021 | switch(offset) |
| 1014 | 1022 | { |
| 1015 | 1023 | case 0x1ff9: |
| r5914 | r5915 | |
| 1073 | 1081 | UINT16 ddr; |
| 1074 | 1082 | UINT16 dcp; |
| 1075 | 1083 | UINT32 clut[256]; |
| 1076 | | UINT8 image_coding_method; |
| 1077 | | UINT8 transparency_control; |
| 1078 | | UINT8 plane_order; |
| 1079 | | UINT8 clut_bank; |
| 1080 | | UINT8 transparent_color_a; |
| 1081 | | UINT8 reserved0; |
| 1082 | | UINT8 transparent_color_b; |
| 1083 | | UINT8 mask_color_a; |
| 1084 | | UINT8 reserved1; |
| 1085 | | UINT8 mask_color_b; |
| 1086 | | UINT8 dyuv_abs_start_a; |
| 1087 | | UINT8 dyuv_abs_start_b; |
| 1088 | | UINT8 reserved2; |
| 1089 | | UINT8 cursor_position; |
| 1090 | | UINT8 cursor_control; |
| 1091 | | UINT8 cursor_pattern[16]; |
| 1092 | | UINT8 region_control[8]; |
| 1093 | | UINT8 backdrop_color; |
| 1094 | | UINT8 mosaic_hold_a; |
| 1095 | | UINT8 mosaic_hold_b; |
| 1096 | | UINT8 weight_factor_a; |
| 1097 | | UINT8 weight_factor_b; |
| 1084 | UINT32 image_coding_method; |
| 1085 | UINT32 transparency_control; |
| 1086 | UINT32 plane_order; |
| 1087 | UINT32 clut_bank; |
| 1088 | UINT32 transparent_color_a; |
| 1089 | UINT32 reserved0; |
| 1090 | UINT32 transparent_color_b; |
| 1091 | UINT32 mask_color_a; |
| 1092 | UINT32 reserved1; |
| 1093 | UINT32 mask_color_b; |
| 1094 | UINT32 dyuv_abs_start_a; |
| 1095 | UINT32 dyuv_abs_start_b; |
| 1096 | UINT32 reserved2; |
| 1097 | UINT32 cursor_position; |
| 1098 | UINT32 cursor_control; |
| 1099 | UINT32 cursor_pattern[16]; |
| 1100 | UINT32 region_control[8]; |
| 1101 | UINT32 backdrop_color; |
| 1102 | UINT32 mosaic_hold_a; |
| 1103 | UINT32 mosaic_hold_b; |
| 1104 | UINT32 weight_factor_a; |
| 1105 | UINT32 weight_factor_b; |
| 1098 | 1106 | } mcd212_channel_t; |
| 1099 | 1107 | |
| 1100 | 1108 | typedef struct |
| r5914 | r5915 | |
| 1105 | 1113 | |
| 1106 | 1114 | mcd212_t mcd212; |
| 1107 | 1115 | |
| 1116 | #define MCD212_CURCNT_COLOR 0x00000f // Cursor color |
| 1117 | #define MCD212_CURCNT_CUW 0x008000 // Cursor width |
| 1118 | #define MCD212_CURCNT_COF 0x070000 // Cursor off time |
| 1119 | #define MCD212_CURCNT_COF_SHIFT 16 |
| 1120 | #define MCD212_CURCNT_CON 0x280000 // Cursor on time |
| 1121 | #define MCD212_CURCNT_CON_SHIFT 19 |
| 1122 | #define MCD212_CURCNT_BLKC 0x400000 // Blink type |
| 1123 | #define MCD212_CURCNT_EN 0x800000 // Cursor enable |
| 1124 | |
| 1108 | 1125 | #define MCD212_CSR2R_IT1 0x0004 // Interrupt 1 |
| 1109 | 1126 | #define MCD212_CSR2R_IT2 0x0002 // Interrupt 2 |
| 1110 | 1127 | #define MCD212_CSR2R_BE 0x0001 // Bus Error |
| r5914 | r5915 | |
| 1132 | 1149 | case 0x10/2: |
| 1133 | 1150 | if(ACCESSING_BITS_0_7) |
| 1134 | 1151 | { |
| 1135 | | verboselog(space->machine, 2, "mcd212_r: Status Register %d: %02x & %04x\n", channel + 1, mcd212.channel[1 - (offset / 8)].csrr, mem_mask); |
| 1152 | verboselog(space->machine, 11, "mcd212_r: Status Register %d: %02x & %04x\n", channel + 1, mcd212.channel[1 - (offset / 8)].csrr, mem_mask); |
| 1136 | 1153 | if(channel == 0) |
| 1137 | 1154 | { |
| 1138 | 1155 | return mcd212.channel[0].csrr | 0x20; |
| r5914 | r5915 | |
| 1307 | 1324 | case 0xcd: // Cursor Position |
| 1308 | 1325 | if(channel == 0) |
| 1309 | 1326 | { |
| 1310 | | verboselog(machine, 11, " %04xxxxx: %d: Cursor Position = %08x\n", channel * 0x20, channel, value ); |
| 1327 | verboselog(machine, 6, " %04xxxxx: %d: Cursor Position = %08x\n", channel * 0x20, channel, value ); |
| 1311 | 1328 | mcd212.channel[channel].cursor_position = value; |
| 1312 | 1329 | } |
| 1313 | 1330 | break; |
| r5914 | r5915 | |
| 1743 | 1760 | //mcd212_set_vsr(channel, vsr); |
| 1744 | 1761 | } |
| 1745 | 1762 | |
| 1763 | static void mcd212_draw_cursor(running_machine *machine, UINT32 *scanline, int y) |
| 1764 | { |
| 1765 | if(mcd212.channel[0].cursor_control & MCD212_CURCNT_EN) |
| 1766 | { |
| 1767 | UINT16 curx = mcd212.channel[0].cursor_position & 0x3ff; |
| 1768 | UINT16 cury = (mcd212.channel[0].cursor_position >> 12) & 0x3ff; |
| 1769 | UINT32 x = 0; |
| 1770 | cury += 22; |
| 1771 | if(y >= cury && y < (cury + 16)) |
| 1772 | { |
| 1773 | UINT32 color = 0; |
| 1774 | switch(mcd212.channel[0].cursor_control & MCD212_CURCNT_COLOR) |
| 1775 | { |
| 1776 | case 0x01: |
| 1777 | color = 0x0000007f; |
| 1778 | break; |
| 1779 | case 0x02: |
| 1780 | color = 0x00007f00; |
| 1781 | break; |
| 1782 | case 0x03: |
| 1783 | color = 0x00007f7f; |
| 1784 | break; |
| 1785 | case 0x04: |
| 1786 | color = 0x007f0000; |
| 1787 | break; |
| 1788 | case 0x05: |
| 1789 | color = 0x007f007f; |
| 1790 | break; |
| 1791 | case 0x06: |
| 1792 | color = 0x007f7f00; |
| 1793 | break; |
| 1794 | case 0x07: |
| 1795 | color = 0x007f7f7f; |
| 1796 | break; |
| 1797 | case 0x09: |
| 1798 | color = 0x000000ff; |
| 1799 | break; |
| 1800 | case 0x0a: |
| 1801 | color = 0x0000ff00; |
| 1802 | break; |
| 1803 | case 0x0b: |
| 1804 | color = 0x0000ffff; |
| 1805 | break; |
| 1806 | case 0x0c: |
| 1807 | color = 0x00ff0000; |
| 1808 | break; |
| 1809 | case 0x0d: |
| 1810 | color = 0x00ff00ff; |
| 1811 | break; |
| 1812 | case 0x0e: |
| 1813 | color = 0x00ffff00; |
| 1814 | break; |
| 1815 | case 0x0f: |
| 1816 | color = 0x00ffffff; |
| 1817 | break; |
| 1818 | } |
| 1819 | y -= cury; |
| 1820 | for(x = curx; x < curx + 16; x++) |
| 1821 | { |
| 1822 | if(mcd212.channel[0].cursor_pattern[y] & (1 << (15 - (x - curx)))) |
| 1823 | { |
| 1824 | scanline[x] = color; |
| 1825 | } |
| 1826 | else |
| 1827 | { |
| 1828 | } |
| 1829 | } |
| 1830 | } |
| 1831 | } |
| 1832 | } |
| 1833 | |
| 1746 | 1834 | static void mcd212_draw_scanline(running_machine *machine, int y) |
| 1747 | 1835 | { |
| 1748 | 1836 | bitmap_t *bitmap = tmpbitmap; |
| r5914 | r5915 | |
| 1750 | 1838 | UINT32 plane_b[768]; |
| 1751 | 1839 | UINT32 *scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 1752 | 1840 | int x; |
| 1753 | | //prinf( "y=%d, m |
| 1754 | 1841 | mcd212_process_vsr(machine, 0, plane_a); |
| 1755 | 1842 | mcd212_process_vsr(machine, 1, plane_b); |
| 1756 | 1843 | for(x = 0; x < 768; x++) |
| 1757 | 1844 | { |
| 1758 | 1845 | scanline[x] = plane_a[x]; |
| 1759 | 1846 | } |
| 1847 | mcd212_draw_cursor(machine, scanline, y); |
| 1760 | 1848 | } |
| 1761 | 1849 | |
| 1762 | 1850 | TIMER_CALLBACK( mcd212_perform_scan ) |
| r5914 | r5915 | |
| 1807 | 1895 | timer_adjust_oneshot(mcd212.scan_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); |
| 1808 | 1896 | } |
| 1809 | 1897 | |
| 1898 | TIMER_CALLBACK( test_timer_callback ) |
| 1899 | { |
| 1900 | // This function manually triggers interrupt requests as a test. |
| 1901 | static UINT8 set = 0; |
| 1902 | if(set == 0) |
| 1903 | { |
| 1904 | set = 1; |
| 1905 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_2, 26); |
| 1906 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, ASSERT_LINE); |
| 1907 | timer_adjust_oneshot(test_timer, ATTOTIME_IN_HZ(10000), 0); |
| 1908 | } |
| 1909 | else |
| 1910 | { |
| 1911 | set = 0; |
| 1912 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, CLEAR_LINE); |
| 1913 | timer_adjust_oneshot(test_timer, ATTOTIME_IN_HZ(60), 0); |
| 1914 | } |
| 1915 | } |
| 1916 | |
| 1810 | 1917 | /************************* |
| 1918 | * Input functions * |
| 1919 | *************************/ |
| 1920 | |
| 1921 | TIMER_CALLBACK( mouse_callback ) |
| 1922 | { |
| 1923 | static UINT8 set = 0; |
| 1924 | if(set == 0) |
| 1925 | { |
| 1926 | set = 1; |
| 1927 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_2, 26); |
| 1928 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, ASSERT_LINE); |
| 1929 | timer_adjust_oneshot(mouse_timer, ATTOTIME_IN_HZ(10000), 0); |
| 1930 | slave_register = 0xf7; |
| 1931 | } |
| 1932 | else |
| 1933 | { |
| 1934 | set = 0; |
| 1935 | cputag_set_input_line(machine, "maincpu", M68K_IRQ_2, CLEAR_LINE); |
| 1936 | timer_adjust_oneshot(mouse_timer, ATTOTIME_IN_HZ(60), 0); |
| 1937 | } |
| 1938 | } |
| 1939 | |
| 1940 | /************************* |
| 1811 | 1941 | * Memory maps * |
| 1812 | 1942 | *************************/ |
| 1813 | 1943 | |
| 1814 | 1944 | static ADDRESS_MAP_START( cdi_mem, ADDRESS_SPACE_PROGRAM, 16 ) |
| 1815 | 1945 | AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE(&planea) |
| 1816 | 1946 | AM_RANGE(0x00200000, 0x0027ffff) AM_RAM AM_BASE(&planeb) |
| 1817 | | AM_RANGE(0x00300000, 0x00303fff) AM_READWRITE(cdic_r, cdic_w) AM_BASE(&cdic_ram) |
| 1947 | #if ENABLE_UART_PRINTING |
| 1948 | AM_RANGE(0x00301400, 0x00301403) AM_READ(uart_loopback_enable) |
| 1949 | AM_RANGE(0x00301404, 0x00303c7f) AM_RAM |
| 1950 | #else |
| 1951 | AM_RANGE(0x00301400, 0x00303c7f) AM_RAM |
| 1952 | #endif |
| 1953 | AM_RANGE(0x00303c80, 0x00303fff) AM_READWRITE(cdic_r, cdic_w) |
| 1818 | 1954 | AM_RANGE(0x00310000, 0x00317fff) AM_READWRITE(slave_r, slave_w) |
| 1819 | 1955 | //AM_RANGE(0x00318000, 0x0031ffff) AM_NOP |
| 1820 | 1956 | AM_RANGE(0x00320000, 0x00323fff) AM_READWRITE(m48t08_r, m48t08_w) |
| r5914 | r5915 | |
| 1830 | 1966 | *************************/ |
| 1831 | 1967 | |
| 1832 | 1968 | static INPUT_PORTS_START( cdi ) |
| 1969 | PORT_START("MOUSEX") |
| 1970 | PORT_BIT(0x3ff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) |
| 1971 | |
| 1972 | PORT_START("MOUSEY") |
| 1973 | PORT_BIT(0x3ff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) |
| 1833 | 1974 | INPUT_PORTS_END |
| 1834 | 1975 | |
| 1835 | 1976 | static MACHINE_RESET( cdi ) |
| r5914 | r5915 | |
| 1848 | 1989 | test_timer = timer_alloc(machine, test_timer_callback, 0); |
| 1849 | 1990 | timer_adjust_oneshot(test_timer, attotime_never, 0); |
| 1850 | 1991 | |
| 1992 | mouse_timer = timer_alloc(machine, mouse_callback, 0); |
| 1993 | timer_adjust_oneshot(mouse_timer, attotime_never, 0); |
| 1994 | |
| 1851 | 1995 | device_reset(cputag_get_cpu(machine, "maincpu")); |
| 1852 | 1996 | } |
| 1853 | 1997 | |
| r5914 | r5915 | |
| 1906 | 2050 | *************************/ |
| 1907 | 2051 | |
| 1908 | 2052 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 1909 | | CONS( 1991, cdi, 0, 0, cdi, 0, 0, 0, "Philips", "CD-i", GAME_NO_SOUND | GAME_NOT_WORKING ) |
| 2053 | CONS( 1991, cdi, 0, 0, cdi, cdi, 0, 0, "Philips", "CD-i", GAME_NO_SOUND | GAME_NOT_WORKING ) |