trunk/src/mame/drivers/ddenlovr.c
| r243093 | r243094 | |
| 110 | 110 | #include "cpu/m68000/m68000.h" |
| 111 | 111 | #include "cpu/z80/z80.h" |
| 112 | 112 | #include "sound/ay8910.h" |
| 113 | #include "sound/okim6295.h" |
| 114 | #include "sound/2413intf.h" |
| 113 | 115 | #include "machine/msm6242.h" |
| 114 | 116 | #include "machine/nvram.h" |
| 115 | 117 | #include "includes/dynax.h" |
| r243093 | r243094 | |
| 151 | 153 | { |
| 152 | 154 | public: |
| 153 | 155 | ddenlovr_state(const machine_config &mconfig, device_type type, const char *tag) |
| 154 | | : dynax_state(mconfig, type, tag), |
| 155 | | m_dsw_sel16(*this, "dsw_sel16"), |
| 156 | | m_protection1(*this, "protection1"), |
| 157 | | m_protection2(*this, "protection2") { } |
| 158 | | |
| 156 | : dynax_state(mconfig, type, tag) |
| 157 | { } |
| 159 | 158 | |
| 160 | | optional_shared_ptr<UINT16> m_dsw_sel16; |
| 161 | | optional_shared_ptr<UINT16> m_protection1; |
| 162 | | optional_shared_ptr<UINT16> m_protection2; |
| 163 | | |
| 164 | | |
| 165 | | UINT8 * m_ddenlovr_pixmap[8]; |
| 166 | | |
| 167 | | /* blitter (TODO: merge with the dynax.h, where possible) */ |
| 168 | | int m_extra_layers; |
| 169 | | int m_ddenlovr_dest_layer; |
| 170 | | int m_ddenlovr_blit_flip; |
| 171 | | int m_ddenlovr_blit_x; |
| 172 | | int m_ddenlovr_blit_y; |
| 173 | | int m_ddenlovr_blit_address; |
| 174 | | int m_ddenlovr_blit_pen; |
| 175 | | int m_ddenlovr_blit_pen_mode; |
| 176 | | int m_ddenlovr_blitter_irq_flag; |
| 177 | | int m_ddenlovr_blitter_irq_enable; |
| 178 | | int m_ddenlovr_rect_width; |
| 179 | | int m_ddenlovr_rect_height; |
| 180 | | int m_ddenlovr_clip_width; |
| 181 | | int m_ddenlovr_clip_height; |
| 182 | | int m_ddenlovr_line_length; |
| 183 | | int m_ddenlovr_clip_ctrl; |
| 184 | | int m_ddenlovr_clip_x; |
| 185 | | int m_ddenlovr_clip_y; |
| 186 | | int m_ddenlovr_scroll[8*2]; |
| 187 | | int m_ddenlovr_priority; |
| 188 | | int m_ddenlovr_priority2; |
| 189 | | int m_ddenlovr_bgcolor; |
| 190 | | int m_ddenlovr_bgcolor2; |
| 191 | | int m_ddenlovr_layer_enable; |
| 192 | | int m_ddenlovr_layer_enable2; |
| 193 | | int m_ddenlovr_palette_base[8]; |
| 194 | | int m_ddenlovr_palette_mask[8]; |
| 195 | | int m_ddenlovr_transparency_pen[8]; |
| 196 | | int m_ddenlovr_transparency_mask[8]; |
| 197 | | int m_ddenlovr_blit_latch; |
| 198 | | int m_ddenlovr_blit_pen_mask; // not implemented |
| 199 | | int m_ddenlovr_blit_rom_bits; // usually 8, 16 in hanakanz |
| 200 | | const int *m_ddenlovr_blit_commands; |
| 201 | | int m_ddenlovr_blit_regs[2]; |
| 202 | | |
| 203 | | /* ddenlovr misc (TODO: merge with dynax.h, where possible) */ |
| 204 | | UINT8 m_palram[0x200]; |
| 205 | | int m_okibank; |
| 206 | | UINT8 m_rongrong_blitter_busy_select; |
| 207 | | UINT8 m_prot_val; |
| 208 | | UINT16 m_prot_16; |
| 209 | | UINT16 m_quiz365_protection[2]; |
| 210 | | |
| 211 | | UINT16 m_mmpanic_leds; /* A led for each of the 9 buttons */ |
| 212 | | UINT8 m_funkyfig_lockout; |
| 213 | | UINT8 m_romdata[2]; |
| 214 | | int m_palette_index; |
| 215 | | UINT8 m_hginga_rombank; |
| 216 | | UINT8 m_mjflove_irq_cause; |
| 217 | | UINT8 m_daimyojn_palette_sel; |
| 218 | | |
| 219 | 159 | DECLARE_MACHINE_START(ddenlovr); |
| 220 | 160 | DECLARE_MACHINE_RESET(ddenlovr); |
| 221 | 161 | DECLARE_VIDEO_START(ddenlovr); |
| r243093 | r243094 | |
| 410 | 350 | DECLARE_VIDEO_START(htengoku); |
| 411 | 351 | DECLARE_WRITE8_MEMBER(htengoku_dsw_w); |
| 412 | 352 | DECLARE_READ8_MEMBER(htengoku_dsw_r); |
| 413 | | DECLARE_WRITE8_MEMBER( quizchq_oki_bank_w ); |
| 414 | | DECLARE_WRITE16_MEMBER( ddenlovr_oki_bank_w ); |
| 415 | | DECLARE_WRITE16_MEMBER( quiz365_oki_bank1_w ); |
| 416 | | DECLARE_WRITE16_MEMBER( quiz365_oki_bank2_w ); |
| 417 | | DECLARE_WRITE8_MEMBER( ddenlovr_select_w ); |
| 418 | | DECLARE_READ8_MEMBER( quiz365_input_r ); |
| 419 | | DECLARE_WRITE16_MEMBER( nettoqc_oki_bank_w ); |
| 420 | | DECLARE_WRITE8_MEMBER( hanakanz_oki_bank_w ); |
| 421 | | DECLARE_WRITE8_MEMBER( mjchuuka_oki_bank_w ); |
| 422 | | DECLARE_READ8_MEMBER( hginga_dsw_r ); |
| 423 | | DECLARE_WRITE8_MEMBER( mjflove_okibank_w ); |
| 424 | | DECLARE_WRITE8_MEMBER( jongtei_okibank_w ); |
| 425 | | DECLARE_READ8_MEMBER( seljan2_dsw_r ); |
| 426 | | DECLARE_WRITE8_MEMBER( daimyojn_okibank_w ); |
| 427 | 353 | |
| 428 | 354 | void ddenlovr_flipscreen_w( UINT8 data ); |
| 429 | 355 | void ddenlovr_blit_flip_w( UINT8 data ); |
| r243093 | r243094 | |
| 442 | 368 | void mmpanic_update_leds(); |
| 443 | 369 | void mjchuuka_get_romdata(); |
| 444 | 370 | UINT8 hgokou_player_r( int player ); |
| 371 | DECLARE_WRITE8_MEMBER( quizchq_oki_bank_w ); |
| 372 | DECLARE_WRITE16_MEMBER( ddenlovr_oki_bank_w ); |
| 373 | DECLARE_WRITE16_MEMBER( quiz365_oki_bank1_w ); |
| 374 | DECLARE_WRITE16_MEMBER( quiz365_oki_bank2_w ); |
| 375 | DECLARE_WRITE8_MEMBER( ddenlovr_select_w ); |
| 376 | DECLARE_READ8_MEMBER( quiz365_input_r ); |
| 377 | DECLARE_WRITE16_MEMBER( nettoqc_oki_bank_w ); |
| 378 | DECLARE_WRITE8_MEMBER( hanakanz_oki_bank_w ); |
| 379 | DECLARE_WRITE8_MEMBER( mjchuuka_oki_bank_w ); |
| 380 | DECLARE_READ8_MEMBER( hginga_dsw_r ); |
| 381 | DECLARE_WRITE8_MEMBER( mjflove_okibank_w ); |
| 382 | DECLARE_WRITE8_MEMBER( jongtei_okibank_w ); |
| 383 | DECLARE_READ8_MEMBER( seljan2_dsw_r ); |
| 384 | DECLARE_WRITE8_MEMBER( daimyojn_okibank_w ); |
| 445 | 385 | }; |
| 446 | 386 | |
| 447 | 387 | VIDEO_START_MEMBER(ddenlovr_state,ddenlovr) |
| r243093 | r243094 | |
| 1976 | 1916 | AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r) // Video Chip |
| 1977 | 1917 | |
| 1978 | 1918 | AM_RANGE(0x3002c0, 0x3002c1) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)// Sound |
| 1979 | | AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 1919 | AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 1980 | 1920 | AM_RANGE(0x300340, 0x30035f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) |
| 1981 | 1921 | AM_RANGE(0x300380, 0x300383) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 1982 | 1922 | AM_RANGE(0x300384, 0x300385) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff) |
| r243093 | r243094 | |
| 2028 | 1968 | AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r) // ? must be 78 on startup (not necessary in ddlover) |
| 2029 | 1969 | AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w) |
| 2030 | 1970 | AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r) // Video Chip |
| 2031 | | AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 1971 | AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 2032 | 1972 | AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) |
| 2033 | 1973 | AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 2034 | 1974 | AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1") |
| r243093 | r243094 | |
| 2095 | 2035 | AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters |
| 2096 | 2036 | AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) // |
| 2097 | 2037 | |
| 2098 | | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 2038 | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 2099 | 2039 | AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) |
| 2100 | 2040 | AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 2101 | 2041 | AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff) |
| r243093 | r243094 | |
| 2133 | 2073 | AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters |
| 2134 | 2074 | AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) // |
| 2135 | 2075 | |
| 2136 | | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 2076 | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 2137 | 2077 | AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) |
| 2138 | 2078 | AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 2139 | 2079 | AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff) |
| r243093 | r243094 | |
| 2207 | 2147 | AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r) // ? must be 78 on startup (not necessary in ddlover) |
| 2208 | 2148 | AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w) |
| 2209 | 2149 | AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r) // Video Chip |
| 2210 | | AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 2150 | AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 2211 | 2151 | AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) |
| 2212 | 2152 | AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 2213 | 2153 | AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1") |
| r243093 | r243094 | |
| 2270 | 2210 | AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters |
| 2271 | 2211 | AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) // |
| 2272 | 2212 | |
| 2273 | | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 2213 | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 2274 | 2214 | AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff) |
| 2275 | 2215 | AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 2276 | 2216 | AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff) |
| r243093 | r243094 | |
| 2326 | 2266 | AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r) |
| 2327 | 2267 | |
| 2328 | 2268 | AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 2329 | | AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2269 | AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2330 | 2270 | |
| 2331 | 2271 | AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w) |
| 2332 | 2272 | AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w) |
| r243093 | r243094 | |
| 2363 | 2303 | |
| 2364 | 2304 | AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 2365 | 2305 | AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 2366 | | AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2306 | AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2367 | 2307 | |
| 2368 | 2308 | AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w) |
| 2369 | 2309 | AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w) |
| r243093 | r243094 | |
| 2517 | 2457 | AM_RANGE(0x02, 0x02) AM_READNOP // read just before port 00 |
| 2518 | 2458 | AM_RANGE(0x04, 0x04) AM_NOP // read only once at the start |
| 2519 | 2459 | AM_RANGE(0x06, 0x06) AM_WRITENOP // almost always 1, sometimes 0 |
| 2520 | | AM_RANGE(0x08, 0x09) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2460 | AM_RANGE(0x08, 0x09) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2521 | 2461 | AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 2522 | 2462 | AM_RANGE(0x0e, 0x0e) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| 2523 | 2463 | ADDRESS_MAP_END |
| r243093 | r243094 | |
| 2800 | 2740 | AM_RANGE(0x93, 0x93) AM_WRITE(hanakanz_coincounter_w) |
| 2801 | 2741 | AM_RANGE(0x94, 0x94) AM_WRITE(hanakanz_keyb_w) |
| 2802 | 2742 | AM_RANGE(0x96, 0x96) AM_READ(hanakanz_rand_r) |
| 2803 | | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2743 | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2804 | 2744 | AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 2805 | 2745 | AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 2806 | 2746 | ADDRESS_MAP_END |
| r243093 | r243094 | |
| 2816 | 2756 | AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w) |
| 2817 | 2757 | AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w) |
| 2818 | 2758 | AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r) |
| 2819 | | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2759 | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2820 | 2760 | AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM") |
| 2821 | 2761 | AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r) |
| 2822 | 2762 | AM_RANGE(0xb3, 0xb3) AM_WRITE(hanakanz_coincounter_w) |
| r243093 | r243094 | |
| 2838 | 2778 | AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w) |
| 2839 | 2779 | AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w) |
| 2840 | 2780 | AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r) |
| 2841 | | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2781 | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2842 | 2782 | AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM") |
| 2843 | 2783 | // AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r) |
| 2844 | 2784 | AM_RANGE(0xb1, 0xb1) AM_READ_PORT("KEYB0") |
| r243093 | r243094 | |
| 2862 | 2802 | AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w) |
| 2863 | 2803 | AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w) |
| 2864 | 2804 | AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r) |
| 2865 | | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2805 | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2866 | 2806 | AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM") |
| 2867 | 2807 | // AM_RANGE(0x91, 0x91) AM_READ(hanakanz_keyb_r) |
| 2868 | 2808 | AM_RANGE(0x91, 0x91) AM_READ_PORT("KEYB0") |
| r243093 | r243094 | |
| 2901 | 2841 | AM_RANGE(0x94, 0x94) AM_READ_PORT("SYSTEM") |
| 2902 | 2842 | AM_RANGE(0x95, 0x96) AM_READ(hanakanz_keyb_r) |
| 2903 | 2843 | AM_RANGE(0x97, 0x97) AM_WRITE(hanakanz_coincounter_w) |
| 2904 | | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2844 | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 2905 | 2845 | AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 2906 | 2846 | AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 2907 | 2847 | ADDRESS_MAP_END |
| r243093 | r243094 | |
| 3029 | 2969 | AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ_PORT("DSW4") |
| 3030 | 2970 | AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ_PORT("DSW5") // DSW 1-4 high bits |
| 3031 | 2971 | AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3032 | | AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 2972 | AM_RANGE(0xa0, 0xa1) AM_MIRROR(0xff00) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3033 | 2973 | AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 3034 | 2974 | AM_RANGE(0xe0, 0xe1) AM_MIRROR(0xff00) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) |
| 3035 | 2975 | ADDRESS_MAP_END |
| r243093 | r243094 | |
| 3138 | 3078 | AM_RANGE(0x22, 0x22) AM_READ(mjmyster_coins_r) |
| 3139 | 3079 | AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r) |
| 3140 | 3080 | AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3141 | | AM_RANGE(0x42, 0x43) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3081 | AM_RANGE(0x42, 0x43) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3142 | 3082 | AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 3143 | 3083 | AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 3144 | 3084 | AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| r243093 | r243094 | |
| 3303 | 3243 | AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r) |
| 3304 | 3244 | AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w) |
| 3305 | 3245 | AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w) |
| 3306 | | AM_RANGE(0x22, 0x23) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3246 | AM_RANGE(0x22, 0x23) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3307 | 3247 | AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 3308 | 3248 | AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 3309 | 3249 | AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| r243093 | r243094 | |
| 3426 | 3366 | AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w) |
| 3427 | 3367 | AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r) |
| 3428 | 3368 | AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3429 | | AM_RANGE(0x82, 0x83) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3369 | AM_RANGE(0x82, 0x83) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3430 | 3370 | AM_RANGE(0x84, 0x84) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 3431 | 3371 | AM_RANGE(0x86, 0x86) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 3432 | 3372 | AM_RANGE(0x88, 0x88) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| r243093 | r243094 | |
| 3469 | 3409 | AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w) // ? ack on RTC int |
| 3470 | 3410 | AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w) |
| 3471 | 3411 | AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3472 | | AM_RANGE(0x22, 0x23) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3412 | AM_RANGE(0x22, 0x23) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3473 | 3413 | AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 3474 | 3414 | AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 3475 | 3415 | AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| r243093 | r243094 | |
| 3560 | 3500 | AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r) |
| 3561 | 3501 | AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w) |
| 3562 | 3502 | AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3563 | | AM_RANGE(0x60, 0x61) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3503 | AM_RANGE(0x60, 0x61) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3564 | 3504 | AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w) |
| 3565 | 3505 | AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w) |
| 3566 | 3506 | AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w) |
| r243093 | r243094 | |
| 3606 | 3546 | AM_RANGE(0x22, 0x22) AM_READ(mjmywrld_coins_r) |
| 3607 | 3547 | AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r) |
| 3608 | 3548 | AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3609 | | AM_RANGE(0x42, 0x43) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3549 | AM_RANGE(0x42, 0x43) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3610 | 3550 | AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r) |
| 3611 | 3551 | AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w) |
| 3612 | 3552 | AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| r243093 | r243094 | |
| 3706 | 3646 | AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w) // Coin Counters |
| 3707 | 3647 | AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w) // |
| 3708 | 3648 | |
| 3709 | | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff) |
| 3649 | AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) |
| 3710 | 3650 | AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff) |
| 3711 | 3651 | AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff) |
| 3712 | 3652 | AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff) |
| r243093 | r243094 | |
| 3797 | 3737 | AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1") |
| 3798 | 3738 | AM_RANGE(0x0181, 0x0181) AM_WRITENOP // ? int. enable |
| 3799 | 3739 | AM_RANGE(0x0184, 0x0184) AM_WRITE(mjflove_coincounter_w) |
| 3800 | | AM_RANGE(0x0200, 0x0201) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3740 | AM_RANGE(0x0200, 0x0201) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3801 | 3741 | AM_RANGE(0x0280, 0x028f) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 3802 | 3742 | AM_RANGE(0x0300, 0x0301) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) |
| 3803 | 3743 | AM_RANGE(0x0380, 0x0380) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| r243093 | r243094 | |
| 3838 | 3778 | AM_RANGE(0x60, 0x60) AM_WRITE(hanakanz_blitter_data_w) |
| 3839 | 3779 | AM_RANGE(0x61, 0x61) AM_WRITE(hanakanz_palette_w) |
| 3840 | 3780 | AM_RANGE(0x63, 0x64) AM_READ(hanakanz_gfxrom_r) |
| 3841 | | AM_RANGE(0x80, 0x81) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3781 | AM_RANGE(0x80, 0x81) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3842 | 3782 | AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3843 | 3783 | AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 3844 | 3784 | ADDRESS_MAP_END |
| r243093 | r243094 | |
| 3901 | 3841 | static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, ddenlovr_state ) |
| 3902 | 3842 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 3903 | 3843 | AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3904 | | AM_RANGE(0x02, 0x03) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3844 | AM_RANGE(0x02, 0x03) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3905 | 3845 | AM_RANGE(0x04, 0x05) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) |
| 3906 | 3846 | AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(sryudens_rambank_w) // ? ack on RTC int |
| 3907 | 3847 | AM_RANGE(0x1e, 0x1e) AM_WRITE(mjflove_rombank_w) |
| r243093 | r243094 | |
| 3988 | 3928 | AM_RANGE(0x70, 0x70) AM_WRITE(quizchq_oki_bank_w) |
| 3989 | 3929 | AM_RANGE(0x80, 0x80) AM_RAM |
| 3990 | 3930 | AM_RANGE(0x90, 0x90) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 3991 | | AM_RANGE(0x92, 0x93) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 3931 | AM_RANGE(0x92, 0x93) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 3992 | 3932 | AM_RANGE(0x94, 0x95) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) |
| 3993 | 3933 | ADDRESS_MAP_END |
| 3994 | 3934 | |
| r243093 | r243094 | |
| 4060 | 4000 | AM_RANGE(0x38, 0x38) AM_READNOP // ? ack or watchdog |
| 4061 | 4001 | AM_RANGE(0x40, 0x41) AM_WRITE(mjflove_blitter_w) |
| 4062 | 4002 | AM_RANGE(0x43, 0x43) AM_READ(rongrong_gfxrom_r) |
| 4063 | | AM_RANGE(0x50, 0x51) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 4003 | AM_RANGE(0x50, 0x51) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 4064 | 4004 | AM_RANGE(0x54, 0x54) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 4065 | 4005 | AM_RANGE(0x58, 0x58) AM_DEVWRITE("aysnd", ay8910_device, address_w) |
| 4066 | 4006 | AM_RANGE(0x5c, 0x5c) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w) // dsw |
| r243093 | r243094 | |
| 4214 | 4154 | AM_RANGE( 0x40, 0x40 ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // AY8910 |
| 4215 | 4155 | AM_RANGE( 0x42, 0x42 ) AM_DEVREAD("aysnd", ay8910_device, data_r) // |
| 4216 | 4156 | AM_RANGE( 0x44, 0x44 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // |
| 4217 | | AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 4157 | AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 4218 | 4158 | AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 4219 | 4159 | AM_RANGE( 0xa0, 0xa3 ) AM_WRITE(ddenlovr_palette_base_w) // ddenlovr mixer chip |
| 4220 | 4160 | AM_RANGE( 0xa4, 0xa7 ) AM_WRITE(ddenlovr_palette_mask_w) |
| r243093 | r243094 | |
| 4286 | 4226 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(ddenlovr_state, htengoku_dsw_w)) |
| 4287 | 4227 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4288 | 4228 | |
| 4289 | | MCFG_SOUND_ADD("ym2413", YM2413, 3579545) |
| 4229 | MCFG_SOUND_ADD("ymsnd", YM2413, 3579545) |
| 4290 | 4230 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4291 | 4231 | |
| 4292 | 4232 | /* devices */ |
| r243093 | r243094 | |
| 4401 | 4341 | AM_RANGE(0x42, 0x44) AM_READ(hanakanz_gfxrom_r) |
| 4402 | 4342 | AM_RANGE(0x8a, 0x8b) AM_READ(daimyojn_year_hack_r) // ? |
| 4403 | 4343 | AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", msm6242_device, read, write) |
| 4404 | | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ym2413", ym2413_device, write) |
| 4344 | AM_RANGE(0xa0, 0xa1) AM_DEVWRITE("ymsnd", ym2413_device, write) |
| 4405 | 4345 | AM_RANGE(0xa2, 0xa2) AM_DEVREADWRITE("oki", okim6295_device, read, write) |
| 4406 | 4346 | AM_RANGE(0xa8, 0xa8) AM_READ_PORT("SYSTEM") |
| 4407 | 4347 | AM_RANGE(0xaa, 0xaa) AM_READ(daimyojn_keyb1_r) |
| r243093 | r243094 | |
| 9361 | 9301 | save_item(NAME(m_mjflove_irq_cause)); |
| 9362 | 9302 | save_item(NAME(m_daimyojn_palette_sel)); |
| 9363 | 9303 | save_item(NAME(m_palram)); |
| 9304 | |
| 9305 | save_item(NAME(m_irq_count)); |
| 9364 | 9306 | } |
| 9365 | 9307 | |
| 9366 | 9308 | MACHINE_RESET_MEMBER(ddenlovr_state,ddenlovr) |
| r243093 | r243094 | |
| 9381 | 9323 | m_hginga_rombank = 0; |
| 9382 | 9324 | m_mjflove_irq_cause = 0; |
| 9383 | 9325 | m_daimyojn_palette_sel = 0; |
| 9326 | m_irq_count = 0; |
| 9384 | 9327 | |
| 9385 | 9328 | m_quiz365_protection[0] = 0; |
| 9386 | 9329 | m_quiz365_protection[1] = 0; |
| r243093 | r243094 | |
| 9492 | 9435 | /* sound hardware */ |
| 9493 | 9436 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 9494 | 9437 | |
| 9495 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8) |
| 9438 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8) |
| 9496 | 9439 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 9497 | 9440 | |
| 9498 | 9441 | MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 16) // or /8 ? |
| r243093 | r243094 | |
| 9610 | 9553 | /* sound hardware */ |
| 9611 | 9554 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 9612 | 9555 | |
| 9613 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz/8) // 3.579545Mhz, verified |
| 9556 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz/8) // 3.579545Mhz, verified |
| 9614 | 9557 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50) |
| 9615 | 9558 | |
| 9616 | 9559 | MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz/28, OKIM6295_PIN7_HIGH) // clock frequency verified 1.022MHz, pin 7 verified high |
| r243093 | r243094 | |
| 9694 | 9637 | /* sound hardware */ |
| 9695 | 9638 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 9696 | 9639 | |
| 9697 | | MCFG_SOUND_ADD("ym2413", YM2413, 3579545) |
| 9640 | MCFG_SOUND_ADD("ymsnd", YM2413, 3579545) |
| 9698 | 9641 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 9699 | 9642 | |
| 9700 | 9643 | MCFG_SOUND_ADD("aysnd", AY8910, 3579545) |
| r243093 | r243094 | |
| 9771 | 9714 | /* sound hardware */ |
| 9772 | 9715 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 9773 | 9716 | |
| 9774 | | MCFG_SOUND_ADD("ym2413", YM2413, 3579545) |
| 9717 | MCFG_SOUND_ADD("ymsnd", YM2413, 3579545) |
| 9775 | 9718 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 9776 | 9719 | |
| 9777 | 9720 | MCFG_OKIM6295_ADD("oki", 1022720, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified |
| r243093 | r243094 | |
| 9817 | 9760 | /* sound hardware */ |
| 9818 | 9761 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 9819 | 9762 | |
| 9820 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_37516MHz / 8) |
| 9763 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_37516MHz / 8) |
| 9821 | 9764 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 9822 | 9765 | |
| 9823 | 9766 | MCFG_OKIM6295_ADD("oki", XTAL_28_37516MHz / 28, OKIM6295_PIN7_HIGH) |
| r243093 | r243094 | |
| 10186 | 10129 | /* sound hardware */ |
| 10187 | 10130 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 10188 | 10131 | |
| 10189 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8) |
| 10132 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8) |
| 10190 | 10133 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 10191 | 10134 | |
| 10192 | 10135 | MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH) |
| r243093 | r243094 | |
| 10229 | 10172 | /* sound hardware */ |
| 10230 | 10173 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 10231 | 10174 | |
| 10232 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8) |
| 10175 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8) |
| 10233 | 10176 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 10234 | 10177 | |
| 10235 | 10178 | MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8) |
| r243093 | r243094 | |
| 10276 | 10219 | /* sound hardware */ |
| 10277 | 10220 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 10278 | 10221 | |
| 10279 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8) |
| 10222 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8) |
| 10280 | 10223 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 10281 | 10224 | |
| 10282 | 10225 | MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8) |
| r243093 | r243094 | |
| 10343 | 10286 | /* sound hardware */ |
| 10344 | 10287 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 10345 | 10288 | |
| 10346 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8) |
| 10289 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8) |
| 10347 | 10290 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 10348 | 10291 | |
| 10349 | 10292 | MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8) |
| r243093 | r243094 | |
| 10393 | 10336 | /* sound hardware */ |
| 10394 | 10337 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 10395 | 10338 | |
| 10396 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8) |
| 10339 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8) |
| 10397 | 10340 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) |
| 10398 | 10341 | |
| 10399 | 10342 | MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH) |
trunk/src/mame/drivers/dynax.c
| r243093 | r243094 | |
| 79 | 79 | #include "sound/ay8910.h" |
| 80 | 80 | #include "sound/2203intf.h" |
| 81 | 81 | #include "sound/3812intf.h" |
| 82 | #include "sound/msm5205.h" |
| 83 | #include "sound/2413intf.h" |
| 82 | 84 | #include "machine/nvram.h" |
| 83 | 85 | #include "rendlay.h" |
| 84 | 86 | |
| r243093 | r243094 | |
| 532 | 534 | AM_RANGE( 0x74, 0x74 ) AM_WRITE(dynax_blitter_ack_w) // Blitter IRQ Ack |
| 533 | 535 | AM_RANGE( 0x76, 0x76 ) AM_WRITE(dynax_blit_palbank_w) // Layers Palettes (High Bit) |
| 534 | 536 | AM_RANGE( 0x77, 0x77 ) AM_WRITE(hanamai_layer_half_w) // half of the interleaved layer to write to |
| 535 | | AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) // 2 x DSW |
| 537 | AM_RANGE( 0x78, 0x79 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) // 2 x DSW |
| 536 | 538 | AM_RANGE( 0x7a, 0x7b ) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) // AY8910 |
| 537 | 539 | // AM_RANGE( 0x7c, 0x7c ) AM_WRITENOP // CRT Controller |
| 538 | 540 | // AM_RANGE( 0x7d, 0x7d ) AM_WRITENOP // |
| r243093 | r243094 | |
| 554 | 556 | AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW2") // DSW3 |
| 555 | 557 | AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 556 | 558 | AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 557 | | AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 559 | AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 558 | 560 | AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r) // AY8910, DSW1 |
| 559 | 561 | AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // AY8910 |
| 560 | 562 | AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // |
| r243093 | r243094 | |
| 638 | 640 | |
| 639 | 641 | AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 640 | 642 | AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 641 | | AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 643 | AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 642 | 644 | |
| 643 | 645 | AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r) // AY8910, DSW1 |
| 644 | 646 | AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // AY8910 |
| r243093 | r243094 | |
| 778 | 780 | AM_RANGE( 0x11, 0x17 ) AM_WRITE(dynax_blitter_rev2_w) // Blitter |
| 779 | 781 | AM_RANGE( 0x20, 0x20 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 780 | 782 | AM_RANGE( 0x22, 0x22 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 781 | | AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 783 | AM_RANGE( 0x24, 0x25 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 782 | 784 | AM_RANGE( 0x28, 0x28 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // AY8910 |
| 783 | 785 | AM_RANGE( 0x2a, 0x2a ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // |
| 784 | 786 | AM_RANGE( 0x48, 0x48 ) AM_WRITE(dynax_extra_scrollx_w) // screen scroll X |
| r243093 | r243094 | |
| 817 | 819 | AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW1") // DSW3 |
| 818 | 820 | AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 819 | 821 | AM_RANGE( 0x32, 0x32 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 820 | | AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 822 | AM_RANGE( 0x34, 0x35 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 821 | 823 | AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // AY8910 |
| 822 | 824 | AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // |
| 823 | 825 | AM_RANGE( 0x40, 0x40 ) AM_WRITE(dynax_blit_pen_w) // Destination Pen |
| r243093 | r243094 | |
| 845 | 847 | static ADDRESS_MAP_START( sprtmtch_io_map, AS_IO, 8, dynax_state ) |
| 846 | 848 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 847 | 849 | AM_RANGE( 0x01, 0x07 ) AM_WRITE(dynax_blitter_rev2_w) // Blitter |
| 848 | | AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) // 2 x DSW |
| 850 | AM_RANGE( 0x10, 0x11 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) // 2 x DSW |
| 849 | 851 | // AM_RANGE( 0x12, 0x12 ) AM_WRITENOP // CRT Controller |
| 850 | 852 | // AM_RANGE( 0x13, 0x13 ) AM_WRITENOP // CRT Controller |
| 851 | 853 | AM_RANGE( 0x20, 0x20 ) AM_READ_PORT("P1") // P1 |
| r243093 | r243094 | |
| 891 | 893 | AM_RANGE( 0x63, 0x63 ) AM_READ(hanamai_keyboard_0_r) // P1 |
| 892 | 894 | AM_RANGE( 0x64, 0x64 ) AM_READ_PORT("DSW0") // DSW |
| 893 | 895 | AM_RANGE( 0x67, 0x67 ) AM_READ_PORT("DSW1") // DSW |
| 894 | | AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 896 | AM_RANGE( 0x70, 0x71 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 895 | 897 | // AM_RANGE( 0x80, 0x80 ) AM_WRITENOP // IRQ ack? |
| 896 | 898 | ADDRESS_MAP_END |
| 897 | 899 | |
| r243093 | r243094 | |
| 900 | 902 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 901 | 903 | AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 902 | 904 | AM_RANGE( 0x02, 0x02 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 903 | | AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 905 | AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 904 | 906 | AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // AY8910 |
| 905 | 907 | AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // |
| 906 | 908 | AM_RANGE( 0x10, 0x10 ) AM_WRITE(hanamai_keyboard_w) // keyboard row select |
| r243093 | r243094 | |
| 1022 | 1024 | AM_RANGE( 0x10, 0x10 ) AM_WRITE(jantouki_sound_vblank_ack_w) // VBlank IRQ Ack |
| 1023 | 1025 | AM_RANGE( 0x21, 0x21 ) AM_DEVREAD("aysnd", ay8910_device, data_r) // AY8910 |
| 1024 | 1026 | AM_RANGE( 0x22, 0x23 ) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) // |
| 1025 | | AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE("ym2203", ym2203_device, read, write) // |
| 1027 | AM_RANGE( 0x28, 0x29 ) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) // |
| 1026 | 1028 | AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 1027 | 1029 | AM_RANGE( 0x40, 0x40 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 1028 | 1030 | AM_RANGE( 0x50, 0x50 ) AM_READ(jantouki_soundlatch_status_r) // Soundlatch status |
| r243093 | r243094 | |
| 1058 | 1060 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 1059 | 1061 | AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w) // MSM5205 reset |
| 1060 | 1062 | AM_RANGE( 0x02, 0x02 ) AM_WRITE(adpcm_data_w) // MSM5205 data |
| 1061 | | AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 1063 | AM_RANGE( 0x04, 0x05 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 1062 | 1064 | AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // AY8910 |
| 1063 | 1065 | AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // |
| 1064 | 1066 | AM_RANGE( 0x11, 0x12 ) AM_WRITE(mjelctrn_blitter_ack_w) //? |
| r243093 | r243094 | |
| 1337 | 1339 | AM_RANGE( 0x10000, 0x10000 ) AM_DEVREAD("aysnd", ay8910_device, data_r) // AY8910 |
| 1338 | 1340 | AM_RANGE( 0x10008, 0x10008 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) // |
| 1339 | 1341 | AM_RANGE( 0x10010, 0x10010 ) AM_DEVWRITE("aysnd", ay8910_device, address_w) // |
| 1340 | | AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE("ym2413", ym2413_device, write) // |
| 1342 | AM_RANGE( 0x10020, 0x10021 ) AM_DEVWRITE("ymsnd", ym2413_device, write) // |
| 1341 | 1343 | AM_RANGE( 0x10040, 0x10040 ) AM_WRITE(dynax_blit_pen_w) // Destination Pen |
| 1342 | 1344 | AM_RANGE( 0x10044, 0x10044 ) AM_WRITE(tenkai_blit_dest_w) // Destination Layer |
| 1343 | 1345 | AM_RANGE( 0x10048, 0x10048 ) AM_WRITE(tenkai_blit_palette23_w) // Layers Palettes |
| r243093 | r243094 | |
| 1479 | 1481 | case 0x8050: // CRT controller |
| 1480 | 1482 | case 0x8051: return; |
| 1481 | 1483 | |
| 1482 | | case 0x8070: m_ym2413->register_port_w(space, 0, data); return; |
| 1483 | | case 0x8071: m_ym2413->data_port_w(space, 0, data); return; |
| 1484 | case 0x8070: downcast<ym2413_device *>(m_ymsnd)->register_port_w(space, 0, data); return; |
| 1485 | case 0x8071: downcast<ym2413_device *>(m_ymsnd)->data_port_w(space, 0, data); return; |
| 1484 | 1486 | |
| 1485 | 1487 | case 0x8060: m_keyb = data; return; |
| 1486 | 1488 | |
| r243093 | r243094 | |
| 3965 | 3967 | |
| 3966 | 3968 | MACHINE_START_MEMBER(dynax_state,dynax) |
| 3967 | 3969 | { |
| 3970 | m_ymsnd = machine().device("ymsnd"); |
| 3971 | |
| 3968 | 3972 | save_item(NAME(m_sound_irq)); |
| 3969 | 3973 | save_item(NAME(m_vblank_irq)); |
| 3970 | 3974 | save_item(NAME(m_blitter_irq)); |
| r243093 | r243094 | |
| 4089 | 4093 | MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8) |
| 4090 | 4094 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4091 | 4095 | |
| 4092 | | MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8) |
| 4096 | MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8) |
| 4093 | 4097 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback)) |
| 4094 | 4098 | MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1")) |
| 4095 | 4099 | MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW0")) |
| r243093 | r243094 | |
| 4143 | 4147 | MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0")) |
| 4144 | 4148 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4145 | 4149 | |
| 4146 | | MCFG_SOUND_ADD("ym2413", YM2413, 3579545) |
| 4150 | MCFG_SOUND_ADD("ymsnd", YM2413, 3579545) |
| 4147 | 4151 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4148 | 4152 | |
| 4149 | 4153 | MCFG_SOUND_ADD("msm", MSM5205, 384000) |
| r243093 | r243094 | |
| 4190 | 4194 | MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0")) |
| 4191 | 4195 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4192 | 4196 | |
| 4193 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_3_579545MHz ) |
| 4197 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz ) |
| 4194 | 4198 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4195 | 4199 | |
| 4196 | 4200 | MCFG_SOUND_ADD("msm", MSM5205, XTAL_384kHz ) |
| r243093 | r243094 | |
| 4234 | 4238 | /* sound hardware */ |
| 4235 | 4239 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4236 | 4240 | |
| 4237 | | MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8) |
| 4241 | MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8) |
| 4238 | 4242 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback)) |
| 4239 | 4243 | MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0")) |
| 4240 | 4244 | MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) |
| r243093 | r243094 | |
| 4279 | 4283 | /* sound hardware */ |
| 4280 | 4284 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4281 | 4285 | |
| 4282 | | MCFG_SOUND_ADD("ym2413", YM2413, 24000000/6) |
| 4286 | MCFG_SOUND_ADD("ymsnd", YM2413, 24000000/6) |
| 4283 | 4287 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4284 | 4288 | MACHINE_CONFIG_END |
| 4285 | 4289 | |
| r243093 | r243094 | |
| 4378 | 4382 | |
| 4379 | 4383 | membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000], 0x8000); |
| 4380 | 4384 | membank("bank2")->configure_entries(0, 12, &SOUND[0x8000], 0x8000); |
| 4381 | | |
| 4385 | |
| 4386 | m_top_scr = machine().device("top"); |
| 4387 | m_bot_scr = machine().device("bottom"); |
| 4388 | |
| 4382 | 4389 | MACHINE_START_CALL_MEMBER(dynax); |
| 4383 | 4390 | } |
| 4384 | 4391 | |
| r243093 | r243094 | |
| 4430 | 4437 | MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8) |
| 4431 | 4438 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4432 | 4439 | |
| 4433 | | MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8) |
| 4440 | MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8) |
| 4434 | 4441 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, jantouki_sound_callback)) |
| 4435 | 4442 | MCFG_SOUND_ROUTE(0, "mono", 0.20) |
| 4436 | 4443 | MCFG_SOUND_ROUTE(1, "mono", 0.20) |
| r243093 | r243094 | |
| 4609 | 4616 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w)) |
| 4610 | 4617 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4611 | 4618 | |
| 4612 | | MCFG_SOUND_ADD("ym2413", YM2413, 3579545) |
| 4619 | MCFG_SOUND_ADD("ymsnd", YM2413, 3579545) |
| 4613 | 4620 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4614 | 4621 | |
| 4615 | 4622 | /* devices */ |
| r243093 | r243094 | |
| 4680 | 4687 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w)) |
| 4681 | 4688 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) |
| 4682 | 4689 | |
| 4683 | | MCFG_SOUND_ADD("ym2413", YM2413, XTAL_24MHz / 8) // ? |
| 4690 | MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_24MHz / 8) // ? |
| 4684 | 4691 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4685 | 4692 | MACHINE_CONFIG_END |
| 4686 | 4693 | |
trunk/src/mame/drivers/model3.c
| r243093 | r243094 | |
| 664 | 664 | #include "machine/nvram.h" |
| 665 | 665 | #include "includes/model3.h" |
| 666 | 666 | |
| 667 | | //#define DECRYPT_ANALYSIS_HACKS |
| 668 | 667 | |
| 669 | | #ifdef DECRYPT_ANALYSIS_HACKS |
| 670 | | int readcount = 0; |
| 671 | | int segcount = 0; |
| 672 | | #endif |
| 673 | | |
| 674 | 668 | void model3_state::update_irq_state() |
| 675 | 669 | { |
| 676 | 670 | if ((m_irq_enable & m_irq_state) || m_scsi_irq_state) |
| r243093 | r243094 | |
| 1679 | 1673 | } |
| 1680 | 1674 | |
| 1681 | 1675 | |
| 1676 | static const UINT16 vs299_prot_data[] = |
| 1677 | { |
| 1678 | 0xc800, 0x4a20, 0x5041, 0x4e41, 0x4920, 0x4154, 0x594c, 0x4220, |
| 1679 | 0x4152, 0x4953, 0x204c, 0x5241, 0x4547, 0x544e, 0x4e49, 0x2041, |
| 1680 | 0x4547, 0x4d52, 0x4e41, 0x2059, 0x4e45, 0x4c47, 0x4e41, 0x2044, |
| 1681 | 0x454e, 0x4854, 0x5245, 0x414c, 0x444e, 0x2053, 0x5246, 0x4e41, |
| 1682 | 0x4543, 0x4320, 0x4c4f, 0x4d4f, 0x4942, 0x2041, 0x4150, 0x4152, |
| 1683 | 0x5547, 0x5941, 0x4220, 0x4c55, 0x4147, 0x4952, 0x2041, 0x5053, |
| 1684 | 0x4941, 0x204e, 0x5243, 0x414f, 0x4954, 0x2041, 0x4542, 0x474c, |
| 1685 | 0x5549, 0x204d, 0x494e, 0x4547, 0x4952, 0x2041, 0x4153, 0x4455, |
| 1686 | 0x2049, 0x4f4b, 0x4552, 0x2041, 0x4544, 0x4d4e, 0x5241, 0x204b, |
| 1687 | 0x4f52, 0x414d, 0x494e, 0x2041, 0x4353, 0x544f, 0x414c, 0x444e, |
| 1688 | 0x5520, 0x4153, 0x5320, 0x554f, 0x4854, 0x4641, 0x4952, 0x4143, |
| 1689 | 0x4d20, 0x5845, 0x4349, 0x204f, 0x5559, 0x4f47, 0x4c53, 0x5641, |
| 1690 | 0x4149, 0x4620, 0x5f43, 0x4553, 0x4147 |
| 1691 | }; |
| 1682 | 1692 | |
| 1693 | static const UINT16 swt_prot_data[] = |
| 1694 | { |
| 1695 | 0xffff, |
| 1696 | 0x3d3d, 0x3d3d, 0x203d, 0x5453, 0x5241, 0x5720, 0x5241, 0x2053, |
| 1697 | 0x3d3d, 0x3d3d, 0x0a3d, 0x6f43, 0x7970, 0x6952, 0x6867, 0x2074, |
| 1698 | 0x4553, 0x4147, 0x4520, 0x746e, 0x7265, 0x7270, 0x7369, 0x7365, |
| 1699 | 0x202c, 0x744c, 0x2e64, 0x410a, 0x756d, 0x6573, 0x656d, 0x746e, |
| 1700 | 0x5220, 0x4426, 0x4420, 0x7065, 0x2e74, 0x2320, 0x3231, 0x4b0a, |
| 1701 | 0x7461, 0x7573, 0x6179, 0x7573, 0x4120, 0x646e, 0x206f, 0x2026, |
| 1702 | 0x614b, 0x6f79, 0x6f6b, 0x5920, 0x6d61, 0x6d61, 0x746f, 0x0a6f, |
| 1703 | }; |
| 1683 | 1704 | |
| 1684 | 1705 | static const UINT16 fvipers2_prot_data[] = |
| 1685 | 1706 | { |
| r243093 | r243094 | |
| 1694 | 1715 | 0x2e64, 0x2a20, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, |
| 1695 | 1716 | }; |
| 1696 | 1717 | |
| 1718 | static const UINT16 spikeout_prot_data[] = |
| 1719 | { |
| 1720 | 0x0000, |
| 1721 | 0x4f4d, 0x4544, 0x2d4c, 0x2033, 0x7953, 0x7473, 0x6d65, 0x5020, |
| 1722 | 0x6f72, 0x7267, 0x6d61, 0x4320, 0x706f, 0x7279, 0x6769, 0x7468, |
| 1723 | 0x2820, 0x2943, 0x3120, 0x3939, 0x2035, 0x4553, 0x4147, 0x4520, |
| 1724 | 0x746e, 0x7265, 0x7270, 0x7369, 0x7365, 0x4c2c, 0x4454, 0x202e, |
| 1725 | 0x6c41, 0x206c, 0x6972, 0x6867, 0x2074, 0x6572, 0x6573, 0x7672, |
| 1726 | 0x6465, 0x202e, 0x2020, 0x0020 |
| 1727 | }; |
| 1697 | 1728 | |
| 1729 | static const UINT16 eca_prot_data[] = |
| 1730 | { |
| 1731 | 0x0000, |
| 1732 | 0x2d2f, 0x202d, 0x4d45, 0x5245, 0x4547, 0x434e, 0x2059, 0x4143, |
| 1733 | 0x4c4c, 0x4120, 0x424d, 0x4c55, 0x4e41, 0x4543, 0x2d20, 0x0a2d, |
| 1734 | 0x6f43, 0x7970, 0x6952, 0x6867, 0x2074, 0x4553, 0x4147, 0x4520, |
| 1735 | 0x746e, 0x7265, 0x7270, 0x7369, 0x7365, 0x202c, 0x744c, 0x2e64, |
| 1736 | 0x530a, 0x666f, 0x7774, 0x7261, 0x2065, 0x2652, 0x2044, 0x6544, |
| 1737 | 0x7470, 0x202e, 0x3123, 0x660a, 0x726f, 0x7420, 0x7365, 0x0a74, |
| 1738 | }; |
| 1698 | 1739 | |
| 1740 | static const UINT16 oceanhun_prot_data[] = |
| 1741 | { |
| 1742 | 0x0000, // dummy read |
| 1743 | 0x3d3d, 0x203d, 0x434f, 0x4145, 0x204e, 0x5548, 0x544e, 0x5245, |
| 1744 | 0x3d20, 0x3d3d, 0x430a, 0x706f, 0x5279, 0x6769, 0x7468, 0x5320, |
| 1745 | 0x4745, 0x2041, 0x6e45, 0x6574, 0x7072, 0x6972, 0x6573, 0x2c73, |
| 1746 | 0x4c20, 0x6474, 0x0a2e, 0x6d41, 0x7375, 0x6d65, 0x6e65, 0x2074, |
| 1747 | 0x2652, 0x2044, 0x6544, 0x7470, 0x202e, 0x3123, 0x4b0a, 0x7a61, |
| 1748 | 0x6e75, 0x7261, 0x2069, 0x7354, 0x6b75, 0x6d61, 0x746f, 0x206f, |
| 1749 | 0x6553, 0x7463, 0x6f69, 0x206e, 0x614d, 0x616e, 0x6567, 0x0a72 |
| 1750 | }; |
| 1751 | /* |
| 1752 | dirtdvls: first 2 words read are discarded, then every other word |
| 1753 | is written to char RAM starting at f1013400 (in between words are |
| 1754 | discarded). |
| 1755 | */ |
| 1699 | 1756 | |
| 1700 | 1757 | READ64_MEMBER(model3_state::model3_security_r) |
| 1701 | 1758 | { |
| r243093 | r243094 | |
| 1706 | 1763 | case 0x00 / 8: retvalue = 0; break; /* status */ |
| 1707 | 1764 | case 0x1c/8: /* security board data read */ |
| 1708 | 1765 | { |
| 1709 | | #ifdef DECRYPT_ANALYSIS_HACKS |
| 1710 | | readcount += 2; |
| 1711 | | printf("model3_security_r offset %08x : %08x%08x (%08x%08x) count %08x\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff), readcount); |
| 1712 | | #endif |
| 1713 | | |
| 1714 | | if (core_stricmp(machine().system().name, "fvipers2") == 0) |
| 1766 | if (core_stricmp(machine().system().name, "vs299") == 0 || |
| 1767 | core_stricmp(machine().system().name, "vs2v991") == 0) |
| 1715 | 1768 | { |
| 1769 | retvalue = (UINT64)vs299_prot_data[m_prot_data_ptr++] << 48; |
| 1770 | } |
| 1771 | else if (core_stricmp(machine().system().name, "swtrilgy") == 0 || |
| 1772 | core_stricmp(machine().system().name, "swtrilgya") == 0) |
| 1773 | { |
| 1774 | UINT64 data = (UINT64)swt_prot_data[m_prot_data_ptr++] << 16; |
| 1775 | if (m_prot_data_ptr > 0x38) |
| 1776 | { |
| 1777 | m_prot_data_ptr = 0; |
| 1778 | } |
| 1779 | retvalue = data; |
| 1780 | } |
| 1781 | else if (core_stricmp(machine().system().name, "fvipers2") == 0) |
| 1782 | { |
| 1716 | 1783 | UINT64 data = (UINT64)fvipers2_prot_data[m_prot_data_ptr++] << 16; |
| 1717 | 1784 | if (m_prot_data_ptr >= 0x41) |
| 1718 | 1785 | { |
| r243093 | r243094 | |
| 1720 | 1787 | } |
| 1721 | 1788 | retvalue = data; |
| 1722 | 1789 | } |
| 1790 | else if (core_stricmp(machine().system().name, "spikeout") == 0 || |
| 1791 | core_stricmp(machine().system().name, "spikeofe") == 0) |
| 1792 | { |
| 1793 | UINT64 data = (UINT64)spikeout_prot_data[m_prot_data_ptr++] << 16; |
| 1794 | if (m_prot_data_ptr >= 0x55) |
| 1795 | { |
| 1796 | m_prot_data_ptr = 0; |
| 1797 | } |
| 1798 | retvalue = data; |
| 1799 | } |
| 1800 | else if (core_stricmp(machine().system().name, "eca") == 0 || |
| 1801 | core_stricmp(machine().system().name, "ecax") == 0) |
| 1802 | { |
| 1803 | UINT64 data = (UINT64)eca_prot_data[m_prot_data_ptr++] << 16; |
| 1804 | if (m_prot_data_ptr >= 0x31) |
| 1805 | { |
| 1806 | m_prot_data_ptr = 0; |
| 1807 | } |
| 1808 | retvalue = data; |
| 1809 | } |
| 1810 | else if (core_stricmp(machine().system().name, "oceanhun") == 0) |
| 1811 | { |
| 1812 | UINT64 data = (UINT64)oceanhun_prot_data[m_prot_data_ptr++] << 16; |
| 1813 | if (m_prot_data_ptr >= 58) |
| 1814 | { |
| 1815 | m_prot_data_ptr = 0; |
| 1816 | } |
| 1817 | retvalue = data; |
| 1818 | } |
| 1723 | 1819 | else |
| 1724 | 1820 | { |
| 1725 | 1821 | retvalue = 0; |
| r243093 | r243094 | |
| 1727 | 1823 | break; |
| 1728 | 1824 | } |
| 1729 | 1825 | } |
| 1826 | printf("model3_security_r offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff)); |
| 1730 | 1827 | |
| 1731 | 1828 | return retvalue; |
| 1732 | 1829 | } |
| 1733 | 1830 | |
| 1734 | | |
| 1735 | | |
| 1736 | | WRITE64_MEMBER(model3_state::model3_security_w) |
| 1737 | | { |
| 1738 | | if (offset == 0x10 / 8) |
| 1739 | | { |
| 1740 | | if (data != 0) |
| 1741 | | printf("model3_security_w address isn't 0?\n"); |
| 1742 | | |
| 1743 | | first_read = 1; |
| 1744 | | |
| 1745 | | printf("setting base %08x%08x\n", (UINT32)(data >> 32), (UINT32)(data & 0xffffffff)); |
| 1746 | | } |
| 1747 | | else if (offset == 0x18 / 8) |
| 1748 | | { |
| 1749 | | UINT16 subkey = data >> (32 + 16); |
| 1750 | | subkey = ((subkey & 0xff00) >> 8) | ((subkey & 0x00ff) << 8); // endian swap the sub-key for this hardware |
| 1751 | | printf("model3_5881prot_w setting subkey %04x\n", subkey); |
| 1752 | | |
| 1753 | | #ifdef DECRYPT_ANALYSIS_HACKS // dump out a copy of protection RAM |
| 1754 | | FILE* fp2; |
| 1755 | | char filename[256]; |
| 1756 | | sprintf(filename,"xxxencrypted_%s_part%d", machine().system().name, segcount); |
| 1757 | | segcount++; |
| 1758 | | readcount = 0; |
| 1759 | | fp2 = fopen(filename, "w+b"); |
| 1760 | | |
| 1761 | | { |
| 1762 | | for (int i = 0; i < 0x8000; i++) |
| 1763 | | { |
| 1764 | | UINT16 dat = m_maincpu->space().read_word((0xf0180000 + 4 * i)); |
| 1765 | | UINT8* dst2 = (UINT8*)&dat; |
| 1766 | | fwrite(&dst2[1], 1, 1, fp2); |
| 1767 | | fwrite(&dst2[0], 1, 1, fp2); |
| 1768 | | } |
| 1769 | | |
| 1770 | | } |
| 1771 | | fclose(fp2); |
| 1772 | | #endif |
| 1773 | | |
| 1774 | | } |
| 1775 | | else |
| 1776 | | { |
| 1777 | | printf("model3_5881prot_w offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(data >> 32), (UINT32)(data & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff)); |
| 1778 | | } |
| 1779 | | } |
| 1780 | | |
| 1781 | 1831 | READ64_MEMBER(model3_state::model3_5881prot_r) |
| 1782 | 1832 | { |
| 1783 | 1833 | UINT64 retvalue = U64(0xffffffffffffffff); |
| r243093 | r243094 | |
| 1839 | 1889 | { |
| 1840 | 1890 | printf("model3_5881prot_w offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(data >> 32), (UINT32)(data & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff)); |
| 1841 | 1891 | } |
| 1892 | |
| 1893 | |
| 1894 | |
| 1842 | 1895 | } |
| 1843 | 1896 | |
| 1844 | 1897 | WRITE64_MEMBER(model3_state::daytona2_rombank_w) |
| r243093 | r243094 | |
| 5533 | 5586 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 5534 | 5587 | MACHINE_CONFIG_END |
| 5535 | 5588 | |
| 5536 | | static MACHINE_CONFIG_START(model3_20, model3_state) |
| 5589 | static MACHINE_CONFIG_START( model3_20, model3_state ) |
| 5537 | 5590 | MCFG_CPU_ADD("maincpu", PPC603R, 166000000) |
| 5538 | 5591 | MCFG_PPC_BUS_FREQUENCY(66000000) /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */ |
| 5539 | 5592 | MCFG_CPU_PROGRAM_MAP(model3_mem) |
| r243093 | r243094 | |
| 5542 | 5595 | MCFG_CPU_ADD("audiocpu", M68000, 12000000) |
| 5543 | 5596 | MCFG_CPU_PROGRAM_MAP(model3_snd) |
| 5544 | 5597 | |
| 5545 | | MCFG_MACHINE_START_OVERRIDE(model3_state, model3_20) |
| 5546 | | MCFG_MACHINE_RESET_OVERRIDE(model3_state, model3_20) |
| 5598 | MCFG_MACHINE_START_OVERRIDE(model3_state,model3_20) |
| 5599 | MCFG_MACHINE_RESET_OVERRIDE(model3_state,model3_20) |
| 5547 | 5600 | |
| 5548 | 5601 | MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") |
| 5549 | 5602 | MCFG_NVRAM_ADD_1FILL("backup") |
| r243093 | r243094 | |
| 5570 | 5623 | MCFG_SOUND_ROUTE(0, "rspeaker", 2.0) |
| 5571 | 5624 | MACHINE_CONFIG_END |
| 5572 | 5625 | |
| 5573 | | static MACHINE_CONFIG_DERIVED(model3_20_5881, model3_20) |
| 5574 | | MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0) |
| 5575 | | MCFG_SET_READ_CALLBACK(model3_state, crypt_read_callback) |
| 5576 | | MACHINE_CONFIG_END |
| 5577 | | |
| 5578 | | static MACHINE_CONFIG_START(model3_21, model3_state) |
| 5626 | static MACHINE_CONFIG_START( model3_21, model3_state ) |
| 5579 | 5627 | MCFG_CPU_ADD("maincpu", PPC603R, 166000000) |
| 5580 | 5628 | MCFG_PPC_BUS_FREQUENCY(66000000) /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */ |
| 5581 | 5629 | MCFG_CPU_PROGRAM_MAP(model3_mem) |
| r243093 | r243094 | |
| 5584 | 5632 | MCFG_CPU_ADD("audiocpu", M68000, 12000000) |
| 5585 | 5633 | MCFG_CPU_PROGRAM_MAP(model3_snd) |
| 5586 | 5634 | |
| 5587 | | MCFG_MACHINE_START_OVERRIDE(model3_state, model3_21) |
| 5588 | | MCFG_MACHINE_RESET_OVERRIDE(model3_state, model3_21) |
| 5635 | MCFG_MACHINE_START_OVERRIDE(model3_state,model3_21) |
| 5636 | MCFG_MACHINE_RESET_OVERRIDE(model3_state,model3_21) |
| 5589 | 5637 | |
| 5590 | 5638 | MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") |
| 5591 | 5639 | MCFG_NVRAM_ADD_1FILL("backup") |
| r243093 | r243094 | |
| 5612 | 5660 | MCFG_SOUND_ROUTE(0, "rspeaker", 2.0) |
| 5613 | 5661 | MACHINE_CONFIG_END |
| 5614 | 5662 | |
| 5615 | | |
| 5616 | 5663 | UINT16 model3_state::crypt_read_callback(UINT32 addr) |
| 5617 | 5664 | { |
| 5618 | 5665 | UINT16 dat = 0; |
| r243093 | r243094 | |
| 5623 | 5670 | |
| 5624 | 5671 | // dat = ((dat & 0xff00) >> 8) | ((dat & 0x00ff) << 8); |
| 5625 | 5672 | // printf("reading %04x\n", dat); |
| 5626 | | |
| 5627 | 5673 | return dat; |
| 5628 | 5674 | } |
| 5629 | 5675 | |
| r243093 | r243094 | |
| 5672 | 5718 | |
| 5673 | 5719 | if (key != -1) |
| 5674 | 5720 | { |
| 5721 | // m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, read64_delegate(FUNC(model3_state::model3_5881prot_r), this), write64_delegate(FUNC(model3_state::model3_5881prot_w), this)); |
| 5675 | 5722 | m_cryptdevice->set_key(key); |
| 5676 | 5723 | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_5881prot_r), this), write64_delegate(FUNC(model3_state::model3_5881prot_w), this) ); |
| 5677 | 5724 | } |
| 5678 | 5725 | else |
| 5679 | 5726 | { |
| 5680 | | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_security_r), this), write64_delegate(FUNC(model3_state::model3_security_w), this) ); |
| 5727 | m_maincpu->space(AS_PROGRAM).install_read_handler(0xf01a0000, 0xf01a003f, 0, 0x0e000000, read64_delegate(FUNC(model3_state::model3_security_r), this) ); |
| 5681 | 5728 | } |
| 5682 | 5729 | } |
| 5683 | 5730 | |
| r243093 | r243094 | |
| 5844 | 5891 | DRIVER_INIT_MEMBER(model3_state,vs298) |
| 5845 | 5892 | { |
| 5846 | 5893 | DRIVER_INIT_CALL(model3_20); |
| 5847 | | DRIVER_INIT_CALL(genprot); |
| 5848 | 5894 | } |
| 5849 | 5895 | |
| 5850 | 5896 | |
| 5897 | DRIVER_INIT_MEMBER(model3_state,vs2v991) |
| 5898 | { |
| 5899 | DRIVER_INIT_CALL(model3_20); |
| 5900 | } |
| 5851 | 5901 | |
| 5902 | DRIVER_INIT_MEMBER(model3_state,vs299b) |
| 5903 | { |
| 5904 | DRIVER_INIT_CALL(model3_20); |
| 5905 | } |
| 5852 | 5906 | |
| 5907 | DRIVER_INIT_MEMBER(model3_state,vs299a) |
| 5908 | { |
| 5909 | DRIVER_INIT_CALL(model3_20); |
| 5910 | } |
| 5911 | |
| 5853 | 5912 | DRIVER_INIT_MEMBER(model3_state,vs299) |
| 5854 | 5913 | { |
| 5855 | 5914 | DRIVER_INIT_CALL(model3_20); |
| 5856 | | DRIVER_INIT_CALL(genprot); |
| 5857 | 5915 | } |
| 5858 | 5916 | |
| 5859 | 5917 | DRIVER_INIT_MEMBER(model3_state,harley) |
| r243093 | r243094 | |
| 5911 | 5969 | { |
| 5912 | 5970 | //UINT32 *rom = (UINT32*)memregion("user1")->base(); |
| 5913 | 5971 | DRIVER_INIT_CALL(model3_20); |
| 5914 | | DRIVER_INIT_CALL(genprot); |
| 5915 | 5972 | |
| 5916 | 5973 | //rom[(0xf6dd0^4)/4] = 0x60000000; |
| 5917 | 5974 | } |
| r243093 | r243094 | |
| 5921 | 5978 | m_step20_with_old_real3d = true; |
| 5922 | 5979 | |
| 5923 | 5980 | DRIVER_INIT_CALL(model3_20); |
| 5924 | | DRIVER_INIT_CALL(genprot); |
| 5925 | 5981 | } |
| 5926 | 5982 | |
| 5927 | 5983 | DRIVER_INIT_MEMBER(model3_state,dirtdvls) |
| r243093 | r243094 | |
| 5929 | 5985 | m_step20_with_old_real3d = true; |
| 5930 | 5986 | |
| 5931 | 5987 | DRIVER_INIT_CALL(model3_20); |
| 5932 | | DRIVER_INIT_CALL(genprot); |
| 5933 | 5988 | } |
| 5934 | 5989 | |
| 5935 | 5990 | DRIVER_INIT_MEMBER(model3_state,daytona2) |
| 5936 | 5991 | { |
| 5937 | | // UINT32 *rom = (UINT32*)memregion("user1")->base(); |
| 5992 | UINT32 *rom = (UINT32*)memregion("user1")->base(); |
| 5938 | 5993 | DRIVER_INIT_CALL(model3_20); |
| 5939 | 5994 | |
| 5940 | 5995 | m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this)); |
| 5941 | 5996 | m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" ); |
| 5942 | 5997 | |
| 5943 | 5998 | //rom[(0x68468c^4)/4] = 0x60000000; |
| 5944 | | //rom[(0x6063c4^4)/4] = 0x60000000; |
| 5945 | | //rom[(0x616434^4)/4] = 0x60000000; |
| 5946 | | //rom[(0x69f4e4^4)/4] = 0x60000000; |
| 5947 | | |
| 5948 | | DRIVER_INIT_CALL(genprot); |
| 5999 | rom[(0x6063c4^4)/4] = 0x60000000; |
| 6000 | rom[(0x616434^4)/4] = 0x60000000; |
| 6001 | rom[(0x69f4e4^4)/4] = 0x60000000; |
| 5949 | 6002 | } |
| 5950 | 6003 | |
| 5951 | 6004 | DRIVER_INIT_MEMBER(model3_state,dayto2pe) |
| 5952 | 6005 | { |
| 5953 | | // UINT32 *rom = (UINT32*)memregion("user1")->base(); |
| 6006 | UINT32 *rom = (UINT32*)memregion("user1")->base(); |
| 5954 | 6007 | DRIVER_INIT_CALL(model3_20); |
| 5955 | 6008 | |
| 5956 | 6009 | m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this)); |
| 5957 | 6010 | m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" ); |
| 5958 | 6011 | |
| 5959 | | // rom[(0x606784^4)/4] = 0x60000000; |
| 5960 | | // rom[(0x69a3fc^4)/4] = 0x60000000; // jump to encrypted code |
| 5961 | | // rom[(0x618b28^4)/4] = 0x60000000; // jump to encrypted code |
| 6012 | rom[(0x606784^4)/4] = 0x60000000; |
| 6013 | rom[(0x69a3fc^4)/4] = 0x60000000; // jump to encrypted code |
| 6014 | rom[(0x618b28^4)/4] = 0x60000000; // jump to encrypted code |
| 5962 | 6015 | |
| 5963 | | // rom[(0x64ca34^4)/4] = 0x60000000; // dec |
| 5964 | | |
| 5965 | | DRIVER_INIT_CALL(genprot); |
| 6016 | rom[(0x64ca34^4)/4] = 0x60000000; // dec |
| 5966 | 6017 | } |
| 5967 | 6018 | |
| 5968 | 6019 | DRIVER_INIT_MEMBER(model3_state,spikeout) |
| r243093 | r243094 | |
| 5972 | 6023 | |
| 5973 | 6024 | rom[(0x6059cc^4)/4] = 0x60000000; |
| 5974 | 6025 | rom[(0x6059ec^4)/4] = 0x60000000; |
| 5975 | | DRIVER_INIT_CALL(genprot); |
| 5976 | 6026 | } |
| 5977 | 6027 | |
| 5978 | 6028 | DRIVER_INIT_MEMBER(model3_state,spikeofe) |
| r243093 | r243094 | |
| 5982 | 6032 | |
| 5983 | 6033 | rom[(0x6059cc^4)/4] = 0x60000000; |
| 5984 | 6034 | rom[(0x6059ec^4)/4] = 0x60000000; |
| 5985 | | DRIVER_INIT_CALL(genprot); |
| 5986 | 6035 | } |
| 5987 | 6036 | |
| 5988 | 6037 | DRIVER_INIT_MEMBER(model3_state,eca) |
| 5989 | 6038 | { |
| 5990 | 6039 | DRIVER_INIT_CALL(model3_20); |
| 5991 | | DRIVER_INIT_CALL(genprot); |
| 5992 | 6040 | } |
| 5993 | 6041 | |
| 5994 | 6042 | DRIVER_INIT_MEMBER(model3_state,skichamp) |
| r243093 | r243094 | |
| 6010 | 6058 | DRIVER_INIT_CALL(model3_20); |
| 6011 | 6059 | |
| 6012 | 6060 | rom[(0x57995c^4)/4] = 0x60000000; // decrementer |
| 6013 | | |
| 6014 | | DRIVER_INIT_CALL(genprot); |
| 6015 | 6061 | } |
| 6016 | 6062 | |
| 6017 | 6063 | DRIVER_INIT_MEMBER(model3_state,magtruck) |
| r243093 | r243094 | |
| 6019 | 6065 | m_step20_with_old_real3d = true; |
| 6020 | 6066 | |
| 6021 | 6067 | DRIVER_INIT_CALL(model3_20); |
| 6022 | | DRIVER_INIT_CALL(genprot); |
| 6023 | 6068 | } |
| 6024 | 6069 | |
| 6025 | 6070 | DRIVER_INIT_MEMBER(model3_state,lamachin) |
| r243093 | r243094 | |
| 6027 | 6072 | m_step20_with_old_real3d = true; |
| 6028 | 6073 | |
| 6029 | 6074 | DRIVER_INIT_CALL(model3_20); |
| 6030 | | DRIVER_INIT_CALL(genprot); |
| 6031 | 6075 | } |
| 6032 | 6076 | |
| 6033 | 6077 | |
| r243093 | r243094 | |
| 6052 | 6096 | GAME( 1998, vs29815, vs298, model3_15, model3, model3_state, vs29815, ROT0, "Sega", "Virtua Striker 2 '98 (Step 1.5)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6053 | 6097 | |
| 6054 | 6098 | /* Model 3 Step 2.0 */ |
| 6055 | | GAME( 1997, vs2, 0, model3_20, model3, model3_state, vs2, ROT0, "Sega", "Virtua Striker 2 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6056 | | GAME( 1997, harley, 0, model3_20, harley, model3_state, harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6057 | | GAME( 1997, harleya, harley, model3_20, harley, model3_state, harleya, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6058 | | GAME( 1998, lamachin, 0, model3_20_5881, model3, model3_state, lamachin, ROT0, "Sega", "L.A. Machineguns", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6059 | | GAME( 1998, oceanhun, 0, model3_20_5881, model3, model3_state, oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6060 | | GAME( 1998, skichamp, 0, model3_20, skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6061 | | GAME( 1998, srally2, 0, model3_20, scud, model3_state, srally2, ROT0, "Sega", "Sega Rally 2", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6062 | | GAME( 1998, srally2x, 0, model3_20, scud, model3_state, srally2, ROT0, "Sega", "Sega Rally 2 DX", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6063 | | GAME( 1998, von2, 0, model3_20_5881, model3, model3_state, von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6064 | | GAME( 1998, von254g, von2, model3_20_5881, model3, model3_state, von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (ver 5.4g)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6065 | | GAME( 1998, fvipers2, 0, model3_20_5881, model3, model3_state, vs299, ROT0, "Sega", "Fighting Vipers 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6066 | | GAME( 1998, vs298, 0, model3_20_5881, model3, model3_state, vs298, ROT0, "Sega", "Virtua Striker 2 '98 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6067 | | GAME( 1999, vs2v991, 0, model3_20_5881, model3, model3_state, vs299, ROT0, "Sega", "Virtua Striker 2 '99.1 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6068 | | GAME( 1999, vs299b, vs2v991, model3_20_5881, model3, model3_state, vs299, ROT0, "Sega", "Virtua Striker 2 '99 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6069 | | GAME( 1999, vs299a, vs2v991, model3_20_5881, model3, model3_state, vs299, ROT0, "Sega", "Virtua Striker 2 '99 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6070 | | GAME( 1999, vs299, vs2v991, model3_20_5881, model3, model3_state, vs299, ROT0, "Sega", "Virtua Striker 2 '99", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6099 | GAME( 1997, vs2, 0, model3_20, model3, model3_state, vs2, ROT0, "Sega", "Virtua Striker 2 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6100 | GAME( 1997, harley, 0, model3_20, harley, model3_state, harley, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6101 | GAME( 1997, harleya, harley, model3_20, harley, model3_state, harleya, ROT0, "Sega", "Harley-Davidson and L.A. Riders (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6102 | GAME( 1998, lamachin, 0, model3_20, model3, model3_state, lamachin, ROT0, "Sega", "L.A. Machineguns", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6103 | GAME( 1998, oceanhun, 0, model3_20, model3, model3_state, oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6104 | GAME( 1998, skichamp, 0, model3_20, skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6105 | GAME( 1998, srally2, 0, model3_20, scud, model3_state, srally2, ROT0, "Sega", "Sega Rally 2", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6106 | GAME( 1998, srally2x, 0, model3_20, scud, model3_state, srally2, ROT0, "Sega", "Sega Rally 2 DX", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6107 | GAME( 1998, von2, 0, model3_20, model3, model3_state, von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6108 | GAME( 1998, von254g, von2, model3_20, model3, model3_state, von2, ROT0, "Sega", "Virtual On 2: Oratorio Tangram (ver 5.4g)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6109 | GAME( 1998, fvipers2, 0, model3_20, model3, model3_state, model3_20, ROT0, "Sega", "Fighting Vipers 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6110 | GAME( 1998, vs298, 0, model3_20, model3, model3_state, vs298, ROT0, "Sega", "Virtua Striker 2 '98 (Step 2.0)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6111 | GAME( 1999, vs2v991, 0, model3_20, model3, model3_state, vs2v991, ROT0, "Sega", "Virtua Striker 2 '99.1 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6112 | GAME( 1999, vs299b, vs2v991, model3_20, model3, model3_state, vs299b, ROT0, "Sega", "Virtua Striker 2 '99 (Revision B)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6113 | GAME( 1999, vs299a, vs2v991, model3_20, model3, model3_state, vs299a, ROT0, "Sega", "Virtua Striker 2 '99 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6114 | GAME( 1999, vs299, vs2v991, model3_20, model3, model3_state, vs299, ROT0, "Sega", "Virtua Striker 2 '99", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6071 | 6115 | |
| 6072 | 6116 | /* Model 3 Step 2.1 */ |
| 6073 | | GAME( 1998, daytona2, 0, model3_21_5881, daytona2, model3_state, daytona2, ROT0, "Sega", "Daytona USA 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6074 | | GAME( 1998, dayto2pe, 0, model3_21_5881, daytona2, model3_state, dayto2pe, ROT0, "Sega", "Daytona USA 2 Power Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6075 | | GAME( 1998, dirtdvls, 0, model3_21_5881, scud, model3_state, dirtdvls, ROT0, "Sega", "Dirt Devils (set 1) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6076 | | GAME( 1998, dirtdvlsa, dirtdvls, model3_21_5881, scud, model3_state, dirtdvls, ROT0, "Sega", "Dirt Devils (set 2) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6117 | GAME( 1998, daytona2, 0, model3_21, daytona2, model3_state, daytona2, ROT0, "Sega", "Daytona USA 2 (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6118 | GAME( 1998, dayto2pe, 0, model3_21, daytona2, model3_state, dayto2pe, ROT0, "Sega", "Daytona USA 2 Power Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6119 | GAME( 1998, dirtdvls, 0, model3_21, scud, model3_state, dirtdvls, ROT0, "Sega", "Dirt Devils (set 1) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6120 | GAME( 1998, dirtdvlsa, dirtdvls, model3_21, scud, model3_state, dirtdvls, ROT0, "Sega", "Dirt Devils (set 2) (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6077 | 6121 | GAME( 1998, swtrilgy, 0, model3_21_5881, swtrilgy, model3_state, swtrilgy, ROT0, "Sega / LucasArts", "Star Wars Trilogy (Revision A)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6078 | 6122 | GAME( 1998, swtrilgya, swtrilgy, model3_21_5881, swtrilgy, model3_state, swtrilga, ROT0, "Sega / LucasArts", "Star Wars Trilogy", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6079 | | GAME( 1998, spikeout, 0, model3_21_5881, model3, model3_state, spikeout, ROT0, "Sega", "Spikeout (Revision C)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6080 | | GAME( 1998, spikeofe, 0, model3_21_5881, model3, model3_state, spikeofe, ROT0, "Sega", "Spikeout Final Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6081 | | GAME( 1998, magtruck, 0, model3_21_5881, eca, model3_state, magtruck, ROT0, "Sega", "Magical Truck Adventure", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6082 | | GAME( 1999, eca, 0, model3_21_5881, eca, model3_state, eca, ROT0, "Sega", "Emergency Call Ambulance", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6083 | | GAME( 1999, ecax, eca, model3_21_5881, eca, model3_state, eca, ROT0, "Sega", "Emergency Call Ambulance (Export)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6084 | | GAME( 1999, ecap, eca, model3_21_5881, eca, model3_state, eca, ROT0, "Sega", "Emergency Call Ambulance (US location test?)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6123 | GAME( 1998, spikeout, 0, model3_21, model3, model3_state, spikeout, ROT0, "Sega", "Spikeout (Revision C)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6124 | GAME( 1998, spikeofe, 0, model3_21, model3, model3_state, spikeofe, ROT0, "Sega", "Spikeout Final Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6125 | GAME( 1998, magtruck, 0, model3_21, eca, model3_state, magtruck, ROT0, "Sega", "Magical Truck Adventure", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6126 | GAME( 1999, eca, 0, model3_21, eca, model3_state, eca, ROT0, "Sega", "Emergency Call Ambulance", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6127 | GAME( 1999, ecax, eca, model3_21, eca, model3_state, eca, ROT0, "Sega", "Emergency Call Ambulance (Export)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 6128 | GAME( 1999, ecap, eca, model3_21, eca, model3_state, eca, ROT0, "Sega", "Emergency Call Ambulance (US location test?)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
trunk/src/mame/machine/315-5881_crypt.c
| r243093 | r243094 | |
| 130 | 130 | |
| 131 | 131 | The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher. |
| 132 | 132 | |
| 133 | | Every stream can be composed by several substreams; there are 18 header bits at the start of every substream, with |
| 134 | | a 1+9+8 format; the highest bit control the mode of operation: set to 1 means that the substream needs to be decompressed |
| 135 | | after being decrypted. The other two blocks (A||B) encode the length of the substream, as (A+1)*(B+1). When a |
| 136 | | substream end, the header of the next one, if existing, follows inmediatly. |
| 133 | There are 2 "control bits" at the start of the decrypted stream which control the mode of operation: bit #1 set to 1 means |
| 134 | that the stream needs to be decompressed after being decrypted. More on this later. |
| 137 | 135 | |
| 138 | 136 | The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been |
| 139 | 137 | conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests |
| r243093 | r243094 | |
| 146 | 144 | given plaintext word, and the remaining 2 to the next plaintext word. |
| 147 | 145 | |
| 148 | 146 | The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (16 bits), |
| 149 | | the game-key (>=29 bits; probably 64) and the sequence-key (16 bits) and output a middle result (16 bits) which will act |
| 150 | | as another key for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key |
| 151 | | and the result from the first FN and will output the decrypted word (16 bits). |
| 147 | the game-key (>=29 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key |
| 148 | for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key and the result |
| 149 | from the first FN and will output the decrypted word (16 bits). |
| 152 | 150 | |
| 153 | 151 | Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input is the |
| 154 | 152 | XOR of at most one bit from the previous round and at most one bit from the different keys. |
| 155 | 153 | |
| 156 | 154 | The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and, |
| 157 | 155 | indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident, |
| 158 | | as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due). |
| 156 | as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due). However, |
| 157 | the key scheduling used by this implementation is much weaker than the CPS-2's one. Many s-boxes inputs aren't XORed with any |
| 158 | key bit. |
| 159 | 159 | |
| 160 | Due to the small key-length, no sophisticated attacks are needed to recover the keys; a brute-force attack knowing just |
| 161 | some (encrypted word-decrypted word) pairs suffice. However, due to the weak key scheduling, it should be noted that some |
| 162 | related keys can produce the same output bytes for some (short) input sequences. |
| 163 | |
| 160 | 164 | Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is |
| 161 | 165 | mapped to multiples of 128K. |
| 162 | 166 | |
| r243093 | r243094 | |
| 169 | 173 | as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the |
| 170 | 174 | decryption need those incomplete parts. |
| 171 | 175 | |
| 172 | | SEGA apparently used his security part label (317-xxxx-yyy) as part of the key; the mapping of the current keys to the chip label |
| 173 | | is given by the following function: |
| 174 | | |
| 175 | | void key2label(uint32_t key) |
| 176 | | { |
| 177 | | int bcd0 = ((BIT(key,17)<<3)|(BIT(key,7)<<2)|(BIT(key,14)<<1)|BIT(key,19))^9; |
| 178 | | int bcd1 = ((BIT(key,20)<<3)|(BIT(key,1)<<2)|(BIT(key,4)<<1)|BIT(key,13))^5; |
| 179 | | int bcd2 = (BIT(key,9)<<1)|BIT(key,22); |
| 180 | | int bcd3 = ((BIT(key,9)<<2)|BIT(key,9))^5; |
| 181 | | |
| 182 | | char chiplabel[13]; |
| 183 | | sprintf(chiplabel, "317-%d%d%d%d-%s", bcd3, bcd2, bcd1, bcd0, (BIT(key,5)?"JPN":"COM")); |
| 184 | | |
| 185 | | printf("%s", chiplabel); |
| 186 | | } |
| 187 | | |
| 188 | | Given the use of the BCD-encoded security module labels, it's expected that at least other 6 additional bits be present in the |
| 189 | | real keys but undetected in the current implementation (due to them being set to fixed values on all the known 315-5881 chip labels). |
| 190 | | That would rise the bit count at least to 35. |
| 191 | | |
| 192 | | Other key bits not directly related to the 315-5881 label still show low entropies, making possible that |
| 193 | | they be derived from other non-random sources. |
| 194 | | |
| 195 | | In the second Feistel Network, every key bit seem to be used at most once (the various uses of current bit #9 are fictitious, as |
| 196 | | that bit really represent various bits in the real key; see comments on the use of the labels above). Given that, it seems probable |
| 197 | | that the real key is 64 bits long, exactly as in the related CPS-2 scheme, and the designers tried to cover all 96 input bits with |
| 198 | | the bits provening from the game key, the sequence key and the result from the first feistel network (64+16+16=96). In the first |
| 199 | | Feistel Network, as only 80 bits are available, some bits would be used twice (as can be partially seen in the current implementation). |
| 200 | | The fact that only 29 bits out of the expected 64 have been observed till now would be due to the generation of the key by composing |
| 201 | | low-entropy sources. |
| 202 | | |
| 203 | 176 | ****************************************************************************************/ |
| 204 | 177 | |
| 205 | 178 | const sega_315_5881_crypt_device::sbox sega_315_5881_crypt_device::fn1_sboxes[4][4] = { |
| r243093 | r243094 | |
| 261 | 234 | |
| 262 | 235 | { |
| 263 | 236 | { |
| 264 | | 2,2,2,3,1,1,0,1,3,3,1,1,2,2,2,0,0,3,2,3,3,0,2,1,2,2,3,0,1,3,0,0, |
| 265 | | 3,2,0,3,2,0,1,0,0,1,2,2,3,3,0,2,2,1,3,1,1,1,1,2,0,3,1,0,0,2,3,2, |
| 237 | 2,2,2,3,1,1,0,1,0,1,2,2,3,3,0,2,0,3,2,3,3,0,2,1,0,3,1,0,0,2,3,2, |
| 238 | 3,2,0,3,2,0,1,0,3,3,1,1,2,2,2,0,2,1,3,1,1,1,1,2,2,2,3,0,1,3,0,0, |
| 266 | 239 | }, |
| 267 | | {1,2,5,6,7,6}, |
| 240 | {1,2,5,6,7,-1}, |
| 268 | 241 | {2,7} |
| 269 | 242 | }, |
| 270 | 243 | |
| r243093 | r243094 | |
| 368 | 341 | |
| 369 | 342 | { |
| 370 | 343 | { |
| 371 | | 0,1,3,0,1,1,2,3,2,0,0,3,2,1,3,1,3,3,0,0,1,0,0,3,0,3,3,2,3,2,0,1, |
| 372 | | 3,2,3,2,2,1,3,1,1,1,0,3,3,2,2,1,1,2,0,2,0,1,1,0,1,0,1,1,2,0,3,0, |
| 344 | 0,2,3,2,1,1,0,0,2,1,0,3,3,0,0,0,3,2,0,2,1,1,2,1,0,0,3,1,2,2,3,1, |
| 345 | 3,1,3,0,0,0,1,3,1,0,0,3,2,2,3,1,1,3,0,0,2,1,3,3,1,3,1,2,3,1,2,1, |
| 373 | 346 | }, |
| 374 | | {0,3,5,6,5,0}, |
| 347 | {0,3,5,6,-1,-1}, |
| 375 | 348 | {1,2} |
| 376 | 349 | }, |
| 377 | 350 | |
| r243093 | r243094 | |
| 414 | 387 | |
| 415 | 388 | { |
| 416 | 389 | { |
| 417 | | 1,0,3,0,0,1,2,1,0,0,1,0,0,0,2,3,2,2,0,2,0,1,3,0,2,0,1,3,2,3,0,1, |
| 418 | | 1,2,2,2,1,3,0,3,0,1,1,0,3,2,3,3,2,0,0,3,1,2,1,3,3,2,1,0,2,1,2,3, |
| 390 | 1,2,3,2,0,3,2,3,0,1,1,0,0,2,2,3,2,0,0,3,0,2,3,3,2,2,1,0,2,1,0,3, |
| 391 | 1,0,2,0,1,1,0,1,0,0,1,0,3,0,3,3,2,2,0,2,1,1,1,0,3,0,1,3,2,3,2,1, |
| 419 | 392 | }, |
| 420 | | {2,3,4,6,7,2}, |
| 393 | {2,3,4,6,7,-1}, |
| 421 | 394 | {2,3} |
| 422 | 395 | }, |
| 423 | 396 | |
| r243093 | r243094 | |
| 433 | 406 | { // 3rd round |
| 434 | 407 | { |
| 435 | 408 | { |
| 436 | | 0,3,0,1,3,0,0,2,1,0,1,3,2,2,2,0,3,3,3,0,2,2,0,3,0,0,2,3,0,3,2,1, |
| 437 | | 3,3,0,3,0,2,3,3,1,1,1,0,2,2,1,1,3,0,3,1,2,0,2,0,0,0,3,2,1,1,0,0, |
| 409 | 0,3,0,1,0,2,3,3,1,0,1,3,2,2,1,1,3,3,3,0,2,0,2,0,0,0,2,3,1,1,0,0, |
| 410 | 3,3,0,3,3,0,0,2,1,1,1,0,2,2,2,0,3,0,3,1,2,2,0,3,0,0,3,2,0,3,2,1, |
| 438 | 411 | }, |
| 439 | | {1,4,5,6,7,5}, |
| 412 | {1,4,5,6,7,-1}, |
| 440 | 413 | {0,5} |
| 441 | 414 | }, |
| 442 | 415 | |
| r243093 | r243094 | |
| 451 | 424 | |
| 452 | 425 | { |
| 453 | 426 | { |
| 454 | | 2,2,0,3,0,3,1,0,1,1,2,3,2,3,1,0,0,0,3,2,2,0,2,3,1,3,2,0,3,3,1,3, |
| 427 | 2,2,3,2,0,3,2,3,1,1,2,0,2,3,1,3,0,0,0,3,2,0,1,0,1,3,2,3,3,3,1,0, |
| 455 | 428 | // unused? |
| 456 | 429 | 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, |
| 457 | 430 | }, |
| 458 | | {1,2,4,7,2,-1}, |
| 431 | {1,2,4,7,-1,-1}, |
| 459 | 432 | {2,4} |
| 460 | 433 | }, |
| 461 | 434 | |
| r243093 | r243094 | |
| 508 | 481 | }; |
| 509 | 482 | |
| 510 | 483 | const int sega_315_5881_crypt_device::fn1_game_key_scheduling[FN1GK][2] = { |
| 511 | | {1,29}, {1,71}, {2,4}, {2,54}, {3,8}, {4,56}, {4,73}, {5,11}, |
| 512 | | {6,51}, {7,92}, {8,89}, {9,9}, {9,39}, {9,58}, {9,86}, {10,90}, |
| 513 | | {11,6}, {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15}, {18,23}, |
| 514 | | {18,43}, {19,82}, {20,81}, {21,32}, {22,5}, {23,66}, {24,13}, {24,45}, |
| 515 | | {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25} |
| 484 | {1,29}, {1,71}, {2,4}, {2,54}, {3,8}, {4,56}, {4,73}, {5,11}, |
| 485 | {6,51}, {7,92}, {8,89}, {9,9}, {9,39}, {9,41}, {9,58}, {9,86}, |
| 486 | {10,90}, {11,6}, {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15}, |
| 487 | {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {22,5}, {23,66}, {24,13}, |
| 488 | {24,45}, {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25} |
| 516 | 489 | }; |
| 517 | 490 | |
| 518 | 491 | const int sega_315_5881_crypt_device::fn2_game_key_scheduling[FN2GK][2] = { |
| 519 | | {0,0}, {1,3}, {2,11}, {3,20}, {4,22}, {5,23}, {6,29}, {7,38}, |
| 520 | | {8,39}, {9,55}, {9,86}, {9,87}, {9,90}, {10,50}, {11,57}, {12,59}, |
| 521 | | {13,61}, {14,63}, {15,67}, {16,72}, {17,83}, {18,88}, {19,94}, {20,35}, |
| 522 | | {21,17}, {22,6}, {23,85}, {24,16}, {25,25}, {26,92}, {27,47}, {28,28} |
| 492 | {0,0}, {1,3}, {2,11}, {3,20}, {4,22}, {5,23}, {6,29}, {7,38}, |
| 493 | {8,39}, {9,55}, {9,86}, {9,87}, {9,90}, {10,50}, {10,53}, {11,57}, |
| 494 | {12,59}, {13,61}, {13,64}, {14,63}, {15,67}, {16,72}, {17,83}, {18,88}, |
| 495 | {19,94}, {20,35}, {21,17}, {22,6}, {22,11}, {23,85}, {24,16}, {25,25}, |
| 496 | {26,92}, {27,47}, {28,28} |
| 523 | 497 | }; |
| 524 | 498 | |
| 525 | 499 | const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = { |
| r243093 | r243094 | |
| 609 | 583 | } |
| 610 | 584 | } |
| 611 | 585 | |
| 586 | // subkeys bits 10 & 41 |
| 587 | fn2_subkeys[0] ^= (BIT(sequence_key, 2) << 10); |
| 588 | fn2_subkeys[1] ^= (BIT(sequence_key, 4) << 17); |
| 612 | 589 | /**************************************************************/ |
| 613 | 590 | |
| 614 | 591 | // First Feistel Network |
trunk/src/mame/machine/315-5881_helper.c
| r243093 | r243094 | |
| 31 | 31 | |
| 32 | 32 | static const struct game_keys keys_table[] = |
| 33 | 33 | { |
| 34 | | // name key gameid # year chip label platform |
| 34 | // name key gameid # year chip label platform |
| 35 | 35 | { "twcup98", 0x05200913 }, // 25209801 1998 317-5039-COM ST-V |
| 36 | 36 | { "astrass", 0x052e2901 }, // 25349801 1998 317-5040-COM ST-V (yes, the 317-5040-COM chip was reused for 3 different games and on both Naomi and ST-V!) |
| 37 | 37 | { "rsgun", 0x05272d01 }, // 1998 317-5041-COM ST-V |
| r243093 | r243094 | |
| 39 | 39 | { "elandore", 0x05226d41 }, // 1998 317-5043-COM ST-V |
| 40 | 40 | { "ffreveng", 0x0524ac01 }, // 1998 317-5049-COM ST-V |
| 41 | 41 | |
| 42 | { "gundmct", 0x000e8010 }, // 841-0017 2001 ??? Naomi |
| 43 | { "puyoda", 0x000acd40 }, // 841-0006 1999 ??? Naomi |
| 44 | { "smlg99", 0x08048a01 }, // 840-0012 1999 ??? Naomi |
| 45 | { "vf4cart", 0x0eef2f96 }, // 840-0080 2002 ??? Naomi 2 |
| 46 | { "vonot", 0x08010715 }, // 840-0028 2000 ??? Naomi |
| 47 | { "marstv", 0x080b8ef5 }, // 840-0025 1999 317-0074-JPN Naomi |
| 42 | 48 | { "dybbnao", 0x080e6ae1 }, // 840-0001 1998 317-0246-JPN Naomi |
| 43 | 49 | { "crzytaxi", 0x080d2f45 }, // 840-0002 1999 317-0248-COM Naomi |
| 44 | 50 | { "zombrvn", 0x08012b41 }, // 840-0003 1999 317-0249-COM Naomi |
| r243093 | r243094 | |
| 50 | 56 | { "tduno", 0x08028ea5 }, // 840-0008 1999 317-0255-JPN Naomi |
| 51 | 57 | { "toyfight", 0x0802ca85 }, // 840-0011 1999 317-0257-COM Naomi |
| 52 | 58 | { "vs2_2k", 0x08088b08 }, // 840-0010 1999 317-0258-COM Naomi |
| 53 | | { "smlg99", 0x08048a01 }, // 840-0012 1999 317-0259-COM Naomi |
| 54 | 59 | { "derbyoc", 0x080fee35 }, // 840-0016 1999 317-0262-JPN Naomi |
| 55 | 60 | { "vtennis", 0x0803eb15 }, // 840-0015 1999 317-0263-COM Naomi |
| 56 | 61 | { "jambo", 0x080fab95 }, // 840-0013 1999 317-0264-COM Naomi |
| r243093 | r243094 | |
| 67 | 72 | { "18wheelr", 0x0807cf54 }, // 840-0023 2000 317-0273-COM Naomi |
| 68 | 73 | { "18wheels", 0x0807cf54 }, // 840-0036 2000 317-0273-COM Naomi |
| 69 | 74 | { "18wheelu", 0x0807cf54 }, // 840-0037 2000 317-0273-COM Naomi |
| 70 | | { "marstv", 0x080b8ef5 }, // 840-0025 1999 317-0274-JPN Naomi |
| 71 | | { "vonot", 0x08010715 }, // 840-0028 2000 317-0279-COM Naomi |
| 72 | 75 | { "sstrkfgt", 0x08132303 }, // 840-0035 2000 317-0281-COM Naomi |
| 73 | 76 | { "sstrkfgta", 0x08132303 }, // 840-0035 2000 317-0281-COM Naomi |
| 74 | 77 | { "wwfroyal", 0x081627c3 }, // 840-0040 2000 317-0285-COM Naomi |
| r243093 | r243094 | |
| 88 | 91 | { "clubkrtd", 0x0ce7d742 }, // 840-0062 2001 317-0313-COM Naomi 2 |
| 89 | 92 | { "clubkrte", 0x0ce7d742 }, // 840-0062 2001 317-0313-COM Naomi 2 |
| 90 | 93 | { "inunoos", 0x094bc3e3 }, // 840-0073 2001 317-0316-JPN Naomi |
| 91 | | { "vf4cart", 0x0eef2f96 }, // 840-0080 2002 317-0324-COM Naomi 2 |
| 92 | 94 | { "toukon4", 0x052e2901 }, // 25349801 2000 317-5040-COM Naomi |
| 93 | 95 | { "wldkicks", 0x052e2901 }, // 25209801 2000 317-5040-COM Naomi |
| 94 | 96 | { "wldkicksa", 0x052e2901 }, // 25209801 2000 317-5040-COM Naomi |
| r243093 | r243094 | |
| 99 | 101 | { "doa2m", 0x0008ad01 }, // 841-0003 1999 317-5048-COM Naomi |
| 100 | 102 | { "shangril", -1 }, // 841-0004 1999 317-5050-JPN Naomi seems not used by game |
| 101 | 103 | { "spawn", 0x00078d01 }, // 841-0005 1999 317-5051-COM Naomi |
| 102 | | { "puyoda", 0x000acd40 }, // 841-0006 1999 317-5052-COM Naomi |
| 103 | 104 | { "pstone2", 0x000b8dc0 }, // 841-0008 2000 317-5054-COM Naomi |
| 104 | 105 | { "capsnk", 0x00000000 }, // 841-0011 2000 317-5059-COM Naomi |
| 105 | 106 | { "capsnka", 0x00000000 }, // 841-0011 2000 317-5059-COM Naomi |
| r243093 | r243094 | |
| 113 | 114 | { "ninjaslt1", 0x000ca510 }, // 25469801 2000 317-5068-COM Naomi |
| 114 | 115 | { "ninjaslt2", 0x000ca510 }, // 25469801 2000 317-5068-COM Naomi |
| 115 | 116 | { "ninjaslt4", 0x000ca510 }, // 25469801 2000 317-5068-COM Naomi |
| 116 | | { "gundmct", 0x000e8010 }, // 841-0017 2001 317-5070-COM Naomi |
| 117 | 117 | { "hmgeo", 0x00038510 }, // HMG016007 2001 317-5071-COM Naomi |
| 118 | 118 | { "zerogu2", 0x0007c010 }, // 841-0020 2001 317-5073-COM Naomi |
| 119 | 119 | { "gunsur2", 0x000680d0 }, // 25709801 2001 317-5075-COM Naomi |
| r243093 | r243094 | |
| 128 | 128 | { "dynamcopb", 0x0c2a4a93 }, // 1998 317-0236-COM Model 2 |
| 129 | 129 | { "dyndeka2b", 0x0c2a4a93 }, // 1998 317-0236-COM Model 2 |
| 130 | 130 | { "dynamcopc", 0x0c2a4a93 }, // 1998 317-0236-COM Model 2 |
| 131 | | { "zerogun", 0x042c0d13 }, // 1997 317-5038-COM Model 2 |
| 132 | | { "zerogunj", 0x042c0d13 }, // 1997 317-5038-COM Model 2 |
| 133 | | { "zeroguna", 0x042c0d13 }, // 1997 317-5038-COM Model 2 |
| 134 | | { "zerogunaj", 0x042c0d13 }, // 1997 317-5038-COM Model 2 |
| 135 | | { "pltkids", 0x042e2dc1 }, // 1998 317-5044-COM Model 2 |
| 136 | | { "pltkidsa", 0x042e2dc1 }, // 1998 317-5044-COM Model 2 |
| 131 | { "pltkids", -1 }, // 1998 317-5044-COM Model 2 |
| 132 | { "pltkidsa", -1 }, // 1998 317-5044-COM Model 2 |
| 133 | { "zerogun", -1 }, // 1997 317-5038-COM Model 2 // lowest numbered chip? |
| 134 | { "zerogunj", -1 }, // 1997 317-5038-COM Model 2 |
| 135 | { "zeroguna", -1 }, // 1997 317-5038-COM Model 2 |
| 136 | { "zerogunaj", -1 }, // 1997 317-5038-COM Model 2 |
| 137 | 137 | |
| 138 | | { "von2", 0x092a0e97 }, // ???? 317-0234-COM Model 3 |
| 139 | | { "von254g", 0x092a0e97 }, // ???? 317-0234-COM Model 3 |
| 140 | | { "fvipers2", 0x09260e96 }, // ???? 317-0235-COM Model 3 |
| 138 | |
| 141 | 139 | { "vs298", 0x09234e96 }, // ???? 317-0237-COM Model 3 |
| 142 | | { "dirtdvls", 0x09290f17 }, // ???? 317-0238-COM Model 3 |
| 143 | | { "dirtdvlsa", 0x09290f17 }, // ???? 317-0238-COM Model 3 |
| 144 | | { "daytona2", 0x09250e16 }, // ???? 317-0239-COM Model 3 |
| 145 | | { "spikeout", 0x092f2b04 }, // ???? 317-0240-COM Model 3 |
| 146 | 140 | { "swtrilgy", 0x11272a01 }, // ???? 317-0241-COM Model 3 |
| 147 | 141 | { "swtrilgya", 0x11272a01 }, // ???? 317-0241-COM Model 3 |
| 148 | | { "oceanhun", 0x092b6a01 }, // ???? 317-0242-COM Model 3 |
| 149 | | { "magtruck", 0x09266e45 }, // ???? 317-0243-COM Model 3 |
| 150 | | { "lamachin", 0x092a2bc5 }, // ???? 317-0244-COM Model 3 |
| 151 | 142 | { "vs299", 0x09222ac8 }, // ???? 317-0245-COM Model 3 |
| 152 | | { "vs2v991", 0x09222ac8 }, // ???? 317-0245-COM Model 3 |
| 153 | | { "vs299b", 0x09222ac8 }, // ???? 317-0245-COM Model 3 |
| 154 | | { "vs299a", 0x09222ac8 }, // ???? 317-0245-COM Model 3 |
| 155 | | { "spikeofe", 0x09236fc8 }, // ???? 317-0247-COM Model 3 |
| 156 | | { "eca", 0x0923aa91 }, // ???? 317-0265-COM Model 3 |
| 157 | | { "ecax", 0x0923aa91 }, // ???? 317-0265-COM Model 3 |
| 158 | | { "ecap", 0x0923aa91 }, // ???? 317-0265-COM Model 3 |
| 159 | | { "dayto2pe", -1 }, // ???? 317-5045-COM Model 3 |
| 160 | | |
| 143 | |
| 144 | |
| 161 | 145 | { NULL, 0 } // end of table |
| 162 | 146 | }; |
| 163 | 147 | |
trunk/src/mame/machine/stvprot.c
| r243093 | r243094 | |
| 1 | | /* ST-V hookup for 315-5881 encryption/compression chip */ |
| 1 | /* ST-V protection stuff */ |
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | |
| r243093 | r243094 | |
| 11 | 11 | Steep Slope Sliders (gfx transfer of character portraits) |
| 12 | 12 | Tecmo World Cup '98 (tecmo logo, player movement) |
| 13 | 13 | |
| 14 | I think this is an encryption device. Decathlete is also protected, but uses a different device |
| 15 | see machine/decathlt.c for details of that one, unlike this that appears to perform decompression |
| 16 | operations. |
| 17 | |
| 18 | |
| 19 | Astra Superstars data were extracted from Saturn version of the game. It is not known if |
| 20 | protection device has data stored inside, or they are read from roms (using decryption/decompression) |
| 21 | |
| 14 | 22 | */ |
| 15 | 23 | |
| 24 | /**************************************************************************************** |
| 25 | |
| 26 | Protection & cartridge handling |
| 27 | |
| 28 | ***************************************************************************************** |
| 29 | |
| 30 | These are the known ST-V games that uses this area as a valid protection,I have written |
| 31 | the data used by the games in the various circumstances for reference: |
| 32 | -Astra Super Stars [astrass] |
| 33 | [0] [1] [2] [3] |
| 34 | 0x000y0000 0x00000000 0x06130027 0x01230000 test mode,char transfer (3) |
| 35 | 0x???????? 0x???????? 0x???????? 0x???????? attract mode |
| 36 | 0x000y0000 0x00000000 0x06130027 0x01230000 gameplay,char transfer (3) |
| 37 | |
| 38 | -Elan Doree : Legend of Dragon [elandore] |
| 39 | [0] [1] [2] [3] |
| 40 | No protection test mode |
| 41 | No protection attract mode |
| 42 | 0x000y0000 0x00000000 0x****00** 0xff7f0000 gameplay,VDP-1 write (textures on humans) |
| 43 | 0x000y0000 0x00000000 0x****00** 0xffbf0000 gameplay,VDP-1 write (textures on humans) |
| 44 | |
| 45 | 0x000y0000 0x00000000 0x****00** 0xf9ff0000 gameplay,VDP-1 write (textures on dragons) |
| 46 | 0x000y0000 0x00000000 0x****00** 0xfbff0000 gameplay,VDP-1 write (textures on dragons) |
| 47 | 0x000y0000 0x00000000 0x****00** 0xfe7f0000 gameplay,VDP-1 write (textures on dragons) |
| 48 | 0x000y0000 0x00000000 0x****00** 0xfd7f0000 gameplay,VDP-1 write (textures on dragons) |
| 49 | 0x000y0000 0x00000000 0x****00** 0xfeff0000 gameplay,VDP-1 write (textures on dragons) |
| 50 | 0x000y0000 0x00000000 0x****00** 0xf9bf0000 gameplay,VDP-1 write (textures on dragons) |
| 51 | |
| 52 | -Final Fight Revenge [ffreveng] |
| 53 | [0] [1] [2] [3] |
| 54 | 0x000y0000 0x00000000 0x4bcc0013 0x10da0000 test mode,boot vectors at $06080000 |
| 55 | 0x000y0000 0x00000000 0x0b780013 0x10d70000 attract mode,boot vectors at $06080000 |
| 56 | 0x???????? 0x???????? 0x???????? 0x???????? gameplay |
| 57 | |
| 58 | -Radiant Silvergun [rsgun] |
| 59 | [0] [1] [2] [3] |
| 60 | No protection test mode |
| 61 | 0x000y0000 0x00000000 0x08000010 0x77770000 attract mode,work ram-h $60ff1ec and so on (1) |
| 62 | 0x???????? 0x???????? 0x???????? 0x???????? gameplay |
| 63 | |
| 64 | -Steep Slope Sliders [sss] |
| 65 | [0] [1] [2] [3] |
| 66 | No protection test mode |
| 67 | *0x000y0000 0x00000000 0x000000a6 0x2c5b0000 attract mode,VDP-1 write |
| 68 | *0x000y0000 0x00000000 0x000000a6 0x2c5b0000 gameplay,VDP-1 write character 1 (2) |
| 69 | *0x000y0000 0x00000000 0x0f9800a6 0x47f10000 gameplay,VDP-1 write character 2 |
| 70 | *0x000y0000 0x00000000 0x1d4800a6 0xfcda0000 gameplay,VDP-1 write character 3 |
| 71 | *0x000y0000 0x00000000 0x29e300a6 0xb5e60000 gameplay,VDP-1 write character 4 |
| 72 | *0x000y0000 0x00000000 0x38e900a6 0x392c0000 gameplay,VDP-1 write character 5 |
| 73 | *0x000y0000 0x00000000 0x462500a6 0x77c30000 gameplay,VDP-1 write character 6 |
| 74 | *0x000y0000 0x00000000 0x555c00a6 0x8a620000 gameplay,VDP-1 write character 7 |
| 75 | |
| 76 | ========================================================================================= |
| 77 | y = setted as a 0,then after the ctrl data is moved is toggled to 1 then again toggled |
| 78 | to 0 after the reading,this bit is likely to be a "calculate protection values" |
| 79 | if 1,use normal ram if 0. |
| 80 | * = working checks |
| 81 | [3,low word]AFAIK this is the cartridge area and it's read-only. |
| 82 | (1)That area is usually (but not always) used as system registers. |
| 83 | (2)Same as P.O.S.T. check,it was really simple to look-up because of that. |
| 84 | (3)Wrong offset,or it requires something else like a bitswap? |
| 85 | ========================================================================================= |
| 86 | Protection works as a sort of data transfer,it could also be that it uses |
| 87 | encryption on the data used... |
| 88 | |
| 89 | For now I'm writing this function with a command basis so I can work better with it. |
| 90 | ****************************************************************************************/ |
| 91 | |
| 16 | 92 | #include "emu.h" |
| 17 | 93 | #include "includes/stv.h" |
| 18 | 94 | |
| 95 | //FILE *fp; |
| 96 | //FILE *fp2; |
| 19 | 97 | |
| 20 | 98 | |
| 99 | /************************ |
| 100 | * |
| 101 | * Tecmo World Cup '98 |
| 102 | * |
| 103 | ************************/ |
| 21 | 104 | |
| 105 | /* |
| 106 | 0x200214 |
| 107 | 0x20de94 |
| 108 | wpset 0x200214,0x20de94-0x200214,r |
| 109 | dump twcup98.dmp,0x200214,0x20de94-0x200214,4,0,0 |
| 110 | protection tests the data 0x201220 at |
| 111 | bp 0x6009a9e |
| 112 | with 0x60651f8 |
| 113 | */ |
| 22 | 114 | |
| 115 | |
| 116 | //MAIN : 12120000 DATA : 0ad20069 Tecmo logo |
| 117 | //MAIN : 12120000 DATA : e332006b title screen |
| 118 | // TODO: encrypted / compressed data. |
| 119 | // Both points to a section that has a string ("TECMO" / "TITLE") |
| 120 | |
| 121 | |
| 122 | /************************* |
| 123 | * |
| 124 | * Final Fight Revenge |
| 125 | * |
| 126 | *************************/ |
| 127 | |
| 128 | /* |
| 129 | ffreveng protection notes |
| 130 | Global: |
| 131 | R2 is the vector read (where to jump to) |
| 132 | R3 is the vector pointer |
| 133 | |
| 134 | Directory listing for Final Fight Revenge (Saturn Version): |
| 135 | |
| 136 | In the ST-V version, most of these file names could be found at relative address 0x346a0 (0x22346a0) |
| 137 | Also, there's a table at 0x260000 (0x2260000), this points to offsets to the ROM (and are sent to the protection device), |
| 138 | and the size of it |
| 139 | |
| 140 | fad size file name date |
| 141 | 000000aa 00003000 2000/2/8 |
| 142 | 000000aa 00003000 ? 2000/2/8 |
| 143 | 000000b0 00076080 0;1 2000/2/8 |
| 144 | 0001799e 014b2000 ALY.RED;1 1999/11/9 |
| 145 | 00002350 00001900 ALYHRAM.BIN;1 2000/2/8 |
| 146 | 0000040e 00005204 ANDEND.BIN;1 1999/11/9 |
| 147 | 000001a0 0000c700 ANDORE.BIN;1 2000/2/8 |
| 148 | 000003c8 00016938 ANDORE.CRT;1 1999/11/9 |
| 149 | 000001b9 000f3528 ANDOREM.BIN;1 2000/2/8 |
| 150 | 00003525 012db000 ATN.RED;1 1999/11/9 |
| 151 | 000024e6 00001900 ATNHRAM.BIN;1 2000/2/8 |
| 152 | 00013291 0120d000 ATO.RED;1 1999/11/9 |
| 153 | 000024a0 00001100 ATOHRAM.BIN;1 2000/2/8 |
| 154 | 00000419 0000f000 BELGER.BIN;1 2000/2/8 |
| 155 | 000005f0 00013bdc BELGER.CRT;1 1999/11/9 |
| 156 | 00000437 000ce990 BELGERM.BIN;1 2000/2/8 |
| 157 | 00002611 00000894 BURGR.BIN;1 2000/2/8 |
| 158 | 00002605 00000638 CAFFE.BIN;1 2000/2/8 |
| 159 | 0000273b 000022e0 CAPCOM.BIN;1 1999/11/9 |
| 160 | 00001d9a 00012100 CAPHRAM.BIN;1 2000/2/8 |
| 161 | 00000834 00004cec CDYEND.BIN;1 1999/11/9 |
| 162 | 0000218a 00005900 CHSHRAM.BIN;1 2000/2/8 |
| 163 | 0000061a 0000b900 CODY.BIN;1 2000/2/8 |
| 164 | 00000809 00014e00 CODY.CRT;1 1999/11/9 |
| 165 | 00002857 000ff412 CODYANIM.BIN;1 1999/11/9 |
| 166 | 00002a56 00011dbc CODYAPAL.BIN;1 1999/11/9 |
| 167 | 00000632 000d31cc CODYM.BIN;1 2000/2/8 |
| 168 | 00002619 0000046c CURRY.BIN;1 2000/2/8 |
| 169 | 00000b36 00005110 DAMEND.BIN;1 1999/11/9 |
| 170 | 0000083e 0000b300 DAMND.BIN;1 2000/2/8 |
| 171 | 00000aa6 000181ae DAMND.CRT;1 1999/11/9 |
| 172 | 00000855 0010c674 DAMNDM.BIN;1 2000/2/8 |
| 173 | 00000ad9 000063c0 DDAD.BIN;1 1999/11/9 |
| 174 | 00000b2c 00004a30 DDBL.BIN;1 1999/11/9 |
| 175 | 00000b25 000034b4 DDCD.BIN;1 1999/11/9 |
| 176 | 00000ae6 00004c6c DDDM.BIN;1 1999/11/9 |
| 177 | 00000b1c 00004660 DDED.BIN;1 1999/11/9 |
| 178 | 00000b15 00003770 DDEL.BIN;1 1999/11/9 |
| 179 | 00000b0e 00003268 DDGY.BIN;1 1999/11/9 |
| 180 | 00000b06 00003c74 DDHG.BIN;1 1999/11/9 |
| 181 | 00000b00 000029a8 DDPS.BIN;1 1999/11/9 |
| 182 | 00000af9 000035e4 DDRL.BIN;1 1999/11/9 |
| 183 | 00000af0 000044a8 DDSD.BIN;1 1999/11/9 |
| 184 | 0000217a 00007d00 DEMHRAM.BIN;1 2000/2/8 |
| 185 | 0000278e 00064396 DLOOP.CRT;1 1999/11/9 |
| 186 | 00000b41 0000e200 EDDIE.BIN;1 2000/2/8 |
| 187 | 00000d25 00019a44 EDDIE.CRT;1 1999/11/9 |
| 188 | 00000b5e 000c7758 EDDIEM.BIN;1 2000/2/8 |
| 189 | 00000d5a 00005204 EDIEND.BIN;1 1999/11/9 |
| 190 | 00000d65 0000d700 ELGADO.BIN;1 2000/2/8 |
| 191 | 00001010 00018b2e ELGADO.CRT;1 1999/11/9 |
| 192 | 00000d80 0012ec64 ELGADOM.BIN;1 2000/2/8 |
| 193 | 00001043 00005204 ELGEND.BIN;1 1999/11/9 |
| 194 | 00001d79 0000e5ec ENDING.BIN;1 1999/11/9 |
| 195 | 00002bc3 0002e8f4 ENDING.CRT;1 1999/11/9 |
| 196 | 0000019e 0000005d FFEXABS.TXT;1 1999/11/9 |
| 197 | 0000019f 00000060 FFEXBIB.TXT;1 1999/11/9 |
| 198 | 0000019d 00000032 FFEXCPY.TXT;1 1999/11/9 |
| 199 | 00002615 0000062c FRIES.BIN;1 2000/2/8 |
| 200 | 00001ce1 0004b8b4 GAMEL.BIN;1 1999/11/9 |
| 201 | 000003f6 000011fc GANDRE.BIN;1 1999/11/9 |
| 202 | 0000040b 00001246 GBEL.BIN;1 1999/11/9 |
| 203 | 000003f9 00000af3 GCODY.BIN;1 1999/11/9 |
| 204 | 000003fb 00000cc4 GDAM.BIN;1 1999/11/9 |
| 205 | 000003fd 00000f6a GEDDIE.BIN;1 1999/11/9 |
| 206 | 000003ff 00000c85 GGADO.BIN;1 1999/11/9 |
| 207 | 00000401 00000d4c GGUY.BIN;1 1999/11/9 |
| 208 | 00000403 00000f16 GHAG.BIN;1 1999/11/9 |
| 209 | 00000405 00000a63 GPOISON.BIN;1 1999/11/9 |
| 210 | 00000407 00000a85 GROL.BIN;1 1999/11/9 |
| 211 | 00005b71 01156000 GRV.RED;1 1999/11/9 |
| 212 | 0000243b 00001600 GRVHRAM.BIN;1 2000/2/8 |
| 213 | 00000409 00000dad GSODOM.BIN;1 1999/11/9 |
| 214 | 0000104e 0000c300 GUY.BIN;1 2000/2/8 |
| 215 | 0000123a 00014844 GUY.CRT;1 1999/11/9 |
| 216 | 00001266 00005204 GUYEND.BIN;1 1999/11/9 |
| 217 | 00001067 000d14aa GUYM.BIN;1 2000/2/8 |
| 218 | 00001271 0000c600 HAGGAR.BIN;1 2000/2/8 |
| 219 | 00001489 00017ad8 HAGGAR.CRT;1 1999/11/9 |
| 220 | 0000128a 000e46fc HAGGARM.BIN;1 2000/2/8 |
| 221 | 000014bb 00005204 HGREND.BIN;1 1999/11/9 |
| 222 | 00002740 0001b468 HISCORE.BIN;1 1999/11/9 |
| 223 | 00002777 00000a00 HISCP.BIN;1 1999/11/9 |
| 224 | 00002779 000086c0 HISCTEX.BIN;1 1999/11/9 |
| 225 | 0000278b 00001680 HSFACE_T.BIN;1 1999/11/9 |
| 226 | 00002607 00000618 HTDOG.BIN;1 2000/2/8 |
| 227 | 00015741 010e3800 JNK.RED;1 1999/11/9 |
| 228 | 000023cd 00001900 JNKHRAM.BIN;1 2000/2/8 |
| 229 | 00002d0b 0003dfc0 KANJI.FON;1 1999/11/9 |
| 230 | 00001d98 00000d44 LOAD.BIN;1 1999/11/9 |
| 231 | 00001dbf 001dd5a8 LOGO.CPK;1 1999/11/9 |
| 232 | 00002d0a 00000400 LVLHRAM.BIN;1 2000/2/8 |
| 233 | 0000260a 000005e8 MEAT.BIN;1 2000/2/8 |
| 234 | 00007eb3 01253800 MLK.RED;1 1999/11/9 |
| 235 | 00002196 00000d00 MLKHRAM.BIN;1 2000/2/8 |
| 236 | 0000278a 00000400 NAMEP.BIN;1 1999/11/9 |
| 237 | 0000a3f0 011b8000 NPK.RED;1 1999/11/9 |
| 238 | 000022d0 00002700 NPKHRAM.BIN;1 2000/2/8 |
| 239 | 00010dc0 0121d800 NUK.RED;1 1999/11/9 |
| 240 | 00002555 00001100 NUKHRAM.BIN;1 2000/2/8 |
| 241 | 00002c21 00036f94 OVER.CRT;1 1999/11/9 |
| 242 | 000014c6 0000ab00 POISON.BIN;1 2000/2/8 |
| 243 | 000017f1 00018880 POISON.CRT;1 1999/11/9 |
| 244 | 000014dc 0017617c POISONM.BIN;1 2000/2/8 |
| 245 | 0000c7f6 01166000 PRK.RED;1 1999/11/9 |
| 246 | 00002268 00001100 PRKHRAM.BIN;1 2000/2/8 |
| 247 | 00002a82 00003940 PSCBCHR.BIN;1 1999/11/9 |
| 248 | 00002a8a 00002000 PSCBMAP.BIN;1 1999/11/9 |
| 249 | 00002a92 00000ac0 PSCRTEX.BIN;1 1999/11/9 |
| 250 | 00002a7b 000033c0 PSFCCHR.BIN;1 1999/11/9 |
| 251 | 00001824 000049d4 PSNEND.BIN;1 1999/11/9 |
| 252 | 00002a8e 00001e54 PSNMCHR.BIN;1 1999/11/9 |
| 253 | 00002a94 000037c0 PSSBCHR.BIN;1 1999/11/9 |
| 254 | 00002a9b 00002000 PSSBMAP.BIN;1 1999/11/9 |
| 255 | 00002a9f 00000200 PSSBPAL.BIN;1 1999/11/9 |
| 256 | 00002a7a 00000600 PS_PAL.BIN;1 1999/11/9 |
| 257 | 00002c8f 0003d4c0 RESIDENT.CRT;1 1999/11/9 |
| 258 | 00001c68 0003ae40 RESTEXT.BIN;1 1999/11/9 |
| 259 | 00001cde 00001220 RESTEXTB.BIN;1 1999/11/9 |
| 260 | 00001d97 00000200 RETIMEPA.BIN;1 1999/11/9 |
| 261 | 0000261b 000004e8 REVNG.BIN;1 1999/11/9 |
| 262 | 00001a5b 00005204 ROLEND.BIN;1 1999/11/9 |
| 263 | 0000182e 0000e700 ROLENTO.BIN;1 2000/2/8 |
| 264 | 00001a2d 00016bfc ROLENTO.CRT;1 1999/11/9 |
| 265 | 0000184b 000d6bf0 ROLENTOM.BIN;1 2000/2/8 |
| 266 | 000025c5 000062e4 SDDRVS.TSK;1 1999/11/9 |
| 267 | 00002eb3 002ee000 SEGA_WRN.DA;1 1998/4/30 |
| 268 | 00002b82 00020492 SELECT.CRT;1 1999/11/9 |
| 269 | 00002aa0 00070e04 SODBTEX.BIN;1 1999/11/9 |
| 270 | 00001c5d 00005154 SODEND.BIN;1 1999/11/9 |
| 271 | 00001a66 0000b100 SODOM.BIN;1 2000/2/8 |
| 272 | 00001c29 0001943a SODOM.CRT;1 1999/11/9 |
| 273 | 00001a7d 000b9e2f SODOMM.BIN;1 2000/2/8 |
| 274 | 0000260d 000004cc SUSHI.BIN;1 2000/2/8 |
| 275 | 0000261c 0008f204 TITLE.BIN;1 1999/11/9 |
| 276 | 0000eb58 010e9000 WHS.RED;1 1999/11/9 |
| 277 | 000021ff 00001100 WHSHRAM.BIN;1 2000/2/8 |
| 278 | 000003a0 00009b90 _ADCL00.BIN;1 1999/11/9 |
| 279 | 000003b4 00009b90 _ADCL01.BIN;1 1999/11/9 |
| 280 | 000023cb 00000c54 _ALYBMAP.BIN;1 1999/11/9 |
| 281 | 0000239b 00017ec0 _ALYFCHR.BIN;1 1999/11/9 |
| 282 | 00002399 00000c1a _ALYFMAP.BIN;1 1999/11/9 |
| 283 | 00002354 00000600 _ALYPAL.BIN;1 1999/11/9 |
| 284 | 0000235a 0001f400 _ALYRCHR.BIN;1 1999/11/9 |
| 285 | 00002355 0000205c _ALYRMAP.BIN;1 1999/11/9 |
| 286 | 0000252a 00015800 _ATNBCHR.BIN;1 1999/11/9 |
| 287 | 00002526 00001882 _ATNBMAP.BIN;1 1999/11/9 |
| 288 | 00002525 00000416 _ATNFMAP.BIN;1 1999/11/9 |
| 289 | 000024ea 00000600 _ATNPAL.BIN;1 1999/11/9 |
| 290 | 000024ef 0001af00 _ATNRCHR.BIN;1 1999/11/9 |
| 291 | 000024eb 00001d10 _ATNRMAP.BIN;1 1999/11/9 |
| 292 | 000024e3 000017fa _ATOBMAP.BIN;1 1999/11/9 |
| 293 | 000024e2 00000040 _ATOFCHR.BIN;1 1999/11/9 |
| 294 | 000024e1 00000006 _ATOFMAP.BIN;1 1999/11/9 |
| 295 | 000024a3 00000600 _ATOPAL.BIN;1 1999/11/9 |
| 296 | 000024a9 0001bbc0 _ATORCHR.BIN;1 1999/11/9 |
| 297 | 000024a4 00002004 _ATORMAP.BIN;1 1999/11/9 |
| 298 | 00000618 00000a20 _BGUNTX.BIN;1 1999/11/9 |
| 299 | 000005d5 0000d688 _BLTXURE.BIN;1 1999/11/9 |
| 300 | 00002613 00000a80 _BURGRTX.BIN;1 1999/11/9 |
| 301 | 00002606 000006c0 _CAFFETX.BIN;1 1999/11/9 |
| 302 | 000007d9 0000bdb0 _CDCL00.BIN;1 1999/11/9 |
| 303 | 000007f1 0000bdb0 _CDCL01.BIN;1 1999/11/9 |
| 304 | 00000ad7 000008a0 _CHSAWTX.BIN;1 1999/11/9 |
| 305 | 000025e3 00003500 _CRAT2TX.BIN;1 1999/11/9 |
| 306 | 000025ea 00002200 _CRAT3TX.BIN;1 1999/11/9 |
| 307 | 000025d5 00003300 _CRATDTX.BIN;1 1999/11/9 |
| 308 | 000025dc 00003300 _CRATNTX.BIN;1 1999/11/9 |
| 309 | 0000261a 00000500 _CURRYTX.BIN;1 1999/11/9 |
| 310 | 00000a6e 0000d918 _DMCL00.BIN;1 1999/11/9 |
| 311 | 00000a8a 0000d918 _DMCL01.BIN;1 1999/11/9 |
| 312 | 000025ef 00001b60 _DRUMTX.BIN;1 1999/11/9 |
| 313 | 00000ced 0000da3c _EDCL00.BIN;1 1999/11/9 |
| 314 | 00000d09 0000da3c _EDCL01.BIN;1 1999/11/9 |
| 315 | 00000fde 0000c404 _ELCL00.BIN;1 1999/11/9 |
| 316 | 00000ff7 0000c404 _ELCL01.BIN;1 1999/11/9 |
| 317 | 00002616 000011a0 _FRIESTX.BIN;1 1999/11/9 |
| 318 | 00001d96 00000660 _GFNTCHR.BIN;1 1999/11/9 |
| 319 | 00001264 00000880 _GKATATX.BIN;1 1999/11/9 |
| 320 | 00002488 0000bcc0 _GRVBCHR.BIN;1 1999/11/9 |
| 321 | 00002486 00000d76 _GRVBMAP.BIN;1 1999/11/9 |
| 322 | 00002483 000010fc _GRVFMAP.BIN;1 1999/11/9 |
| 323 | 0000243e 00000600 _GRVPAL.BIN;1 1999/11/9 |
| 324 | 00002444 0001f4c0 _GRVRCHR.BIN;1 1999/11/9 |
| 325 | 0000243f 00002004 _GRVRMAP.BIN;1 1999/11/9 |
| 326 | 0000120a 0000bf44 _GYCL00.BIN;1 1999/11/9 |
| 327 | 00001222 0000bf44 _GYCL01.BIN;1 1999/11/9 |
| 328 | 00001453 0000d614 _HGCL00.BIN;1 1999/11/9 |
| 329 | 0000146e 0000d614 _HGCL01.BIN;1 1999/11/9 |
| 330 | 00002608 00000880 _HTDOGTX.BIN;1 1999/11/9 |
| 331 | 000025f3 00002b60 _ICEBTX.BIN;1 1999/11/9 |
| 332 | 00001042 00000560 _JKNFTX.BIN;1 1999/11/9 |
| 333 | 00002419 00010940 _JNKBCHR.BIN;1 1999/11/9 |
| 334 | 00002417 00000982 _JNKBMAP.BIN;1 1999/11/9 |
| 335 | 00002414 0000113a _JNKFMAP.BIN;1 1999/11/9 |
| 336 | 000023d1 00000600 _JNKPAL.BIN;1 1999/11/9 |
| 337 | 000023d6 0001ee80 _JNKRCHR.BIN;1 1999/11/9 |
| 338 | 000023d2 00001bde _JNKRMAP.BIN;1 1999/11/9 |
| 339 | 000025d4 000006c0 _KATA2TX.BIN;1 1999/11/9 |
| 340 | 00001c5c 00000780 _KATANTX.BIN;1 1999/11/9 |
| 341 | 0000260b 00000cc0 _MEATTX.BIN;1 1999/11/9 |
| 342 | 000021dd 00010e80 _MLKBCHR.BIN;1 1999/11/9 |
| 343 | 000021db 00000be6 _MLKBMAP.BIN;1 1999/11/9 |
| 344 | 000021d9 00000f70 _MLKFMAP.BIN;1 1999/11/9 |
| 345 | 00002198 00000600 _MLKPAL.BIN;1 1999/11/9 |
| 346 | 0000219c 0001e440 _MLKRCHR.BIN;1 1999/11/9 |
| 347 | 00002199 000013de _MLKRMAP.BIN;1 1999/11/9 |
| 348 | 0000234d 00001416 _NPKBMAP.BIN;1 1999/11/9 |
| 349 | 0000231d 00017dc0 _NPKFCHR.BIN;1 1999/11/9 |
| 350 | 0000231a 00001406 _NPKFMAP.BIN;1 1999/11/9 |
| 351 | 000022d5 00000600 _NPKPAL.BIN;1 1999/11/9 |
| 352 | 000022db 0001f640 _NPKRCHR.BIN;1 1999/11/9 |
| 353 | 000022d6 00002202 _NPKRMAP.BIN;1 1999/11/9 |
| 354 | 0000259a 000153c0 _NUKBCHR.BIN;1 1999/11/9 |
| 355 | 00002596 00001924 _NUKBMAP.BIN;1 1999/11/9 |
| 356 | 00002594 00000f6e _NUKFMAP.BIN;1 1999/11/9 |
| 357 | 00002558 00000600 _NUKPAL.BIN;1 1999/11/9 |
| 358 | 0000255e 0001adc0 _NUKRCHR.BIN;1 1999/11/9 |
| 359 | 00002559 00002004 _NUKRMAP.BIN;1 1999/11/9 |
| 360 | 000025d3 000005a0 _NYOIBTX.BIN;1 1999/11/9 |
| 361 | 000025f9 000039e0 _OILCTX.BIN;1 1999/11/9 |
| 362 | 000014b9 00000b40 _PIPETX.BIN;1 1999/11/9 |
| 363 | 00001823 00000600 _POISNTX.BIN;1 1999/11/9 |
| 364 | 000022cc 000018fc _PRKBMAP.BIN;1 1999/11/9 |
| 365 | 000022ac 0000fd00 _PRKFCHR.BIN;1 1999/11/9 |
| 366 | 000022a8 00001d4a _PRKFMAP.BIN;1 1999/11/9 |
| 367 | 0000226b 00000600 _PRKPAL.BIN;1 1999/11/9 |
| 368 | 00002271 0001b0c0 _PRKRCHR.BIN;1 1999/11/9 |
| 369 | 0000226c 00002202 _PRKRMAP.BIN;1 1999/11/9 |
| 370 | 000017c9 00009874 _PSCL00.BIN;1 1999/11/9 |
| 371 | 000017dd 00009874 _PSCL01.BIN;1 1999/11/9 |
| 372 | 00000d59 00000180 _PSTKTX.BIN;1 1999/11/9 |
| 373 | 000019f9 0000cb2c _RLCL00.BIN;1 1999/11/9 |
| 374 | 00001a13 0000cb2c _RLCL01.BIN;1 1999/11/9 |
| 375 | 00001bf1 0000dd0c _SDCL00.BIN;1 1999/11/9 |
| 376 | 00001c0d 0000dd0c _SDCL01.BIN;1 1999/11/9 |
| 377 | 00000833 00000660 _SKNFTX.BIN;1 1999/11/9 |
| 378 | 000025d2 00000240 _SPIKETX.BIN;1 1999/11/9 |
| 379 | 0000260e 000011e0 _SUSHITX.BIN;1 1999/11/9 |
| 380 | 00002601 00001ba0 _TOMBTX.BIN;1 1999/11/9 |
| 381 | 0000224b 0000e2c0 _WHSBCHR.BIN;1 1999/11/9 |
| 382 | 00002249 00000a36 _WHSBMAP.BIN;1 1999/11/9 |
| 383 | 00002245 00001bb8 _WHSFMAP.BIN;1 1999/11/9 |
| 384 | 00002202 00000600 _WHSPAL.BIN;1 1999/11/9 |
| 385 | 00002207 0001efc0 _WHSRCHR.BIN;1 1999/11/9 |
| 386 | 00002203 00001cf4 _WHSRMAP.BIN;1 1999/11/9 |
| 387 | */ |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | UINT32 rsgun_prot_read_callback( address_space &space, int protaddr, UINT32 key ) |
| 396 | { |
| 397 | int tempctrl = protaddr - 0x0201000; // technically it doesn't seem to care, but... |
| 398 | |
| 399 | switch(key) |
| 400 | { |
| 401 | case 0x77770000: |
| 402 | { |
| 403 | UINT32 val = |
| 404 | ((tempctrl & 0xff)<<24) | |
| 405 | (((tempctrl+1) & 0xff)<<16) | |
| 406 | (((tempctrl+2) & 0xff)<<8) | |
| 407 | ((tempctrl+3) & 0xff); |
| 408 | if(tempctrl & 0x100) |
| 409 | val &= 0x0f0f0f0f; |
| 410 | else |
| 411 | val &= 0xf0f0f0f0; |
| 412 | |
| 413 | return val; |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | return 0; |
| 418 | } |
| 419 | |
| 420 | UINT32 twcup98_prot_read_callback( address_space &space, int protaddr, UINT32 key ) |
| 421 | { |
| 422 | UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base(); |
| 423 | UINT32 res = 0; |
| 424 | |
| 425 | UINT32 twcup_prot_data[8] = |
| 426 | { |
| 427 | 0x23232323, 0x23232323, 0x4c4c4c4c, 0x4c156301 |
| 428 | }; |
| 429 | |
| 430 | switch(key >> 16) |
| 431 | { |
| 432 | case 0x1212: |
| 433 | if(protaddr & 2) |
| 434 | { |
| 435 | res = (ROM[protaddr / 4] & 0xffff) << 16; |
| 436 | res |= (ROM[(protaddr+4) / 4] & 0xffff0000) >> 16; |
| 437 | } |
| 438 | else |
| 439 | { |
| 440 | res = ROM[protaddr / 4] & 0xffff0000; |
| 441 | res |= ROM[protaddr / 4] & 0xffff; |
| 442 | } |
| 443 | |
| 444 | if(protaddr >= 0xD215A4+0x100c && protaddr < 0xD215A4+0x100c+8*4) |
| 445 | res = twcup_prot_data[(protaddr-(0xD215A4+0x100c))/4]; |
| 446 | |
| 447 | return res; |
| 448 | } |
| 449 | |
| 450 | return 0; |
| 451 | } |
| 452 | |
| 453 | UINT32 sss_prot_read_callback( address_space &space, int protaddr, UINT32 key ) |
| 454 | { |
| 455 | UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base(); |
| 456 | int read_offset_hack = 0; |
| 457 | UINT32 res; |
| 458 | |
| 459 | /* |
| 460 | MAIN : 2c5b0000 DATA : 000000a6 014c0000 |
| 461 | MAIN : 47f10000 DATA : 0f9800a6 014c1f30 |
| 462 | MAIN : fcda0000 DATA : 1d4800a6 014c3a90 |
| 463 | MAIN : b5e60000 DATA : 29e300a6 014c53c6 |
| 464 | MAIN : 392c0000 DATA : 38e900a6 014c71d2 |
| 465 | MAIN : 77c30000 DATA : 462500a6 014c8c4a |
| 466 | MAIN : 8a620000 DATA : 555c00a6 014caab8 |
| 467 | */ |
| 468 | |
| 469 | // I have a feeling rather than the offsets being scrambled they were lazy |
| 470 | // and left unencrypted copies in the ROM... but this still needs verification |
| 471 | switch(key>>16) |
| 472 | { |
| 473 | case 0x2c5b: read_offset_hack = 0x60054; break; |
| 474 | case 0x47f1: read_offset_hack = 0x56498; break; |
| 475 | case 0xfcda: read_offset_hack = 0x50b0c; break; |
| 476 | case 0xb5e6: read_offset_hack = 0x4af56; break; |
| 477 | case 0x392c: read_offset_hack = 0x45876; break; |
| 478 | case 0x77c3: read_offset_hack = 0x3fe02; break; |
| 479 | case 0x8a62: read_offset_hack = 0x3a784; break; |
| 480 | } |
| 481 | |
| 482 | switch(key>>16) |
| 483 | { |
| 484 | default: |
| 485 | if(protaddr & 2) |
| 486 | { |
| 487 | res = (ROM[(protaddr-read_offset_hack) / 4] & 0xffff) << 16; |
| 488 | res |= (ROM[((protaddr-read_offset_hack)+4) / 4] & 0xffff0000) >> 16; |
| 489 | } |
| 490 | else |
| 491 | { |
| 492 | res = ROM[(protaddr-read_offset_hack) / 4] & 0xffff0000; |
| 493 | res |= ROM[(protaddr-read_offset_hack) / 4] & 0xffff; |
| 494 | } |
| 495 | return res; |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | |
| 500 | |
| 501 | UINT32 elandore_prot_read_callback( address_space &space, int protaddr, UINT32 key ) |
| 502 | { |
| 503 | UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base(); |
| 504 | UINT32 res = 0; |
| 505 | |
| 506 | switch(key >> 16) |
| 507 | { |
| 508 | default: |
| 509 | if(protaddr & 2) |
| 510 | { |
| 511 | res = (ROM[protaddr / 4] & 0xffff) << 16; |
| 512 | res |= (ROM[(protaddr+4) / 4] & 0xffff0000) >> 16; |
| 513 | } |
| 514 | else |
| 515 | { |
| 516 | res = ROM[protaddr / 4] & 0xffff0000; |
| 517 | res |= ROM[protaddr / 4] & 0xffff; |
| 518 | } |
| 519 | return res; |
| 520 | } |
| 521 | |
| 522 | // never executed |
| 523 | //return 0; |
| 524 | } |
| 525 | |
| 526 | UINT32 ffreveng_prot_read_callback( address_space &space, int protaddr, UINT32 key ) |
| 527 | { |
| 528 | //UINT32 res = 0; |
| 529 | |
| 530 | switch(key >> 16) |
| 531 | { |
| 532 | case 0x10da://ffreveng, boot vectors at $6080000,test mode |
| 533 | case 0x10d7://ffreveng, boot vectors at $6080000,attract mode |
| 534 | #if 0 |
| 535 | if(protaddr & 2) |
| 536 | { |
| 537 | res = (ROM[protaddr / 4] & 0xffff) << 16; |
| 538 | res |= (ROM[(protaddr+4) / 4] & 0xffff0000) >> 16; |
| 539 | } |
| 540 | else |
| 541 | { |
| 542 | res = ROM[protaddr / 4] & 0xffff0000; |
| 543 | res |= ROM[protaddr / 4] & 0xffff; |
| 544 | } |
| 545 | #endif |
| 546 | return 0; |
| 547 | } |
| 548 | |
| 549 | return 0; |
| 550 | } |
| 551 | |
| 552 | |
| 23 | 553 | /************************************* |
| 24 | 554 | * |
| 25 | 555 | * Common Handlers |
| 26 | 556 | * |
| 27 | 557 | *************************************/ |
| 28 | 558 | |
| 559 | // the naomi hookup of 315-5881 reads 16-bits at a time, here we seem to read 32? |
| 560 | |
| 29 | 561 | READ32_MEMBER( stv_state::common_prot_r ) |
| 30 | 562 | { |
| 31 | 563 | UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base(); |
| r243093 | r243094 | |
| 34 | 566 | { |
| 35 | 567 | if(offset == 3) |
| 36 | 568 | { |
| 37 | | UINT8* base; |
| 38 | | UINT16 res = m_cryptdevice->do_decrypt(base); |
| 39 | | UINT16 res2 = m_cryptdevice->do_decrypt(base); |
| 40 | | res = ((res & 0xff00) >> 8) | ((res & 0x00ff) << 8); |
| 41 | | res2 = ((res2 & 0xff00) >> 8) | ((res2 & 0x00ff) << 8); |
| 569 | #ifdef MAME_DEBUG |
| 570 | popmessage("Prot read at %06x with data = %08x",space.device().safe_pc(),m_abus_protkey); |
| 571 | #endif |
| 572 | if (!m_using_crypt_device) // decrypt using hacks |
| 573 | { |
| 574 | UINT32 realret = space.read_dword(0x2000000 + m_ctrl_index); |
| 575 | UINT32 retdata = m_prot_readback(space, m_ctrl_index, m_abus_protkey); |
| 576 | //fwrite(&realret, 1, 4, fp); |
| 577 | //fwrite(&retdata, 1, 4, fp2); |
| 578 | |
| 579 | logerror("A-Bus control protection read at %06x with data = %08x Returning = %08x Would otherwise return = %08x\n", space.device().safe_pc(), m_abus_protkey, retdata, realret); |
| 580 | m_ctrl_index += 4; |
| 581 | return retdata; |
| 582 | } |
| 583 | else // decrypt using real decryption device |
| 584 | { |
| 585 | UINT8* base; |
| 586 | UINT16 res = m_cryptdevice->do_decrypt(base); |
| 587 | UINT16 res2 = m_cryptdevice->do_decrypt(base); |
| 588 | res = ((res & 0xff00) >> 8) | ((res & 0x00ff) << 8); |
| 589 | res2 = ((res2 & 0xff00) >> 8) | ((res2 & 0x00ff) << 8); |
| 42 | 590 | |
| 43 | | return res2 | (res << 16); |
| 591 | return res2 | (res << 16); |
| 592 | } |
| 593 | |
| 44 | 594 | } |
| 45 | 595 | return m_a_bus[offset]; |
| 46 | 596 | } |
| r243093 | r243094 | |
| 61 | 611 | WRITE32_MEMBER ( stv_state::common_prot_w ) |
| 62 | 612 | { |
| 63 | 613 | COMBINE_DATA(&m_a_bus[offset]); |
| 614 | //printf("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data); |
| 64 | 615 | |
| 65 | 616 | if (offset == 0) |
| 66 | 617 | { |
| r243093 | r243094 | |
| 68 | 619 | } |
| 69 | 620 | else if(offset == 2) |
| 70 | 621 | { |
| 71 | | if (mem_mask&0xffff0000) m_cryptdevice->set_addr_low(data >> 16); |
| 72 | | if (mem_mask&0x0000ffff) m_cryptdevice->set_addr_high(data&0xffff); |
| 622 | COMBINE_DATA(&m_abus_prot_addr); |
| 73 | 623 | |
| 624 | m_cryptdevice->set_addr_low(m_abus_prot_addr >> 16); |
| 625 | m_cryptdevice->set_addr_high(m_abus_prot_addr&0xffff); |
| 626 | |
| 74 | 627 | } |
| 75 | 628 | else if(offset == 3) |
| 76 | 629 | { |
| 77 | 630 | COMBINE_DATA(&m_abus_protkey); |
| 78 | 631 | |
| 79 | 632 | m_cryptdevice->set_subkey(m_abus_protkey>>16); |
| 633 | |
| 634 | |
| 635 | int a_bus_vector; |
| 636 | a_bus_vector = m_abus_prot_addr >> 16; |
| 637 | a_bus_vector|= (m_abus_prot_addr & 0xffff) << 16; |
| 638 | a_bus_vector<<= 1; |
| 639 | /* |
| 640 | if (fp) |
| 641 | { |
| 642 | fclose(fp); |
| 643 | fp = 0; |
| 644 | } |
| 645 | if (fp2) |
| 646 | { |
| 647 | fclose(fp2); |
| 648 | fp2 = 0; |
| 649 | } |
| 650 | char filename[256]; |
| 651 | sprintf(filename,"encrypted_%s_key_%04x_address_%08x", machine().system().name, m_abus_protkey>>16, a_bus_vector); |
| 652 | fp=fopen(filename, "w+b"); |
| 653 | sprintf(filename,"not-encrypted_%s_key_%04x_address_%08x", machine().system().name, m_abus_protkey>>16, a_bus_vector); |
| 654 | fp2=fopen(filename, "w+b"); |
| 655 | */ |
| 656 | |
| 657 | //printf("MAIN : %08x DATA : %08x %08x\n",m_abus_protkey,m_abus_prot_addr,a_bus_vector); |
| 658 | |
| 659 | // if you look at the first transfer in ffreveng this is clearly a ROM address from a table | MAIN : 10d70000 DATA : 0b780013 002616f0 |
| 660 | // (opr21872.7, offset 0x616f0, which happens to be 0x2616f0 in the ROM region "game0") |
| 661 | // the values sent by the CPU are plucked from a table above where the data is, located at 0x60000 |
| 662 | // Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F |
| 663 | // 00060000 00 00 16 F0 00 00 2F A0 00 00 46 90 00 00 4D 04 |
| 664 | // this is the first entry in the table, 0x16f0 is the address, 0x2fa0 is the length. |
| 665 | // the next entry is address 0x4690, length 0x4d04. 0x16f0 + 0x2fa0 == 0x4690 so that entry is located straight after the first one |
| 666 | // the game reads the number of bytes specified in the length via the protection device, writing them to RAM. This suggests there |
| 667 | // is no compression going on, only some form of encryption. |
| 668 | |
| 669 | m_ctrl_index = a_bus_vector; |
| 80 | 670 | } |
| 81 | 671 | } |
| 82 | 672 | |
| r243093 | r243094 | |
| 85 | 675 | m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x4fffff0, 0x4ffffff, read32_delegate(FUNC(stv_state::common_prot_r), this), write32_delegate(FUNC(stv_state::common_prot_w), this)); |
| 86 | 676 | |
| 87 | 677 | INT64 key = get_315_5881_key(machine()); |
| 88 | | m_cryptdevice->set_key(key); |
| 678 | |
| 679 | if (key != -1) |
| 680 | { |
| 681 | m_cryptdevice->set_key(key); // use real decryption |
| 682 | m_using_crypt_device = 1; |
| 683 | } |
| 684 | else |
| 685 | m_using_crypt_device = 0; // use protection sim |
| 89 | 686 | } |
| 90 | 687 | |
| 688 | void stv_state::install_sss_protection() |
| 689 | { |
| 690 | install_common_protection(); |
| 691 | m_prot_readback = sss_prot_read_callback; |
| 692 | } |
| 693 | |
| 694 | void stv_state::install_astrass_protection() |
| 695 | { |
| 696 | install_common_protection(); |
| 697 | } |
| 698 | |
| 699 | void stv_state::install_ffreveng_protection() |
| 700 | { |
| 701 | install_common_protection(); |
| 702 | m_prot_readback = ffreveng_prot_read_callback; |
| 703 | } |
| 704 | |
| 705 | void stv_state::install_elandore_protection() |
| 706 | { |
| 707 | install_common_protection(); |
| 708 | m_prot_readback = elandore_prot_read_callback; |
| 709 | } |
| 710 | |
| 711 | void stv_state::install_rsgun_protection() |
| 712 | { |
| 713 | install_common_protection(); |
| 714 | m_prot_readback = rsgun_prot_read_callback; |
| 715 | } |
| 716 | |
| 717 | void stv_state::install_twcup98_protection() |
| 718 | { |
| 719 | install_common_protection(); |
| 720 | m_prot_readback = twcup98_prot_read_callback; |
| 721 | } |
| 722 | |
| 723 | |
| 91 | 724 | void stv_state::stv_register_protection_savestates() |
| 92 | 725 | { |
| 93 | 726 | save_item(NAME(m_a_bus)); |
| 727 | save_item(NAME(m_ctrl_index)); |
| 728 | save_item(NAME(m_internal_counter)); |
| 729 | save_item(NAME(m_char_offset)); |
| 94 | 730 | } |
trunk/src/osd/modules/font/font_sdl.c
| r0 | r243094 | |
| 1 | /* |
| 2 | * font_sdl.c |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | #include "font_module.h" |
| 7 | #include "modules/osdmodule.h" |
| 8 | |
| 9 | #if defined(SDLMAME_UNIX) && (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN)) |
| 10 | |
| 11 | #if (SDLMAME_SDL2) |
| 12 | #include <SDL2/SDL_ttf.h> |
| 13 | #else |
| 14 | #include <SDL/SDL_ttf.h> |
| 15 | #endif |
| 16 | #ifndef SDLMAME_HAIKU |
| 17 | #include <fontconfig/fontconfig.h> |
| 18 | #endif |
| 19 | |
| 20 | |
| 21 | #include "astring.h" |
| 22 | #include "corealloc.h" |
| 23 | #include "fileio.h" |
| 24 | |
| 25 | #define POINT_SIZE 144.0 |
| 26 | |
| 27 | //------------------------------------------------- |
| 28 | // font_open - attempt to "open" a handle to the |
| 29 | // font with the given name |
| 30 | //------------------------------------------------- |
| 31 | |
| 32 | class osd_font_sdl : public osd_font |
| 33 | { |
| 34 | public: |
| 35 | virtual ~osd_font_sdl() {}; |
| 36 | |
| 37 | virtual bool open(const char *font_path, const char *name, int &height); |
| 38 | virtual void close(); |
| 39 | virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 40 | private: |
| 41 | #ifndef SDLMAME_HAIKU |
| 42 | TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles); |
| 43 | #endif |
| 44 | bool BDF_Check_Magic(astring name); |
| 45 | TTF_Font * TTF_OpenFont_Magic(astring name, int fsize); |
| 46 | TTF_Font *m_font; |
| 47 | }; |
| 48 | |
| 49 | bool osd_font_sdl::open(const char *font_path, const char *_name, int &height) |
| 50 | { |
| 51 | TTF_Font *font = (TTF_Font *)NULL; |
| 52 | bool bakedstyles = false; |
| 53 | int style = 0; |
| 54 | |
| 55 | // accept qualifiers from the name |
| 56 | astring name(_name); |
| 57 | |
| 58 | if (name == "default") |
| 59 | { |
| 60 | name = "Liberation Sans"; |
| 61 | } |
| 62 | |
| 63 | bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0); |
| 64 | bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0); |
| 65 | bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0); |
| 66 | bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0); |
| 67 | |
| 68 | // first up, try it as a filename |
| 69 | font = TTF_OpenFont_Magic(name, POINT_SIZE); |
| 70 | |
| 71 | // if no success, try the font path |
| 72 | |
| 73 | if (!font) |
| 74 | { |
| 75 | osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH); |
| 76 | //emu_file file(options().font_path(), OPEN_FLAG_READ); |
| 77 | emu_file file(font_path, OPEN_FLAG_READ); |
| 78 | if (file.open(name) == FILERR_NONE) |
| 79 | { |
| 80 | astring full_name = file.fullpath(); |
| 81 | font = TTF_OpenFont_Magic(full_name, POINT_SIZE); |
| 82 | if (font) |
| 83 | osd_printf_verbose("Found font %s\n", full_name.cstr()); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // if that didn't work, crank up the FontConfig database |
| 88 | #ifndef SDLMAME_HAIKU |
| 89 | if (!font) |
| 90 | { |
| 91 | font = search_font_config(name, bold, italic, underline, bakedstyles); |
| 92 | } |
| 93 | #endif |
| 94 | |
| 95 | if (!font) |
| 96 | { |
| 97 | if (!BDF_Check_Magic(name)) |
| 98 | { |
| 99 | osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr()); |
| 100 | } |
| 101 | return NULL; |
| 102 | } |
| 103 | |
| 104 | // apply styles |
| 105 | if (!bakedstyles) |
| 106 | { |
| 107 | style |= bold ? TTF_STYLE_BOLD : 0; |
| 108 | style |= italic ? TTF_STYLE_ITALIC : 0; |
| 109 | } |
| 110 | style |= underline ? TTF_STYLE_UNDERLINE : 0; |
| 111 | // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH |
| 112 | #if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9) |
| 113 | style |= strike ? TTF_STYLE_STRIKETHROUGH : 0; |
| 114 | #else |
| 115 | if (strike) |
| 116 | osd_printf_warning("Ignoring strikethrough for SDL_TTF older than 2.0.10\n"); |
| 117 | #endif // PATCHLEVEL |
| 118 | TTF_SetFontStyle(font, style); |
| 119 | |
| 120 | height = TTF_FontLineSkip(font); |
| 121 | |
| 122 | m_font = font; |
| 123 | return true; |
| 124 | } |
| 125 | |
| 126 | //------------------------------------------------- |
| 127 | // font_close - release resources associated with |
| 128 | // a given OSD font |
| 129 | //------------------------------------------------- |
| 130 | |
| 131 | void osd_font_sdl::close() |
| 132 | { |
| 133 | TTF_CloseFont(this->m_font); |
| 134 | } |
| 135 | |
| 136 | //------------------------------------------------- |
| 137 | // font_get_bitmap - allocate and populate a |
| 138 | // BITMAP_FORMAT_ARGB32 bitmap containing the |
| 139 | // pixel values rgb_t(0xff,0xff,0xff,0xff) |
| 140 | // or rgb_t(0x00,0xff,0xff,0xff) for each |
| 141 | // pixel of a black & white font |
| 142 | //------------------------------------------------- |
| 143 | |
| 144 | bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 145 | { |
| 146 | TTF_Font *ttffont; |
| 147 | SDL_Surface *drawsurf; |
| 148 | SDL_Color fcol = { 0xff, 0xff, 0xff }; |
| 149 | UINT16 ustr[16]; |
| 150 | |
| 151 | ttffont = m_font; |
| 152 | |
| 153 | memset(ustr,0,sizeof(ustr)); |
| 154 | ustr[0] = (UINT16)chnum; |
| 155 | drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol); |
| 156 | |
| 157 | // was nothing returned? |
| 158 | if (drawsurf) |
| 159 | { |
| 160 | // allocate a MAME destination bitmap |
| 161 | bitmap.allocate(drawsurf->w, drawsurf->h); |
| 162 | |
| 163 | // copy the rendered character image into it |
| 164 | for (int y = 0; y < bitmap.height(); y++) |
| 165 | { |
| 166 | UINT32 *dstrow = &bitmap.pix32(y); |
| 167 | UINT8 *srcrow = (UINT8 *)drawsurf->pixels; |
| 168 | |
| 169 | srcrow += (y * drawsurf->pitch); |
| 170 | |
| 171 | for (int x = 0; x < drawsurf->w; x++) |
| 172 | { |
| 173 | dstrow[x] = srcrow[x] ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // what are these? |
| 178 | xoffs = yoffs = 0; |
| 179 | width = drawsurf->w; |
| 180 | |
| 181 | SDL_FreeSurface(drawsurf); |
| 182 | } |
| 183 | |
| 184 | return bitmap.valid(); |
| 185 | } |
| 186 | |
| 187 | TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize) |
| 188 | { |
| 189 | emu_file file(OPEN_FLAG_READ); |
| 190 | if (file.open(name) == FILERR_NONE) |
| 191 | { |
| 192 | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 193 | unsigned char magic[5] = { 0x00, 0x01, 0x00, 0x00, 0x00 }; |
| 194 | file.read(buffer,5); |
| 195 | if (memcmp(buffer, magic, 5)) |
| 196 | return NULL; |
| 197 | } |
| 198 | return TTF_OpenFont(name.cstr(), POINT_SIZE); |
| 199 | } |
| 200 | |
| 201 | bool osd_font_sdl::BDF_Check_Magic(astring name) |
| 202 | { |
| 203 | emu_file file(OPEN_FLAG_READ); |
| 204 | if (file.open(name) == FILERR_NONE) |
| 205 | { |
| 206 | unsigned char buffer[9]; |
| 207 | unsigned char magic[9] = { 'S', 'T', 'A', 'R', 'T', 'F', 'O', 'N', 'T' }; |
| 208 | file.read(buffer, 9); |
| 209 | file.close(); |
| 210 | if (!memcmp(buffer, magic, 9)) |
| 211 | return true; |
| 212 | } |
| 213 | |
| 214 | return false; |
| 215 | } |
| 216 | |
| 217 | #ifndef SDLMAME_HAIKU |
| 218 | TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles) |
| 219 | { |
| 220 | TTF_Font *font = (TTF_Font *)NULL; |
| 221 | FcConfig *config; |
| 222 | FcPattern *pat; |
| 223 | FcObjectSet *os; |
| 224 | FcFontSet *fontset; |
| 225 | FcValue val; |
| 226 | |
| 227 | config = FcConfigGetCurrent(); |
| 228 | pat = FcPatternCreate(); |
| 229 | os = FcObjectSetCreate(); |
| 230 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); |
| 231 | |
| 232 | // try and get a font with the requested styles baked-in |
| 233 | if (bold) |
| 234 | { |
| 235 | if (italic) |
| 236 | { |
| 237 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold Italic"); |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold"); |
| 242 | } |
| 243 | } |
| 244 | else if (italic) |
| 245 | { |
| 246 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Italic"); |
| 247 | } |
| 248 | else |
| 249 | { |
| 250 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); |
| 251 | } |
| 252 | |
| 253 | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); |
| 254 | |
| 255 | FcObjectSetAdd(os, FC_FILE); |
| 256 | fontset = FcFontList(config, pat, os); |
| 257 | |
| 258 | for (int i = 0; i < fontset->nfont; i++) |
| 259 | { |
| 260 | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) |
| 261 | { |
| 262 | continue; |
| 263 | } |
| 264 | |
| 265 | if (val.type != FcTypeString) |
| 266 | { |
| 267 | continue; |
| 268 | } |
| 269 | |
| 270 | osd_printf_verbose("Matching font: %s\n", val.u.s); |
| 271 | { |
| 272 | astring match_name((const char*)val.u.s); |
| 273 | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); |
| 274 | } |
| 275 | |
| 276 | if (font) |
| 277 | { |
| 278 | bakedstyles = true; |
| 279 | break; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // didn't get a font above? try again with no baked-in styles |
| 284 | if (!font) |
| 285 | { |
| 286 | FcPatternDestroy(pat); |
| 287 | FcFontSetDestroy(fontset); |
| 288 | |
| 289 | pat = FcPatternCreate(); |
| 290 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); |
| 291 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); |
| 292 | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); |
| 293 | fontset = FcFontList(config, pat, os); |
| 294 | |
| 295 | for (int i = 0; i < fontset->nfont; i++) |
| 296 | { |
| 297 | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) |
| 298 | { |
| 299 | continue; |
| 300 | } |
| 301 | |
| 302 | if (val.type != FcTypeString) |
| 303 | { |
| 304 | continue; |
| 305 | } |
| 306 | |
| 307 | osd_printf_verbose("Matching unstyled font: %s\n", val.u.s); |
| 308 | { |
| 309 | astring match_name((const char*)val.u.s); |
| 310 | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); |
| 311 | } |
| 312 | |
| 313 | if (font) |
| 314 | { |
| 315 | break; |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | FcPatternDestroy(pat); |
| 321 | FcObjectSetDestroy(os); |
| 322 | FcFontSetDestroy(fontset); |
| 323 | return font; |
| 324 | } |
| 325 | #endif |
| 326 | |
| 327 | |
| 328 | class font_sdl : public osd_module, public font_module |
| 329 | { |
| 330 | public: |
| 331 | font_sdl() |
| 332 | : osd_module(OSD_FONT_PROVIDER, "sdl"), font_module() |
| 333 | { |
| 334 | } |
| 335 | |
| 336 | osd_font *font_alloc() |
| 337 | { |
| 338 | return global_alloc(osd_font_sdl); |
| 339 | } |
| 340 | |
| 341 | virtual void init() |
| 342 | { |
| 343 | if (TTF_Init() == -1) |
| 344 | { |
| 345 | osd_printf_error("SDL_ttf failed: %s\n", TTF_GetError()); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | virtual void exit() |
| 350 | { |
| 351 | TTF_Quit(); |
| 352 | } |
| 353 | }; |
| 354 | #else /* SDLMAME_UNIX */ |
| 355 | MODULE_NOT_SUPPORTED(font_sdl, OSD_FONT_PROVIDER, "sdl") |
| 356 | #endif |
| 357 | |
| 358 | MODULE_DEFINITION(FONT_SDL, font_sdl) |
| 359 | |
| 360 | |
trunk/src/osd/modules/font/font_unix.c
| r243093 | r243094 | |
| 1 | | /* |
| 2 | | * font_sdl.c |
| 3 | | * |
| 4 | | */ |
| 5 | | |
| 6 | | #if (SDLMAME_SDL2) |
| 7 | | #include <SDL2/SDL_ttf.h> |
| 8 | | #else |
| 9 | | #include <SDL/SDL_ttf.h> |
| 10 | | #endif |
| 11 | | #ifndef SDLMAME_HAIKU |
| 12 | | #include <fontconfig/fontconfig.h> |
| 13 | | #endif |
| 14 | | |
| 15 | | #include "osdepend.h" |
| 16 | | |
| 17 | | #include "astring.h" |
| 18 | | #include "corealloc.h" |
| 19 | | #include "fileio.h" |
| 20 | | |
| 21 | | #define POINT_SIZE 144.0 |
| 22 | | |
| 23 | | //------------------------------------------------- |
| 24 | | // font_open - attempt to "open" a handle to the |
| 25 | | // font with the given name |
| 26 | | //------------------------------------------------- |
| 27 | | |
| 28 | | class osd_font_unix : public osd_font |
| 29 | | { |
| 30 | | public: |
| 31 | | virtual ~osd_font_unix() {}; |
| 32 | | |
| 33 | | virtual bool open(const char *font_path, const char *name, int &height); |
| 34 | | virtual void close(); |
| 35 | | virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 36 | | private: |
| 37 | | #ifndef SDLMAME_HAIKU |
| 38 | | TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles); |
| 39 | | #endif |
| 40 | | bool BDF_Check_Magic(astring name); |
| 41 | | TTF_Font * TTF_OpenFont_Magic(astring name, int fsize); |
| 42 | | TTF_Font *m_font; |
| 43 | | }; |
| 44 | | |
| 45 | | osd_font *osd_font_alloc() |
| 46 | | { |
| 47 | | return global_alloc(osd_font_unix); |
| 48 | | } |
| 49 | | |
| 50 | | bool osd_font_unix::open(const char *font_path, const char *_name, int &height) |
| 51 | | { |
| 52 | | TTF_Font *font = (TTF_Font *)NULL; |
| 53 | | bool bakedstyles = false; |
| 54 | | int style = 0; |
| 55 | | |
| 56 | | // accept qualifiers from the name |
| 57 | | astring name(_name); |
| 58 | | |
| 59 | | if (name == "default") |
| 60 | | { |
| 61 | | name = "Liberation Sans"; |
| 62 | | } |
| 63 | | |
| 64 | | bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0); |
| 65 | | bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0); |
| 66 | | bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0); |
| 67 | | bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0); |
| 68 | | |
| 69 | | // first up, try it as a filename |
| 70 | | font = TTF_OpenFont_Magic(name, POINT_SIZE); |
| 71 | | |
| 72 | | // if no success, try the font path |
| 73 | | |
| 74 | | if (!font) |
| 75 | | { |
| 76 | | osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH); |
| 77 | | //emu_file file(options().font_path(), OPEN_FLAG_READ); |
| 78 | | emu_file file(font_path, OPEN_FLAG_READ); |
| 79 | | if (file.open(name) == FILERR_NONE) |
| 80 | | { |
| 81 | | astring full_name = file.fullpath(); |
| 82 | | font = TTF_OpenFont_Magic(full_name, POINT_SIZE); |
| 83 | | if (font) |
| 84 | | osd_printf_verbose("Found font %s\n", full_name.cstr()); |
| 85 | | } |
| 86 | | } |
| 87 | | |
| 88 | | // if that didn't work, crank up the FontConfig database |
| 89 | | #ifndef SDLMAME_HAIKU |
| 90 | | if (!font) |
| 91 | | { |
| 92 | | font = search_font_config(name, bold, italic, underline, bakedstyles); |
| 93 | | } |
| 94 | | #endif |
| 95 | | |
| 96 | | if (!font) |
| 97 | | { |
| 98 | | if (!BDF_Check_Magic(name)) |
| 99 | | { |
| 100 | | osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr()); |
| 101 | | } |
| 102 | | return NULL; |
| 103 | | } |
| 104 | | |
| 105 | | // apply styles |
| 106 | | if (!bakedstyles) |
| 107 | | { |
| 108 | | style |= bold ? TTF_STYLE_BOLD : 0; |
| 109 | | style |= italic ? TTF_STYLE_ITALIC : 0; |
| 110 | | } |
| 111 | | style |= underline ? TTF_STYLE_UNDERLINE : 0; |
| 112 | | // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH |
| 113 | | #if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9) |
| 114 | | style |= strike ? TTF_STYLE_STRIKETHROUGH : 0; |
| 115 | | #else |
| 116 | | if (strike) |
| 117 | | osd_printf_warning("Ignoring strikethrough for SDL_TTF older than 2.0.10\n"); |
| 118 | | #endif // PATCHLEVEL |
| 119 | | TTF_SetFontStyle(font, style); |
| 120 | | |
| 121 | | height = TTF_FontLineSkip(font); |
| 122 | | |
| 123 | | m_font = font; |
| 124 | | return true; |
| 125 | | } |
| 126 | | |
| 127 | | //------------------------------------------------- |
| 128 | | // font_close - release resources associated with |
| 129 | | // a given OSD font |
| 130 | | //------------------------------------------------- |
| 131 | | |
| 132 | | void osd_font_unix::close() |
| 133 | | { |
| 134 | | TTF_CloseFont(this->m_font); |
| 135 | | } |
| 136 | | |
| 137 | | //------------------------------------------------- |
| 138 | | // font_get_bitmap - allocate and populate a |
| 139 | | // BITMAP_FORMAT_ARGB32 bitmap containing the |
| 140 | | // pixel values rgb_t(0xff,0xff,0xff,0xff) |
| 141 | | // or rgb_t(0x00,0xff,0xff,0xff) for each |
| 142 | | // pixel of a black & white font |
| 143 | | //------------------------------------------------- |
| 144 | | |
| 145 | | bool osd_font_unix::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 146 | | { |
| 147 | | TTF_Font *ttffont; |
| 148 | | SDL_Surface *drawsurf; |
| 149 | | SDL_Color fcol = { 0xff, 0xff, 0xff }; |
| 150 | | UINT16 ustr[16]; |
| 151 | | |
| 152 | | ttffont = m_font; |
| 153 | | |
| 154 | | memset(ustr,0,sizeof(ustr)); |
| 155 | | ustr[0] = (UINT16)chnum; |
| 156 | | drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol); |
| 157 | | |
| 158 | | // was nothing returned? |
| 159 | | if (drawsurf) |
| 160 | | { |
| 161 | | // allocate a MAME destination bitmap |
| 162 | | bitmap.allocate(drawsurf->w, drawsurf->h); |
| 163 | | |
| 164 | | // copy the rendered character image into it |
| 165 | | for (int y = 0; y < bitmap.height(); y++) |
| 166 | | { |
| 167 | | UINT32 *dstrow = &bitmap.pix32(y); |
| 168 | | UINT8 *srcrow = (UINT8 *)drawsurf->pixels; |
| 169 | | |
| 170 | | srcrow += (y * drawsurf->pitch); |
| 171 | | |
| 172 | | for (int x = 0; x < drawsurf->w; x++) |
| 173 | | { |
| 174 | | dstrow[x] = srcrow[x] ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); |
| 175 | | } |
| 176 | | } |
| 177 | | |
| 178 | | // what are these? |
| 179 | | xoffs = yoffs = 0; |
| 180 | | width = drawsurf->w; |
| 181 | | |
| 182 | | SDL_FreeSurface(drawsurf); |
| 183 | | } |
| 184 | | |
| 185 | | return bitmap.valid(); |
| 186 | | } |
| 187 | | |
| 188 | | TTF_Font * osd_font_unix::TTF_OpenFont_Magic(astring name, int fsize) |
| 189 | | { |
| 190 | | emu_file file(OPEN_FLAG_READ); |
| 191 | | if (file.open(name) == FILERR_NONE) |
| 192 | | { |
| 193 | | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 194 | | unsigned char magic[5] = { 0x00, 0x01, 0x00, 0x00, 0x00 }; |
| 195 | | file.read(buffer,5); |
| 196 | | if (memcmp(buffer, magic, 5)) |
| 197 | | return NULL; |
| 198 | | } |
| 199 | | return TTF_OpenFont(name.cstr(), POINT_SIZE); |
| 200 | | } |
| 201 | | |
| 202 | | bool osd_font_unix::BDF_Check_Magic(astring name) |
| 203 | | { |
| 204 | | emu_file file(OPEN_FLAG_READ); |
| 205 | | if (file.open(name) == FILERR_NONE) |
| 206 | | { |
| 207 | | unsigned char buffer[9]; |
| 208 | | unsigned char magic[9] = { 'S', 'T', 'A', 'R', 'T', 'F', 'O', 'N', 'T' }; |
| 209 | | file.read(buffer, 9); |
| 210 | | file.close(); |
| 211 | | if (!memcmp(buffer, magic, 9)) |
| 212 | | return true; |
| 213 | | } |
| 214 | | |
| 215 | | return false; |
| 216 | | } |
| 217 | | |
| 218 | | #ifndef SDLMAME_HAIKU |
| 219 | | TTF_Font *osd_font_unix::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles) |
| 220 | | { |
| 221 | | TTF_Font *font = (TTF_Font *)NULL; |
| 222 | | FcConfig *config; |
| 223 | | FcPattern *pat; |
| 224 | | FcObjectSet *os; |
| 225 | | FcFontSet *fontset; |
| 226 | | FcValue val; |
| 227 | | |
| 228 | | config = FcConfigGetCurrent(); |
| 229 | | pat = FcPatternCreate(); |
| 230 | | os = FcObjectSetCreate(); |
| 231 | | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); |
| 232 | | |
| 233 | | // try and get a font with the requested styles baked-in |
| 234 | | if (bold) |
| 235 | | { |
| 236 | | if (italic) |
| 237 | | { |
| 238 | | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold Italic"); |
| 239 | | } |
| 240 | | else |
| 241 | | { |
| 242 | | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold"); |
| 243 | | } |
| 244 | | } |
| 245 | | else if (italic) |
| 246 | | { |
| 247 | | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Italic"); |
| 248 | | } |
| 249 | | else |
| 250 | | { |
| 251 | | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); |
| 252 | | } |
| 253 | | |
| 254 | | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); |
| 255 | | |
| 256 | | FcObjectSetAdd(os, FC_FILE); |
| 257 | | fontset = FcFontList(config, pat, os); |
| 258 | | |
| 259 | | for (int i = 0; i < fontset->nfont; i++) |
| 260 | | { |
| 261 | | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) |
| 262 | | { |
| 263 | | continue; |
| 264 | | } |
| 265 | | |
| 266 | | if (val.type != FcTypeString) |
| 267 | | { |
| 268 | | continue; |
| 269 | | } |
| 270 | | |
| 271 | | osd_printf_verbose("Matching font: %s\n", val.u.s); |
| 272 | | { |
| 273 | | astring match_name((const char*)val.u.s); |
| 274 | | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); |
| 275 | | } |
| 276 | | |
| 277 | | if (font) |
| 278 | | { |
| 279 | | bakedstyles = true; |
| 280 | | break; |
| 281 | | } |
| 282 | | } |
| 283 | | |
| 284 | | // didn't get a font above? try again with no baked-in styles |
| 285 | | if (!font) |
| 286 | | { |
| 287 | | FcPatternDestroy(pat); |
| 288 | | FcFontSetDestroy(fontset); |
| 289 | | |
| 290 | | pat = FcPatternCreate(); |
| 291 | | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); |
| 292 | | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); |
| 293 | | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); |
| 294 | | fontset = FcFontList(config, pat, os); |
| 295 | | |
| 296 | | for (int i = 0; i < fontset->nfont; i++) |
| 297 | | { |
| 298 | | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) |
| 299 | | { |
| 300 | | continue; |
| 301 | | } |
| 302 | | |
| 303 | | if (val.type != FcTypeString) |
| 304 | | { |
| 305 | | continue; |
| 306 | | } |
| 307 | | |
| 308 | | osd_printf_verbose("Matching unstyled font: %s\n", val.u.s); |
| 309 | | { |
| 310 | | astring match_name((const char*)val.u.s); |
| 311 | | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); |
| 312 | | } |
| 313 | | |
| 314 | | if (font) |
| 315 | | { |
| 316 | | break; |
| 317 | | } |
| 318 | | } |
| 319 | | } |
| 320 | | |
| 321 | | FcPatternDestroy(pat); |
| 322 | | FcObjectSetDestroy(os); |
| 323 | | FcFontSetDestroy(fontset); |
| 324 | | return font; |
| 325 | | } |
| 326 | | #endif |