Previous 199869 Revisions Next

r34582 Friday 23rd January, 2015 at 18:53:42 UTC by Couriersud
Added a generic module abstraction layer and migrated font modules to
use this layer. (nw)
[src/mame]mame.lst
[src/mame/drivers]circus.c ddenlovr.c dkong.c dynax.c exidyttl.c model2.c model3.c naomi.c st_mp200.c stv.c taitottl.c
[src/mame/includes]dynax.h model3.h stv.h
[src/mame/machine]315-5881_crypt.c 315-5881_crypt.h 315-5881_helper.c stvprot.c
[src/mame/video]taitoair.c
[src/osd]osdepend.h
[src/osd/modules]osdmodule.c* osdmodule.h*
[src/osd/modules/font]font_module.h* font_none.c font_osx.c font_sdl.c* font_unix.c font_windows.c
[src/osd/modules/lib]osdobj_common.c osdobj_common.h
[src/osd/sdl]main.c osdsdl.h sdl.mak sdlmain.c strconv.h
[src/osd/windows]main.c netdev_pcap.h strconv.h windows.mak

trunk/src/mame/drivers/circus.c
r243093r243094
66
77Robot Bowl           1977  6502   4020-4027, 4010-4013
88Circus               1977  6502   9000-9003, 9004-9011
9Football         Aug,1978  6502   unknown
109Rip Cord         May,1979  6502   RC30-0014 (cpu) 0015 (snd)
1110                                  9023-9026, 9027-9034, 9035
1211Crash           July,1979  6502   CR30-3162 (cpu) 3161 (snd)  9036 (?)
trunk/src/mame/drivers/ddenlovr.c
r243093r243094
110110#include "cpu/m68000/m68000.h"
111111#include "cpu/z80/z80.h"
112112#include "sound/ay8910.h"
113#include "sound/okim6295.h"
114#include "sound/2413intf.h"
113115#include "machine/msm6242.h"
114116#include "machine/nvram.h"
115117#include "includes/dynax.h"
r243093r243094
151153{
152154public:
153155   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      { }
159158
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
219159   DECLARE_MACHINE_START(ddenlovr);
220160   DECLARE_MACHINE_RESET(ddenlovr);
221161   DECLARE_VIDEO_START(ddenlovr);
r243093r243094
410350   DECLARE_VIDEO_START(htengoku);
411351   DECLARE_WRITE8_MEMBER(htengoku_dsw_w);
412352   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 );
427353
428354   void ddenlovr_flipscreen_w( UINT8 data );
429355   void ddenlovr_blit_flip_w( UINT8 data );
r243093r243094
442368   void mmpanic_update_leds();
443369   void mjchuuka_get_romdata();
444370   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 );
445385};
446386
447387VIDEO_START_MEMBER(ddenlovr_state,ddenlovr)
r243093r243094
19761916   AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r)                             // Video Chip
19771917
19781918   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)
19801920   AM_RANGE(0x300340, 0x30035f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
19811921   AM_RANGE(0x300380, 0x300383) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
19821922   AM_RANGE(0x300384, 0x300385) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243093r243094
20281968   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                       // ? must be 78 on startup (not necessary in ddlover)
20291969   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
20301970   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)
20321972   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
20331973   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
20341974   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
r243093r243094
20952035   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
20962036   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
20972037
2098   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2038   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
20992039   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
21002040   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
21012041   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243093r243094
21332073   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
21342074   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
21352075
2136   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2076   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
21372077   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
21382078   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
21392079   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243093r243094
22072147   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                           // ? must be 78 on startup (not necessary in ddlover)
22082148   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
22092149   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)
22112151   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
22122152   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
22132153   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
r243093r243094
22702210   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
22712211   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
22722212
2273   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
2213   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
22742214   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
22752215   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
22762216   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243093r243094
23262266   AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r)
23272267
23282268   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)
23302270
23312271   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
23322272   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
r243093r243094
23632303
23642304   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
23652305   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)
23672307
23682308   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
23692309   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
r243093r243094
25172457   AM_RANGE(0x02, 0x02) AM_READNOP     // read just before port 00
25182458   AM_RANGE(0x04, 0x04) AM_NOP                 // read only once at the start
25192459   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)
25212461   AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("aysnd", ay8910_device, data_w)
25222462   AM_RANGE(0x0e, 0x0e) AM_DEVWRITE("aysnd", ay8910_device, address_w)
25232463ADDRESS_MAP_END
r243093r243094
28002740   AM_RANGE(0x93, 0x93) AM_WRITE(hanakanz_coincounter_w)
28012741   AM_RANGE(0x94, 0x94) AM_WRITE(hanakanz_keyb_w)
28022742   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)
28042744   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
28052745   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
28062746ADDRESS_MAP_END
r243093r243094
28162756   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28172757   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28182758   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)
28202760   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
28212761   AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
28222762   AM_RANGE(0xb3, 0xb3) AM_WRITE(hanakanz_coincounter_w)
r243093r243094
28382778   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28392779   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28402780   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)
28422782   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
28432783//  AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
28442784   AM_RANGE(0xb1, 0xb1) AM_READ_PORT("KEYB0")
r243093r243094
28622802   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
28632803   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
28642804   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)
28662806   AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
28672807//  AM_RANGE(0x91, 0x91) AM_READ(hanakanz_keyb_r)
28682808   AM_RANGE(0x91, 0x91) AM_READ_PORT("KEYB0")
r243093r243094
29012841   AM_RANGE(0x94, 0x94) AM_READ_PORT("SYSTEM")
29022842   AM_RANGE(0x95, 0x96) AM_READ(hanakanz_keyb_r)
29032843   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)
29052845   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
29062846   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
29072847ADDRESS_MAP_END
r243093r243094
30292969   AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ_PORT("DSW4")
30302970   AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ_PORT("DSW5")     // DSW 1-4 high bits
30312971   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)
30332973   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
30342974   AM_RANGE(0xe0, 0xe1) AM_MIRROR(0xff00) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
30352975ADDRESS_MAP_END
r243093r243094
31383078   AM_RANGE(0x22, 0x22) AM_READ(mjmyster_coins_r)
31393079   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
31403080   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)
31423082   AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r)
31433083   AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w)
31443084   AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243093r243094
33033243   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
33043244   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)
33053245   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)
33073247   AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r)
33083248   AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w)
33093249   AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243093r243094
34263366   AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w)
34273367   AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r)
34283368   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)
34303370   AM_RANGE(0x84, 0x84) AM_DEVREAD("aysnd", ay8910_device, data_r)
34313371   AM_RANGE(0x86, 0x86) AM_DEVWRITE("aysnd", ay8910_device, data_w)
34323372   AM_RANGE(0x88, 0x88) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243093r243094
34693409   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)        // ? ack on RTC int
34703410   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
34713411   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)
34733413   AM_RANGE(0x24, 0x24) AM_DEVREAD("aysnd", ay8910_device, data_r)
34743414   AM_RANGE(0x26, 0x26) AM_DEVWRITE("aysnd", ay8910_device, data_w)
34753415   AM_RANGE(0x28, 0x28) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243093r243094
35603500   AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r)
35613501   AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w)
35623502   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)
35643504   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
35653505   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
35663506   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
r243093r243094
36063546   AM_RANGE(0x22, 0x22) AM_READ(mjmywrld_coins_r)
36073547   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
36083548   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)
36103550   AM_RANGE(0x44, 0x44) AM_DEVREAD("aysnd", ay8910_device, data_r)
36113551   AM_RANGE(0x46, 0x46) AM_DEVWRITE("aysnd", ay8910_device, data_w)
36123552   AM_RANGE(0x48, 0x48) AM_DEVWRITE("aysnd", ay8910_device, address_w)
r243093r243094
37063646   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                         // Coin Counters
37073647   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                         //
37083648
3709   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ym2413", ym2413_device, write, 0x00ff)
3649   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff)
37103650   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
37113651   AM_RANGE(0xe00600, 0xe00603) AM_DEVWRITE8("aysnd", ay8910_device, address_data_w, 0x00ff)
37123652   AM_RANGE(0xe00604, 0xe00605) AM_DEVREAD8("aysnd", ay8910_device, data_r, 0x00ff)
r243093r243094
37973737   AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1")
37983738   AM_RANGE(0x0181, 0x0181) AM_WRITENOP                        // ? int. enable
37993739   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)
38013741   AM_RANGE(0x0280, 0x028f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
38023742   AM_RANGE(0x0300, 0x0301) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
38033743   AM_RANGE(0x0380, 0x0380) AM_DEVREADWRITE("oki", okim6295_device, read, write)
r243093r243094
38383778   AM_RANGE(0x60, 0x60) AM_WRITE(hanakanz_blitter_data_w)
38393779   AM_RANGE(0x61, 0x61) AM_WRITE(hanakanz_palette_w)
38403780   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)
38423782   AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
38433783   AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
38443784ADDRESS_MAP_END
r243093r243094
39013841static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, ddenlovr_state )
39023842   ADDRESS_MAP_GLOBAL_MASK(0xff)
39033843   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)
39053845   AM_RANGE(0x04, 0x05) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
39063846   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(sryudens_rambank_w)    // ? ack on RTC int
39073847   AM_RANGE(0x1e, 0x1e) AM_WRITE(mjflove_rombank_w)
r243093r243094
39883928   AM_RANGE(0x70, 0x70) AM_WRITE(quizchq_oki_bank_w)
39893929   AM_RANGE(0x80, 0x80) AM_RAM
39903930   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)
39923932   AM_RANGE(0x94, 0x95) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)
39933933ADDRESS_MAP_END
39943934
r243093r243094
40604000   AM_RANGE(0x38, 0x38) AM_READNOP         // ? ack or watchdog
40614001   AM_RANGE(0x40, 0x41) AM_WRITE(mjflove_blitter_w)
40624002   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)
40644004   AM_RANGE(0x54, 0x54) AM_DEVREADWRITE("oki", okim6295_device, read, write)
40654005   AM_RANGE(0x58, 0x58) AM_DEVWRITE("aysnd", ay8910_device, address_w)
40664006   AM_RANGE(0x5c, 0x5c) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w)   // dsw
r243093r243094
42144154   AM_RANGE( 0x40, 0x40 ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    // AY8910
42154155   AM_RANGE( 0x42, 0x42 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     //
42164156   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)        //
42184158   AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
42194159   AM_RANGE( 0xa0, 0xa3 ) AM_WRITE(ddenlovr_palette_base_w)    // ddenlovr mixer chip
42204160   AM_RANGE( 0xa4, 0xa7 ) AM_WRITE(ddenlovr_palette_mask_w)
r243093r243094
42864226   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(ddenlovr_state, htengoku_dsw_w))
42874227   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
42884228
4289   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
4229   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
42904230   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
42914231
42924232   /* devices */
r243093r243094
44014341   AM_RANGE(0x42, 0x44) AM_READ(hanakanz_gfxrom_r)
44024342   AM_RANGE(0x8a, 0x8b) AM_READ(daimyojn_year_hack_r)  // ?
44034343   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)
44054345   AM_RANGE(0xa2, 0xa2) AM_DEVREADWRITE("oki", okim6295_device, read, write)
44064346   AM_RANGE(0xa8, 0xa8) AM_READ_PORT("SYSTEM")
44074347   AM_RANGE(0xaa, 0xaa) AM_READ(daimyojn_keyb1_r)
r243093r243094
93619301   save_item(NAME(m_mjflove_irq_cause));
93629302   save_item(NAME(m_daimyojn_palette_sel));
93639303   save_item(NAME(m_palram));
9304
9305   save_item(NAME(m_irq_count));
93649306}
93659307
93669308MACHINE_RESET_MEMBER(ddenlovr_state,ddenlovr)
r243093r243094
93819323   m_hginga_rombank = 0;
93829324   m_mjflove_irq_cause = 0;
93839325   m_daimyojn_palette_sel = 0;
9326   m_irq_count = 0;
93849327
93859328   m_quiz365_protection[0] = 0;
93869329   m_quiz365_protection[1] = 0;
r243093r243094
94929435   /* sound hardware */
94939436   MCFG_SPEAKER_STANDARD_MONO("mono")
94949437
9495   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
9438   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
94969439   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
94979440
94989441   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 16)  // or /8 ?
r243093r243094
96109553   /* sound hardware */
96119554   MCFG_SPEAKER_STANDARD_MONO("mono")
96129555
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
96149557   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50)
96159558
96169559   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz/28, OKIM6295_PIN7_HIGH) // clock frequency verified 1.022MHz, pin 7 verified high
r243093r243094
96949637   /* sound hardware */
96959638   MCFG_SPEAKER_STANDARD_MONO("mono")
96969639
9697   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
9640   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
96989641   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
96999642
97009643   MCFG_SOUND_ADD("aysnd", AY8910, 3579545)
r243093r243094
97719714   /* sound hardware */
97729715   MCFG_SPEAKER_STANDARD_MONO("mono")
97739716
9774   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
9717   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
97759718   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
97769719
97779720   MCFG_OKIM6295_ADD("oki", 1022720, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
r243093r243094
98179760   /* sound hardware */
98189761   MCFG_SPEAKER_STANDARD_MONO("mono")
98199762
9820   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_37516MHz / 8)
9763   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_37516MHz / 8)
98219764   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
98229765
98239766   MCFG_OKIM6295_ADD("oki", XTAL_28_37516MHz / 28, OKIM6295_PIN7_HIGH)
r243093r243094
1018610129   /* sound hardware */
1018710130   MCFG_SPEAKER_STANDARD_MONO("mono")
1018810131
10189   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10132   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1019010133   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1019110134
1019210135   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH)
r243093r243094
1022910172   /* sound hardware */
1023010173   MCFG_SPEAKER_STANDARD_MONO("mono")
1023110174
10232   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10175   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1023310176   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1023410177
1023510178   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243093r243094
1027610219   /* sound hardware */
1027710220   MCFG_SPEAKER_STANDARD_MONO("mono")
1027810221
10279   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10222   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1028010223   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1028110224
1028210225   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243093r243094
1034310286   /* sound hardware */
1034410287   MCFG_SPEAKER_STANDARD_MONO("mono")
1034510288
10346   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10289   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1034710290   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1034810291
1034910292   MCFG_SOUND_ADD("aysnd", AY8910, XTAL_28_63636MHz / 8)
r243093r243094
1039310336   /* sound hardware */
1039410337   MCFG_SPEAKER_STANDARD_MONO("mono")
1039510338
10396   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_28_63636MHz / 8)
10339   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_28_63636MHz / 8)
1039710340   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1039810341
1039910342   MCFG_OKIM6295_ADD("oki", XTAL_28_63636MHz / 28, OKIM6295_PIN7_HIGH)
trunk/src/mame/drivers/dkong.c
r243093r243094
302302    ------------------------------------------------
303303
304304
305Donkey Kong Notes
306=================
307
308    Nintendo Service Department Bulletin # TKG-02 12-11-81
309    GAME: Donkey Kong
310    SUBJECT: Speed-up Kit #1
311
312    TO prevent extremely long play times, we are making available
313    a speed-up kit. This kit prevents players from waiting on top
314    of ladders, on screen #1, while the barrels roll across
315    instead of coming donw on top of him. Whit this kit, barrels
316    will roll on top of the player on a ladder 70 to 80 percent of
317    the time.
318
319    Machines above serial #30,000 will have this kit installed at
320    the factory, and all TKG4 board sets will come with this kit.
321
322    To install this kit in a four-board set, follow these
323    instructions:
324
325    1) Remove P.C. Boards from game, leaving them
326    attached to P.C. Board bracket.
327
328    2) Using a pair of needle-nose pliers, separate the
329    sound P.C. Board fromt he CPU P.C. Board, exposing
330    the entire surface of the CPU Board.
331
332    3) Remove the EPROMS's at location 5F, 5A, 5H and 5K
333    from the CPU Board. (Note 5A should read 5G - MSH)
334
335    4) Install the speed-up kit EPROM's in the corres-
336    ponding locations.
337
338    5) Reconnect the sound P.C. Board to the CPU P.C.
339    Board and mount the P.C. Boards in the game.
340    --------------------------------------------------------------
341
342    That kit included the following 4 EPROM's
343
344    USA (c) 1981 Nintendo of America set
345    ------------------------------------
346
347    Filename Label Type Loc/PCB *Label *Loc/PCB CSum
348    --------- ---------- ------ ------- ---------- -------- ----
349    2532.5K TKG4-C-5At 2532 5A(CPU) TKG3-C-5K 5K(CPU) A0F0
350    2532.5H TKG4-C-5Bt 2532 5B(CPU) TKG3-C-5H 5H(CPU) B2BC
351    2532.5G TKG4-C-5Ct 2532 5C(CPU) TKG3-C-5G 5G(CPU) 73BA
352    2532.5F TKG4-C-5Et 2532 5E(CPU) TKG3-C-5F 5F(CPU) AA97
353
354    Not only did the eprom fix the ladder bug, but it also changed
355    the copyright screen to read "(C)1981 Nintendo of America".
356
357
358305    D2K Jumpman returns Notes
359306    =========================
360307
r243093r243094
366313    6800 and E800.
367314
368315
369    Donkey Kong "Hard" Kit
370    ======================
316Donkey Kong "Hard" Kit
317======================
371318
372    A yet "unconfirmed original" rom replacement kit which is a replacement for
373    TKG-03 and -04 boards and greatly increases the speed and amount of fireballs
374    showing on all levels.  Such behavior can be seen easily on the Rivet Board,
375    where most of the fireballs have appeared even before removing the first rivet.
319A yet "unconfirmed original" rom replacement kit which is a replacement for
320TKG-03 and -04 boards and greatly increases the speed and amount of fireballs
321showing on all levels.  Such behavior can be seen easily on the Rivet Board,
322where most of the fireballs have appeared even before removing the first rivet.
376323
377    Hopefully confirmation and information will come along later which confirms
378    this is a legitimate Nintendo Kit.
324Hopefully confirmation and information will come along later which confirms
325this is a legitimate Nintendo Kit.
379326
380327***************************************************************************/
381328
r243093r243094
19471894   ROM_LOAD( "trs01v1d.bin",    0x0300, 0x0100, BAD_DUMP CRC(1b828315) SHA1(00c9f8c5ae86b68d38c66f9071b5f1ef421c1005) ) /* character color codes on a per-column basis */
19481895ROM_END
19491896
1950ROM_START( dkong ) /* Confirmed TKG-04 Upgrade as mentioned in Nintendo Service Department Bulletin # TKG-02 12-11-81 */
1897ROM_START( dkong )
19511898   ROM_REGION( 0x10000, "maincpu", 0 )
19521899   ROM_LOAD( "c_5et_g.bin",  0x0000, 0x1000, CRC(ba70b88b) SHA1(d76ebecfea1af098d843ee7e578e480cd658ac1a) )
19531900   ROM_LOAD( "c_5ct_g.bin",  0x1000, 0x1000, CRC(5ec461ec) SHA1(acb11a8fbdbb3ab46068385fe465f681e3c824bd) )
r243093r243094
23072254   ROM_LOAD( "v-2n.bpr",  0x0200, 0x0100, CRC(dbf185bf) SHA1(2697a991a4afdf079dd0b7e732f71c7618f43b70) )   /* character color codes on a per-column basis */
23082255ROM_END
23092256
2310ROM_START( dkongjre )  /* Confirmed E-Kit set mentioned in Nintendo Service Department Bulletin # DJR-03 (02-23-83) */
2257ROM_START( dkongjre )
23112258   ROM_REGION( 0x10000, "maincpu", 0 )
23122259   ROM_LOAD( "djr1-c.5b",    0x0000, 0x1000, CRC(ffe9e1a5) SHA1(715dc79d85169b4c1faf43458592e69b434afefd) )
23132260   ROM_CONTINUE(             0x3000, 0x1000 )
r243093r243094
23442291   ROM_REGION( 0x10000, "maincpu", 0 )
23452292   ROM_LOAD( "dkjr1-c.5b-p", 0x0000, 0x1000, CRC(8d99b3e0) SHA1(311a9f353e62d9d07c678e45baa2efec575a8f3b) ) // does not match SUM16 of bulletin (see notes), definitely not from Nintendo
23462293   ROM_CONTINUE(             0x3000, 0x1000 )
2347   ROM_LOAD( "dkjr1-c.5c-p", 0x2000, 0x0800, CRC(b92d258c) SHA1(793483e249d08cbbbefe06d3ddc4c2eda5428ee8) )
2294   ROM_LOAD( "dkjr1-c.5c-p", 0x2000, 0x0800, CRC(b92d258c) SHA1(793483e249d08cbbbefe06d3ddc4c2eda5428ee8) ) // "
23482295   ROM_CONTINUE(             0x4800, 0x0800 )
23492296   ROM_CONTINUE(             0x1000, 0x0800 )
23502297   ROM_CONTINUE(             0x5800, 0x0800 )
trunk/src/mame/drivers/dynax.c
r243093r243094
7979#include "sound/ay8910.h"
8080#include "sound/2203intf.h"
8181#include "sound/3812intf.h"
82#include "sound/msm5205.h"
83#include "sound/2413intf.h"
8284#include "machine/nvram.h"
8385#include "rendlay.h"
8486
r243093r243094
532534   AM_RANGE( 0x74, 0x74 ) AM_WRITE(dynax_blitter_ack_w)        // Blitter IRQ Ack
533535   AM_RANGE( 0x76, 0x76 ) AM_WRITE(dynax_blit_palbank_w)       // Layers Palettes (High Bit)
534536   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
536538   AM_RANGE( 0x7a, 0x7b ) AM_DEVWRITE("aysnd", ay8910_device, address_data_w)   // AY8910
537539//  AM_RANGE( 0x7c, 0x7c ) AM_WRITENOP   // CRT Controller
538540//  AM_RANGE( 0x7d, 0x7d ) AM_WRITENOP   //
r243093r243094
554556   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW2")         // DSW3
555557   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
556558   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)        //
558560   AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     // AY8910, DSW1
559561   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
560562   AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
r243093r243094
638640
639641   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
640642   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)        //
642644
643645   AM_RANGE( 0x36, 0x36 ) AM_DEVREAD("aysnd", ay8910_device, data_r)     // AY8910, DSW1
644646   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
r243093r243094
778780   AM_RANGE( 0x11, 0x17 ) AM_WRITE(dynax_blitter_rev2_w)       // Blitter
779781   AM_RANGE( 0x20, 0x20 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
780782   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)        //
782784   AM_RANGE( 0x28, 0x28 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
783785   AM_RANGE( 0x2a, 0x2a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
784786   AM_RANGE( 0x48, 0x48 ) AM_WRITE(dynax_extra_scrollx_w)  // screen scroll X
r243093r243094
817819   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT("DSW1")         // DSW3
818820   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
819821   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)        //
821823   AM_RANGE( 0x38, 0x38 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
822824   AM_RANGE( 0x3a, 0x3a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
823825   AM_RANGE( 0x40, 0x40 ) AM_WRITE(dynax_blit_pen_w)       // Destination Pen
r243093r243094
845847static ADDRESS_MAP_START( sprtmtch_io_map, AS_IO, 8, dynax_state )
846848   ADDRESS_MAP_GLOBAL_MASK(0xff)
847849   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
849851//  AM_RANGE( 0x12, 0x12 ) AM_WRITENOP   // CRT Controller
850852//  AM_RANGE( 0x13, 0x13 ) AM_WRITENOP   // CRT Controller
851853   AM_RANGE( 0x20, 0x20 ) AM_READ_PORT("P1")               // P1
r243093r243094
891893   AM_RANGE( 0x63, 0x63 ) AM_READ(hanamai_keyboard_0_r)        // P1
892894   AM_RANGE( 0x64, 0x64 ) AM_READ_PORT("DSW0")         // DSW
893895   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)        //
895897//  AM_RANGE( 0x80, 0x80 ) AM_WRITENOP   // IRQ ack?
896898ADDRESS_MAP_END
897899
r243093r243094
900902   ADDRESS_MAP_GLOBAL_MASK(0xff)
901903   AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
902904   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)        //
904906   AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
905907   AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
906908   AM_RANGE( 0x10, 0x10 ) AM_WRITE(hanamai_keyboard_w)     // keyboard row select
r243093r243094
10221024   AM_RANGE( 0x10, 0x10 ) AM_WRITE(jantouki_sound_vblank_ack_w)    // VBlank IRQ Ack
10231025   AM_RANGE( 0x21, 0x21 ) AM_DEVREAD("aysnd", ay8910_device, data_r)         // AY8910
10241026   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) //
10261028   AM_RANGE( 0x30, 0x30 ) AM_WRITE(adpcm_reset_w)      // MSM5205 reset
10271029   AM_RANGE( 0x40, 0x40 ) AM_WRITE(adpcm_data_w)               // MSM5205 data
10281030   AM_RANGE( 0x50, 0x50 ) AM_READ(jantouki_soundlatch_status_r)    // Soundlatch status
r243093r243094
10581060   ADDRESS_MAP_GLOBAL_MASK(0xff)
10591061   AM_RANGE( 0x00, 0x00 ) AM_WRITE(adpcm_reset_w)  // MSM5205 reset
10601062   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)        //
10621064   AM_RANGE( 0x08, 0x08 ) AM_DEVWRITE("aysnd", ay8910_device, data_w)   // AY8910
10631065   AM_RANGE( 0x0a, 0x0a ) AM_DEVWRITE("aysnd", ay8910_device, address_w)    //
10641066   AM_RANGE( 0x11, 0x12 ) AM_WRITE(mjelctrn_blitter_ack_w) //?
r243093r243094
13371339   AM_RANGE( 0x10000, 0x10000 ) AM_DEVREAD("aysnd", ay8910_device, data_r)       // AY8910
13381340   AM_RANGE( 0x10008, 0x10008 ) AM_DEVWRITE("aysnd", ay8910_device, data_w) //
13391341   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)      //
13411343   AM_RANGE( 0x10040, 0x10040 ) AM_WRITE(dynax_blit_pen_w)     // Destination Pen
13421344   AM_RANGE( 0x10044, 0x10044 ) AM_WRITE(tenkai_blit_dest_w)       // Destination Layer
13431345   AM_RANGE( 0x10048, 0x10048 ) AM_WRITE(tenkai_blit_palette23_w)  // Layers Palettes
r243093r243094
14791481         case 0x8050:    // CRT controller
14801482         case 0x8051:    return;
14811483
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;
14841486
14851487         case 0x8060:    m_keyb = data;  return;
14861488
r243093r243094
39653967
39663968MACHINE_START_MEMBER(dynax_state,dynax)
39673969{
3970   m_ymsnd = machine().device("ymsnd");
3971
39683972   save_item(NAME(m_sound_irq));
39693973   save_item(NAME(m_vblank_irq));
39703974   save_item(NAME(m_blitter_irq));
r243093r243094
40894093   MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8)
40904094   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
40914095
4092   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
4096   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
40934097   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
40944098   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
40954099   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW0"))
r243093r243094
41434147   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
41444148   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
41454149
4146   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
4150   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
41474151   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41484152
41494153   MCFG_SOUND_ADD("msm", MSM5205, 384000)
r243093r243094
41904194   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
41914195   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
41924196
4193   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_3_579545MHz )
4197   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz )
41944198   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41954199
41964200   MCFG_SOUND_ADD("msm", MSM5205, XTAL_384kHz )
r243093r243094
42344238   /* sound hardware */
42354239   MCFG_SPEAKER_STANDARD_MONO("mono")
42364240
4237   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
4241   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
42384242   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, sprtmtch_sound_callback))
42394243   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
42404244   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1"))
r243093r243094
42794283   /* sound hardware */
42804284   MCFG_SPEAKER_STANDARD_MONO("mono")
42814285
4282   MCFG_SOUND_ADD("ym2413", YM2413, 24000000/6)
4286   MCFG_SOUND_ADD("ymsnd", YM2413, 24000000/6)
42834287   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
42844288MACHINE_CONFIG_END
42854289
r243093r243094
43784382
43794383   membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000],  0x8000);
43804384   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
43824389   MACHINE_START_CALL_MEMBER(dynax);
43834390}
43844391
r243093r243094
44304437   MCFG_SOUND_ADD("aysnd", AY8910, 22000000 / 8)
44314438   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
44324439
4433   MCFG_SOUND_ADD("ym2203", YM2203, 22000000 / 8)
4440   MCFG_SOUND_ADD("ymsnd", YM2203, 22000000 / 8)
44344441   MCFG_YM2203_IRQ_HANDLER(WRITELINE(dynax_state, jantouki_sound_callback))
44354442   MCFG_SOUND_ROUTE(0, "mono", 0.20)
44364443   MCFG_SOUND_ROUTE(1, "mono", 0.20)
r243093r243094
46094616   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w))
46104617   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
46114618
4612   MCFG_SOUND_ADD("ym2413", YM2413, 3579545)
4619   MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
46134620   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
46144621
46154622   /* devices */
r243093r243094
46804687   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(dynax_state, tenkai_dswsel_w))
46814688   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
46824689
4683   MCFG_SOUND_ADD("ym2413", YM2413, XTAL_24MHz / 8) // ?
4690   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_24MHz / 8) // ?
46844691   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
46854692MACHINE_CONFIG_END
46864693
trunk/src/mame/drivers/exidyttl.c
r243093r243094
66 Attack (1977)
77 Death Race (1976)
88 Destruction Derby (1975)
9 Football (1978)
910 Old Time Basketball (1976)
1011 Spiders From Space (1976)
1112 Score (1977)
trunk/src/mame/drivers/model2.c
r243093r243094
13501350
13511351   if (offset == 0x0008/4)
13521352   {
1353      // Zero Gunner uses this, it's encrypted data in prot.RAM consists of several small chunks, selected using low address
1354      // so far this is only known game with 315-5881 which uses not 0 offset in prot.RAM
1355      if (mem_mask == 0x0000ffff)
1356         m_cryptdevice->set_addr_low(data&0xffff);
1357      else if (mem_mask == 0xffff0000)
1358      {
1359         m_cryptdevice->set_addr_high(0);
1360         if (data != 0)
1361            printf("model2_5881prot_w not zero high address %08x (%08x)\n", data, mem_mask);
1362      }
1353      // code is copied to RAM first, so base address is always 0
1354      m_cryptdevice->set_addr_low(0);
1355      m_cryptdevice->set_addr_high(0);
1356
1357      if (data != 0)
1358         printf("model2_5881prot_w address isn't 0?\n");
1359
13631360      first_read = 1;
13641361   }
13651362   else if (offset == 0x000c/4)
trunk/src/mame/drivers/model3.c
r243093r243094
664664#include "machine/nvram.h"
665665#include "includes/model3.h"
666666
667//#define DECRYPT_ANALYSIS_HACKS
668667
669#ifdef DECRYPT_ANALYSIS_HACKS
670int readcount = 0;
671int segcount = 0;
672#endif
673
674668void model3_state::update_irq_state()
675669{
676670   if ((m_irq_enable & m_irq_state) || m_scsi_irq_state)
r243093r243094
16791673}
16801674
16811675
1676static 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};
16821692
1693static 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};
16831704
16841705static const UINT16 fvipers2_prot_data[] =
16851706{
r243093r243094
16941715   0x2e64, 0x2a20, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a, 0x2a2a,
16951716};
16961717
1718static 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};
16971728
1729static 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};
16981739
1740static 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*/
16991756
17001757READ64_MEMBER(model3_state::model3_security_r)
17011758{
r243093r243094
17061763      case 0x00 / 8:    retvalue = 0; break;       /* status */
17071764      case 0x1c/8:                    /* security board data read */
17081765      {
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)
17151768         {
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         {
17161783            UINT64 data = (UINT64)fvipers2_prot_data[m_prot_data_ptr++] << 16;
17171784            if (m_prot_data_ptr >= 0x41)
17181785            {
r243093r243094
17201787            }
17211788            retvalue = data;
17221789         }
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         }
17231819         else
17241820         {
17251821            retvalue = 0;
r243093r243094
17271823         break;
17281824      }
17291825   }
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));
17301827
17311828   return retvalue;
17321829}
17331830
1734
1735
1736WRITE64_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
17811831READ64_MEMBER(model3_state::model3_5881prot_r)
17821832{
17831833   UINT64 retvalue = U64(0xffffffffffffffff);
r243093r243094
18391889   {
18401890      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));
18411891   }
1892
1893
1894
18421895}
18431896
18441897WRITE64_MEMBER(model3_state::daytona2_rombank_w)
r243093r243094
55335586   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
55345587MACHINE_CONFIG_END
55355588
5536static MACHINE_CONFIG_START(model3_20, model3_state)
5589static MACHINE_CONFIG_START( model3_20, model3_state )
55375590   MCFG_CPU_ADD("maincpu", PPC603R, 166000000)
55385591   MCFG_PPC_BUS_FREQUENCY(66000000)    /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */
55395592   MCFG_CPU_PROGRAM_MAP(model3_mem)
r243093r243094
55425595   MCFG_CPU_ADD("audiocpu", M68000, 12000000)
55435596   MCFG_CPU_PROGRAM_MAP(model3_snd)
55445597
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)
55475600
55485601   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
55495602   MCFG_NVRAM_ADD_1FILL("backup")
r243093r243094
55705623   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
55715624MACHINE_CONFIG_END
55725625
5573static 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)
5576MACHINE_CONFIG_END
5577
5578static MACHINE_CONFIG_START(model3_21, model3_state)
5626static MACHINE_CONFIG_START( model3_21, model3_state )
55795627   MCFG_CPU_ADD("maincpu", PPC603R, 166000000)
55805628   MCFG_PPC_BUS_FREQUENCY(66000000)    /* Multiplier 2.5, Bus = 66MHz, Core = 166MHz */
55815629   MCFG_CPU_PROGRAM_MAP(model3_mem)
r243093r243094
55845632   MCFG_CPU_ADD("audiocpu", M68000, 12000000)
55855633   MCFG_CPU_PROGRAM_MAP(model3_snd)
55865634
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)
55895637
55905638   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
55915639   MCFG_NVRAM_ADD_1FILL("backup")
r243093r243094
56125660   MCFG_SOUND_ROUTE(0, "rspeaker", 2.0)
56135661MACHINE_CONFIG_END
56145662
5615
56165663UINT16 model3_state::crypt_read_callback(UINT32 addr)
56175664{
56185665   UINT16 dat = 0;
r243093r243094
56235670
56245671//   dat = ((dat & 0xff00) >> 8) | ((dat & 0x00ff) << 8);
56255672//   printf("reading %04x\n", dat);
5626
56275673   return dat;
56285674}
56295675
r243093r243094
56725718
56735719   if (key != -1)
56745720   {
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));
56755722      m_cryptdevice->set_key(key);
56765723      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) );                   
56775724   }
56785725   else
56795726   {
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) );                   
56815728   }
56825729}
56835730
r243093r243094
58445891DRIVER_INIT_MEMBER(model3_state,vs298)
58455892{
58465893   DRIVER_INIT_CALL(model3_20);
5847   DRIVER_INIT_CALL(genprot);
58485894}
58495895
58505896
5897DRIVER_INIT_MEMBER(model3_state,vs2v991)
5898{
5899   DRIVER_INIT_CALL(model3_20);
5900}
58515901
5902DRIVER_INIT_MEMBER(model3_state,vs299b)
5903{
5904   DRIVER_INIT_CALL(model3_20);
5905}
58525906
5907DRIVER_INIT_MEMBER(model3_state,vs299a)
5908{
5909   DRIVER_INIT_CALL(model3_20);
5910}
5911
58535912DRIVER_INIT_MEMBER(model3_state,vs299)
58545913{
58555914   DRIVER_INIT_CALL(model3_20);
5856   DRIVER_INIT_CALL(genprot);
58575915}
58585916
58595917DRIVER_INIT_MEMBER(model3_state,harley)
r243093r243094
59115969{
59125970   //UINT32 *rom = (UINT32*)memregion("user1")->base();
59135971   DRIVER_INIT_CALL(model3_20);
5914   DRIVER_INIT_CALL(genprot);
59155972
59165973   //rom[(0xf6dd0^4)/4] = 0x60000000;
59175974}
r243093r243094
59215978   m_step20_with_old_real3d = true;
59225979
59235980   DRIVER_INIT_CALL(model3_20);
5924   DRIVER_INIT_CALL(genprot);
59255981}
59265982
59275983DRIVER_INIT_MEMBER(model3_state,dirtdvls)
r243093r243094
59295985   m_step20_with_old_real3d = true;
59305986
59315987   DRIVER_INIT_CALL(model3_20);
5932   DRIVER_INIT_CALL(genprot);
59335988}
59345989
59355990DRIVER_INIT_MEMBER(model3_state,daytona2)
59365991{
5937//   UINT32 *rom = (UINT32*)memregion("user1")->base();
5992   UINT32 *rom = (UINT32*)memregion("user1")->base();
59385993   DRIVER_INIT_CALL(model3_20);
59395994
59405995   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
59415996   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
59425997
59435998   //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;
59496002}
59506003
59516004DRIVER_INIT_MEMBER(model3_state,dayto2pe)
59526005{
5953//   UINT32 *rom = (UINT32*)memregion("user1")->base();
6006   UINT32 *rom = (UINT32*)memregion("user1")->base();
59546007   DRIVER_INIT_CALL(model3_20);
59556008
59566009   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
59576010   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
59586011
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
59626015
5963//   rom[(0x64ca34^4)/4] = 0x60000000;       // dec
5964
5965   DRIVER_INIT_CALL(genprot);
6016   rom[(0x64ca34^4)/4] = 0x60000000;       // dec
59666017}
59676018
59686019DRIVER_INIT_MEMBER(model3_state,spikeout)
r243093r243094
59726023
59736024   rom[(0x6059cc^4)/4] = 0x60000000;
59746025   rom[(0x6059ec^4)/4] = 0x60000000;
5975   DRIVER_INIT_CALL(genprot);
59766026}
59776027
59786028DRIVER_INIT_MEMBER(model3_state,spikeofe)
r243093r243094
59826032
59836033   rom[(0x6059cc^4)/4] = 0x60000000;
59846034   rom[(0x6059ec^4)/4] = 0x60000000;
5985   DRIVER_INIT_CALL(genprot);
59866035}
59876036
59886037DRIVER_INIT_MEMBER(model3_state,eca)
59896038{
59906039   DRIVER_INIT_CALL(model3_20);
5991   DRIVER_INIT_CALL(genprot);
59926040}
59936041
59946042DRIVER_INIT_MEMBER(model3_state,skichamp)
r243093r243094
60106058   DRIVER_INIT_CALL(model3_20);
60116059
60126060   rom[(0x57995c^4)/4] = 0x60000000;   // decrementer
6013
6014   DRIVER_INIT_CALL(genprot);
60156061}
60166062
60176063DRIVER_INIT_MEMBER(model3_state,magtruck)
r243093r243094
60196065   m_step20_with_old_real3d = true;
60206066
60216067   DRIVER_INIT_CALL(model3_20);
6022   DRIVER_INIT_CALL(genprot);
60236068}
60246069
60256070DRIVER_INIT_MEMBER(model3_state,lamachin)
r243093r243094
60276072   m_step20_with_old_real3d = true;
60286073
60296074   DRIVER_INIT_CALL(model3_20);
6030   DRIVER_INIT_CALL(genprot);
60316075}
60326076
60336077
r243093r243094
60526096GAME( 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 )
60536097
60546098/* Model 3 Step 2.0 */
6055GAME( 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 )
6056GAME( 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 )
6057GAME( 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 )
6058GAME( 1998, lamachin,       0, model3_20_5881, model3, model3_state,   lamachin, ROT0, "Sega", "L.A. Machineguns", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6059GAME( 1998, oceanhun,       0, model3_20_5881, model3, model3_state,   oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6060GAME( 1998, skichamp,       0, model3_20,      skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6061GAME( 1998, srally2,        0, model3_20,      scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6062GAME( 1998, srally2x,       0, model3_20,      scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2 DX", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6063GAME( 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 )
6064GAME( 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 )
6065GAME( 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 )
6066GAME( 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 )
6067GAME( 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 )
6068GAME( 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 )
6069GAME( 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 )
6070GAME( 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 )
6099GAME( 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 )
6100GAME( 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 )
6101GAME( 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 )
6102GAME( 1998, lamachin,       0, model3_20, model3, model3_state,   lamachin, ROT0, "Sega", "L.A. Machineguns", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6103GAME( 1998, oceanhun,       0, model3_20, model3, model3_state,   oceanhun, ROT0, "Sega", "The Ocean Hunter", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6104GAME( 1998, skichamp,       0, model3_20, skichamp, model3_state, skichamp, ROT0, "Sega", "Ski Champ", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6105GAME( 1998, srally2,        0, model3_20, scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6106GAME( 1998, srally2x,       0, model3_20, scud, model3_state,      srally2, ROT0, "Sega", "Sega Rally 2 DX", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6107GAME( 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 )
6108GAME( 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 )
6109GAME( 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 )
6110GAME( 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 )
6111GAME( 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 )
6112GAME( 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 )
6113GAME( 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 )
6114GAME( 1999, vs299,    vs2v991, model3_20, model3, model3_state,      vs299, ROT0, "Sega", "Virtua Striker 2 '99", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
60716115
60726116/* Model 3 Step 2.1 */
6073GAME( 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 )
6074GAME( 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 )
6075GAME( 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 )
6076GAME( 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 )
6117GAME( 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 )
6118GAME( 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 )
6119GAME( 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 )
6120GAME( 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 )
60776121GAME( 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 )
60786122GAME( 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 )
6079GAME( 1998, spikeout,         0, model3_21_5881, model3,   model3_state, spikeout, ROT0, "Sega", "Spikeout (Revision C)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6080GAME( 1998, spikeofe,         0, model3_21_5881, model3,   model3_state, spikeofe, ROT0, "Sega", "Spikeout Final Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6081GAME( 1998, magtruck,         0, model3_21_5881, eca,      model3_state, magtruck, ROT0, "Sega", "Magical Truck Adventure", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6082GAME( 1999, eca,              0, model3_21_5881, eca,      model3_state, eca,      ROT0, "Sega", "Emergency Call Ambulance", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6083GAME( 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 )
6084GAME( 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 )
6123GAME( 1998, spikeout,         0, model3_21,      model3, model3_state,   spikeout, ROT0, "Sega", "Spikeout (Revision C)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6124GAME( 1998, spikeofe,         0, model3_21,      model3, model3_state,   spikeofe, ROT0, "Sega", "Spikeout Final Edition", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6125GAME( 1998, magtruck,         0, model3_21,      eca, model3_state,      magtruck, ROT0, "Sega", "Magical Truck Adventure", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6126GAME( 1999, eca,              0, model3_21,      eca, model3_state,           eca, ROT0, "Sega", "Emergency Call Ambulance", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6127GAME( 1999, ecax,           eca, model3_21,      eca, model3_state,           eca, ROT0, "Sega", "Emergency Call Ambulance (Export)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
6128GAME( 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/drivers/naomi.c
r243093r243094
328328House of the Dead 2                             834-13636-01 21585   20 (64Mb)   not present 315-6213  not present
329329Idol Janshi Suchie-Pai 3                        841-0002C    21979   14 (64Mb)   ?           315-6213  317-5047-JPN   requires mahjong panel
330330Jambo! Safari (Rev A)                           840-0013C    22826A   8 (64Mb)   ?           315-6213  317-0264-COM
331Mars TV                                         840-0025C    22993   15 (64Mb)   present     315-6213  317-0274-JPN
331Mars TV                                         840-0025C    22993   15 (64Mb)   present     315-6213  317-0074-JPN
332332OutTrigger                                      840-0017C    22163   19 (64Mb)   ?           315-6213  317-0266-COM   requires regular 837-13551 and 837-13938 rotary JVS boards, and special panel
333333Power Stone                                     841-0001C    21597    8 (64Mb)   present     315-6213  317-5046-COM   joystick + 3 buttons
334334Power Stone 2                                   841-0008C    23127    9 (64Mb)   present     315-6213  317-5054-COM   joystick + 3 buttons
335Puyo Puyo Da!                                   841-0006C    22206   20 (64Mb)   ?           315-6213  317-5052-COM
335Puyo Puyo Da!                                   841-0006C    22206   20 (64Mb)   ?           315-6213  ?
336336Ring Out 4x4                                    840-0004C    21779   10 (64Mb)   present     315-6213  317-0250-COM   requires 2 JVS boards
337337Samba de Amigo (Rev B)                          840-0020C    22966B  16 (64Mb)   present     315-6213  317-0270-COM   will boot but requires special controller to play it
338338Sega Marine Fishing                             840-0027C    22221   10 (64Mb)   ?           315-6213  not present    ROM 3&4 not present. Requires 837-13844 JVS IO with all DIPSW Off and fishing controller
r243093r243094
341341Sega Tetris                                     840-0018C    22909    6 (64Mb)   present     315-6213  317-0268-COM
342342Slashout                                        840-0041C    23341   17 (64Mb)   ?           315-6213  317-0286-COM   joystick + 4 buttons
343343Spawn In the Demon's Hand (Rev B)               841-0005C    22977B  10 (64Mb)   ?           315-6213  317-5051-COM   joystick + 4 buttons
344Super Major League '99                          840-0012C    22059   21 (64Mb)   ?           315-6213  317-0259-COM
344Super Major League '99                          840-0012C    22059   21 (64Mb)   ?           315-6213  ?
345345The Typing of the Dead (Rev A)                  840-0026C    23021A  20 (64Mb)   present     315-6213  not present
346346Touch de UNO! / Unou Nouryoku Check Machine     840-0008C    22073    4 (64Mb)   present     315-6213  317-0255-JPN   requires 837-13844 JVS IO with DIPSW 5 On, ELO AccuTouch-compatible touch screen controller and special printer.
347347Toy Fighter / Waffupu                           840-0011C    22035   10 (64Mb)   present     315-6212  317-0257-COM   joystick + 3 buttons
r243093r243094
349349Virtua NBA (original)                           840-0021C    22949   21 (64Mb)   present     315-6213  317-0271-COM
350350Virtua Striker 2 Ver. 2000 (Rev C)              840-0010C    21929C  14 (64Mb)*  present     315-6213  317-0258-COM   joystick + 3 buttons *(+1x 32Mb)
351351Virtua Tennis / Power Smash                     840-0015C    22927   11 (64Mb)   present     315-6213  317-0263-COM
352Virtual On Oratorio Tangram M.S.B.S. ver5.66    840-0028C    23198   13 (64Mb)   ?           315-6213  317-0279-COM
353352Zombie Revenge                                  840-0003C    21707   19 (64Mb)   ?           315-6213  317-0249-COM   joystick + 3 buttons
354353
355354
r243093r243094
513512Derby Owners Club World Edition (Rev C)         840-0088C  22336C   7 (128Mb)  315-6319A  315-6213  not present
514513Derby Owners Club World Edition (Rev D)         840-0088C  22336D   7 (128Mb)  315-6319A  315-6213  not present   2 MaskROM are different from Rev C
515514Giga Wing 2                                     841-0014C  22270    5 (128Mb)  315-6319A  315-6213  317-5064-COM
516Mobile Suit Gundam: Federation Vs. Zeon         841-0017C  23638   10 (128Mb)  315-6319A  315-6213  317-5070-COM
515Mobile Suit Gundam: Federation Vs. Zeon         841-0017C  23638   10 (128Mb)  315-6319A  315-6213  ?
517516Moero Justice Gakuen / Project Justice (Rev A)  841-0015C  23548A  11 (128Mb)  315-6319A  315-6213  317-5065-COM
518517MushiKing - The King Of Beetle 2K5 1ST          840-0158C  24286    7 (128Mb)  315-6319A  315-6213  not present   requires 610-0669 barcode reader
519518Oinori-daimyoujin Matsuri                       840-0126B  24053    5 (128Mb)  315-6319A  315-6213  not present   requires 837-14274 "G2 EXPANSION BD" (similar to hopper 837-14381 but with ARC NET chip)
r243093r243094
522521Star Horse (satellite)                          840-0056C  23627    6 (128Mb)* 315-6319   315-6213  not present   * +1 (64Mb), requires 837-13785 ARCNET&IO BD
523522Star Horse Progress (satellite) (Rev A)         840-0123C  24122A   7 (128Mb)  315-6319A  315-6213  not present   requires 837-13785 ARCNET&IO BD
524523The King of Route 66 (Rev A)                    840-0087C  23819A  10 (128Mb)  315-6319A  315-6213  not present
525Virtua Fighter 4                                840-0080C  23785   11 (128Mb)  ?          ?         317-0324-COM
524Virtua Fighter 4                                840-0080C  23785   11 (128Mb)  ?          ?         ?
526525Virtua Striker 3                                840-0061C  23663   11 (128Mb)  315-6319A  315-6213  317-0310-COM
527526Virtua Striker 3 (Rev B)                        840-0061C  23663B  11 (128Mb)  315-6319A  315-6213  317-0310-COM
528527Wave Runner GP                                  840-0064C  24059    6 (128Mb)  315-6319A  315-6213  not present
trunk/src/mame/drivers/st_mp200.c
r243093r243094
769769/*--------------------------------
770770/ Split Second #144
771771/-------------------------------*/
772ROM_START(spltsecp)
772ROM_START(splitsec)
773773   ROM_REGION(0x10000, "maincpu", 0)
774774   ROM_LOAD( "cpu_u1.716", 0x1000, 0x0800, CRC(c6ff9aa9) SHA1(39f80faca16c869ac14df7c5fc3dfa80b47dad95))
775775   ROM_LOAD( "cpu_u5.716", 0x1800, 0x0800, CRC(fda74efc) SHA1(31becc243ada23e2f4d17927985772c9fcf8a3c3))
r243093r243094
929929GAME(1980,  nineball,   0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Nine Ball", GAME_IS_SKELETON_MECHANICAL)
930930GAME(1981,  lightnin,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Lightning", GAME_IS_SKELETON_MECHANICAL)
931931GAME(1980,  stargzr,    0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Stargazer", GAME_IS_SKELETON_MECHANICAL)
932GAME(1981,  spltsecp,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Split Second (Pinball)", GAME_IS_SKELETON_MECHANICAL)
932GAME(1981,  splitsec,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Split Second", GAME_IS_SKELETON_MECHANICAL)
933933GAME(1981,  catacomp,   0,          st_mp201,   mp200, st_mp200_state,   st_mp201,   ROT0, "Stern", "Catacomb (Pinball)", GAME_IS_SKELETON_MECHANICAL)
934934GAME(1982,  dragfist,   0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Dragonfist", GAME_IS_SKELETON_MECHANICAL)
935935GAME(1984,  lazrlord,   0,          st_mp200,   mp200, st_mp200_state,   st_mp200,   ROT0, "Stern", "Lazer Lord", GAME_IS_SKELETON_MECHANICAL)
trunk/src/mame/drivers/stv.c
r243093r243094
672672   m_maincpu->sh2drc_add_pcflush(0x60011ba);
673673   m_maincpu->sh2drc_add_pcflush(0x605b9da);
674674
675   install_common_protection();
675   install_astrass_protection();
676676
677677   DRIVER_INIT_CALL(stv);
678678}
r243093r243094
766766   m_maincpu->sh2drc_add_pcflush(0x6026398);
767767   m_slave->sh2drc_add_pcflush(0x6028cd6);
768768
769   install_common_protection();
769   install_sss_protection();
770770
771771   DRIVER_INIT_CALL(stv);
772772
r243093r243094
829829   m_slave->sh2drc_add_pcflush(0x6062bca);
830830
831831   DRIVER_INIT_CALL(stv);
832   install_common_protection();
832   install_twcup98_protection();
833833
834834   m_minit_boost_timeslice = m_sinit_boost_timeslice = attotime::from_usec(5);
835835}
r243093r243094
886886   m_maincpu->sh2drc_add_pcflush(0x604eac0);
887887   m_slave->sh2drc_add_pcflush(0x605340a);
888888
889   install_common_protection();
889   install_elandore_protection();
890890
891891   DRIVER_INIT_CALL(stv);
892892   m_minit_boost_timeslice = m_sinit_boost_timeslice = attotime::from_usec(0);
r243093r243094
897897   m_maincpu->sh2drc_add_pcflush(0x6034d04);
898898   m_slave->sh2drc_add_pcflush(0x6036152);
899899
900   install_common_protection();
900   install_rsgun_protection();
901901
902902   DRIVER_INIT_CALL(stv);
903903
r243093r243094
906906
907907DRIVER_INIT_MEMBER(stv_state,ffreveng)
908908{
909   install_common_protection();
909   install_ffreveng_protection();
910910   DRIVER_INIT_CALL(stv);
911911}
912912
trunk/src/mame/drivers/taitottl.c
r243093r243094
33 Taito Discrete Hardware Games
44
55
6 Game Name(s)                                               Part #'s       Data      PROM/ROM Chip Numbers
7 ---------------------------------------------------------+--------------+---------+---------------------------------------
8 Astro Race (11/1973)                                                      UNKNOWN
9 Attack (09/1976)                                                          UNKNOWN
10 Attack UFO (08/1974)                                                      UNKNOWN
11 Avenger (??/1976) (clone of Electra's Avenger)                            UNKNOWN
12 Ball Park/TT Ball Park (??/1974)                                          UNKNOWN
13 Basketball (04/1974)                                                      UNKNOWN
14 Bombs Away (??/1977)                                                      UNKNOWN
15 Cisco/Fisco 400 (04/1977)                                                 UNKNOWN
16 Clean Sweep (??/1976) (clone of Ramtek's Clean Sweep)                     UNKNOWN
17 Clean Sweep II (??/1976) (clone of Ramtek's Clean Sweep)                  UNKNOWN
18 Crashing Race (06/1976)                                                   UNKNOWN
19 Cross Fire (08/1977) (aka Bazooka)                                        UNKNOWN
20 Davis Cup (12/1973)                                                       UNKNOWN
21 Dead Heat (??/1975)                                                       UNKNOWN
22 Elepong (07/1973)                                                         UNKNOWN
23 Flying Fortress (??/1977)                                                 UNKNOWN
24 Flying Fortress II (06/1977)                                             UNKNOWN
25 Gunman (10/1977)                                                          YES        8 x 32bytes (or 11? )
26 Interceptor (03/1976)                                                     UNKNOWN
27 Missile-X (??/1977)                                                       YES        10 - (5 x 512bytes, 5x32bytes)
28 Pro Hockey (11/1973)                                                      UNKNOWN
29 Road Champion (04/1977)                                                   UNKNOWN
30 Road Champion S (06/1977)                                                 UNKNOWN
31 Soccer (11/1973)                                                          UNKNOWN
32 Soccer DX (??/1977)                                                       UNKNOWN
33 Speed Race (11/1974)                                                      UNKNOWN
34 Speed Race CL-5 (10/1978)                                                 UNKNOWN
35 Speed Race Color (10/1978)                                                UNKNOWN
36 Speed Race DX (08/1975)                                                   UNKNOWN
37 Speed Race Twin (04/1976)                                                 UNKNOWN
38 Speed Race GP-5 (??/1980)                                                 UNKNOWN
39 Super Block (02/1978)                                                     UNKNOWN
40 Super Speed Race (12/1977)                                                UNKNOWN
41 Super Speed Race V (07/1978)                                              UNKNOWN
42 Super Speed Race GP-V (??/1980)                                           UNKNOWN
43 Table Football (??/1977)                                                  UNKNOWN
44 Tahitian (??/1975)                                                        UNKNOWN
45 Tennis (??/1977)                                                          UNKNOWN
46 T. T. Block (08/1977)                                                     YES        1 x 2048bytes
47 T. T. Block C (05/1978)                                                   UNKNOWN
48 T. T. Block CU (08/1978)                                                  UNKNOWN
49 T. T. Speed Race (??/1978)                                                UNKNOWN
50 Wall Block (08/1978)                                                      UNKNOWN
51 Wall Break (01/1977)                                                      UNKNOWN
52 Western Gun (09/1975)                                                     UNKNOWN
53 Zun Zun Block (04/1979)                                                   YES        3 - (2 x 512bytes, 1 x 32bytes)
6 Game Name(s)                                  Part #'s     Data      PROM/ROM Chip Numbers
7 --------------------------------------------+-----------+---------+---------------------------------------
8 Acrobat (1978)                                            UNKNOWN
9 Astro Race (1973)                                         UNKNOWN
10 Avenger (1976) (clone of Electra's Avenger)               UNKNOWN
11 Attack (1976)                                             UNKNOWN
12 Attack UFO (1974)                                         UNKNOWN
13 Barricade II (1977)                                       UNKNOWN
14 Basketball (1974)                                         UNKNOWN
15 Cisco/Fisco 400 (1977)                                    UNKNOWN
16 Crashing Race (1976)                                      UNKNOWN
17 Cross Fire (1977) (aka Bazooka)                           UNKNOWN
18 Davis Cup (1973)                                          UNKNOWN
19 Elepong (1973)                                            UNKNOWN
20 Flying Fortress/Flying Fortress II (1977)                 UNKNOWN
21 Gunman (1977)                                             YES        8 x 32bytes (or 11? )
22 Interceptor (1976)                                        UNKNOWN
23 Missile-X (1977)                                          YES        10 - (5 x 512bytes, 5x32bytes)
24 Pro Hockey (1973)                                         UNKNOWN
25 Road Champion (1978)                                      UNKNOWN
26 Sky Fighter 2 (1970)                                      UNKNOWN
27 Soccer (1973)                                             UNKNOWN
28 Speed Race (1974)                                         UNKNOWN
29 Speed Race Twin (1976)                                    UNKNOWN
30 Speed Race GP-5 (1980)                                    UNKNOWN
31 Sub Hunter (1977)                                         UNKNOWN
32 Super Block (1978)                                        UNKNOWN
33 Super Speed Race 5 (1978)                                 UNKNOWN
34 Super Speed Race GP-V (1980)                              UNKNOWN
35 Top Bowler (1978)                                         UNKNOWN
36 T. T. Block (1977)                                        YES        1 x 2048bytes
37 Trampoline (1978)                                         UNKNOWN
38 Wall Block (1978)                                         UNKNOWN
39 Western Gun (1975)                                        UNKNOWN
40 Zun Zun Block (1979)                                      YES        3 - (2 x 512bytes, 1 x 32bytes)
5441
5542***************************************************************************/
5643
trunk/src/mame/includes/dynax.h
r243093r243094
44
55***************************************************************************/
66#include "machine/msm6242.h"
7#include "sound/2413intf.h"
87#include "sound/msm5205.h"
98#include "sound/okim6295.h"
109
r243093r243094
1312public:
1413   dynax_state(const machine_config &mconfig, device_type type, const char *tag)
1514      : driver_device(mconfig, type, tag),
15         m_dsw_sel16(*this, "dsw_sel16"),
16         m_protection1(*this, "protection1"),
17         m_protection2(*this, "protection2"),
1618         m_maincpu(*this, "maincpu"),
1719         m_soundcpu(*this, "soundcpu"),
18         m_ym2413(*this, "ym2413"),
1920         m_oki(*this, "oki"),
2021         m_msm(*this, "msm"),
2122         m_screen(*this, "screen"),
r243093r243094
2324         m_rtc(*this, "rtc")
2425      { }
2526
26   /* devices */
27   required_device<cpu_device> m_maincpu;
28   optional_device<cpu_device> m_soundcpu;
29   optional_device<ym2413_device> m_ym2413;
30   optional_device<okim6295_device> m_oki;
31   optional_device<msm5205_device> m_msm;
32   optional_device<screen_device> m_screen;
33   required_device<palette_device> m_palette;
34   optional_device<msm6242_device> m_rtc;
35
3627   // up to 8 layers, 2 images per layer (interleaved on screen)
3728   UINT8 *  m_pixmap[8][2];
29   UINT8 *  m_ddenlovr_pixmap[8];
3830
3931   /* irq */
4032   typedef void (dynax_state::*irq_func)();    // some games trigger IRQ at blitter end, some don't
r243093r243094
8476   const int *m_priority_table;
8577   int m_hanamai_priority;
8678
79   /* ddenlovr blitter (TODO: merge with the above, where possible) */
80   int m_extra_layers;
81   int m_ddenlovr_dest_layer;
82   int m_ddenlovr_blit_flip;
83   int m_ddenlovr_blit_x;
84   int m_ddenlovr_blit_y;
85   int m_ddenlovr_blit_address;
86   int m_ddenlovr_blit_pen;
87   int m_ddenlovr_blit_pen_mode;
88   int m_ddenlovr_blitter_irq_flag;
89   int m_ddenlovr_blitter_irq_enable;
90   int m_ddenlovr_rect_width;
91   int m_ddenlovr_rect_height;
92   int m_ddenlovr_clip_width;
93   int m_ddenlovr_clip_height;
94   int m_ddenlovr_line_length;
95   int m_ddenlovr_clip_ctrl;
96   int m_ddenlovr_clip_x;
97   int m_ddenlovr_clip_y;
98   int m_ddenlovr_scroll[8*2];
99   int m_ddenlovr_priority;
100   int m_ddenlovr_priority2;
101   int m_ddenlovr_bgcolor;
102   int m_ddenlovr_bgcolor2;
103   int m_ddenlovr_layer_enable;
104   int m_ddenlovr_layer_enable2;
105   int m_ddenlovr_palette_base[8];
106   int m_ddenlovr_palette_mask[8];
107   int m_ddenlovr_transparency_pen[8];
108   int m_ddenlovr_transparency_mask[8];
109   int m_ddenlovr_blit_latch;
110   int m_ddenlovr_blit_pen_mask;   // not implemented
111   int m_ddenlovr_blit_rom_bits;           // usually 8, 16 in hanakanz
112   const int *m_ddenlovr_blit_commands;
113   int m_ddenlovr_blit_regs[2];
114
87115   /* input */
88116   UINT8 m_input_sel;
89117   UINT8 m_dsw_sel;
r243093r243094
111139   UINT8 m_gekisha_rom_enable;
112140   UINT8 *m_romptr;
113141
142   /* ddenlovr misc (TODO: merge with the above, where possible) */
143   UINT8 m_palram[0x200];
144   int m_okibank;
145   UINT8 m_rongrong_blitter_busy_select;
146
147   optional_shared_ptr<UINT16> m_dsw_sel16;
148   optional_shared_ptr<UINT16> m_protection1;
149   optional_shared_ptr<UINT16> m_protection2;
150   UINT8 m_prot_val;
151   UINT16 m_prot_16;
152   UINT16 m_quiz365_protection[2];
153
154   UINT16 m_mmpanic_leds;  /* A led for each of the 9 buttons */
155   UINT8 m_funkyfig_lockout;
156   UINT8 m_romdata[2];
157   int m_palette_index;
158   UINT8 m_hginga_rombank;
159   UINT8 m_mjflove_irq_cause;
160   UINT8 m_daimyojn_palette_sel;
161
162   int m_irq_count;
163
164
165   /* devices */
166   required_device<cpu_device> m_maincpu;
167   optional_device<cpu_device> m_soundcpu;
168   device_t *m_ymsnd;
169   optional_device<okim6295_device> m_oki;
170   optional_device<msm5205_device> m_msm;
171   optional_device<screen_device> m_screen;
172   required_device<palette_device> m_palette;
173   optional_device<msm6242_device> m_rtc;
174   device_t *m_top_scr;
175   device_t *m_bot_scr;
114176   DECLARE_WRITE8_MEMBER(dynax_vblank_ack_w);
115177   DECLARE_WRITE8_MEMBER(dynax_blitter_ack_w);
116178   DECLARE_WRITE8_MEMBER(jantouki_vblank_ack_w);
r243093r243094
213275   DECLARE_WRITE8_MEMBER(jantouki_blitter2_rev2_w);
214276   DECLARE_WRITE8_MEMBER(hanamai_priority_w);
215277   DECLARE_WRITE8_MEMBER(tenkai_priority_w);
216   
217278   DECLARE_DRIVER_INIT(mjelct3);
218279   DECLARE_DRIVER_INIT(blktouch);
219280   DECLARE_DRIVER_INIT(mjelct3a);
220281   DECLARE_DRIVER_INIT(mjreach);
221282   DECLARE_DRIVER_INIT(maya);
222   
223283   UINT32 screen_update_hanamai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
224284   UINT32 screen_update_hnoridur(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
225285   UINT32 screen_update_sprtmtch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
226286   UINT32 screen_update_mjdialq2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
227287   UINT32 screen_update_jantouki_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
228288   UINT32 screen_update_jantouki_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
229   
230289   INTERRUPT_GEN_MEMBER(sprtmtch_vblank_interrupt);
231290   INTERRUPT_GEN_MEMBER(jantouki_vblank_interrupt);
232291   INTERRUPT_GEN_MEMBER(jantouki_sound_vblank_interrupt);
233292   INTERRUPT_GEN_MEMBER(yarunara_clock_interrupt);
234293   INTERRUPT_GEN_MEMBER(mjelctrn_vblank_interrupt);
235   
236294   TIMER_DEVICE_CALLBACK_MEMBER(neruton_irq_scanline);
237295   TIMER_DEVICE_CALLBACK_MEMBER(majxtal7_vblank_interrupt);
238296   TIMER_DEVICE_CALLBACK_MEMBER(tenkai_interrupt);
239   
240297   void tenkai_update_rombank();
241298   void gekisha_bank_postload();
242   
243299   DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback);
244300   DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback);
245301   DECLARE_WRITE_LINE_MEMBER(adpcm_int);
r243093r243094
268324   DECLARE_VIDEO_START(mcnpshnt);
269325   DECLARE_PALETTE_INIT(janyuki);
270326   DECLARE_VIDEO_START(neruton);
271   
272327   inline void blitter_plot_pixel( int layer, int mask, int x, int y, int pen, int wrap, int flags );
273328   int blitter_drawgfx( int layer, int mask, const char *gfx, int src, int pen, int x, int y, int wrap, int flags );
274329   void dynax_blitter_start( int flags );
trunk/src/mame/includes/model3.h
r243093r243094
231231   DECLARE_READ64_MEMBER(network_r);
232232   DECLARE_WRITE64_MEMBER(network_w);
233233   DECLARE_READ64_MEMBER(model3_security_r);
234   DECLARE_WRITE64_MEMBER(model3_security_w);
235
236
237234   DECLARE_WRITE64_MEMBER(daytona2_rombank_w);
238235   DECLARE_WRITE16_MEMBER(model3snd_ctrl);
239236   UINT32 pci_device_get_reg();
r243093r243094
246243   DECLARE_DRIVER_INIT(scudplus);
247244   DECLARE_DRIVER_INIT(model3_20);
248245   DECLARE_DRIVER_INIT(bass);
246   DECLARE_DRIVER_INIT(vs2v991);
249247   DECLARE_DRIVER_INIT(vs2);
250248   DECLARE_DRIVER_INIT(daytona2);
251249   DECLARE_DRIVER_INIT(eca);
r243093r243094
262260   DECLARE_DRIVER_INIT(getbass);
263261   DECLARE_DRIVER_INIT(scudplusa);
264262   DECLARE_DRIVER_INIT(dirtdvls);
263   DECLARE_DRIVER_INIT(vs299b);
265264   DECLARE_DRIVER_INIT(vf3);
266265   DECLARE_DRIVER_INIT(von2);
266   DECLARE_DRIVER_INIT(vs299a);
267267   DECLARE_DRIVER_INIT(lostwsga);
268268   DECLARE_DRIVER_INIT(oceanhun);
269269   DECLARE_DRIVER_INIT(dayto2pe);
trunk/src/mame/includes/stv.h
r243093r243094
701701      : saturn_state(mconfig, type, tag),
702702      m_adsp(*this, "adsp"),
703703      m_adsp_pram(*this, "adsp_pram"),
704      m_cryptdevice(*this, "315_5881")
704      m_cryptdevice(*this, "315_5881"),
705      m_using_crypt_device(0)
705706   {
706707   }
707708
r243093r243094
798799
799800   // protection specific variables and functions (see machine/stvprot.c)
800801   UINT32 m_abus_protenable;
802   UINT32 m_abus_prot_addr;
801803   UINT32 m_abus_protkey;
802804
803805   UINT32 m_a_bus[4];
806   UINT32 m_ctrl_index;
807   UINT32 m_internal_counter;
808   UINT8 m_char_offset; //helper to jump the decoding of the NULL chars.
804809
810   UINT32 (*m_prot_readback)(address_space&,int,UINT32);
811
805812   DECLARE_READ32_MEMBER( common_prot_r );
806813   DECLARE_WRITE32_MEMBER( common_prot_w );
807814
808815   void install_common_protection();
816
817   void install_twcup98_protection();
818   void install_sss_protection();
819   void install_astrass_protection();
820   void install_rsgun_protection();
821   void install_elandore_protection();
822   void install_ffreveng_protection();
823
809824   void stv_register_protection_savestates();
810825
811826   // Decathlete specific variables and functions (see machine/decathlt.c)
r243093r243094
825840
826841   optional_device<sega_315_5881_crypt_device> m_cryptdevice;
827842   UINT16 crypt_read_callback(UINT32 addr);
843   int m_using_crypt_device;
828844};
829845
830846
trunk/src/mame/machine/315-5881_crypt.c
r243093r243094
130130
131131The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher.
132132
133Every stream can be composed by several substreams; there are 18 header bits at the start of every substream, with
134a 1+9+8 format; the highest bit control the mode of operation: set to 1 means that the substream needs to be decompressed
135after being decrypted. The other two blocks (A||B) encode the length of the substream, as (A+1)*(B+1). When a
136substream end, the header of the next one, if existing, follows inmediatly.
133There are 2 "control bits" at the start of the decrypted stream which control the mode of operation: bit #1 set to 1 means
134that the stream needs to be decompressed after being decrypted. More on this later.
137135
138136The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been
139137conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests
r243093r243094
146144given plaintext word, and the remaining 2 to the next plaintext word.
147145
148146The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (16 bits),
149the game-key (>=29 bits; probably 64) and the sequence-key (16 bits) and output a middle result (16 bits) which will act
150as another key for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key
151and the result from the first FN and will output the decrypted word (16 bits).
147the game-key (>=29 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key
148for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key and the result
149from the first FN and will output the decrypted word (16 bits).
152150
153151Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input is the
154152XOR of at most one bit from the previous round and at most one bit from the different keys.
155153
156154The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and,
157155indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident,
158as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due).
156as you need to apply a bitswapping and some XORs to the input & output of the sboxes to get the same values due). However,
157the key scheduling used by this implementation is much weaker than the CPS-2's one. Many s-boxes inputs aren't XORed with any
158key bit.
159159
160Due to the small key-length, no sophisticated attacks are needed to recover the keys; a brute-force attack knowing just
161some (encrypted word-decrypted word) pairs suffice. However, due to the weak key scheduling, it should be noted that some
162related keys can produce the same output bytes for some (short) input sequences.
163
160164Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is
161165mapped to multiples of 128K.
162166
r243093r243094
169173as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the
170174decryption need those incomplete parts.
171175
172SEGA apparently used his security part label (317-xxxx-yyy) as part of the key; the mapping of the current keys to the chip label
173is given by the following function:
174
175void 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
188Given the use of the BCD-encoded security module labels, it's expected that at least other 6 additional bits be present in the
189real keys but undetected in the current implementation (due to them being set to fixed values on all the known 315-5881 chip labels).
190That would rise the bit count at least to 35.
191
192Other key bits not directly related to the 315-5881 label still show low entropies, making possible that
193they be derived from other non-random sources.
194
195In the second Feistel Network, every key bit seem to be used at most once (the various uses of current bit #9 are fictitious, as
196that bit really represent various bits in the real key; see comments on the use of the labels above). Given that, it seems probable
197that 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
198the bits provening from the game key, the sequence key and the result from the first feistel network (64+16+16=96). In the first
199Feistel Network, as only 80 bits are available, some bits would be used twice (as can be partially seen in the current implementation).
200The 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
201low-entropy sources.
202
203176****************************************************************************************/
204177
205178const sega_315_5881_crypt_device::sbox sega_315_5881_crypt_device::fn1_sboxes[4][4] = {
r243093r243094
261234
262235      {
263236         {
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,
266239         },
267         {1,2,5,6,7,6},
240         {1,2,5,6,7,-1},
268241         {2,7}
269242      },
270243
r243093r243094
368341
369342      {
370343         {
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,
373346         },
374         {0,3,5,6,5,0},
347         {0,3,5,6,-1,-1},
375348         {1,2}
376349      },
377350
r243093r243094
414387
415388      {
416389         {
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,
419392         },
420         {2,3,4,6,7,2},
393         {2,3,4,6,7,-1},
421394         {2,3}
422395      },
423396
r243093r243094
433406   {   // 3rd round
434407      {
435408         {
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,
438411         },
439         {1,4,5,6,7,5},
412         {1,4,5,6,7,-1},
440413         {0,5}
441414      },
442415
r243093r243094
451424
452425      {
453426         {
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,
455428            // unused?
456429            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,
457430         },
458         {1,2,4,7,2,-1},
431         {1,2,4,7,-1,-1},
459432         {2,4}
460433      },
461434
r243093r243094
508481};
509482
510483const 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}
516489};
517490
518491const 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}
523497};
524498
525499const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = {
r243093r243094
609583      }
610584   }
611585
586   // subkeys bits 10 & 41
587   fn2_subkeys[0] ^= (BIT(sequence_key, 2) << 10);
588   fn2_subkeys[1] ^= (BIT(sequence_key, 4) << 17);
612589   /**************************************************************/
613590
614591   // First Feistel Network
trunk/src/mame/machine/315-5881_crypt.h
r243093r243094
7474   static const sbox fn1_sboxes[4][4];
7575   static const sbox fn2_sboxes[4][4];
7676
77   static const int FN1GK = 38;
78   static const int FN2GK = 32;
77   static const int FN1GK = 39;
78   static const int FN2GK = 35;
7979   static const int fn1_game_key_scheduling[FN1GK][2];
8080   static const int fn2_game_key_scheduling[FN2GK][2];
8181   static const int fn1_sequence_key_scheduling[20][2];
trunk/src/mame/machine/315-5881_helper.c
r243093r243094
3131
3232static const struct game_keys keys_table[] =
3333{
34   // name              key              gameid #    year     chip label     platform
34   // name             key              gameid #     year     chip label     platform
3535   { "twcup98",         0x05200913 }, // 25209801    1998     317-5039-COM   ST-V
3636   { "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!)
3737   { "rsgun",           0x05272d01 }, //             1998     317-5041-COM   ST-V
r243093r243094
3939   { "elandore",        0x05226d41 }, //             1998     317-5043-COM   ST-V
4040   { "ffreveng",        0x0524ac01 }, //             1998     317-5049-COM   ST-V
4141
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
4248   { "dybbnao",         0x080e6ae1 }, // 840-0001    1998     317-0246-JPN   Naomi
4349   { "crzytaxi",        0x080d2f45 }, // 840-0002    1999     317-0248-COM   Naomi
4450   { "zombrvn",         0x08012b41 }, // 840-0003    1999     317-0249-COM   Naomi
r243093r243094
5056   { "tduno",           0x08028ea5 }, // 840-0008    1999     317-0255-JPN   Naomi
5157   { "toyfight",        0x0802ca85 }, // 840-0011    1999     317-0257-COM   Naomi
5258   { "vs2_2k",          0x08088b08 }, // 840-0010    1999     317-0258-COM   Naomi
53   { "smlg99",          0x08048a01 }, // 840-0012    1999     317-0259-COM   Naomi
5459   { "derbyoc",         0x080fee35 }, // 840-0016    1999     317-0262-JPN   Naomi
5560   { "vtennis",         0x0803eb15 }, // 840-0015    1999     317-0263-COM   Naomi
5661   { "jambo",           0x080fab95 }, // 840-0013    1999     317-0264-COM   Naomi
r243093r243094
6772   { "18wheelr",        0x0807cf54 }, // 840-0023    2000     317-0273-COM   Naomi
6873   { "18wheels",        0x0807cf54 }, // 840-0036    2000     317-0273-COM   Naomi
6974   { "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
7275   { "sstrkfgt",        0x08132303 }, // 840-0035    2000     317-0281-COM   Naomi
7376   { "sstrkfgta",       0x08132303 }, // 840-0035    2000     317-0281-COM   Naomi
7477   { "wwfroyal",        0x081627c3 }, // 840-0040    2000     317-0285-COM   Naomi
r243093r243094
8891   { "clubkrtd",        0x0ce7d742 }, // 840-0062    2001     317-0313-COM   Naomi 2
8992   { "clubkrte",        0x0ce7d742 }, // 840-0062    2001     317-0313-COM   Naomi 2
9093   { "inunoos",         0x094bc3e3 }, // 840-0073    2001     317-0316-JPN   Naomi
91   { "vf4cart",         0x0eef2f96 }, // 840-0080    2002     317-0324-COM   Naomi 2
9294   { "toukon4",         0x052e2901 }, // 25349801    2000     317-5040-COM   Naomi
9395   { "wldkicks",        0x052e2901 }, // 25209801    2000     317-5040-COM   Naomi
9496   { "wldkicksa",       0x052e2901 }, // 25209801    2000     317-5040-COM   Naomi
r243093r243094
99101   { "doa2m",           0x0008ad01 }, // 841-0003    1999     317-5048-COM   Naomi
100102   { "shangril",        -1         }, // 841-0004    1999     317-5050-JPN   Naomi     seems not used by game
101103   { "spawn",           0x00078d01 }, // 841-0005    1999     317-5051-COM   Naomi
102   { "puyoda",          0x000acd40 }, // 841-0006    1999     317-5052-COM   Naomi
103104   { "pstone2",         0x000b8dc0 }, // 841-0008    2000     317-5054-COM   Naomi
104105   { "capsnk",          0x00000000 }, // 841-0011    2000     317-5059-COM   Naomi
105106   { "capsnka",         0x00000000 }, // 841-0011    2000     317-5059-COM   Naomi
r243093r243094
113114   { "ninjaslt1",       0x000ca510 }, // 25469801    2000     317-5068-COM   Naomi
114115   { "ninjaslt2",       0x000ca510 }, // 25469801    2000     317-5068-COM   Naomi
115116   { "ninjaslt4",       0x000ca510 }, // 25469801    2000     317-5068-COM   Naomi
116   { "gundmct",         0x000e8010 }, // 841-0017    2001     317-5070-COM   Naomi
117117   { "hmgeo",           0x00038510 }, // HMG016007   2001     317-5071-COM   Naomi
118118   { "zerogu2",         0x0007c010 }, // 841-0020    2001     317-5073-COM   Naomi
119119   { "gunsur2",         0x000680d0 }, // 25709801    2001     317-5075-COM   Naomi
r243093r243094
128128   { "dynamcopb",       0x0c2a4a93 }, //             1998     317-0236-COM   Model 2
129129   { "dyndeka2b",       0x0c2a4a93 }, //             1998     317-0236-COM   Model 2
130130   { "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 
137137
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
141139   { "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
146140   { "swtrilgy",        0x11272a01 }, //             ????     317-0241-COM   Model 3
147141   { "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
151142   { "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
161145   { NULL, 0 }    // end of table
162146};
163147
trunk/src/mame/machine/stvprot.c
r243093r243094
1/* ST-V hookup for 315-5881 encryption/compression chip */
1/* ST-V protection stuff */
22
33/*
44
r243093r243094
1111 Steep Slope Sliders (gfx transfer of character portraits)
1212 Tecmo World Cup '98 (tecmo logo, player movement)
1313
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
1422*/
1523
24/****************************************************************************************
25
26Protection & cartridge handling
27
28*****************************************************************************************
29
30These are the known ST-V games that uses this area as a valid protection,I have written
31the 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=========================================================================================
77y = 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=========================================================================================
86Protection works as a sort of data transfer,it could also be that it uses
87encryption on the data used...
88
89For now I'm writing this function with a command basis so I can work better with it.
90****************************************************************************************/
91
1692#include "emu.h"
1793#include "includes/stv.h"
1894
95//FILE *fp;
96//FILE *fp2;
1997
2098
99/************************
100*
101* Tecmo World Cup '98
102*
103************************/
21104
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 */
22114
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/*
129ffreveng protection notes
130Global:
131R2 is the vector read (where to jump to)
132R3 is the vector pointer
133
134Directory listing for Final Fight Revenge (Saturn Version):
135
136In the ST-V version, most of these file names could be found at relative address 0x346a0 (0x22346a0)
137Also, there's a table at 0x260000 (0x2260000), this points to offsets to the ROM (and are sent to the protection device),
138and the size of it
139
140fad      size     file name   date
141000000aa 00003000  2000/2/8
142000000aa 00003000 ? 2000/2/8
143000000b0 00076080 0;1 2000/2/8
1440001799e 014b2000 ALY.RED;1 1999/11/9
14500002350 00001900 ALYHRAM.BIN;1 2000/2/8
1460000040e 00005204 ANDEND.BIN;1 1999/11/9
147000001a0 0000c700 ANDORE.BIN;1 2000/2/8
148000003c8 00016938 ANDORE.CRT;1 1999/11/9
149000001b9 000f3528 ANDOREM.BIN;1 2000/2/8
15000003525 012db000 ATN.RED;1 1999/11/9
151000024e6 00001900 ATNHRAM.BIN;1 2000/2/8
15200013291 0120d000 ATO.RED;1 1999/11/9
153000024a0 00001100 ATOHRAM.BIN;1 2000/2/8
15400000419 0000f000 BELGER.BIN;1 2000/2/8
155000005f0 00013bdc BELGER.CRT;1 1999/11/9
15600000437 000ce990 BELGERM.BIN;1 2000/2/8
15700002611 00000894 BURGR.BIN;1 2000/2/8
15800002605 00000638 CAFFE.BIN;1 2000/2/8
1590000273b 000022e0 CAPCOM.BIN;1 1999/11/9
16000001d9a 00012100 CAPHRAM.BIN;1 2000/2/8
16100000834 00004cec CDYEND.BIN;1 1999/11/9
1620000218a 00005900 CHSHRAM.BIN;1 2000/2/8
1630000061a 0000b900 CODY.BIN;1 2000/2/8
16400000809 00014e00 CODY.CRT;1 1999/11/9
16500002857 000ff412 CODYANIM.BIN;1 1999/11/9
16600002a56 00011dbc CODYAPAL.BIN;1 1999/11/9
16700000632 000d31cc CODYM.BIN;1 2000/2/8
16800002619 0000046c CURRY.BIN;1 2000/2/8
16900000b36 00005110 DAMEND.BIN;1 1999/11/9
1700000083e 0000b300 DAMND.BIN;1 2000/2/8
17100000aa6 000181ae DAMND.CRT;1 1999/11/9
17200000855 0010c674 DAMNDM.BIN;1 2000/2/8
17300000ad9 000063c0 DDAD.BIN;1 1999/11/9
17400000b2c 00004a30 DDBL.BIN;1 1999/11/9
17500000b25 000034b4 DDCD.BIN;1 1999/11/9
17600000ae6 00004c6c DDDM.BIN;1 1999/11/9
17700000b1c 00004660 DDED.BIN;1 1999/11/9
17800000b15 00003770 DDEL.BIN;1 1999/11/9
17900000b0e 00003268 DDGY.BIN;1 1999/11/9
18000000b06 00003c74 DDHG.BIN;1 1999/11/9
18100000b00 000029a8 DDPS.BIN;1 1999/11/9
18200000af9 000035e4 DDRL.BIN;1 1999/11/9
18300000af0 000044a8 DDSD.BIN;1 1999/11/9
1840000217a 00007d00 DEMHRAM.BIN;1 2000/2/8
1850000278e 00064396 DLOOP.CRT;1 1999/11/9
18600000b41 0000e200 EDDIE.BIN;1 2000/2/8
18700000d25 00019a44 EDDIE.CRT;1 1999/11/9
18800000b5e 000c7758 EDDIEM.BIN;1 2000/2/8
18900000d5a 00005204 EDIEND.BIN;1 1999/11/9
19000000d65 0000d700 ELGADO.BIN;1 2000/2/8
19100001010 00018b2e ELGADO.CRT;1 1999/11/9
19200000d80 0012ec64 ELGADOM.BIN;1 2000/2/8
19300001043 00005204 ELGEND.BIN;1 1999/11/9
19400001d79 0000e5ec ENDING.BIN;1 1999/11/9
19500002bc3 0002e8f4 ENDING.CRT;1 1999/11/9
1960000019e 0000005d FFEXABS.TXT;1 1999/11/9
1970000019f 00000060 FFEXBIB.TXT;1 1999/11/9
1980000019d 00000032 FFEXCPY.TXT;1 1999/11/9
19900002615 0000062c FRIES.BIN;1 2000/2/8
20000001ce1 0004b8b4 GAMEL.BIN;1 1999/11/9
201000003f6 000011fc GANDRE.BIN;1 1999/11/9
2020000040b 00001246 GBEL.BIN;1 1999/11/9
203000003f9 00000af3 GCODY.BIN;1 1999/11/9
204000003fb 00000cc4 GDAM.BIN;1 1999/11/9
205000003fd 00000f6a GEDDIE.BIN;1 1999/11/9
206000003ff 00000c85 GGADO.BIN;1 1999/11/9
20700000401 00000d4c GGUY.BIN;1 1999/11/9
20800000403 00000f16 GHAG.BIN;1 1999/11/9
20900000405 00000a63 GPOISON.BIN;1 1999/11/9
21000000407 00000a85 GROL.BIN;1 1999/11/9
21100005b71 01156000 GRV.RED;1 1999/11/9
2120000243b 00001600 GRVHRAM.BIN;1 2000/2/8
21300000409 00000dad GSODOM.BIN;1 1999/11/9
2140000104e 0000c300 GUY.BIN;1 2000/2/8
2150000123a 00014844 GUY.CRT;1 1999/11/9
21600001266 00005204 GUYEND.BIN;1 1999/11/9
21700001067 000d14aa GUYM.BIN;1 2000/2/8
21800001271 0000c600 HAGGAR.BIN;1 2000/2/8
21900001489 00017ad8 HAGGAR.CRT;1 1999/11/9
2200000128a 000e46fc HAGGARM.BIN;1 2000/2/8
221000014bb 00005204 HGREND.BIN;1 1999/11/9
22200002740 0001b468 HISCORE.BIN;1 1999/11/9
22300002777 00000a00 HISCP.BIN;1 1999/11/9
22400002779 000086c0 HISCTEX.BIN;1 1999/11/9
2250000278b 00001680 HSFACE_T.BIN;1 1999/11/9
22600002607 00000618 HTDOG.BIN;1 2000/2/8
22700015741 010e3800 JNK.RED;1 1999/11/9
228000023cd 00001900 JNKHRAM.BIN;1 2000/2/8
22900002d0b 0003dfc0 KANJI.FON;1 1999/11/9
23000001d98 00000d44 LOAD.BIN;1 1999/11/9
23100001dbf 001dd5a8 LOGO.CPK;1 1999/11/9
23200002d0a 00000400 LVLHRAM.BIN;1 2000/2/8
2330000260a 000005e8 MEAT.BIN;1 2000/2/8
23400007eb3 01253800 MLK.RED;1 1999/11/9
23500002196 00000d00 MLKHRAM.BIN;1 2000/2/8
2360000278a 00000400 NAMEP.BIN;1 1999/11/9
2370000a3f0 011b8000 NPK.RED;1 1999/11/9
238000022d0 00002700 NPKHRAM.BIN;1 2000/2/8
23900010dc0 0121d800 NUK.RED;1 1999/11/9
24000002555 00001100 NUKHRAM.BIN;1 2000/2/8
24100002c21 00036f94 OVER.CRT;1 1999/11/9
242000014c6 0000ab00 POISON.BIN;1 2000/2/8
243000017f1 00018880 POISON.CRT;1 1999/11/9
244000014dc 0017617c POISONM.BIN;1 2000/2/8
2450000c7f6 01166000 PRK.RED;1 1999/11/9
24600002268 00001100 PRKHRAM.BIN;1 2000/2/8
24700002a82 00003940 PSCBCHR.BIN;1 1999/11/9
24800002a8a 00002000 PSCBMAP.BIN;1 1999/11/9
24900002a92 00000ac0 PSCRTEX.BIN;1 1999/11/9
25000002a7b 000033c0 PSFCCHR.BIN;1 1999/11/9
25100001824 000049d4 PSNEND.BIN;1 1999/11/9
25200002a8e 00001e54 PSNMCHR.BIN;1 1999/11/9
25300002a94 000037c0 PSSBCHR.BIN;1 1999/11/9
25400002a9b 00002000 PSSBMAP.BIN;1 1999/11/9
25500002a9f 00000200 PSSBPAL.BIN;1 1999/11/9
25600002a7a 00000600 PS_PAL.BIN;1 1999/11/9
25700002c8f 0003d4c0 RESIDENT.CRT;1 1999/11/9
25800001c68 0003ae40 RESTEXT.BIN;1 1999/11/9
25900001cde 00001220 RESTEXTB.BIN;1 1999/11/9
26000001d97 00000200 RETIMEPA.BIN;1 1999/11/9
2610000261b 000004e8 REVNG.BIN;1 1999/11/9
26200001a5b 00005204 ROLEND.BIN;1 1999/11/9
2630000182e 0000e700 ROLENTO.BIN;1 2000/2/8
26400001a2d 00016bfc ROLENTO.CRT;1 1999/11/9
2650000184b 000d6bf0 ROLENTOM.BIN;1 2000/2/8
266000025c5 000062e4 SDDRVS.TSK;1 1999/11/9
26700002eb3 002ee000 SEGA_WRN.DA;1 1998/4/30
26800002b82 00020492 SELECT.CRT;1 1999/11/9
26900002aa0 00070e04 SODBTEX.BIN;1 1999/11/9
27000001c5d 00005154 SODEND.BIN;1 1999/11/9
27100001a66 0000b100 SODOM.BIN;1 2000/2/8
27200001c29 0001943a SODOM.CRT;1 1999/11/9
27300001a7d 000b9e2f SODOMM.BIN;1 2000/2/8
2740000260d 000004cc SUSHI.BIN;1 2000/2/8
2750000261c 0008f204 TITLE.BIN;1 1999/11/9
2760000eb58 010e9000 WHS.RED;1 1999/11/9
277000021ff 00001100 WHSHRAM.BIN;1 2000/2/8
278000003a0 00009b90 _ADCL00.BIN;1 1999/11/9
279000003b4 00009b90 _ADCL01.BIN;1 1999/11/9
280000023cb 00000c54 _ALYBMAP.BIN;1 1999/11/9
2810000239b 00017ec0 _ALYFCHR.BIN;1 1999/11/9
28200002399 00000c1a _ALYFMAP.BIN;1 1999/11/9
28300002354 00000600 _ALYPAL.BIN;1 1999/11/9
2840000235a 0001f400 _ALYRCHR.BIN;1 1999/11/9
28500002355 0000205c _ALYRMAP.BIN;1 1999/11/9
2860000252a 00015800 _ATNBCHR.BIN;1 1999/11/9
28700002526 00001882 _ATNBMAP.BIN;1 1999/11/9
28800002525 00000416 _ATNFMAP.BIN;1 1999/11/9
289000024ea 00000600 _ATNPAL.BIN;1 1999/11/9
290000024ef 0001af00 _ATNRCHR.BIN;1 1999/11/9
291000024eb 00001d10 _ATNRMAP.BIN;1 1999/11/9
292000024e3 000017fa _ATOBMAP.BIN;1 1999/11/9
293000024e2 00000040 _ATOFCHR.BIN;1 1999/11/9
294000024e1 00000006 _ATOFMAP.BIN;1 1999/11/9
295000024a3 00000600 _ATOPAL.BIN;1 1999/11/9
296000024a9 0001bbc0 _ATORCHR.BIN;1 1999/11/9
297000024a4 00002004 _ATORMAP.BIN;1 1999/11/9
29800000618 00000a20 _BGUNTX.BIN;1 1999/11/9
299000005d5 0000d688 _BLTXURE.BIN;1 1999/11/9
30000002613 00000a80 _BURGRTX.BIN;1 1999/11/9
30100002606 000006c0 _CAFFETX.BIN;1 1999/11/9
302000007d9 0000bdb0 _CDCL00.BIN;1 1999/11/9
303000007f1 0000bdb0 _CDCL01.BIN;1 1999/11/9
30400000ad7 000008a0 _CHSAWTX.BIN;1 1999/11/9
305000025e3 00003500 _CRAT2TX.BIN;1 1999/11/9
306000025ea 00002200 _CRAT3TX.BIN;1 1999/11/9
307000025d5 00003300 _CRATDTX.BIN;1 1999/11/9
308000025dc 00003300 _CRATNTX.BIN;1 1999/11/9
3090000261a 00000500 _CURRYTX.BIN;1 1999/11/9
31000000a6e 0000d918 _DMCL00.BIN;1 1999/11/9
31100000a8a 0000d918 _DMCL01.BIN;1 1999/11/9
312000025ef 00001b60 _DRUMTX.BIN;1 1999/11/9
31300000ced 0000da3c _EDCL00.BIN;1 1999/11/9
31400000d09 0000da3c _EDCL01.BIN;1 1999/11/9
31500000fde 0000c404 _ELCL00.BIN;1 1999/11/9
31600000ff7 0000c404 _ELCL01.BIN;1 1999/11/9
31700002616 000011a0 _FRIESTX.BIN;1 1999/11/9
31800001d96 00000660 _GFNTCHR.BIN;1 1999/11/9
31900001264 00000880 _GKATATX.BIN;1 1999/11/9
32000002488 0000bcc0 _GRVBCHR.BIN;1 1999/11/9
32100002486 00000d76 _GRVBMAP.BIN;1 1999/11/9
32200002483 000010fc _GRVFMAP.BIN;1 1999/11/9
3230000243e 00000600 _GRVPAL.BIN;1 1999/11/9
32400002444 0001f4c0 _GRVRCHR.BIN;1 1999/11/9
3250000243f 00002004 _GRVRMAP.BIN;1 1999/11/9
3260000120a 0000bf44 _GYCL00.BIN;1 1999/11/9
32700001222 0000bf44 _GYCL01.BIN;1 1999/11/9
32800001453 0000d614 _HGCL00.BIN;1 1999/11/9
3290000146e 0000d614 _HGCL01.BIN;1 1999/11/9
33000002608 00000880 _HTDOGTX.BIN;1 1999/11/9
331000025f3 00002b60 _ICEBTX.BIN;1 1999/11/9
33200001042 00000560 _JKNFTX.BIN;1 1999/11/9
33300002419 00010940 _JNKBCHR.BIN;1 1999/11/9
33400002417 00000982 _JNKBMAP.BIN;1 1999/11/9
33500002414 0000113a _JNKFMAP.BIN;1 1999/11/9
336000023d1 00000600 _JNKPAL.BIN;1 1999/11/9
337000023d6 0001ee80 _JNKRCHR.BIN;1 1999/11/9
338000023d2 00001bde _JNKRMAP.BIN;1 1999/11/9
339000025d4 000006c0 _KATA2TX.BIN;1 1999/11/9
34000001c5c 00000780 _KATANTX.BIN;1 1999/11/9
3410000260b 00000cc0 _MEATTX.BIN;1 1999/11/9
342000021dd 00010e80 _MLKBCHR.BIN;1 1999/11/9
343000021db 00000be6 _MLKBMAP.BIN;1 1999/11/9
344000021d9 00000f70 _MLKFMAP.BIN;1 1999/11/9
34500002198 00000600 _MLKPAL.BIN;1 1999/11/9
3460000219c 0001e440 _MLKRCHR.BIN;1 1999/11/9
34700002199 000013de _MLKRMAP.BIN;1 1999/11/9
3480000234d 00001416 _NPKBMAP.BIN;1 1999/11/9
3490000231d 00017dc0 _NPKFCHR.BIN;1 1999/11/9
3500000231a 00001406 _NPKFMAP.BIN;1 1999/11/9
351000022d5 00000600 _NPKPAL.BIN;1 1999/11/9
352000022db 0001f640 _NPKRCHR.BIN;1 1999/11/9
353000022d6 00002202 _NPKRMAP.BIN;1 1999/11/9
3540000259a 000153c0 _NUKBCHR.BIN;1 1999/11/9
35500002596 00001924 _NUKBMAP.BIN;1 1999/11/9
35600002594 00000f6e _NUKFMAP.BIN;1 1999/11/9
35700002558 00000600 _NUKPAL.BIN;1 1999/11/9
3580000255e 0001adc0 _NUKRCHR.BIN;1 1999/11/9
35900002559 00002004 _NUKRMAP.BIN;1 1999/11/9
360000025d3 000005a0 _NYOIBTX.BIN;1 1999/11/9
361000025f9 000039e0 _OILCTX.BIN;1 1999/11/9
362000014b9 00000b40 _PIPETX.BIN;1 1999/11/9
36300001823 00000600 _POISNTX.BIN;1 1999/11/9
364000022cc 000018fc _PRKBMAP.BIN;1 1999/11/9
365000022ac 0000fd00 _PRKFCHR.BIN;1 1999/11/9
366000022a8 00001d4a _PRKFMAP.BIN;1 1999/11/9
3670000226b 00000600 _PRKPAL.BIN;1 1999/11/9
36800002271 0001b0c0 _PRKRCHR.BIN;1 1999/11/9
3690000226c 00002202 _PRKRMAP.BIN;1 1999/11/9
370000017c9 00009874 _PSCL00.BIN;1 1999/11/9
371000017dd 00009874 _PSCL01.BIN;1 1999/11/9
37200000d59 00000180 _PSTKTX.BIN;1 1999/11/9
373000019f9 0000cb2c _RLCL00.BIN;1 1999/11/9
37400001a13 0000cb2c _RLCL01.BIN;1 1999/11/9
37500001bf1 0000dd0c _SDCL00.BIN;1 1999/11/9
37600001c0d 0000dd0c _SDCL01.BIN;1 1999/11/9
37700000833 00000660 _SKNFTX.BIN;1 1999/11/9
378000025d2 00000240 _SPIKETX.BIN;1 1999/11/9
3790000260e 000011e0 _SUSHITX.BIN;1 1999/11/9
38000002601 00001ba0 _TOMBTX.BIN;1 1999/11/9
3810000224b 0000e2c0 _WHSBCHR.BIN;1 1999/11/9
38200002249 00000a36 _WHSBMAP.BIN;1 1999/11/9
38300002245 00001bb8 _WHSFMAP.BIN;1 1999/11/9
38400002202 00000600 _WHSPAL.BIN;1 1999/11/9
38500002207 0001efc0 _WHSRCHR.BIN;1 1999/11/9
38600002203 00001cf4 _WHSRMAP.BIN;1 1999/11/9
387*/
388
389
390
391
392
393
394
395UINT32 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
420UINT32 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
453UINT32 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
501UINT32 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
526UINT32 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
23553/*************************************
24554*
25555* Common Handlers
26556*
27557*************************************/
28558
559// the naomi hookup of 315-5881 reads 16-bits at a time, here we seem to read 32?
560
29561READ32_MEMBER( stv_state::common_prot_r )
30562{
31563   UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base();
r243093r243094
34566   {
35567      if(offset == 3)
36568      {
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);
42590           
43         return res2 | (res << 16);         
591            return res2 | (res << 16);
592         }
593         
44594      }
45595      return m_a_bus[offset];
46596   }
r243093r243094
61611WRITE32_MEMBER ( stv_state::common_prot_w )
62612{
63613   COMBINE_DATA(&m_a_bus[offset]);
614   //printf("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data);
64615
65616   if (offset == 0)
66617   {
r243093r243094
68619   }
69620   else if(offset == 2)
70621   {
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);
73623
624      m_cryptdevice->set_addr_low(m_abus_prot_addr >> 16);
625      m_cryptdevice->set_addr_high(m_abus_prot_addr&0xffff);
626
74627   }
75628   else if(offset == 3)
76629   {
77630      COMBINE_DATA(&m_abus_protkey);
78631
79632      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;
80670   }
81671}
82672
r243093r243094
85675   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));
86676
87677   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
89686}
90687
688void stv_state::install_sss_protection()
689{
690   install_common_protection();
691   m_prot_readback = sss_prot_read_callback;
692}
693
694void stv_state::install_astrass_protection()
695{
696   install_common_protection();
697}
698
699void stv_state::install_ffreveng_protection()
700{
701   install_common_protection();
702   m_prot_readback = ffreveng_prot_read_callback;
703}
704
705void stv_state::install_elandore_protection()
706{
707   install_common_protection();
708   m_prot_readback = elandore_prot_read_callback;
709}
710
711void stv_state::install_rsgun_protection()
712{
713   install_common_protection();
714   m_prot_readback = rsgun_prot_read_callback;
715}
716
717void stv_state::install_twcup98_protection()
718{
719   install_common_protection();
720   m_prot_readback = twcup98_prot_read_callback;
721}
722
723
91724void stv_state::stv_register_protection_savestates()
92725{
93726   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));
94730}
trunk/src/mame/mame.lst
r243093r243094
3114231142orbitor1
3114331143quicksil
3114431144seawitch
31145spltsecp
31145splitsec
3114631146stargzr
3114731147viperp
3114831148gamatron
trunk/src/mame/video/taitoair.c
r243093r243094
229229         int xx1 = x1 >> TAITOAIR_FRAC_SHIFT;
230230         int xx2 = x2 >> TAITOAIR_FRAC_SHIFT;
231231         int grad_col;
232         int base_color;
233         
232
234233         if (xx1 <= cliprect.max_x || xx2 >= cliprect.min_x)
235234         {
236235            if (xx1 < cliprect.min_x)
237236               xx1 = cliprect.min_x;
238237            if (xx2 > cliprect.max_x)
239238               xx2 = cliprect.max_x;
240           
241            if(color & 0x40)
242            {
243               /* Non-terrain elements are colored with this. */
244               base_color = (color & 0x3f) + 0x340;
245               grad_col = 0;
246            }
247            else
248            {
249               /* Terrain elements, with a gradient applied. */
250               /* TODO: it's unknown if gradient color applies by global screen Y coordinate or there's a calculation to somewhere ... */
251               base_color = ((color & 0x3f) * 0x80) + 0x2040;
252               grad_col = (y1 >> 3) & 0x3f;
253            }
254239
240            /* TODO: it's unknown if gradient color applies by global screen Y coordinate or there's a calculation to somewhere ... */
241            grad_col = (y1 >> 3) & 0x3f;
242
255243            while (xx1 <= xx2)
256244            {
257               bitmap.pix16(y1, xx1) = base_color + grad_col;
245               bitmap.pix16(y1, xx1) = color + grad_col;
258246               xx1++;
259247            }
260248         }
r243093r243094
405393                  logerror("quad: unknown value %04x at %04x\n", m_line_ram[adr], adr);
406394                  break;
407395               }
408               m_q.col = m_line_ram[adr] & 0x7f;//((m_line_ram[adr] & 0x007f) * 0x80) + 0x2040;
409
396               m_q.col = ((m_line_ram[adr] & 0x007f) * 0x80) + 0x2040;
410397               adr--;
411398               pcount = 0;
412399               while (pcount < TAITOAIR_POLY_MAX_PT && adr >= 1 && !(m_line_ram[adr] & 0xc000))
trunk/src/osd/modules/font/font_module.h
r0r243094
1/*
2 * font_module.h
3 *
4 */
5
6#ifndef FONT_MODULE_H_
7#define FONT_MODULE_H_
8
9#include "osdepend.h"
10#include "modules/osdmodule.h"
11
12//============================================================
13//  CONSTANTS
14//============================================================
15
16#define OSD_FONT_PROVIDER   "uifontprovider"
17
18class font_module
19{
20public:
21    virtual ~font_module() { }
22    virtual osd_font *font_alloc() = 0;
23};
24
25
26#endif /* FONT_MODULE_H_ */
trunk/src/osd/modules/font/font_none.c
r243093r243094
33 *
44 */
55
6#include "osdepend.h"
6#include "font_module.h"
7#include "modules/osdmodule.h"
78
89#include "astring.h"
910#include "corealloc.h"
r243093r243094
2526private:
2627};
2728
28osd_font *osd_font_alloc()
29{
30    return global_alloc(osd_font_none);
31}
32
3329bool osd_font_none::open(const char *font_path, const char *_name, int &height)
3430{
3531    return false;
r243093r243094
5652{
5753    return false;
5854}
55
56class font_none : public osd_module, public font_module
57{
58public:
59    font_none()
60    : osd_module(OSD_FONT_PROVIDER, "none"), font_module()
61    {
62    }
63
64    osd_font *font_alloc()
65    {
66        return global_alloc(osd_font_none);
67    }
68};
69
70MODULE_DEFINITION(FONT_NONE, font_none)
71
trunk/src/osd/modules/font/font_osx.c
r243093r243094
33 *
44 */
55
6#include "font_module.h"
7#include "modules/osdmodule.h"
8
9#ifdef SDLMAME_MACOSX
10
611#include <Carbon/Carbon.h>
712
8#include "osdepend.h"
9
1013#include "astring.h"
1114#include "corealloc.h"
1215#include "fileio.h"
r243093r243094
3235    CTFontRef m_font;
3336};
3437
35osd_font *osd_font_alloc()
36{
37    return global_alloc(osd_font_osx);
38}
39
4038bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
4139{
4240    CFStringRef font_name = NULL;
r243093r243094
183181    return bitmap.valid();
184182}
185183
184
185class font_osx : public osd_module, public font_module
186{
187public:
188    font_osx()
189    : osd_module(OSD_FONT_PROVIDER, "osx"), font_module()
190    {
191    }
192
193    osd_font *font_alloc()
194    {
195        return global_alloc(osd_font_osx);
196    }
197
198};
199#else /* SDLMAME_UNIX */
200    MODULE_NOT_SUPPORTED(font_osx, OSD_FONT_PROVIDER, "osx")
201#endif
202
203MODULE_DEFINITION(FONT_OSX, font_osx)
trunk/src/osd/modules/font/font_sdl.c
r0r243094
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
32class osd_font_sdl : public osd_font
33{
34public:
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);
40private:
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
49bool 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
131void 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
144bool 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
187TTF_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
201bool 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
218TTF_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
328class font_sdl : public osd_module, public font_module
329{
330public:
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
358MODULE_DEFINITION(FONT_SDL, font_sdl)
359
360
trunk/src/osd/modules/font/font_unix.c
r243093r243094
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
28class osd_font_unix : public osd_font
29{
30public:
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);
36private:
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
45osd_font *osd_font_alloc()
46{
47    return global_alloc(osd_font_unix);
48}
49
50bool 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
132void 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
145bool 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
188TTF_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
202bool 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
219TTF_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
trunk/src/osd/modules/font/font_windows.c
r243093r243094
33 *
44 */
55
6#include "font_module.h"
7#include "modules/osdmodule.h"
8
9#if defined(OSD_WINDOWS) || defined(SDLMAME_WIN32)
10
611#define WIN32_LEAN_AND_MEAN
712#include <windows.h>
813#include <commctrl.h>
r243093r243094
1015#include <tchar.h>
1116#include <io.h>
1217
13#include "osdepend.h"
18#include "font_module.h"
19#include "modules/osdmodule.h"
1420
1521#include "strconv.h"
1622#include "astring.h"
r243093r243094
7884    HGDIOBJ m_font;
7985};
8086
81osd_font *osd_font_alloc()
82{
83    return global_alloc(osd_font_windows);
84}
85
8687bool osd_font_windows::open(const char *font_path, const char *_name, int &height)
8788{
8889    // accept qualifiers from the name
r243093r243094
298299    return bitmap.valid();
299300}
300301
302class font_win : public osd_module, public font_module
303{
304public:
305    font_win()
306    : osd_module(OSD_FONT_PROVIDER, "win"), font_module()
307    {
308    }
309
310    osd_font *font_alloc()
311    {
312        return global_alloc(osd_font_windows);
313    }
314
315};
316#else /* SDLMAME_UNIX */
317    MODULE_NOT_SUPPORTED(font_win, OSD_FONT_PROVIDER, "win")
318#endif
319
320MODULE_DEFINITION(FONT_WINDOWS, font_win)
trunk/src/osd/modules/lib/osdobj_common.c
r243093r243094
2020
2121const options_entry osd_options::s_option_entries[] =
2222{
23    { NULL,                                   NULL,       OPTION_HEADER,     "OSD FONT OPTIONS" },
24    { OSD_FONT_PROVIDER,                      "auto",     OPTION_STRING,     "provider for ui font: " },
25
2326    { NULL,                                   NULL,       OPTION_HEADER,     "OSD CLI OPTIONS" },
2427    { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist",  "0",        OPTION_COMMAND,    "list available MIDI I/O devices" },
2528    { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0",     OPTION_COMMAND,    "list available network adapters" },
r243093r243094
106109{
107110}
108111
112#define REGISTER_MODULE(_O, _X ) { extern const module_type _X; _O . register_module( _X ); }
109113
110114void osd_common_t::register_options()
111115{
116
117    REGISTER_MODULE(m_mod_man, FONT_OSX);
118    REGISTER_MODULE(m_mod_man, FONT_WINDOWS);
119    REGISTER_MODULE(m_mod_man, FONT_SDL);
120    REGISTER_MODULE(m_mod_man, FONT_NONE);
121
122    // after initialization we know which modules are supported
123
124    const char *names[20];
125    int num;
126    m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names);
127    dynamic_array<const char *> dnames;
128    for (int i = 0; i < num; i++)
129        dnames.append(names[i]);
130    update_option(OSD_FONT_PROVIDER, dnames);
131
132
133
134
135
112136    // Register video options and update options
113137    video_options_add("none", NULL);
114138    video_register();
r243093r243094
209233   if (options.verbose())
210234      g_print_verbose = true;
211235
236    m_font_module = select_module_options<font_module *>(options, OSD_FONT_PROVIDER);
237
238    m_mod_man.init();
239
240
212241   // ensure we get called on the way out
213242   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_common_t::osd_exit), this));
214243}
r243093r243094
539568
540569void osd_common_t::osd_exit()
541570{
542   exit_subsystems();
571    m_mod_man.exit();
572
573    exit_subsystems();
543574}
544575
545576void osd_common_t::video_options_add(const char *name, void *type)
trunk/src/osd/modules/lib/osdobj_common.h
r243093r243094
1414#define __OSDOBJ_COMMON__
1515
1616#include "osdepend.h"
17#include "modules/osdmodule.h"
18#include "modules/font/font_module.h"
1719#include "cliopts.h"
1820
1921//============================================================
r243093r243094
5557//  TYPE DEFINITIONS
5658//============================================================
5759
58/* FIXME: core_options inherits from osd_options. This will force any
59 * future osd implementation to use the options below. Actually, these
60 * options are *private* to the osd_core. This object should actually be an
61 * accessor object. Later ...
62 */
63
64/* FIXME: core_options inherits from osd_options. This will force any
65 * future osd implementation to use the options below. Actually, these
66 * options are *private* to the osd_core. This object should actually be an
67 * accessor object. Later ...
68 */
69
7060class osd_options : public cli_options
7161{
7262public:
r243093r243094
163153    // command option overrides
164154    virtual bool execute_command(const char *command);
165155
156    osd_font *font_alloc() { return m_font_module->font_alloc(); }
157
166158   // FIXME: everything below seems to be osd specific and not part of
167159   //        this INTERFACE but part of the osd IMPLEMENTATION
168160
r243093r243094
214206   running_machine *   m_machine;
215207   osd_options& m_options;
216208
209    osd_module_manager m_mod_man;
210    font_module *m_font_module;
211
217212   void update_option(const char * key, dynamic_array<const char *> &values);
213    // FIXME: should be elsewhere
214    osd_module *select_module_options(const core_options &opts, const astring &opt_name)
215    {
216        astring opt_val = opts.value(opt_name);
217        if (opt_val == "auto")
218            opt_val = "";
219        else if (!m_mod_man.type_has_name(opt_name, opt_val))
220        {
221            osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.cstr(), opt_name.cstr());
222            opt_val = "";
223        }
224        return m_mod_man.select_module(opt_name, opt_val);
225    }
218226
227    template<class C>
228    C select_module_options(const core_options &opts, const astring &opt_name)
229    {
230        return dynamic_cast<C>(select_module_options(opts, opt_name));
231    }
232
219233protected:
220234   osd_sound_interface* m_sound;
221235   osd_debugger_interface* m_debugger;
trunk/src/osd/modules/osdmodule.c
r0r243094
1/*
2 * osdmodule.c
3 *
4 */
5
6#include "modules/osdmodule.h"
7
8osd_module_manager::osd_module_manager()
9{
10    for (int i=0; i<MAX_MODULES; i++)
11    {
12        m_modules[i]  = NULL;
13        m_selected[i] = NULL;
14    }
15}
16osd_module_manager::~osd_module_manager()
17{
18    for (int i = 0; m_modules[i] != NULL; i++)
19    {
20        m_modules[i]->~osd_module();
21        osd_free(m_modules[i]);
22    }
23}
24
25void osd_module_manager::register_module(const module_type &mod_type)
26{
27    osd_module *module = mod_type();
28    if (module->probe())
29    {
30        osd_printf_info("===> registered module %s %s\n", module->name(), module->type());
31
32        int i;
33        for (i = 0; m_modules[i] != NULL; i++)
34            ;
35        m_modules[i] = module;
36    }
37    else
38    {
39        osd_printf_info("===> not supported %s %s\n", module->name(), module->type());
40        module->~osd_module();
41        osd_free(module);
42    }
43}
44
45bool osd_module_manager::type_has_name(const char *type, const char *name)
46{
47    return (get_module_index(type, name) >= 0);
48}
49
50osd_module *osd_module_manager::get_module_generic(const char *type, const char *name)
51{
52    int i = get_module_index(type, name);
53    if (i>=0)
54        return m_modules[i];
55    else
56        return NULL;
57}
58
59osd_module *osd_module_manager::select_module(const char *type, const char *name)
60{
61    osd_module *m = get_module_generic(type, name);
62
63    // FIXME: check if already exists!
64    int i;
65    for (i = 0; m_selected[i] != NULL; i++)
66        ;
67    m_selected[i] = m;
68    return m;
69}
70
71void osd_module_manager::init()
72{
73    for (int i = 0; m_selected[i] != NULL; i++)
74    {
75        m_selected[i]->init();
76    }
77}
78
79void osd_module_manager::exit()
80{
81    // Find count
82    int cnt;
83    for (cnt = 0; m_selected[cnt] != NULL; cnt++)
84        ;
85    for (int i = cnt - 1; i >= 0; i--)
86    {
87        m_selected[i]->exit();
88        m_selected[i] = NULL;
89    }
90}
91
92int osd_module_manager::get_module_index(const char *type, const char *name)
93{
94    for (int i = 0; m_modules[i] != NULL; i++)
95    {
96        if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0)))
97            return i;
98    }
99    return -1;
100}
101
102void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[])
103{
104    *num = 0;
105    for (int i = 0; m_modules[i] != NULL; i++)
106    {
107        if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max))
108        {
109            names[*num] = m_modules[i]->name();
110            *num = *num + 1;
111        }
112
113    }
114}
115
116
trunk/src/osd/modules/osdmodule.h
r0r243094
1/***************************************************************************
2
3    osdmodule.h
4
5    OSD module manangement
6
7*******************************************************************c********/
8
9//#pragma once
10
11#ifndef __OSDMODULE_H__
12#define __OSDMODULE_H__
13
14#include "osdcore.h"
15#include "osdepend.h"
16
17//============================================================
18//  TYPE DEFINITIONS
19//============================================================
20
21class osd_module;
22
23// ======================> osd_module
24
25class osd_module
26{
27public:
28
29    osd_module(const char *type, const char *name)
30    : m_name(name), m_type(type)
31    {}
32    virtual ~osd_module() { }
33
34    const char * name() const { return m_name; }
35    const char * type() const { return m_type; }
36
37    virtual bool probe() const { return true; }
38
39    virtual void init() {  }
40    virtual void exit() {  }
41
42private:
43    astring     m_name;
44    astring     m_type;
45};
46
47// a module_type is simply a pointer to its alloc function
48typedef osd_module *(*module_type)();
49
50// this template function creates a stub which constructs a module
51template<class _ModuleClass>
52osd_module *module_creator()
53{
54    void *p = osd_malloc(sizeof(_ModuleClass));
55    return new(p) _ModuleClass;
56}
57
58class osd_module_manager
59{
60public:
61
62    static const int MAX_MODULES = 32;
63
64    osd_module_manager();
65    ~osd_module_manager();
66
67    void register_module(const module_type &mod_type);
68    bool type_has_name(const char *type, const char *name);
69
70    osd_module *get_module_generic(const char *type, const char *name);
71
72    template<class C>
73    C select_module(const char *type, const char *name = "")
74    {
75        return dynamic_cast<C>(select_module(type, name));
76    }
77
78    osd_module *select_module(const char *type, const char *name = "");
79
80    void get_module_names(const char *type, const int max, int *num, const char *names[]);
81
82    void init();
83
84    void exit();
85
86private:
87    int get_module_index(const char *type, const char *name);
88
89    osd_module *m_modules[MAX_MODULES];
90    osd_module *m_selected[MAX_MODULES];
91};
92
93#define MODULE_DEFINITION(_id, _class) \
94    extern const module_type _id ;  \
95    const module_type _id = &module_creator< _class >;
96
97
98#define MODULE_NOT_SUPPORTED(_mod, _type, _name) \
99    class _mod : public osd_module { \
100    public: \
101        _mod () \
102        : osd_module(_type, _name) {} \
103        bool probe() const { return false; } \
104    };
105
106#endif  /* __OSDMODULE_H__ */
trunk/src/osd/osdepend.h
r243093r243094
1818#include "unicode.h"
1919#include "cliopts.h"
2020
21
2122// forward references
2223class input_type_entry;     // FIXME: including emu.h does not work because emu.h includes osdepend.h
2324
r243093r243094
4041
4142// ======================> osd_interface
4243
43/* FIXME: this should be replaced by a proper module implementation
44 * For the time being only one font provider can be linked
45 */
46
47osd_font *osd_font_alloc();
48
4944// description of the currently-running machine
5045class osd_interface
5146{
r243093r243094
7166   virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
7267
7368   // font interface
69   virtual osd_font *font_alloc() = 0;
7470
75   // font is allocated with global_alloc; therefore use global_free!
76   osd_font *font_alloc() { return osd_font_alloc(); }
77
7871   // command option overrides
7972   virtual bool execute_command(const char *command) = 0;
8073
trunk/src/osd/sdl/main.c
r243093r243094
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
13//============================================================
24//
35//  main.c - Win32 main program
r243093r243094
24//
3//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
4//  Visit http://mamedev.org for licensing and usage restrictions.
5//
6//  SDLMAME by Olivier Galibert and R. Belmont
7//
85//============================================================
96
107// standard windows headers
8#ifdef OSD_SDL
119#define _WIN32_WINNT 0x0400
10#endif
1211#define WIN32_LEAN_AND_MEAN
r243093r243094
3837   int i, rc;
3938   char **utf8_argv;
4039
40#ifdef OSD_SDL
4141#ifdef MALLOC_DEBUG
4242{
4343   extern int winalloc_in_main_code;
4444   winalloc_in_main_code = TRUE;
4545#endif
46#endif
4647
4748   /* convert arguments to UTF-8 */
4849   utf8_argv = (char **) malloc(argc * sizeof(*argv));
r243093r243094
6364      osd_free(utf8_argv[i]);
6465   free(utf8_argv);
6566
67#ifdef OSD_SDL
6668#ifdef MALLOC_DEBUG
6769   {
6870      void check_unfreed_mem(void);
r243093r243094
7173   winalloc_in_main_code = FALSE;
7274}
7375#endif
76#endif
7477
7578   return rc;
7679}
trunk/src/osd/sdl/osdsdl.h
r243093r243094
77#include "clifront.h"
88#include "modules/lib/osdobj_common.h"
99#include "video.h"
10#include "modules/osdmodule.h"
11#include "modules/font/font_module.h"
1012
1113//============================================================
1214//  System dependent defines
r243093r243094
220222   // FIXME: remove machine usage
221223   void extract_video_config(running_machine &machine);
222224
223
224225    sdl_options &m_options;
225226
226227   watchdog *m_watchdog;
trunk/src/osd/sdl/sdl.mak
r243093r243094
204204ifeq ($(TARGETOS),unix)
205205BASE_TARGETOS = unix
206206SYNC_IMPLEMENTATION = tc
207FONT_IMPLEMENTATION = unix
207FONT_IMPLEMENTATION = sdl
208208endif
209209
210210ifeq ($(TARGETOS),linux)
211211BASE_TARGETOS = unix
212212SYNC_IMPLEMENTATION = tc
213213SDL_NETWORK = taptun
214FONT_IMPLEMENTATION = unix
214FONT_IMPLEMENTATION = sdl
215215
216216ifndef NO_USE_MIDI
217217INCPATH += `pkg-config --cflags alsa`
r243093r243094
223223ifeq ($(TARGETOS),freebsd)
224224BASE_TARGETOS = unix
225225SYNC_IMPLEMENTATION = tc
226FONT_IMPLEMENTATION = unix
226FONT_IMPLEMENTATION = sdl
227227DEFS += -DNO_AFFINITY_NP
228228LIBS += -lutil
229229# /usr/local/include is not considered a system include directory
r243093r243094
235235ifeq ($(TARGETOS),openbsd)
236236BASE_TARGETOS = unix
237237SYNC_IMPLEMENTATION = ntc
238FONT_IMPLEMENTATION = unix
238FONT_IMPLEMENTATION = sdl
239239LIBS += -lutil
240240NO_USE_MIDI = 1
241241endif
r243093r243094
243243ifeq ($(TARGETOS),netbsd)
244244BASE_TARGETOS = unix
245245SYNC_IMPLEMENTATION = ntc
246FONT_IMPLEMENTATION = unix
246FONT_IMPLEMENTATION = sdl
247247LIBS += -lutil
248248NO_USE_MIDI = 1
249249endif
r243093r243094
252252BASE_TARGETOS = unix
253253DEFS += -DNO_AFFINITY_NP -UHAVE_VSNPRINTF -DNO_vsnprintf
254254SYNC_IMPLEMENTATION = tc
255FONT_IMPLEMENTATION = unix
255FONT_IMPLEMENTATION = sdl
256256NO_USE_MIDI = 1
257257endif
258258
259259ifeq ($(TARGETOS),haiku)
260260BASE_TARGETOS = unix
261261SYNC_IMPLEMENTATION = ntc
262FONT_IMPLEMENTATION = unix
262FONT_IMPLEMENTATION = sdl
263263NO_X11 = 1
264264NO_USE_XINPUT = 1
265265NO_USE_MIDI = 1
r243093r243094
430430   $(SDLOBJ)/sdlos_$(SDLOS_TARGETOS).o \
431431   $(OSDOBJ)/modules/lib/osdlib_$(SDLOS_TARGETOS).o \
432432   $(OSDOBJ)/modules/sync/sync_$(SYNC_IMPLEMENTATION).o \
433   $(OSDOBJ)/modules/font/font_$(FONT_IMPLEMENTATION).o \
433   $(OSDOBJ)/modules/osdmodule.o \
434434
435435ifdef NOASM
436436OSDCOREOBJS += $(OSDOBJ)/modules/sync/work_mini.o
r243093r243094
451451   $(SDLOBJ)/output.o \
452452   $(SDLOBJ)/watchdog.o \
453453   $(OSDOBJ)/modules/lib/osdobj_common.o  \
454   $(OSDOBJ)/modules/font/font_sdl.o \
455   $(OSDOBJ)/modules/font/font_windows.o \
456   $(OSDOBJ)/modules/font/font_osx.o \
457   $(OSDOBJ)/modules/font/font_none.o \
454458
455459ifdef NO_USE_MIDI
456460   OSDOBJS += $(OSDOBJ)/modules/midi/none.o
trunk/src/osd/sdl/sdlmain.c
r243093r243094
1212
1313#ifdef SDLMAME_UNIX
1414#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN))
15#if (SDLMAME_SDL2)
16#include <SDL2/SDL_ttf.h>
17#else
18#include <SDL/SDL_ttf.h>
19#endif
2015#ifndef SDLMAME_HAIKU
2116#include <fontconfig/fontconfig.h>
2217#endif
r243093r243094
6156#include "input.h"
6257#include "osdsdl.h"
6358#include "modules/lib/osdlib.h"
59
6460#include "modules/sound/sdl_sound.h"
61
6562#if defined(SDLMAME_EMSCRIPTEN)
6663#include "modules/sound/js_sound.h"
6764#endif
r243093r243094
269266   set_default_value(SDLOPTION_INIPATH, ini_path.cstr());
270267}
271268
272
273269//============================================================
274270//  main
275271//============================================================
r243093r243094
301297   setvbuf(stdout, (char *) NULL, _IONBF, 0);
302298   setvbuf(stderr, (char *) NULL, _IONBF, 0);
303299
304   //FIXME: move to font module
300   // FIXME: this should be done differently
301
305302   #ifdef SDLMAME_UNIX
306303   sdl_entered_debugger = 0;
307304   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
308   if (TTF_Init() == -1)
309   {
310      printf("SDL_ttf failed: %s\n", TTF_GetError());
311   }
312305   FcInit();
313306   #endif
314307   #endif
r243093r243094
355348   }
356349#endif
357350
358   // already called...
359   //SDL_Quit();
360
361351   #ifdef SDLMAME_UNIX
362352   #if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_HAIKU)) && (!defined(SDLMAME_EMSCRIPTEN))
363   TTF_Quit();
364353   if (!sdl_entered_debugger)
365354   {
366355      FcFini();
r243093r243094
591580//  init
592581//============================================================
593582
583
594584void sdl_osd_interface::init(running_machine &machine)
595585{
596586   // call our parent
trunk/src/osd/sdl/strconv.h
r243093r243094
2222
2323#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
2424
25#if defined(SDLMAME_WIN32)
2526#define WIN32_LEAN_AND_MEAN
2627#include <windows.h>
28#endif
2729// the result of these functions has to be released with osd_free()
2830
2931CHAR *astring_from_utf8(const char *s);
trunk/src/osd/windows/main.c
r243093r243094
77//============================================================
88
99// standard windows headers
10#ifdef OSD_SDL
11#define _WIN32_WINNT 0x0400
12#endif
1013#define WIN32_LEAN_AND_MEAN
1114#include <windows.h>
1215#include <tchar.h>
r243093r243094
3437   int i, rc;
3538   char **utf8_argv;
3639
40#ifdef OSD_SDL
41#ifdef MALLOC_DEBUG
42{
43   extern int winalloc_in_main_code;
44   winalloc_in_main_code = TRUE;
45#endif
46#endif
47
3748   /* convert arguments to UTF-8 */
3849   utf8_argv = (char **) malloc(argc * sizeof(*argv));
3950   if (utf8_argv == NULL)
r243093r243094
5364      osd_free(utf8_argv[i]);
5465   free(utf8_argv);
5566
67#ifdef OSD_SDL
68#ifdef MALLOC_DEBUG
69   {
70      void check_unfreed_mem(void);
71      check_unfreed_mem();
72   }
73   winalloc_in_main_code = FALSE;
74}
75#endif
76#endif
77
5678   return rc;
5779}
trunk/src/osd/windows/netdev_pcap.h
r243093r243094
1#ifndef __NETDEV_H
2#define __NETDEV_H
1#ifndef __NETDEV_PCAP_H__
2#define __NETDEV_PCAP_H__
33
44void init_pcap();
55void deinit_pcap();
trunk/src/osd/windows/strconv.h
r243093r243094
2222
2323#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
2424
25#if defined(SDLMAME_WIN32)
26#define WIN32_LEAN_AND_MEAN
27#include <windows.h>
28#endif
2529// the result of these functions has to be released with osd_free()
2630
2731CHAR *astring_from_utf8(const char *s);
r243093r243094
3842#define utf8_from_tstring   utf8_from_astring
3943#endif // UNICODE
4044
45#if defined(SDLMAME_WIN32)
46#define _tcsncpy wcsncpy
47#endif
48
4149#endif //SDLMAME_WIN32
4250
4351
trunk/src/osd/windows/windows.mak
r243093r243094
358358   $(OSDOBJ)/modules/sync/work_osd.o \
359359   $(OSDOBJ)/modules/lib/osdlib_win32.o \
360360   $(OSDOBJ)/modules/font/font_windows.o \
361   $(OSDOBJ)/modules/osdmodule.o \
361362   $(WINOBJ)/winptty.o \
362363
363364
r243093r243094
381382   $(WINOBJ)/winmain.o \
382383   $(OSDOBJ)/modules/midi/portmidi.o \
383384   $(OSDOBJ)/modules/lib/osdobj_common.o  \
385   $(OSDOBJ)/modules/font/font_sdl.o \
386   $(OSDOBJ)/modules/font/font_windows.o \
387   $(OSDOBJ)/modules/font/font_osx.o \
388   $(OSDOBJ)/modules/font/font_none.o \
384389
385390ifdef USE_SDL
386391OSDOBJS += \


Previous 199869 Revisions Next


© 1997-2024 The MAME Team