src/mess/drivers/saturn.c
| r3830 | r3831 | |
| 257 | 257 | int minit_boost,sinit_boost; |
| 258 | 258 | attotime minit_boost_timeslice, sinit_boost_timeslice; |
| 259 | 259 | |
| 260 | | static int scanline; |
| 260 | //static int scanline; |
| 261 | 261 | |
| 262 | /*A-Bus IRQ checks,where they could be located these?*/ |
| 263 | #define ABUSIRQ(_irq_,_vector_) \ |
| 264 | { cpu_set_input_line_and_vector(device->machine->cpu[0], _irq_, HOLD_LINE , _vector_); } |
| 262 | 265 | #if 0 |
| 263 | | /*A-Bus IRQ checks,where they could be located these?*/ |
| 264 | | #define ABUSIRQ(_irq_,_vector_,_mask_) \ |
| 265 | | if(!(stv_scu[40] & _mask_)) { cpu_set_input_line_and_vector(Machine->cpu[0], _irq_, HOLD_LINE , _vector_); } |
| 266 | | |
| 267 | 266 | if(stv_scu[42] & 1)//IRQ ACK |
| 268 | 267 | { |
| 269 | 268 | ABUSIRQ(7,0x50,0x00010000); |
| r3830 | r3831 | |
| 629 | 628 | if(EXLE1 || EXLE2) |
| 630 | 629 | if(!(stv_scu[40] & 0x0100)) /*Pad irq*/ |
| 631 | 630 | { |
| 632 | | if(LOG_SMPC) logerror ("Interrupt: PAD irq at scanline %04x, Vector 0x48 Level 0x08\n",scanline); |
| 631 | if(LOG_SMPC) logerror ("Interrupt: PAD irq, Vector 0x48 Level 0x08\n"); |
| 633 | 632 | cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x48); |
| 634 | 633 | } |
| 635 | 634 | } |
| r3830 | r3831 | |
| 836 | 835 | |
| 837 | 836 | |
| 838 | 837 | /* |
| 839 | | (Preliminary) explaination about this: |
| 840 | | VBLANK-OUT is used at the start of the vblank period.It also sets the timer zero |
| 841 | | variable to 0. |
| 842 | | If the Timer Compare register is zero too,the Timer 0 irq is triggered. |
| 843 | 838 | |
| 844 | | HBLANK-IN is used at the end of each scanline except when in VBLANK-IN/OUT periods. |
| 845 | | |
| 846 | | The timer 0 is also incremented by one at each HBLANK and checked with the value |
| 847 | | of the Timer Compare register;if equal,the timer 0 irq is triggered here too. |
| 848 | | Notice that the timer 0 compare register can be more than the VBLANK maximum range,in |
| 849 | | this case the timer 0 irq is simply never triggered.This is a known Sega Saturn/ST-V "bug". |
| 850 | | |
| 851 | | VBLANK-IN is used at the end of the vblank period. |
| 852 | | |
| 853 | | SCU register[36] is the timer zero compare register. |
| 854 | | SCU register[40] is for IRQ masking. |
| 855 | | */ |
| 856 | | |
| 857 | | /* to do, update bios idle skips so they work better with this arrangement.. */ |
| 858 | | |
| 859 | | static emu_timer *vblank_in_timer,*scan_timer,*t1_timer; |
| 860 | | static int h_sync,v_sync; |
| 861 | | static int cur_scan; |
| 862 | | |
| 863 | | #define VBLANK_OUT_IRQ \ |
| 864 | | timer_0 = 0; \ |
| 865 | | { \ |
| 866 | | /*if(LOG_IRQ) logerror ("Interrupt: VBlank-OUT Vector 0x41 Level 0x0e\n");*/ \ |
| 867 | | cpu_set_input_line_and_vector(device->machine->cpu[0], 0xe, (stv_irq.vblank_out) ? HOLD_LINE : CLEAR_LINE , 0x41); \ |
| 868 | | } \ |
| 869 | | |
| 870 | | #define VBLANK_IN_IRQ \ |
| 871 | | { \ |
| 872 | | /*if(LOG_IRQ) logerror ("Interrupt: VBlank IN Vector 0x40 Level 0x0f\n");*/ \ |
| 873 | | cpu_set_input_line_and_vector(machine->cpu[0], 0xf, (stv_irq.vblank_in) ? HOLD_LINE : CLEAR_LINE , 0x40); \ |
| 874 | | } \ |
| 875 | | |
| 876 | | #define HBLANK_IN_IRQ \ |
| 877 | | timer_1 = stv_scu[37] & 0x1ff; \ |
| 878 | | { \ |
| 879 | | /*if(LOG_IRQ) logerror ("Interrupt: HBlank-In at scanline %04x, Vector 0x42 Level 0x0d\n",scanline);*/ \ |
| 880 | | cpu_set_input_line_and_vector(machine->cpu[0], 0xd, (stv_irq.hblank_in) ? HOLD_LINE : CLEAR_LINE, 0x42); \ |
| 881 | | } \ |
| 882 | | |
| 883 | | #define TIMER_0_IRQ \ |
| 884 | | if(timer_0 == (stv_scu[36] & 0x3ff)) \ |
| 885 | | { \ |
| 886 | | /*if(LOG_IRQ) logerror ("Interrupt: Timer 0 at scanline %04x, Vector 0x43 Level 0x0c\n",scanline);*/ \ |
| 887 | | cpu_set_input_line_and_vector(machine->cpu[0], 0xc, (stv_irq.timer_0) ? HOLD_LINE : CLEAR_LINE, 0x43 ); \ |
| 888 | | } \ |
| 889 | | |
| 890 | | #define TIMER_1_IRQ \ |
| 891 | | if((stv_scu[38] & 1)) \ |
| 892 | | { \ |
| 893 | | if(!(stv_scu[38] & 0x80)) \ |
| 894 | | { \ |
| 895 | | /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \ |
| 896 | | cpu_set_input_line_and_vector(machine->cpu[0], 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \ |
| 897 | | } \ |
| 898 | | else \ |
| 899 | | { \ |
| 900 | | if((timer_0) == (stv_scu[36] & 0x3ff)) \ |
| 901 | | { \ |
| 902 | | /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \ |
| 903 | | cpu_set_input_line_and_vector(machine->cpu[0], 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \ |
| 904 | | } \ |
| 905 | | } \ |
| 906 | | } \ |
| 907 | | |
| 908 | | #define VDP1_IRQ \ |
| 909 | | { \ |
| 910 | | cpu_set_input_line_and_vector(machine->cpu[0], 2, (stv_irq.vdp1_end) ? HOLD_LINE : CLEAR_LINE, 0x4d); \ |
| 911 | | } \ |
| 912 | | |
| 913 | | static TIMER_CALLBACK( hblank_in_irq ) |
| 914 | | { |
| 915 | | int scanline = param; |
| 916 | | |
| 917 | | // h = video_screen_get_height(machine->primary_screen); |
| 918 | | // w = video_screen_get_width(machine->primary_screen); |
| 919 | | |
| 920 | | TIMER_0_IRQ; |
| 921 | | HBLANK_IN_IRQ; |
| 922 | | |
| 923 | | if((scanline+1) < v_sync) |
| 924 | | { |
| 925 | | timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline+1, h_sync), scanline+1); |
| 926 | | /*set the first Timer-1 event*/ |
| 927 | | cur_scan = scanline+1; |
| 928 | | timer_adjust_oneshot(t1_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline+1, 0), 0); |
| 929 | | } |
| 930 | | |
| 931 | | timer_0++; |
| 932 | | } |
| 933 | | |
| 934 | | static TIMER_CALLBACK( timer1_irq ) |
| 935 | | { |
| 936 | | int cur_point = param; |
| 937 | | |
| 938 | | TIMER_1_IRQ; |
| 939 | | |
| 940 | | if((cur_point+1) < h_sync) |
| 941 | | { |
| 942 | | timer_adjust_oneshot(t1_timer, video_screen_get_time_until_pos(machine->primary_screen, cur_scan, cur_point+1), cur_point+1); |
| 943 | | } |
| 944 | | |
| 945 | | if(timer_1 > 0) timer_1--; |
| 946 | | } |
| 947 | | |
| 948 | | static TIMER_CALLBACK( vdp1_irq ) |
| 949 | | { |
| 950 | | VDP1_IRQ; |
| 951 | | } |
| 952 | | |
| 953 | | static TIMER_CALLBACK( vblank_in_irq ) |
| 954 | | { |
| 955 | | VBLANK_IN_IRQ; |
| 956 | | } |
| 957 | | |
| 958 | | /*V-Blank-OUT event*/ |
| 959 | | static INTERRUPT_GEN( stv_interrupt ) |
| 960 | | { |
| 961 | | // scanline = 0; |
| 962 | | h_sync = video_screen_get_height(device->machine->primary_screen)/2;//horz |
| 963 | | v_sync = video_screen_get_width(device->machine->primary_screen)-2;//vert |
| 964 | | |
| 965 | | VBLANK_OUT_IRQ; |
| 966 | | |
| 967 | | /*Next V-Blank-IN event*/ |
| 968 | | timer_adjust_oneshot(vblank_in_timer,video_screen_get_time_until_pos(device->machine->primary_screen, 0, 0), 0); |
| 969 | | /*Set the first Hblank-IN event*/ |
| 970 | | timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(device->machine->primary_screen, 0, h_sync), 0); |
| 971 | | |
| 972 | | /*TODO: timing of this one (related to the VDP1 speed)*/ |
| 973 | | /* (NOTE: value shouldn't be at h_sync/v_sync position (will break shienryu))*/ |
| 974 | | timer_set(device->machine, video_screen_get_time_until_pos(device->machine->primary_screen,0,0), NULL, 0, vdp1_irq); |
| 975 | | } |
| 976 | | |
| 977 | | static UINT8 port_sel,mux_data; |
| 978 | | |
| 979 | | #define HI_WORD_ACCESS (~mem_mask & 0x00ff0000) == 0 |
| 980 | | #define LO_WORD_ACCESS (~mem_mask & 0x000000ff) == 0 |
| 981 | | |
| 982 | | /* |
| 983 | | |
| 984 | 839 | SCU Handling |
| 985 | 840 | |
| 986 | 841 | */ |
| r3830 | r3831 | |
| 1113 | 968 | if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(space->cpu)); |
| 1114 | 969 | return stv_scu[offset]; |
| 1115 | 970 | } |
| 971 | // Saturn BIOS needs this (need to investigate further) |
| 972 | else if (offset == 32) |
| 973 | { |
| 974 | return 0x00100000; |
| 975 | } |
| 1116 | 976 | else if ( offset == 35 ) |
| 1117 | 977 | { |
| 1118 | 978 | if(LOG_SCU) logerror( "DSP mem read at %08X\n", stv_scu[34]); |
| r3830 | r3831 | |
| 1366 | 1226 | stv_irq.sound_req = (((stv_scu[40] & 0x0040)>>6) ^ 1); |
| 1367 | 1227 | stv_irq.smpc = (((stv_scu[40] & 0x0080)>>7)); //NOTE: SCU bug |
| 1368 | 1228 | stv_irq.pad = (((stv_scu[40] & 0x0100)>>8) ^ 1); |
| 1369 | | stv_irq.dma_end[0] = (((stv_scu[40] & 0x0200)>>9) ^ 1); |
| 1229 | stv_irq.dma_end[2] = (((stv_scu[40] & 0x0200)>>9) ^ 1); |
| 1370 | 1230 | stv_irq.dma_end[1] = (((stv_scu[40] & 0x0400)>>10) ^ 1); |
| 1371 | | stv_irq.dma_end[2] = (((stv_scu[40] & 0x0800)>>11) ^ 1); |
| 1231 | stv_irq.dma_end[0] = (((stv_scu[40] & 0x0800)>>11) ^ 1); |
| 1372 | 1232 | stv_irq.dma_ill = (((stv_scu[40] & 0x1000)>>12) ^ 1); |
| 1373 | 1233 | stv_irq.vdp1_end = (((stv_scu[40] & 0x2000)>>13) ^ 1); |
| 1374 | 1234 | stv_irq.abus = (((stv_scu[40] & 0x8000)>>15) ^ 1); |
| r3830 | r3831 | |
| 1413 | 1273 | stv_irq.sound_req = ((stv_scu[41] & 0x0040)>>6); |
| 1414 | 1274 | stv_irq.smpc = ((stv_scu[41] & 0x0080)>>7); |
| 1415 | 1275 | stv_irq.pad = ((stv_scu[41] & 0x0100)>>8); |
| 1416 | | stv_irq.dma_end[0] = ((stv_scu[41] & 0x0200)>>9); |
| 1276 | stv_irq.dma_end[2] = ((stv_scu[41] & 0x0200)>>9); |
| 1417 | 1277 | stv_irq.dma_end[1] = ((stv_scu[41] & 0x0400)>>10); |
| 1418 | | stv_irq.dma_end[2] = ((stv_scu[41] & 0x0800)>>11); |
| 1278 | stv_irq.dma_end[0] = ((stv_scu[41] & 0x0800)>>11); |
| 1419 | 1279 | stv_irq.dma_ill = ((stv_scu[41] & 0x1000)>>12); |
| 1420 | 1280 | stv_irq.vdp1_end = ((stv_scu[41] & 0x2000)>>13); |
| 1421 | 1281 | stv_irq.abus = ((stv_scu[41] & 0x8000)>>15); |
| r3830 | r3831 | |
| 2174 | 2034 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("P2 R") PORT_PLAYER(2) // R |
| 2175 | 2035 | INPUT_PORTS_END |
| 2176 | 2036 | |
| 2037 | /* |
| 2038 | (Preliminary) explaination about this: |
| 2039 | VBLANK-OUT is used at the start of the vblank period.It also sets the timer zero |
| 2040 | variable to 0. |
| 2041 | If the Timer Compare register is zero too,the Timer 0 irq is triggered. |
| 2042 | |
| 2043 | HBLANK-IN is used at the end of each scanline except when in VBLANK-IN/OUT periods. |
| 2044 | |
| 2045 | The timer 0 is also incremented by one at each HBLANK and checked with the value |
| 2046 | of the Timer Compare register;if equal,the timer 0 irq is triggered here too. |
| 2047 | Notice that the timer 0 compare register can be more than the VBLANK maximum range,in |
| 2048 | this case the timer 0 irq is simply never triggered.This is a known Sega Saturn/ST-V "bug". |
| 2049 | |
| 2050 | VBLANK-IN is used at the end of the vblank period. |
| 2051 | |
| 2052 | SCU register[36] is the timer zero compare register. |
| 2053 | SCU register[40] is for IRQ masking. |
| 2054 | */ |
| 2055 | |
| 2056 | /* to do, update bios idle skips so they work better with this arrangement.. */ |
| 2057 | |
| 2058 | static emu_timer *vblank_out_timer,*scan_timer,*t1_timer; |
| 2059 | static int h_sync,v_sync; |
| 2060 | static int cur_scan; |
| 2061 | |
| 2062 | #define VBLANK_OUT_IRQ \ |
| 2063 | timer_0 = 0; \ |
| 2064 | { \ |
| 2065 | /*if(LOG_IRQ) logerror ("Interrupt: VBlank-OUT Vector 0x41 Level 0x0e\n");*/ \ |
| 2066 | cpu_set_input_line_and_vector(machine->cpu[0], 0xe, (stv_irq.vblank_out) ? HOLD_LINE : CLEAR_LINE , 0x41); \ |
| 2067 | } \ |
| 2068 | |
| 2069 | #define VBLANK_IN_IRQ \ |
| 2070 | { \ |
| 2071 | /*if(LOG_IRQ) logerror ("Interrupt: VBlank IN Vector 0x40 Level 0x0f\n");*/ \ |
| 2072 | cpu_set_input_line_and_vector(device->machine->cpu[0], 0xf, (stv_irq.vblank_in) ? HOLD_LINE : CLEAR_LINE , 0x40); \ |
| 2073 | } \ |
| 2074 | |
| 2075 | #define HBLANK_IN_IRQ \ |
| 2076 | timer_1 = stv_scu[37] & 0x1ff; \ |
| 2077 | { \ |
| 2078 | /*if(LOG_IRQ) logerror ("Interrupt: HBlank-In at scanline %04x, Vector 0x42 Level 0x0d\n",scanline);*/ \ |
| 2079 | cpu_set_input_line_and_vector(machine->cpu[0], 0xd, (stv_irq.hblank_in) ? HOLD_LINE : CLEAR_LINE, 0x42); \ |
| 2080 | } \ |
| 2081 | |
| 2082 | #define TIMER_0_IRQ \ |
| 2083 | if(timer_0 == (stv_scu[36] & 0x3ff)) \ |
| 2084 | { \ |
| 2085 | /*if(LOG_IRQ) logerror ("Interrupt: Timer 0 at scanline %04x, Vector 0x43 Level 0x0c\n",scanline);*/ \ |
| 2086 | cpu_set_input_line_and_vector(machine->cpu[0], 0xc, (stv_irq.timer_0) ? HOLD_LINE : CLEAR_LINE, 0x43 ); \ |
| 2087 | } \ |
| 2088 | |
| 2089 | #define TIMER_1_IRQ \ |
| 2090 | if((stv_scu[38] & 1)) \ |
| 2091 | { \ |
| 2092 | if(!(stv_scu[38] & 0x80)) \ |
| 2093 | { \ |
| 2094 | /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \ |
| 2095 | cpu_set_input_line_and_vector(machine->cpu[0], 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \ |
| 2096 | } \ |
| 2097 | else \ |
| 2098 | { \ |
| 2099 | if((timer_0) == (stv_scu[36] & 0x3ff)) \ |
| 2100 | { \ |
| 2101 | /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \ |
| 2102 | cpu_set_input_line_and_vector(machine->cpu[0], 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \ |
| 2103 | } \ |
| 2104 | } \ |
| 2105 | } \ |
| 2106 | |
| 2107 | #define VDP1_IRQ \ |
| 2108 | { \ |
| 2109 | cpu_set_input_line_and_vector(machine->cpu[0], 2, (stv_irq.vdp1_end) ? HOLD_LINE : CLEAR_LINE, 0x4d); \ |
| 2110 | } \ |
| 2111 | |
| 2112 | static TIMER_CALLBACK( hblank_in_irq ) |
| 2113 | { |
| 2114 | int scanline = param; |
| 2115 | |
| 2116 | // h = video_screen_get_height(machine->primary_screen); |
| 2117 | // w = video_screen_get_width(machine->primary_screen); |
| 2118 | |
| 2119 | HBLANK_IN_IRQ; |
| 2120 | TIMER_0_IRQ; |
| 2121 | |
| 2122 | if(scanline+1 < v_sync) |
| 2123 | { |
| 2124 | if(stv_irq.hblank_in || stv_irq.timer_0) |
| 2125 | timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline+1, h_sync), scanline+1); |
| 2126 | /*set the first Timer-1 event*/ |
| 2127 | cur_scan = scanline+1; |
| 2128 | if(stv_irq.timer_1) |
| 2129 | timer_adjust_oneshot(t1_timer, video_screen_get_time_until_pos(machine->primary_screen, scanline+1, 0), 0); |
| 2130 | } |
| 2131 | |
| 2132 | timer_0++; |
| 2133 | } |
| 2134 | |
| 2135 | static TIMER_CALLBACK( timer1_irq ) |
| 2136 | { |
| 2137 | int cur_point = param; |
| 2138 | |
| 2139 | TIMER_1_IRQ; |
| 2140 | |
| 2141 | if((cur_point+1) < h_sync && stv_irq.timer_1) |
| 2142 | { |
| 2143 | timer_adjust_oneshot(t1_timer, video_screen_get_time_until_pos(machine->primary_screen, cur_scan, cur_point+1), cur_point+1); |
| 2144 | } |
| 2145 | |
| 2146 | if(timer_1 > 0) timer_1--; |
| 2147 | } |
| 2148 | |
| 2149 | static TIMER_CALLBACK( vdp1_irq ) |
| 2150 | { |
| 2151 | VDP1_IRQ; |
| 2152 | } |
| 2153 | |
| 2154 | static TIMER_CALLBACK( vblank_out_irq ) |
| 2155 | { |
| 2156 | VBLANK_OUT_IRQ; |
| 2157 | } |
| 2158 | |
| 2159 | /*V-Blank-IN event*/ |
| 2160 | static INTERRUPT_GEN( stv_interrupt ) |
| 2161 | { |
| 2162 | // scanline = 0; |
| 2163 | rectangle visarea = *video_screen_get_visible_area(device->machine->primary_screen); |
| 2164 | |
| 2165 | h_sync = visarea.max_x+1;//horz |
| 2166 | v_sync = visarea.max_y+1;//vert |
| 2167 | |
| 2168 | VBLANK_IN_IRQ; |
| 2169 | |
| 2170 | /*Next V-Blank-OUT event*/ |
| 2171 | if(stv_irq.vblank_out) |
| 2172 | timer_adjust_oneshot(vblank_out_timer,video_screen_get_time_until_pos(device->machine->primary_screen, 0, 0), 0); |
| 2173 | /*Set the first Hblank-IN event*/ |
| 2174 | if(stv_irq.hblank_in || stv_irq.timer_0 || stv_irq.timer_1) |
| 2175 | timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(device->machine->primary_screen, 0, h_sync), 0); |
| 2176 | |
| 2177 | /*TODO: timing of this one (related to the VDP1 speed)*/ |
| 2178 | /* (NOTE: value shouldn't be at h_sync/v_sync position (will break shienryu))*/ |
| 2179 | timer_set(device->machine, video_screen_get_time_until_pos(device->machine->primary_screen,0,0), NULL, 0, vdp1_irq); |
| 2180 | } |
| 2181 | |
| 2177 | 2182 | static void saturn_init_driver(running_machine *machine, int rgn) |
| 2178 | 2183 | { |
| 2179 | 2184 | mame_system_time systime; |
| r3830 | r3831 | |
| 2242 | 2247 | state_save_register_global(machine, en_68k); |
| 2243 | 2248 | state_save_register_global(machine, timer_0); |
| 2244 | 2249 | state_save_register_global(machine, timer_1); |
| 2245 | | state_save_register_global(machine, scanline); |
| 2246 | 2250 | state_save_register_global(machine, IOSEL1); |
| 2247 | 2251 | state_save_register_global(machine, IOSEL2); |
| 2248 | 2252 | state_save_register_global(machine, EXLE1); |
| 2249 | 2253 | state_save_register_global(machine, EXLE2); |
| 2250 | 2254 | state_save_register_global(machine, PDR1); |
| 2251 | 2255 | state_save_register_global(machine, PDR2); |
| 2252 | | state_save_register_global(machine, port_sel); |
| 2253 | | state_save_register_global(machine, mux_data); |
| 2256 | // state_save_register_global(machine, port_sel); |
| 2257 | // state_save_register_global(machine, mux_data); |
| 2254 | 2258 | state_save_register_global(machine, scsp_last_line); |
| 2255 | 2259 | state_save_register_global(machine, intback_stage); |
| 2256 | 2260 | state_save_register_global(machine, pmode); |
| r3830 | r3831 | |
| 2289 | 2293 | /* set the first scanline 0 timer to go off */ |
| 2290 | 2294 | scan_timer = timer_alloc(machine, hblank_in_irq, NULL); |
| 2291 | 2295 | t1_timer = timer_alloc(machine, timer1_irq,NULL); |
| 2292 | | vblank_in_timer = timer_alloc(machine, vblank_in_irq,NULL); |
| 2293 | | timer_adjust_oneshot(vblank_in_timer,video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); |
| 2296 | vblank_out_timer = timer_alloc(machine, vblank_out_irq,NULL); |
| 2297 | timer_adjust_oneshot(vblank_out_timer,video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); |
| 2294 | 2298 | timer_adjust_oneshot(scan_timer, video_screen_get_time_until_pos(machine->primary_screen, 224, 352), 0); |
| 2295 | 2299 | } |
| 2296 | 2300 | |
| r3830 | r3831 | |
| 2402 | 2406 | /* basic machine hardware */ |
| 2403 | 2407 | MDRV_CPU_ADD("main", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz |
| 2404 | 2408 | MDRV_CPU_PROGRAM_MAP(saturn_mem, 0) |
| 2405 | | MDRV_CPU_VBLANK_INT_HACK(stv_interrupt, 264)/*264 lines,224 display lines*/ |
| 2409 | MDRV_CPU_VBLANK_INT("main",stv_interrupt) |
| 2406 | 2410 | MDRV_CPU_CONFIG(sh2_conf_master) |
| 2407 | 2411 | |
| 2408 | 2412 | MDRV_CPU_ADD("slave", SH2, MASTER_CLOCK_352/2) // 28.6364 MHz |
| r3830 | r3831 | |
| 2423 | 2427 | |
| 2424 | 2428 | /* video hardware */ |
| 2425 | 2429 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15) |
| 2426 | | MDRV_SCREEN_SIZE(1024, 1024) |
| 2427 | | MDRV_SCREEN_VISIBLE_AREA(0*8, 703, 0*8, 512) // we need to use a resolution as high as the max size it can change to |
| 2430 | MDRV_SCREEN_SIZE(704*2, 512*2) |
| 2431 | MDRV_SCREEN_VISIBLE_AREA(0*8, 703, 0*8, 511) // we need to use a resolution as high as the max size it can change to |
| 2428 | 2432 | MDRV_PALETTE_LENGTH(2048+(2048*2))//standard palette + extra memory for rgb brightness. |
| 2429 | 2433 | MDRV_GFXDECODE(saturn) |
| 2430 | 2434 | |