Previous 199869 Revisions Next

r34678 Wednesday 28th January, 2015 at 08:20:10 UTC by Miodrag Milanović
Cleanups and version bump
[hash]lantutor.xml pasogo.xml
[src]version.c
[src/emu]clifront.c cliopts.c devfind.c devfind.h distate.c emucore.c emuopts.c emuopts.h luaengine.c machine.c mame.c parameters.c render.c render.h rendfont.c
[src/emu/bus/a8sio]a8sio.c cassette.c
[src/emu/bus/nes_ctrl]4score.c 4score.h arkpaddle.c arkpaddle.h bcbattle.c ctrl.c ctrl.h fckeybrd.c ftrainer.c hori.c hori.h joypad.c joypad.h konamihs.c miracle.c mjpanel.c pachinko.c partytap.c powerpad.c suborkey.c zapper.c
[src/emu/bus/sms_ctrl]joypad.c
[src/emu/bus/vcs]dpc.c
[src/emu/cpu/arcompact]arcompact.c arcompact.h arcompact_execute.c
[src/emu/cpu/i386]i386dasm.c
[src/emu/cpu/m68000]m68k_in.c m68kcpu.c m68kfpu.inc
[src/emu/cpu/tms0980]tms0980.c
[src/emu/machine]intelfsh.c jvshost.c netlist.c
[src/emu/netlist]nl_base.c nl_base.h nl_config.h nl_factory.c nl_setup.c nl_setup.h plists.h pstate.c
[src/emu/netlist/analog]nld_ms_direct.h nld_ms_gauss_seidel.h nld_opamps.c nld_solver.c nld_solver.h
[src/emu/netlist/devices]net_lib.c nld_4020.c nld_cmos.h nld_system.h
[src/emu/sound]qs1000.c tiasound.c
[src/emu/ui]barcode.c devctrl.h devopt.c devopt.h filemngr.c imgcntrl.c imgcntrl.h info.c inputmap.c sliders.c slotopt.h tapectrl.c
[src/emu/video]h63484.c h63484.h
[src/lib/util]coretmpl.h palette.h
[src/mame]mame.lst
[src/mame/audio]mario.c
[src/mame/drivers]aleck64.c btime.c calomega.c cps1.c ddenlovr.c dec0.c dgpix.c dkong.c dynax.c eolith.c eolith16.c eolithsp.c exidy.c funkball.c galaxian.c gticlub.c gts80a.c model2.c model3.c overdriv.c psychic5.c seta2.c stv.c taitottl.c tourtabl.c twinkle.c vegaeo.c vicdual.c
[src/mame/includes]bogeyman.h calomega.h dec0.h dynax.h eolith.h exidy.h hyhoo.h m58.h mario.h model2.h nb1413m3.h paradise.h pastelg.h senjyo.h stadhero.h stfight.h stlforce.h strnskil.h vaportra.h xyonix.h
[src/mame/layout]gts80a_caveman.lay
[src/mame/machine]315-5838_317-0229_comp.c 315-5881_crypt.c dec0.c stfight.c stvprot.c
[src/mame/video]eolith.c gp9001.c pastelg.c taitoair.c tia.c tia.h
[src/mess/drivers]a2600.c banctec.c cat.c gamate.c hp16500.c hp9k_3xx.c nes.c ngen.c pasogo.c splitsec.c tispeak.c
[src/mess/includes]mac.h
[src/mess/machine]amstrad.c macadb.c nes.c
[src/osd]osdcore.c osdepend.h
[src/osd/modules]osdmodule.c osdmodule.h
[src/osd/modules/debugger]debug_module.h debugint.c debugqt.c debugwin.c none.c
[src/osd/modules/font]font_module.h font_none.c font_osx.c font_sdl.c font_windows.c
[src/osd/modules/lib]osdlib_macosx.c osdlib_os2.c osdlib_unix.c osdlib_win32.c osdobj_common.c osdobj_common.h
[src/osd/modules/midi]none.c portmidi.c
[src/osd/modules/sound]direct_sound.c js_sound.c none.c sdl_sound.c sound_module.h
[src/osd/modules/sync]sync_mini.c sync_ntc.c sync_os2.c sync_sdl.c sync_tc.c sync_windows.c work_osd.c
[src/osd/osdmini]minimisc.c
[src/osd/sdl]blit13.h draw13.c drawogl.c input.c netdev_pcap.c netdev_pcap_osx.c osdsdl.h sdl.mak sdldir.c sdlfile.c sdlmain.c sdlos_macosx.c sdlos_unix.c sdlos_win32.c sdlptty_unix.c strconv.c video.c window.c window.h
[src/osd/windows]vconv.c windows.mak
[src/tools]chdman.c nltool.c

trunk/hash/lantutor.xml
r243189r243190
3838      <publisher>Texas Instruments</publisher>
3939      <part name="cart" interface="lantutor">
4040         <dataarea name="rom" size="0x10000">
41<!--         <rom name="cd2315.vsm" size="0x4000" crc="" sha1="" offset="0x0000" /> -->
42<!--         <rom name="cd2316.vsm" size="0x4000" crc="" sha1="" offset="0x4000" /> -->
41<!--            <rom name="cd2315.vsm" size="0x4000" crc="" sha1="" offset="0x0000" /> -->
42<!--            <rom name="cd2316.vsm" size="0x4000" crc="" sha1="" offset="0x4000" /> -->
4343            <rom name="cd2317.vsm" size="0x4000" crc="53231c0b" sha1="472117c3d0e28437fa8faa054f98088e06efc2a1" offset="0x8000" />
4444            <rom name="cd2318.vsm" size="0x4000" crc="6c0727bc" sha1="132e39755b122f2cbec6f3e767f5d256a9c1e7ae" offset="0xc000" />
4545         </dataarea>
trunk/hash/pasogo.xml
r243189r243190
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
33<softwarelist name="pasogo" description="Koei PasoGo cartridges">
44
5<!--
5<!--
66  Koei PasoGo (パソ碁) undumped games
77
88  Taikyoku-kun I ~ 対局くん I [KS-1001]
trunk/src/emu/bus/a8sio/a8sio.c
r243189r243190
217217SLOT_INTERFACE_START(a8sio_cards)
218218   SLOT_INTERFACE("cassette", A8SIO_CASSETTE)
219219SLOT_INTERFACE_END
220
trunk/src/emu/bus/a8sio/cassette.c
r243189r243190
115115         break;
116116   }
117117}
118
trunk/src/emu/bus/nes_ctrl/4score.c
r243189r243190
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
7 
8 
9 TODO: current implementation is a HACK, due to limitations of the
7
8
9 TODO: current implementation is a HACK, due to limitations of the
1010 slot system!
1111 A real Four Score would be connected to both the controller ports of
1212 the NES, but current core cannot emulate something like this until
1313 devices can live their own life and being connected to other devices
1414 at request.
15 In current implementation the device has to be mounted separately in
15 In current implementation the device has to be mounted separately in
1616 the two ports and each enables 2 inputs (this is more or less as hacky
1717 as the non-slot previous one, where the 4 ports were always available
1818 to the emulated system, but it's not a great consolation :( )
r243189r243190
2222 since we could at best have two switches to disable the second player
2323 inputs.
2424
25 Note: Two Pads are hardcoded in inputs below, instead of acting as
25 Note: Two Pads are hardcoded in inputs below, instead of acting as
2626 passthrough for 2 standard joypad devices, in order to show in the
2727 internal UI that they belong to P1+P3 and P2+P4, otherwise they would
2828 be listed as P1+P2 and P3+P4 respectively. This *HAS* to be changed
r243189r243190
171171{
172172   if (data & 0x01)
173173      return;
174   
174
175175   // P3 & P4 inputs in NES Four Score are read serially with P1 & P2
176176   m_latch  = m_joypad1->read();
177   m_latch |= (m_joypad3->read() << 8); // pad 3
177   m_latch |= (m_joypad3->read() << 8); // pad 3
178178   m_latch |= (0x08 << 16); // signature
179179}
180180
r243189r243190
182182{
183183   if (data & 0x01)
184184      return;
185   
185
186186   // P3 & P4 inputs in NES Four Score are read serially with P1 & P2
187187   m_latch = m_joypad2->read();
188   m_latch |= (m_joypad4->read() << 8); // pad 4
188   m_latch |= (m_joypad4->read() << 8); // pad 4
189189   m_latch |= (0x04 << 16); // signature
190190}
trunk/src/emu/bus/nes_ctrl/4score.h
r243189r243190
4747public:
4848   // construction/destruction
4949   nes_4score_p1p3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
50   
50
5151   virtual ioport_constructor device_input_ports() const;
52   
52
5353protected:
5454   virtual void write(UINT8 data);
55   
55
5656private:
5757   required_ioport m_joypad1;
5858   required_ioport m_joypad3;
r243189r243190
6767   nes_4score_p2p4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6868
6969   virtual ioport_constructor device_input_ports() const;
70   
70
7171protected:
7272   virtual void write(UINT8 data);
73   
73
7474private:
7575   required_ioport m_joypad2;
7676   required_ioport m_joypad4;
trunk/src/emu/bus/nes_ctrl/arkpaddle.c
r243189r243190
105105UINT8 nes_vausfc_device::read_exp(offs_t offset)
106106{
107107   UINT8 ret = 0;
108   if (offset == 0)   //$4016
108   if (offset == 0)    //$4016
109109      ret = m_button->read() << 1;
110   else   //$4017
110   else    //$4017
111111   {
112112      ret = (m_latch & 0x80) >> 6;
113113      m_latch <<= 1;
trunk/src/emu/bus/nes_ctrl/arkpaddle.h
r243189r243190
5656public:
5757   // construction/destruction
5858   nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
59   
59
6060protected:
6161   virtual UINT8 read_bit34() { return 0; }
6262   virtual UINT8 read_exp(offs_t offset);
trunk/src/emu/bus/nes_ctrl/bcbattle.c
r243189r243190
55    TODO: this should be actually emulated as a standalone system with
66    a few 7segments LEDs, once we get a dump of its BIOS
77    At the moment we only emulated the connection with a Famicom
8
8
99    Copyright MESS Team.
1010    Visit http://mamedev.org for licensing and usage restrictions.
1111
r243189r243190
5757         if (m_reader->get_byte_length() == 13)
5858         {
5959            for (int i = 0; i < 13; i++)
60               m_current_barcode[i] = m_reader->read_code() + '0';
60               m_current_barcode[i] = m_reader->read_code() + '0';
6161         }
6262         else if (m_reader->get_byte_length() == 8)
6363         {
6464            for (int i = 0; i < 5; i++)
65               m_current_barcode[i] = 0x20;
65               m_current_barcode[i] = 0x20;
6666            for (int i = 5; i < 13; i++)
67               m_current_barcode[i] = m_reader->read_code() + '0';
67               m_current_barcode[i] = m_reader->read_code() + '0';
6868         }
6969         // read one more, to reset the internal byte counter
7070         m_reader->read_code();
7171
7272         // the string "SUNSOFT" is accepted as well by Barcode World
73         m_current_barcode[13] = 'E';
74         m_current_barcode[14] = 'P';
75         m_current_barcode[15] = 'O';
76         m_current_barcode[16] = 'C';
77         m_current_barcode[17] = 'H';
78         m_current_barcode[18] = 0x0d;
79         m_current_barcode[19] = 0x0a;
73         m_current_barcode[13] = 'E';
74         m_current_barcode[14] = 'P';
75         m_current_barcode[15] = 'O';
76         m_current_barcode[16] = 'C';
77         m_current_barcode[17] = 'H';
78         m_current_barcode[18] = 0x0d;
79         m_current_barcode[19] = 0x0a;
8080         m_pending_code = 1;
8181      }
8282      m_new_code = m_reader->get_pending_code();
r243189r243190
110110   // and sending the proper serial bits, instead of our read_current_bit() function!
111111   battler_timer = timer_alloc(TIMER_BATTLER);
112112   battler_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1000));
113   
113
114114   save_item(NAME(m_current_barcode));
115115   save_item(NAME(m_new_code));
116116   save_item(NAME(m_pending_code));
r243189r243190
184184UINT8 nes_bcbattle_device::read_exp(offs_t offset)
185185{
186186   UINT8 ret = 0;
187   if (offset == 1)   //$4017
187   if (offset == 1)    //$4017
188188   {
189189      ret |= read_current_bit() << 2;
190190   }
trunk/src/emu/bus/nes_ctrl/ctrl.c
r243189r243190
11/**********************************************************************
22
3    Nintendo Family Computer & Entertainment System controller ports
3    Nintendo Family Computer & Entertainment System controller ports
44    and Family Computer expansion port emulation
55
66    Here we emulate in fact 3 different kind of ports, which are
r243189r243190
99      corresponding address ($4016 for port1, $4017 for port2)
1010    - FC controller ports: these are only hooked to bit 0 of the
1111      corresponding address (so that e.g. a NES Zapper could not
12      be connected to a later FC AV model, because its inputs
12      be connected to a later FC AV model, because its inputs
1313      would not be detected)
1414    - FC expansion port: this is hooked to bits 0-4 of both addresses
1515    To make things a little bit more complex, old FC models have the
1616    controller hardwired to the unit, and the P2 controllers are
17    directly hooked also to one of the expansion port lines (namely,
17    directly hooked also to one of the expansion port lines (namely,
1818    microphone inputs from P2 go to $4016 bit 2)
1919
20    Even if the controller port and the expansion port are
20    Even if the controller port and the expansion port are
2121    physically different (the FC expansion is a 15pin port, while
2222    the controller ports are 7pin), we emulate them as variants of a
2323    common device, exposing the following handlers:
r243189r243190
2525      inputs from controllers
2626    - read_bit34: for bit3,4 reading, expected to be at the correct
2727      offset (but we don't currently check for read_bit34 & 0xf8==0)
28    - read_exp: for reads going through the expansion, with a offset
28    - read_exp: for reads going through the expansion, with a offset
2929      parameter to decide whether we are reading from $4016 and $4017
3030    - write: to acknowledge writes to $4016
3131
32    The driver emulation will take care to only call the correct
33    handlers they have hooks for: Basic usage is that the expansion
34    port calls read_exp, FC ctrl ports call read_bit0, and NES ctrl
35    ports call both read_bit0 and read_bit34. However, to cope with
36    the original FC microphone, we will have the second controller
32    The driver emulation will take care to only call the correct
33    handlers they have hooks for: Basic usage is that the expansion
34    port calls read_exp, FC ctrl ports call read_bit0, and NES ctrl
35    ports call both read_bit0 and read_bit34. However, to cope with
36    the original FC microphone, we will have the second controller
3737    port calling read_exp too.
3838
3939    Copyright MESS Team.
r243189r243190
168168   SLOT_INTERFACE("joypad", NES_JOYPAD)
169169   SLOT_INTERFACE("zapper", NES_ZAPPER)
170170   SLOT_INTERFACE("4score_p1p3", NES_4SCORE_P1P3)
171//   SLOT_INTERFACE("miracle_piano", NES_MIRACLE)
171//  SLOT_INTERFACE("miracle_piano", NES_MIRACLE)
172172SLOT_INTERFACE_END
173173
174174SLOT_INTERFACE_START( nes_control_port2_devices )
trunk/src/emu/bus/nes_ctrl/ctrl.h
r243189r243190
11/**********************************************************************
22
3    Nintendo Family Computer & Entertainment System controller port
3    Nintendo Family Computer & Entertainment System controller port
44    emulation
55
66    Copyright MESS Team.
r243189r243190
3232   // construction/destruction
3333   device_nes_control_port_interface(const machine_config &mconfig, device_t &device);
3434   virtual ~device_nes_control_port_interface();
35   
35
3636   virtual UINT8 read_bit0() { return 0; };
3737   virtual UINT8 read_bit34() { return 0; };
3838   virtual UINT8 read_exp(offs_t offset) { return 0; };
3939   virtual void write(UINT8 data) { };
40   
40
4141protected:
4242   nes_control_port_device *m_port;
4343};
trunk/src/emu/bus/nes_ctrl/fckeybrd.c
r243189r243190
1818
1919static INPUT_PORTS_START( fc_keyboard )
2020   PORT_START("FCKEY.0")
21   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
22   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)         
21   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
22   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
2323   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR('[')
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']')   
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana")                             
26   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT)                     
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']')
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Kana")
26   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT)
2727   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2)    PORT_CHAR('\\')
28   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_BACKSPACE)
28   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Stop") PORT_CODE(KEYCODE_BACKSPACE)
2929
3030   PORT_START("FCKEY.1")
31   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
31   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
3232   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@')
33   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')   
34   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';')   
35   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('_')                             
36   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('/')                             
37   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')   
33   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')
34   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';')
35   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('_')
36   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CHAR('/')
37   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-')
3838   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('^')
3939
4040   PORT_START("FCKEY.2")
41   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
41   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
4242   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
4343   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
4444   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
r243189r243190
4848   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
4949
5050   PORT_START("FCKEY.3")
51   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
51   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
5252   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
5353   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
5454   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
r243189r243190
5858   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
5959
6060   PORT_START("FCKEY.4")
61   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
61   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
6262   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
6363   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
6464   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
r243189r243190
6868   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')
6969
7070   PORT_START("FCKEY.5")
71   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
71   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
7272   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
7373   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
7474   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
r243189r243190
7878   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')
7979
8080   PORT_START("FCKEY.6")
81   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
81   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
8282   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
8383   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
8484   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
r243189r243190
8888   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')
8989
9090   PORT_START("FCKEY.7")
91   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))         
92   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC))       
93   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')                       
94   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2) 
95   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)        PORT_CHAR(UCHAR_SHIFT_1) 
96   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT)     
97   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')           
98   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')           
91   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
92   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC))
93   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
94   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)
95   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)        PORT_CHAR(UCHAR_SHIFT_1)
96   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT)
97   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')
98   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')
9999
100100   PORT_START("FCKEY.8")
101   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Clr")                               
102   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP)    PORT_CHAR(UCHAR_MAMEKEY(UP))     
103   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))   
104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))     
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))     
106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE)     PORT_CHAR(' ')   
107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL)       
108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)     
101   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Clr")
102   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP)    PORT_CHAR(UCHAR_MAMEKEY(UP))
103   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE)     PORT_CHAR(' ')
107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL)
108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)
109109INPUT_PORTS_END
110110
111111
r243189r243190
183183UINT8 nes_fckeybrd_device::read_exp(offs_t offset)
184184{
185185   UINT8 ret = 0;
186   if (offset == 0)   //$4016
186   if (offset == 0)    //$4016
187187   {
188188      // FC Keyboard: tape input
189189      if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY)
r243189r243190
195195            ret |= 0x02;
196196      }
197197   }
198   else   //$4017
198   else    //$4017
199199   {
200200      // FC Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4
201201      if (m_fck_scan < 9)
r243189r243190
216216   // tape output (not fully tested)
217217   if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_RECORD)
218218      m_cassette->output(((data & 0x07) == 0x07) ? +1.0 : -1.0);
219   
219
220220   if (BIT(data, 2))   // keyboard active
221221   {
222222      UINT8 out = BIT(data, 1);   // scan
223     
223
224224      if (m_fck_mode && !out && ++m_fck_scan > 9)
225225         m_fck_scan = 0;
226     
226
227227      m_fck_mode = out;   // access lower or upper 4 bits
228     
228
229229      if (BIT(data, 0))   // reset
230230         m_fck_scan = 0;
231231   }
trunk/src/emu/bus/nes_ctrl/ftrainer.c
r243189r243190
119119UINT8 nes_ftrainer_device::read_exp(offs_t offset)
120120{
121121   UINT8 ret = 0;
122   if (offset == 1)   //$4017
122   if (offset == 1)    //$4017
123123   {
124124      if (!BIT(m_row_scan, 0))
125125      {
trunk/src/emu/bus/nes_ctrl/hori.c
r243189r243190
11/**********************************************************************
22
33    Nintendo Family Computer Hori Twin (and 4P?) adapters
4 
5    Emulation of the 4Players adapter is quite pointless: if 2P mode
4
5    Emulation of the 4Players adapter is quite pointless: if 2P mode
66    (default mode) it behaves like a Hori Twin adapter, in 4P mode
77    it has P1 and P2 inputs overwriting the inputs coming from the
88    main controllers (possibly creating a bit of confusion, since
r243189r243190
117117UINT8 nes_horitwin_device::read_exp(offs_t offset)
118118{
119119   UINT8 ret = 0;
120   if (offset == 0)   //$4016
120   if (offset == 0)    //$4016
121121      ret |= (m_port1->read_bit0() << 1);
122   else   //$4017
122   else    //$4017
123123      ret |= (m_port2->read_bit0() << 1);
124124   return ret;
125125}
r243189r243190
127127UINT8 nes_hori4p_device::read_exp(offs_t offset)
128128{
129129   UINT8 ret = 0;
130   if (m_cfg->read() == 0)   // 2P
130   if (m_cfg->read() == 0) // 2P
131131   {
132      if (offset == 0)   //$4016
132      if (offset == 0)    //$4016
133133         ret |= (m_port1->read_bit0() << 1);
134      else   //$4017
134      else    //$4017
135135         ret |= (m_port2->read_bit0() << 1);
136136   }
137   else   // 4P
137   else    // 4P
138138   {
139      if (offset == 0)   //$4016
139      if (offset == 0)    //$4016
140140      {
141141         ret |= (m_port1->read_bit0() << 0);
142142         ret |= (m_port3->read_bit0() << 1);
143143      }
144      else   //$4017
144      else    //$4017
145145      {
146146         ret |= (m_port2->read_bit0() << 0);
147147         ret |= (m_port4->read_bit0() << 1);
trunk/src/emu/bus/nes_ctrl/hori.h
r243189r243190
5151public:
5252   // construction/destruction
5353   nes_hori4p_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
54   
54
5555   virtual ioport_constructor device_input_ports() const;
5656   virtual machine_config_constructor device_mconfig_additions() const;
57   
58protected:   
57
58protected:
5959   // device-level overrides
6060   virtual void device_start() {}
61   
61
6262   virtual UINT8 read_exp(offs_t offset);
6363   virtual void write(UINT8 data);
64   
64
6565private:
6666   required_device<nes_control_port_device> m_port1;
6767   required_device<nes_control_port_device> m_port2;
trunk/src/emu/bus/nes_ctrl/joypad.c
r243189r243190
33    Nintendo Family Computer & Entertainment System Joypads
44
55    The original Famicom had two hardwired controller, with the second
6    controller slightly different from the first one: it featured no
6    controller slightly different from the first one: it featured no
77    Start nor Select buttons, but had a built-in microphone (with
88    very limited capabilities, since it basically only detected two
99    states: something blowing into it / nothing blowing into it) for
1010    some games to react to users "talking" into it
11 
12    Crazy Climber Pads are not really a kind of separate controllers,
13    but just a couple of small sticks to be put on top of d-pads of
14    the regular controllers. Users should then control the game by
15    using both controllers, turned 90 degrees, as a couple of dual
11
12    Crazy Climber Pads are not really a kind of separate controllers,
13    but just a couple of small sticks to be put on top of d-pads of
14    the regular controllers. Users should then control the game by
15    using both controllers, turned 90 degrees, as a couple of dual
1616    sticks like in the arcade control panel. However, we emulate them
1717    separately so to map the controls to a friendlier default.
1818
r243189r243190
2020    by Hori, but possibly licensed by Nintendo, since it use the official
2121    logo and brand) which fits into the expansion port and allows to
2222    daisy chain a second controller to the first one, to play 4players
23    game (an image of such connection is shown e.g. in Nekketsu Koukou
23    game (an image of such connection is shown e.g. in Nekketsu Koukou
2424    Dodgeball Bu manual)
25
25
2626    Copyright MESS Team.
2727    Visit http://mamedev.org for licensing and usage restrictions.
2828
r243189r243190
4545   PORT_START("JOYPAD")
4646   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
4747   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
48   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
49   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
48   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
49   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
5050   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
5151   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
5252   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
r243189r243190
5858   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
5959   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
6060   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Microphone")
61   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
61   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
6262   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
6363   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
6464   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
r243189r243190
6969   PORT_START("JOYPAD")
7070   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
7171   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
72   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
73   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
72   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
73   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
7474   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY
7575   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY
7676   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_8WAY
r243189r243190
8181   PORT_START("JOYPAD")
8282   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
8383   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
84   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
85   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
84   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
85   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
8686   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY
8787   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_8WAY
8888   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY
r243189r243190
103103   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
104104   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
105105   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
106   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY      PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
107   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
108   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
109   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
110   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY      PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
111   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
112   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
113   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
106   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY     PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
107   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
108   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
109   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY  PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x01)
110   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY     PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
111   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
112   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY   PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
113   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY  PORT_CONDITION("CONFIG", 0x01, EQUALS, 0x00)
114114INPUT_PORTS_END
115115
116116//-------------------------------------------------
r243189r243190
245245UINT8 nes_fcpad2_device::read_exp(offs_t offset)
246246{
247247   UINT8 ret = 0;
248   if (!offset)   // microphone input
248   if (!offset)    // microphone input
249249      ret |= m_joypad->read() & 0x04;
250250
251251   return ret;
r243189r243190
260260UINT8 nes_arcstick_device::read_exp(offs_t offset)
261261{
262262   UINT8 ret = 0;
263   if (offset == 0)   //$4016
263   if (offset == 0)    //$4016
264264   {
265      if ((m_cfg->read() & 2) == 0)   // we are P1 input
265      if ((m_cfg->read() & 2) == 0)   // we are P1 input
266266      {
267267         ret |= (m_latch & 1) << 1;
268268         m_latch >>= 1;
r243189r243190
270270      else
271271         ret |= m_daisychain->read_exp(0);
272272   }
273   else    //$4017
273   else    //$4017
274274   {
275      if ((m_cfg->read() & 2) == 2)   // we are P2 input
275      if ((m_cfg->read() & 2) == 2)   // we are P2 input
276276      {
277277         ret |= (m_latch & 1) << 1;
278278         m_latch >>= 1;
r243189r243190
280280      else
281281         ret |= m_daisychain->read_exp(1);
282282   }
283   
283
284284   return ret;
285285}
286286
r243189r243190
292292{
293293   if (data & 0x01)
294294      return;
295   
295
296296   m_latch = m_joypad->read();
297297}
298298
r243189r243190
311311
312312   if (data & 0x01)
313313      return;
314   
314
315315   m_latch = m_joypad->read();
316316}
317
trunk/src/emu/bus/nes_ctrl/joypad.h
r243189r243190
5151public:
5252   // construction/destruction
5353   nes_fcpad2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
54   
54
5555   virtual ioport_constructor device_input_ports() const;
56   
56
5757protected:
5858   virtual UINT8 read_exp(offs_t offset);
5959   virtual void write(UINT8 data);
r243189r243190
6666public:
6767   // construction/destruction
6868   nes_ccpadl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
69   
69
7070   virtual ioport_constructor device_input_ports() const;
7171};
7272
r243189r243190
7777public:
7878   // construction/destruction
7979   nes_ccpadr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
80   
80
8181   virtual ioport_constructor device_input_ports() const;
8282};
8383
r243189r243190
8888public:
8989   // construction/destruction
9090   nes_arcstick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
91   
91
9292   virtual ioport_constructor device_input_ports() const;
9393   virtual machine_config_constructor device_mconfig_additions() const;
9494
r243189r243190
9696   virtual UINT8 read_bit0() { return 0; }
9797   virtual UINT8 read_exp(offs_t offset);
9898   virtual void write(UINT8 data);
99   
99
100100   required_device<nes_control_port_device> m_daisychain;
101101   required_ioport m_cfg;
102102};
trunk/src/emu/bus/nes_ctrl/konamihs.c
r243189r243190
8181UINT8 nes_konamihs_device::read_exp(offs_t offset)
8282{
8383   UINT8 ret = 0;
84   if (offset == 1)   //$4017
84   if (offset == 1)    //$4017
8585   {
8686      ret |= m_latch_p1 << 1;
8787      ret |= m_latch_p2 << 3;
trunk/src/emu/bus/nes_ctrl/miracle.c
r243189r243190
11/**********************************************************************
22
33    Nintendo Entertainment System - Miracle Piano Keyboard
4 
5    TODO: basically everything, this is just a skeleton with no
4
5    TODO: basically everything, this is just a skeleton with no
66    real MIDI handling at the moment.
77
88    Copyright MESS Team.
r243189r243190
1313#include "miracle.h"
1414
1515#define MIRACLE_MIDI_WAITING 0
16#define MIRACLE_MIDI_RECEIVE 1      // receive byte from piano
17#define MIRACLE_MIDI_SEND 2         // send byte to piano
16#define MIRACLE_MIDI_RECEIVE 1      // receive byte from piano
17#define MIRACLE_MIDI_SEND 2         // send byte to piano
1818
1919//**************************************************************************
2020//  DEVICE DEFINITIONS
r243189r243190
129129
130130void nes_miracle_device::write(UINT8 data)
131131{
132//   printf("write: %d (%d %02x %d)\n", data & 1, m_sent_bits, m_data_sent, m_midi_mode);
132//  printf("write: %d (%d %02x %d)\n", data & 1, m_sent_bits, m_data_sent, m_midi_mode);
133133
134134   if (m_midi_mode == MIRACLE_MIDI_SEND)
135135   {
r243189r243190
142142      // then we go back to waiting
143143      if (m_sent_bits == 8)
144144      {
145//         printf("xmit MIDI byte %02x\n", m_data_sent);
145//          printf("xmit MIDI byte %02x\n", m_data_sent);
146146         xmit_char(m_data_sent);
147147         m_midi_mode = MIRACLE_MIDI_WAITING;
148148         m_sent_bits = 0;
r243189r243190
157157      m_strobe_on = 1;
158158      return;
159159   }
160   
160
161161   if (m_strobe_on)
162162   {
163163      // was timer running?
164164      if (m_strobe_clock > 0)
165165      {
166//         printf("got strobe at %d clocks\n", m_strobe_clock);
166//          printf("got strobe at %d clocks\n", m_strobe_clock);
167167
168168         if (m_strobe_clock < 66 && data == 0)
169169         {
r243189r243190
199199void nes_miracle_device::rcv_complete()    // Rx completed receiving byte
200200{
201201   receive_register_extract();
202//   UINT8 rcv = get_received_char();
202//  UINT8 rcv = get_received_char();
203203}
204204
205205void nes_miracle_device::tra_complete()    // Tx completed sending byte
r243189r243190
247247      }
248248   }
249249}
250
trunk/src/emu/bus/nes_ctrl/mjpanel.c
r243189r243190
1818
1919static INPUT_PORTS_START( nes_mjpanel )
2020   PORT_START("MJPANEL.0")
21   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
21   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
2222
2323   PORT_START("MJPANEL.1")
24   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
25   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
26   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
27   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
28   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
29   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
30   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
24   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
25   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_N )
26   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_M )
27   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_L )
28   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_K )
29   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_J )
30   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_I )
3131
3232   PORT_START("MJPANEL.2")
33   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
34   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
35   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
36   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
37   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
38   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
39   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_B )
40   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
33   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MAHJONG_H )
34   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_G )
35   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_F )
36   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_E )
37   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_D )
38   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_C )
39   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_MAHJONG_B )
40   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_MAHJONG_A )
4141
4242   PORT_START("MJPANEL.3")
43   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
44   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_RON )
45   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
46   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
47   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
48   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
49   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Mahjong Select")
50   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Mahjong Start")
43   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
44   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_MAHJONG_RON )
45   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH )
46   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI )
47   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_MAHJONG_PON )
48   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN )
49   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Mahjong Select")
50   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Mahjong Start")
5151INPUT_PORTS_END
5252
5353
r243189r243190
124124{
125125   if (data & 0x01)
126126      return;
127   
127
128128   if (data & 0xf8)
129129      logerror("Error: Mahjong panel read with mux data %02x\n", (data & 0xfe));
130130   else
trunk/src/emu/bus/nes_ctrl/pachinko.c
r243189r243190
2020   PORT_START("JOYPAD")
2121   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A")
2222   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B")
23   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
23   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )
24   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START )
2525   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
2626   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
2727   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
r243189r243190
8585{
8686   UINT8 ret = 0;
8787   // this controller behaves like a standard P3 joypad, with longer stream of inputs
88   if (offset == 0)   //$4016
88   if (offset == 0)    //$4016
8989   {
9090      ret |= (m_latch & 1) << 1;
9191      m_latch >>= 1;
r243189r243190
101101{
102102   if (data & 0x01)
103103      return;
104   
104
105105   m_latch = m_joypad->read();
106106   m_latch |= ((m_trigger->read() ^ 0xff) & 0xff) << 8;
107107   m_latch |= 0xff0000;
trunk/src/emu/bus/nes_ctrl/partytap.c
r243189r243190
8181UINT8 nes_partytap_device::read_exp(offs_t offset)
8282{
8383   UINT8 ret = 0;
84   if (offset == 1)   //$4017
84   if (offset == 1)    //$4017
8585   {
8686      ret |= m_latch & 0x1c;
8787      m_latch >>= 3;
trunk/src/emu/bus/nes_ctrl/powerpad.c
r243189r243190
130130{
131131   if (data & 0x01)
132132      return;
133   
133
134134   m_latch[0] = m_ipt1->read();
135135   m_latch[1] = m_ipt2->read() | 0xf0;
136136}
trunk/src/emu/bus/nes_ctrl/suborkey.c
r243189r243190
2222   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G')
2323   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
2424   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
25   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
2626   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
2727   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')
2828   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V')
r243189r243190
3232   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
3333   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
3434   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_END) PORT_CHAR(UCHAR_MAMEKEY(END))
35   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))     
35   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
3636   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W')
3737   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')
3838   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
3939
4040   PORT_START("SUBOR.2")
41   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))
42   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)             
43   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT")                                         
41   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT))
42   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
43   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEXT")
4444   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
45   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))     
46   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PRIOR")                                     
45   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
46   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PRIOR")
4747   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
48   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
48   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME))
4949
5050   PORT_START("SUBOR.3")
5151   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')
5252   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
5353   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
54   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')       
55   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
54   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',')
55   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
5656   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O')
5757   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
5858   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP)  PORT_CHAR('.')
5959
6060   PORT_START("SUBOR.4")
61   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR(']')       
62   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)             
63   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))     
64   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
65   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))     
66   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')       
67   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')       
68   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
61   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)    PORT_CHAR(']')
62   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
63   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
64   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
65   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
66   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[')
67   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\')
68   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
6969
7070   PORT_START("SUBOR.5")
7171   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
72   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
72   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
7373   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z')
7474   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB)   PORT_CHAR('\t')
75   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))       
75   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
7676   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
7777   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')
78   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)     
78   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)
7979
8080   PORT_START("SUBOR.6")
8181   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')
8282   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
8383   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
8484   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M')
85   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
85   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
8686   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U')
8787   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
8888   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
r243189r243190
9292   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':')
9393   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'')
9494   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/')
95   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
95   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
9696   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P)     PORT_CHAR('P')
9797   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS)    PORT_CHAR('=')
98   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)    PORT_CHAR(UCHAR_SHIFT_1) 
98   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT)    PORT_CHAR(UCHAR_SHIFT_1)
9999
100100   PORT_START("SUBOR.8")
101101   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
102102   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
103103   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N')
104104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
106106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
107107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')
108108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
r243189r243190
111111   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
112112
113113   PORT_START("SUBOR.10")
114   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LMENU")
114   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LMENU")
115115   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
116116   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
117   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11)       PORT_CHAR(UCHAR_MAMEKEY(F11))
118   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12)       PORT_CHAR(UCHAR_MAMEKEY(F12))
117   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11)       PORT_CHAR(UCHAR_MAMEKEY(F11))
118   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12)       PORT_CHAR(UCHAR_MAMEKEY(F12))
119119   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
120120   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
121121   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
r243189r243190
124124   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD)PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
125125   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD)  PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
126126   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ASTERISK)  PORT_CHAR(UCHAR_MAMEKEY(ASTERISK))
127   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))   
128   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))       
129   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))   
127   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
128   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
129   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
130130   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH_PAD)PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD))
131   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK)   PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
131   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK)   PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
132132
133133   PORT_START("SUBOR.12")
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`')               
134   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`')
135135   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE")                                         
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE2")                                       
138   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))         
136   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PAUSE")
137   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE2")
138   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
139139   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
140   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD)       
140   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Keypad .") PORT_CODE(KEYCODE_DEL_PAD)
141141   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
142142INPUT_PORTS_END
143143
r243189r243190
198198UINT8 nes_suborkey_device::read_exp(offs_t offset)
199199{
200200   UINT8 ret = 0;
201   if (offset == 1)   //$4017
201   if (offset == 1)    //$4017
202202   {
203203      // Subor Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4
204204      if (m_fck_scan < 13)
r243189r243190
206206      else
207207         ret |= 0x1e;
208208   }
209   
209
210210   return ret;
211211}
212212
r243189r243190
218218{
219219   if (BIT(data, 2))   // keyboard active
220220   {
221      UINT8 out = BIT(data, 1);   // scan     
221      UINT8 out = BIT(data, 1);   // scan
222222      if (m_fck_mode && !out && ++m_fck_scan > 12)
223223         m_fck_scan = 0;
224     
224
225225      m_fck_mode = out;   // access lower or upper 4 bits
226     
226
227227      if (BIT(data, 0))   // reset
228228         m_fck_scan = 0;
229229   }
trunk/src/emu/bus/nes_ctrl/zapper.c
r243189r243190
8080UINT8 nes_zapper_device::read_bit34()
8181{
8282   UINT8 ret = m_trigger->read();
83   if (!m_port->m_brightpixel_cb.isnull() &&
83   if (!m_port->m_brightpixel_cb.isnull() &&
8484      m_port->m_brightpixel_cb(m_lightx->read(), m_lighty->read()))
8585      ret &= ~0x08; // sprite hit
8686   else
r243189r243190
9191UINT8 nes_zapper_device::read_exp(offs_t offset)
9292{
9393   UINT8 ret = 0;
94   if (offset == 1)   // $4017
94   if (offset == 1)    // $4017
9595      ret |= nes_zapper_device::read_bit34();
9696   return ret;
9797}
trunk/src/emu/bus/sms_ctrl/joypad.c
r243189r243190
2020
2121static INPUT_PORTS_START( sms_joypad )
2222   PORT_START("JOYPAD")
23   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
24   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
23   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
24   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
25   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
26   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
2727   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )   // Vcc
2828   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )  // TL
2929   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   // TH
trunk/src/emu/bus/vcs/dpc.c
r243189r243190
3737      save_item(NAME(m_df[i].music_mode), i);
3838      save_item(NAME(m_df[i].osc_clk), i);
3939   }
40   
40
4141   save_item(NAME(m_movamt));
4242   save_item(NAME(m_latch_62));
4343   save_item(NAME(m_latch_64));
trunk/src/emu/clifront.c
r243189r243190
3636class media_identifier
3737{
3838public:
39    // construction/destruction
40    media_identifier(cli_options &options);
39   // construction/destruction
40   media_identifier(cli_options &options);
4141
42    // getters
43    int total() const { return m_total; }
44    int matches() const { return m_matches; }
45    int nonroms() const { return m_nonroms; }
42   // getters
43   int total() const { return m_total; }
44   int matches() const { return m_matches; }
45   int nonroms() const { return m_nonroms; }
4646
47    // operations
48    void reset() { m_total = m_matches = m_nonroms = 0; }
49    void identify(const char *name);
50    void identify_file(const char *name);
51    void identify_data(const char *name, const UINT8 *data, int length);
52    int find_by_hash(const hash_collection &hashes, int length);
47   // operations
48   void reset() { m_total = m_matches = m_nonroms = 0; }
49   void identify(const char *name);
50   void identify_file(const char *name);
51   void identify_data(const char *name, const UINT8 *data, int length);
52   int find_by_hash(const hash_collection &hashes, int length);
5353
5454private:
55    // internal state
56    driver_enumerator   m_drivlist;
57    int                 m_total;
58    int                 m_matches;
59    int                 m_nonroms;
55   // internal state
56   driver_enumerator   m_drivlist;
57   int                 m_total;
58   int                 m_matches;
59   int                 m_nonroms;
6060};
6161
6262
r243189r243190
16191619      }
16201620
16211621   if (!m_osd.execute_command(m_options.command()))
1622        // if we get here, we don't know what has been requested
1623        throw emu_fatalerror(MAMERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command());
1622      // if we get here, we don't know what has been requested
1623      throw emu_fatalerror(MAMERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command());
16241624}
16251625
16261626
trunk/src/emu/cliopts.c
r243189r243190
6060cli_options::cli_options()
6161: emu_options()
6262{
63    add_entries(cli_options::s_option_entries);
63   add_entries(cli_options::s_option_entries);
6464}
65
trunk/src/emu/cpu/arcompact/arcompact.c
r243189r243190
5151arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5252   : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__)
5353   , m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0) // some docs describe these as 'middle endian'?!
54   , m_io_config( "io", ENDIANNESS_LITTLE, 32, AUX_SPACE_ADDRESS_WIDTH, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) )
54   , m_io_config( "io", ENDIANNESS_LITTLE, 32, AUX_SPACE_ADDRESS_WIDTH, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) )
5555{
5656}
5757
trunk/src/emu/cpu/arcompact/arcompact.h
r243189r243190
6060public:
6161   // construction/destruction
6262   arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
63   
63
6464   DECLARE_READ32_MEMBER( arcompact_auxreg002_LPSTART_r);
6565   DECLARE_WRITE32_MEMBER(arcompact_auxreg002_LPSTART_w);
6666   DECLARE_READ32_MEMBER( arcompact_auxreg003_LPEND_r);
6767   DECLARE_WRITE32_MEMBER(arcompact_auxreg003_LPEND_w);
68   
68
6969   DECLARE_READ32_MEMBER( arcompact_auxreg00a_STATUS32_r);
7070   DECLARE_READ32_MEMBER( arcompact_auxreg025_INTVECTORBASE_r);
7171   DECLARE_WRITE32_MEMBER( arcompact_auxreg025_INTVECTORBASE_w);
7272
73   
73
7474protected:
7575   // device-level overrides
7676   virtual void device_start();
r243189r243190
184184   ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32);
185185   ARCOMPACT_RETTYPE arcompact_handle04_1d(OPS_32);
186186//  ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32);
187//   ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
187//  ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
188188   ARCOMPACT_RETTYPE arcompact_handle04_22(OPS_32);
189189   ARCOMPACT_RETTYPE arcompact_handle04_23(OPS_32);
190190   ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32);
191191   ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32);
192//   ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
192//  ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
193193//  ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
194194   ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32);
195195   ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32);
196196//  ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32);
197//   ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32);
197//  ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32);
198198   ARCOMPACT_RETTYPE arcompact_handle04_2f_04(OPS_32);
199199   ARCOMPACT_RETTYPE arcompact_handle04_2f_05(OPS_32);
200200   ARCOMPACT_RETTYPE arcompact_handle04_2f_06(OPS_32);
r243189r243190
770770   ARCOMPACT_RETTYPE arcompact_handle19_0x_helper(OPS_16, const char* optext, int shift, int format);
771771   ARCOMPACT_RETTYPE arcompact_handle1e_0x_helper(OPS_16, const char* optext);
772772   ARCOMPACT_RETTYPE arcompact_handle1e_03_0x_helper(OPS_16, const char* optext);
773   
774773
774
775775   UINT32 handle_jump_to_addr(int delay, int link, UINT32 address, UINT32 next_addr);
776776   UINT32 handle_jump_to_register(int delay, int link, UINT32 reg, UINT32 next_addr, int flag);
777777
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r243189r243190
21422142         size = 8;
21432143      }
21442144
2145   //   c = limm;
2145   //  c = limm;
21462146
21472147   }
21482148   else
r243189r243190
21512151      // Jcc [c]         0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ
21522152      // no conditional links to ILINK1, ILINK2?
21532153
2154   //   c = m_regs[creg];
2154   //  c = m_regs[creg];
21552155   }
21562156
21572157   if (!check_condition(condition))
trunk/src/emu/cpu/i386/i386dasm.c
r243189r243190
9898#define ALWAYS64            0x400
9999#define SPECIAL64           0x800
100100#define SPECIAL64_ENT(x)    (SPECIAL64 | ((x) << 24))
101#define GROUP_MOD         0x1000
101#define GROUP_MOD           0x1000
102102
103103struct I386_OPCODE {
104104   const char *mnemonic;
r243189r243190
19531953   { "group0F0D",          group0F0D_table         },
19541954   { "group0F12",          group0F12_table         },
19551955   { "group0F16",          group0F16_table         },
1956   { "group0F18",           group0F18_table         },
1956   { "group0F18",          group0F18_table         },
19571957   { "group0F71",          group0F71_table         },
19581958   { "group0F72",          group0F72_table         },
19591959   { "group0F73",          group0F73_table         },
trunk/src/emu/cpu/m68000/m68k_in.c
r243189r243190
272272extern void m68040_fpu_op0(m68000_base_device *m68k);
273273extern void m68040_fpu_op1(m68000_base_device *m68k);
274274extern void m68881_mmu_ops(m68000_base_device *m68k);
275extern void m68881_ftrap(m68000_base_device *m68k);
275extern void m68881_ftrap(m68000_base_device *m68k);
276276
277277/* ======================================================================== */
278278/* ========================= INSTRUCTION HANDLERS ========================= */
trunk/src/emu/cpu/m68000/m68kcpu.c
r243189r243190
699699   {
700700      /* only the 68010 throws this unique type-1000 frame */
701701      m68ki_stack_frame_1000(m68k, REG_PPC(m68k), sr, EXCEPTION_BUS_ERROR);
702   }
702   }
703703   else if (m68k->mmu_tmp_buserror_address == REG_PPC(m68k))
704704   {
705705      m68ki_stack_frame_1010(m68k, sr, EXCEPTION_BUS_ERROR, REG_PPC(m68k), m68k->mmu_tmp_buserror_address);
trunk/src/emu/cpu/m68000/m68kfpu.inc
r243189r243190
21772177      // trap here
21782178      m68ki_exception_trap(m68k, EXCEPTION_TRAPV);
21792179   }
2180   else   // fall through, requires eating the operand
2180   else    // fall through, requires eating the operand
21812181   {
21822182      switch (m68k->ir & 0x7)
21832183      {
2184         case 2:   // word operand
2184         case 2: // word operand
21852185            OPER_I_16(m68k);
21862186            break;
21872187
r243189r243190
21892189            OPER_I_32(m68k);
21902190            break;
21912191
2192         case 4:   // no operand
2192         case 4: // no operand
21932193            break;
21942194      }
21952195   }
21962196}
2197
trunk/src/emu/cpu/tms0980/tms0980.c
r243189r243190
10371037
10381038      m_ps = m_ps << 4 | m_pa;
10391039      m_pa = m_pb;
1040     
1040
10411041      m_cs = m_cs << 2 | m_ca;
10421042      m_ca = m_cb;
10431043   }
r243189r243190
10571057
10581058      m_pc = m_sr & m_pc_mask;
10591059      m_sr >>= m_pc_bits;
1060     
1060
10611061      m_pa = m_pb = m_ps & 0xf;
10621062      m_ps >>= 4;
1063     
1063
10641064      m_ca = m_cb = m_cs & 3;
10651065      m_cs >>= 2;
10661066   }
trunk/src/emu/devfind.c
r243189r243190
114114
115115void finder_base::printf_warning(const char *format, ...)
116116{
117    va_list argptr;
118    char buffer[1024];
117   va_list argptr;
118   char buffer[1024];
119119
120    /* do the output */
121    va_start(argptr, format);
122    vsnprintf(buffer, 1024, format, argptr);
123    osd_printf_warning("%s", buffer);
124    va_end(argptr);
120   /* do the output */
121   va_start(argptr, format);
122   vsnprintf(buffer, 1024, format, argptr);
123   osd_printf_warning("%s", buffer);
124   va_end(argptr);
125125}
trunk/src/emu/devfind.h
r243189r243190
5757   void *find_memshare(UINT8 width, size_t &bytes, bool required);
5858   bool report_missing(bool found, const char *objname, bool required);
5959
60    void printf_warning(const char *format, ...) ATTR_PRINTF(2,3);
60   void printf_warning(const char *format, ...) ATTR_PRINTF(2,3);
6161
6262   // internal state
6363   finder_base *m_next;
trunk/src/emu/distate.c
r243189r243190
8989
9090device_state_entry::device_state_entry(int index, device_state_interface *dev)
9191   : m_device_state(dev),
92       m_next(NULL),
92      m_next(NULL),
9393      m_index(index),
9494      m_dataptr(NULL),
9595      m_datamask(0),
trunk/src/emu/emucore.c
r243189r243190
1717emu_fatalerror::emu_fatalerror(const char *format, ...)
1818: code(0)
1919{
20    if (format == NULL)
21    {
22        text[0] = '\0';
23    }
24    else
25    {
26        va_list ap;
27        va_start(ap, format);
28        vsprintf(text, format, ap);
29        va_end(ap);
30    }
31    osd_break_into_debugger(text);
20   if (format == NULL)
21   {
22      text[0] = '\0';
23   }
24   else
25   {
26      va_list ap;
27      va_start(ap, format);
28      vsprintf(text, format, ap);
29      va_end(ap);
30   }
31   osd_break_into_debugger(text);
3232}
3333
3434emu_fatalerror::emu_fatalerror(const char *format, va_list ap)
3535: code(0)
3636{
37    if (format == NULL)
38    {
39        text[0] = '\0';
40    }
41    else
42    {
43        vsprintf(text, format, ap);
44    }
45    osd_break_into_debugger(text);
37   if (format == NULL)
38   {
39      text[0] = '\0';
40   }
41   else
42   {
43      vsprintf(text, format, ap);
44   }
45   osd_break_into_debugger(text);
4646}
4747
4848emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, ...)
4949: code(_exitcode)
5050{
51    if (format == NULL)
52    {
53        text[0] = '\0';
54    }
55    else
56    {
57        va_list ap;
58        va_start(ap, format);
59        vsprintf(text, format, ap);
60        va_end(ap);
61    }
51   if (format == NULL)
52   {
53      text[0] = '\0';
54   }
55   else
56   {
57      va_list ap;
58      va_start(ap, format);
59      vsprintf(text, format, ap);
60      va_end(ap);
61   }
6262}
6363
6464emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, va_list ap)
6565: code(_exitcode)
6666{
67    if (format == NULL)
68    {
69        text[0] = '\0';
70    }
71    else
72    {
73        vsprintf(text, format, ap);
74    }
67   if (format == NULL)
68   {
69      text[0] = '\0';
70   }
71   else
72   {
73      vsprintf(text, format, ap);
74   }
7575}
7676
7777
r243189r243190
8989
9090void fatalerror(const char *format, ...)
9191{
92    va_list ap;
93    va_start(ap, format);
94    emu_fatalerror error(format, ap);
95    va_end(ap);
96    throw error;
92   va_list ap;
93   va_start(ap, format);
94   emu_fatalerror error(format, ap);
95   va_end(ap);
96   throw error;
9797}
9898
9999void fatalerror_exitcode(running_machine &machine, int exitcode, const char *format, ...)
100100{
101    va_list ap;
102    va_start(ap, format);
103    emu_fatalerror error(exitcode, format, ap);
104    va_end(ap);
105    throw error;
101   va_list ap;
102   va_start(ap, format);
103   emu_fatalerror error(exitcode, format, ap);
104   va_end(ap);
105   throw error;
106106}
trunk/src/emu/emuopts.c
r243189r243190
150150
151151   // debugging options
152152   { NULL,                                              NULL,        OPTION_HEADER,     "CORE DEBUGGING OPTIONS" },
153    { OPTION_VERBOSE ";v",                               "0",         OPTION_BOOLEAN,    "display additional diagnostic information" },
154    { OPTION_LOG,                                        "0",         OPTION_BOOLEAN,    "generate an error.log file" },
155    { OPTION_OSLOG,                                      "0",         OPTION_BOOLEAN,    "output error.log data to the system debugger" },
156    { OPTION_DEBUG ";d",                                 "0",         OPTION_BOOLEAN,    "enable/disable debugger" },
153   { OPTION_VERBOSE ";v",                               "0",         OPTION_BOOLEAN,    "display additional diagnostic information" },
154   { OPTION_LOG,                                        "0",         OPTION_BOOLEAN,    "generate an error.log file" },
155   { OPTION_OSLOG,                                      "0",         OPTION_BOOLEAN,    "output error.log data to the system debugger" },
156   { OPTION_DEBUG ";d",                                 "0",         OPTION_BOOLEAN,    "enable/disable debugger" },
157157   { OPTION_UPDATEINPAUSE,                              "0",         OPTION_BOOLEAN,    "keep calling video updates while in pause" },
158158   { OPTION_DEBUGSCRIPT,                                NULL,        OPTION_STRING,     "script for debugger" },
159159
trunk/src/emu/emuopts.h
r243189r243190
318318   bool joystick_contradictory() const { return bool_value(OPTION_JOYSTICK_CONTRADICTORY); }
319319   int coin_impulse() const { return int_value(OPTION_COIN_IMPULSE); }
320320
321    // core debugging options
322    bool log() const { return bool_value(OPTION_LOG); }
323    bool debug() const { return bool_value(OPTION_DEBUG); }
324    bool verbose() const { return bool_value(OPTION_VERBOSE); }
325    bool oslog() const { return bool_value(OPTION_OSLOG); }
321   // core debugging options
322   bool log() const { return bool_value(OPTION_LOG); }
323   bool debug() const { return bool_value(OPTION_DEBUG); }
324   bool verbose() const { return bool_value(OPTION_VERBOSE); }
325   bool oslog() const { return bool_value(OPTION_OSLOG); }
326326   const char *debug_script() const { return value(OPTION_DEBUGSCRIPT); }
327327   bool update_in_pause() const { return bool_value(OPTION_UPDATEINPAUSE); }
328328
trunk/src/emu/luaengine.c
r243189r243190
714714   render_container &rc = sc->container();
715715   ui_manager &ui = sc->machine().ui();
716716   ui.draw_text_full(&rc, msg, x, y , (1.0f - x),
717                  JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR,
718                  UI_TEXT_BG_COLOR, NULL, NULL);
717                  JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR,
718                  UI_TEXT_BG_COLOR, NULL, NULL);
719719
720720   return 0;
721721}
trunk/src/emu/machine.c
r243189r243190
108108
109109osd_interface &running_machine::osd() const
110110{
111    return m_manager.osd();
111   return m_manager.osd();
112112}
113113
114114//-------------------------------------------------
r243189r243190
142142      m_save(*this),
143143      m_memory(*this),
144144      m_ioport(*this),
145      m_parameters(*this),
145      m_parameters(*this),
146146      m_scheduler(*this)
147147{
148148   memset(&m_base_time, 0, sizeof(m_base_time));
trunk/src/emu/machine/intelfsh.c
r243189r243190
253253      m_size = 0x400000;
254254      m_maker_id = MFG_INTEL;
255255      m_device_id = 0x14;
256//      m_sector_is_4k = true; 128kb?
256//      m_sector_is_4k = true; 128kb?
257257      map = ADDRESS_MAP_NAME( memory_map16_32Mb );
258258      break;
259259   case FLASH_SST_39VF020:
trunk/src/emu/machine/jvshost.c
r243189r243190
5050   if(send_size < 3 || send_buffer[0] == 0x00 || send_buffer[1] != send_size-1) {
5151      logerror("JVS checksum error\n");
5252   } /*
53      Naomi suchie3 have bad working controls with this
54   
55      // "This message is crap" doesn't exist so call it checksum error
56      recv_buffer[0] = 0x00;
57      recv_buffer[1] = 0x02;
58      recv_buffer[2] = 0x03;
59      recv_size = 3;
53        Naomi suchie3 have bad working controls with this
6054
61   } else */ {
55        // "This message is crap" doesn't exist so call it checksum error
56        recv_buffer[0] = 0x00;
57        recv_buffer[1] = 0x02;
58        recv_buffer[2] = 0x03;
59        recv_size = 3;
60
61    } else */ {
6262      if(first_device) {
6363         first_device->message(send_buffer[0], send_buffer+2, send_size-2, recv_buffer+2, recv_size);
6464         recv_is_encoded = false;
trunk/src/emu/machine/netlist.c
r243189r243190
440440               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
441441            }
442442            break;
443            case DT_FLOAT:
444                {
445                    float *td = s->resolved<float>();
446                    if (td != NULL) save_pointer(td, s->m_name, s->m_count);
447                }
448                break;
443         case DT_FLOAT:
444            {
445               float *td = s->resolved<float>();
446               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
447            }
448            break;
449449         case DT_INT64:
450450            save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
451451            break;
trunk/src/emu/mame.c
r243189r243190
9494
9595osd_interface &machine_manager::osd() const
9696{
97    return m_osd;
97   return m_osd;
9898}
9999
100100
trunk/src/emu/netlist/analog/nld_ms_direct.h
r243189r243190
1414public:
1515
1616   netlist_matrix_solver_direct_t(const netlist_solver_parameters_t &params, int size);
17    netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t &params, int size);
17   netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t &params, int size);
1818
1919   virtual ~netlist_matrix_solver_direct_t();
2020
r243189r243190
6969   {
7070      //delete[] m_A[k];
7171   }
72    for (int k = 0; k < N(); k++)
73    {
74        nl_free(m_terms[k]);
75        nl_free(m_row_ops[k]);
76    }
77    nl_free(m_row_ops[N()]);
78    //delete[] m_last_RHS;
72   for (int k = 0; k < N(); k++)
73   {
74      nl_free(m_terms[k]);
75      nl_free(m_row_ops[k]);
76   }
77   nl_free(m_row_ops[N()]);
78   //delete[] m_last_RHS;
7979   //delete[] m_RHS;
8080   nl_free_array(m_terms);
8181   nl_free_array(m_rails_temp);
r243189r243190
193193    * Sorting as a general matrix pre-conditioning is mentioned in
194194    * literature but I have found no articles about Gauss Seidel.
195195    *
196     * For Gaussian Elimination however increasing order is better suited.
197     * FIXME: Even better would be to sort on elements right of the matrix diagonal.
198     *
196    * For Gaussian Elimination however increasing order is better suited.
197    * FIXME: Even better would be to sort on elements right of the matrix diagonal.
198    *
199199    */
200200
201    int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
201   int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1);
202202
203203   for (int k = 0; k < N() / 2; k++)
204204      for (int i = 0; i < N() - 1; i++)
205205      {
206            if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
206         if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0)
207207         {
208208            std::swap(m_terms[i],m_terms[i+1]);
209209            m_nets.swap(i, i+1);
r243189r243190
475475, m_dim(size)
476476, m_lp_fact(0)
477477{
478    m_terms = nl_alloc_array(terms_t *, N());
479    m_rails_temp = nl_alloc_array(terms_t, N());
478   m_terms = nl_alloc_array(terms_t *, N());
479   m_rails_temp = nl_alloc_array(terms_t, N());
480480
481    for (int k = 0; k < N(); k++)
482    {
483        m_terms[k] = nl_alloc(terms_t);
484        m_row_ops[k] = vector_ops_t::create_ops(k);
485    }
486    m_row_ops[N()] = vector_ops_t::create_ops(N());
481   for (int k = 0; k < N(); k++)
482   {
483      m_terms[k] = nl_alloc(terms_t);
484      m_row_ops[k] = vector_ops_t::create_ops(k);
485   }
486   m_row_ops[N()] = vector_ops_t::create_ops(N());
487487}
488488
489489
trunk/src/emu/netlist/analog/nld_ms_gauss_seidel.h
r243189r243190
1717public:
1818
1919   netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t &params, int size)
20      : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size)
20      : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size)
2121      , m_lp_fact(0)
2222      , m_gs_fail(0)
2323      , m_gs_total(0)
2424      {
25           const char *p = osd_getenv("NETLIST_STATS");
26           if (p != NULL)
27               m_log_stats = (bool) atoi(p);
28           else
29               m_log_stats = false;
25         const char *p = osd_getenv("NETLIST_STATS");
26         if (p != NULL)
27            m_log_stats = (bool) atoi(p);
28         else
29            m_log_stats = false;
3030      }
3131
3232   virtual ~netlist_matrix_solver_gauss_seidel_t() {}
r243189r243190
5252template <int m_N, int _storage_N>
5353void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats()
5454{
55    if (this->m_stat_calculations != 0 && m_log_stats)
56    {
57        printf("==============================================\n");
58        printf("Solver %s\n", this->name().cstr());
59        printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
60        printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
61        printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
62        printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
63        printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
64                this->m_stat_calculations,
65                this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
66                this->m_gs_fail,
67                100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
68                (double) this->m_gs_total / (double) this->m_stat_calculations);
69    }
55   if (this->m_stat_calculations != 0 && m_log_stats)
56   {
57      printf("==============================================\n");
58      printf("Solver %s\n", this->name().cstr());
59      printf("       ==> %d nets\n", this->N()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
60      printf("       has %s elements\n", this->is_dynamic() ? "dynamic" : "no dynamic");
61      printf("       has %s elements\n", this->is_timestep() ? "timestep" : "no timestep");
62      printf("       %6.3f average newton raphson loops\n", (double) this->m_stat_newton_raphson / (double) this->m_stat_vsolver_calls);
63      printf("       %10d invocations (%6d Hz)  %10d gs fails (%6.2f%%) %6.3f average\n",
64            this->m_stat_calculations,
65            this->m_stat_calculations * 10 / (int) (this->netlist().time().as_double() * 10.0),
66            this->m_gs_fail,
67            100.0 * (double) this->m_gs_fail / (double) this->m_stat_calculations,
68            (double) this->m_gs_total / (double) this->m_stat_calculations);
69   }
7070}
7171
7272template <int m_N, int _storage_N>
r243189r243190
299299      //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20)
300300      //    printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t);
301301
302        gabs_t *= 0.95; // avoid rounding issues
302      gabs_t *= 0.95; // avoid rounding issues
303303      if (!USE_GABS || gabs_t <= gtot_t)
304304      {
305305         w[k] = ws / gtot_t;
r243189r243190
343343      this->m_nets[k]->m_cur_Analog = new_V[k];
344344
345345   this->m_gs_total += resched_cnt;
346    this->m_stat_calculations++;
346   this->m_stat_calculations++;
347347
348348   if (resched)
349349   {
trunk/src/emu/netlist/analog/nld_opamps.c
r243189r243190
3131   NET_C(R1.2, R2.2, G1.ON)
3232   VCVS(G1)
3333   PARAM(G1.G, 10000000)
34    //PARAM(G1.RI, 1)
34   //PARAM(G1.RI, 1)
3535   PARAM(G1.RO, RES_K(8))
3636
3737NETLIST_END()
trunk/src/emu/netlist/analog/nld_solver.c
r243189r243190
9999
100100ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params)
101101: m_stat_calculations(0),
102  m_stat_newton_raphson(0),
103  m_stat_vsolver_calls(0),
104 m_params(params),
105 m_cur_ts(0),
106 m_type(type)
102   m_stat_newton_raphson(0),
103   m_stat_vsolver_calls(0),
104   m_params(params),
105   m_cur_ts(0),
106   m_type(type)
107107{
108108}
109109
r243189r243190
257257template<class C >
258258void netlist_matrix_solver_t::solve_base(C *p)
259259{
260    m_stat_vsolver_calls++;
260   m_stat_vsolver_calls++;
261261   if (is_dynamic())
262262   {
263263      int this_resched;
r243189r243190
270270         newton_loops++;
271271      } while (this_resched > 1 && newton_loops < m_params.m_nr_loops);
272272
273        m_stat_newton_raphson += newton_loops;
273      m_stat_newton_raphson += newton_loops;
274274      // reschedule ....
275275      if (this_resched > 1 && !m_Q_sync.net().is_queued())
276276      {
r243189r243190
438438      return nl_alloc(netlist_matrix_solver_direct2_t, m_params);
439439   else
440440   {
441       typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N;
441      typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N;
442442      if (size >= gs_threshold)
443443         return nl_alloc(solver_N, m_params, size);
444444      else
trunk/src/emu/netlist/analog/nld_solver.h
r243189r243190
197197
198198   enum eSolverType
199199   {
200       GAUSSIAN_ELIMINATION,
201       GAUSS_SEIDEL
200      GAUSSIAN_ELIMINATION,
201      GAUSS_SEIDEL
202202   };
203203
204204   ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t &params);
r243189r243190
243243   plinearlist_t<netlist_analog_net_t *> m_nets;
244244   plinearlist_t<netlist_analog_output_t *> m_inps;
245245
246    int m_stat_calculations;
247    int m_stat_newton_raphson;
248    int m_stat_vsolver_calls;
246   int m_stat_calculations;
247   int m_stat_newton_raphson;
248   int m_stat_vsolver_calls;
249249
250250   const netlist_solver_parameters_t &m_params;
251251
r243189r243190
264264
265265   ATTR_HOT void update_inputs();
266266
267    const eSolverType m_type;
267   const eSolverType m_type;
268268};
269269
270270
trunk/src/emu/netlist/devices/net_lib.c
r243189r243190
7878   ENTRY(VCCS,                 VCCS,                   "-")
7979   ENTRY(CCCS,                 CCCS,                   "-")
8080   ENTRY(dummy_input,          DUMMY_INPUT,            "-")
81    ENTRY(frontier,             FRONTIER,               "+I,Q")
81   ENTRY(frontier,             FRONTIER,               "+I,Q")
8282   ENTRY(QBJT_EB,              QBJT_EB,                "model")
8383   ENTRY(QBJT_switch,          QBJT_SW,                "model")
8484   ENTRY(ttl_input,            TTL_INPUT,              "IN")
r243189r243190
148148   ENTRY(SN74LS629_dip,        SN74LS629_DIP,          "1.CAP1,2.CAP2")
149149   ENTRY(NE555_dip,            NE555_DIP,              "-")
150150}
151
trunk/src/emu/netlist/devices/nld_4020.c
r243189r243190
4343   register_output("Q5", m_Q[4]);
4444   register_output("Q6", m_Q[5]);
4545   register_output("Q7", m_Q[6]);
46    register_output("Q8", m_Q[7]);
46   register_output("Q8", m_Q[7]);
4747   register_output("Q9", m_Q[8]);
4848   register_output("Q10", m_Q[9]);
4949   register_output("Q11", m_Q[10]);
trunk/src/emu/netlist/devices/nld_cmos.h
r243189r243190
2121
2222   protected:
2323      ATTR_HOT void update() {};
24        ATTR_HOT void start()
25        {
26            register_input("VDD,", m_vdd);
27            register_input("VSS,", m_vss);
28        };
24      ATTR_HOT void start()
25      {
26         register_input("VDD,", m_vdd);
27         register_input("VSS,", m_vss);
28      };
2929      ATTR_HOT void reset()  {};
3030
3131public:
trunk/src/emu/netlist/devices/nld_system.h
r243189r243190
4040      NET_REGISTER_DEV(dummy_input, _name)
4141
4242#define FRONTIER(_name, _IN, _OUT)                                             \
43        NET_REGISTER_DEV(frontier, _name)                                      \
44        NET_C(_IN, _name.I)                                                    \
45        NET_C(_OUT, _name.Q)                                                   \
46
43      NET_REGISTER_DEV(frontier, _name)                                      \
44      NET_C(_IN, _name.I)                                                    \
45      NET_C(_OUT, _name.Q)
4746// -----------------------------------------------------------------------------
4847// mainclock
4948// -----------------------------------------------------------------------------
r243189r243190
159158class NETLIB_NAME(frontier) : public netlist_device_t
160159{
161160public:
162    ATTR_COLD NETLIB_NAME(frontier)()
163            : netlist_device_t(DUMMY) { }
161   ATTR_COLD NETLIB_NAME(frontier)()
162         : netlist_device_t(DUMMY) { }
164163
165    ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
164   ATTR_COLD virtual ~NETLIB_NAME(frontier)() {}
166165
167166protected:
168167
169    ATTR_COLD void start()
170    {
171        register_input("I", m_I);
172        register_output("Q", m_Q);
173    }
168   ATTR_COLD void start()
169   {
170      register_input("I", m_I);
171      register_output("Q", m_Q);
172   }
174173
175    ATTR_COLD void reset()
176    {
177    }
174   ATTR_COLD void reset()
175   {
176   }
178177
179    ATTR_HOT ATTR_ALIGN void update()
180    {
181        OUTANALOG(m_Q, INPANALOG(m_I));
182    }
178   ATTR_HOT ATTR_ALIGN void update()
179   {
180      OUTANALOG(m_Q, INPANALOG(m_I));
181   }
183182
184183private:
185    netlist_analog_input_t m_I;
186    netlist_analog_output_t m_Q;
184   netlist_analog_input_t m_I;
185   netlist_analog_output_t m_Q;
187186
188187};
189188
trunk/src/emu/netlist/nl_base.c
r243189r243190
10011001   net.toggle_new_Q();
10021002   net.set_time(netlist().time() + m_inc);
10031003}
1004
trunk/src/emu/netlist/nl_base.h
r243189r243190
337337      CAPACITOR,  // Capacitor
338338      DIODE,      // Diode
339339      DUMMY,      // DUMMY device without function
340        FRONTIER,   // Net frontier
340      FRONTIER,   // Net frontier
341341      BJT_EB,     // BJT(Ebers-Moll)
342342      BJT_SWITCH, // BJT(Switch)
343343      VCVS,       // Voltage controlled voltage source
r243189r243190
12681268
12691269ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const
12701270{
1271    nl_assert(family() == LOGIC);
1271   nl_assert(family() == LOGIC);
12721272   return static_cast<const netlist_logic_net_t &>(*this);
12731273}
12741274
12751275ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog()
12761276{
1277    nl_assert(family() == ANALOG);
1277   nl_assert(family() == ANALOG);
12781278   return static_cast<netlist_analog_net_t &>(*this);
12791279}
12801280
trunk/src/emu/netlist/nl_config.h
r243189r243190
121121class nl_fatalerror : public std::exception
122122{
123123public:
124    nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3)
125    {
126        char text[1024];
127        va_list ap;
128        va_start(ap, format);
129        vsprintf(text, format, ap);
130        va_end(ap);
131        osd_printf_error("%s\n", text);
132    }
133    nl_fatalerror(const char *format, va_list ap)
134    {
135        char text[1024];
136        vsprintf(text, format, ap);
137        osd_printf_error("%s\n", text);
138    }
124   nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3)
125   {
126      char text[1024];
127      va_list ap;
128      va_start(ap, format);
129      vsprintf(text, format, ap);
130      va_end(ap);
131      osd_printf_error("%s\n", text);
132   }
133   nl_fatalerror(const char *format, va_list ap)
134   {
135      char text[1024];
136      vsprintf(text, format, ap);
137      osd_printf_error("%s\n", text);
138   }
139139};
140140
141141//============================================================
trunk/src/emu/netlist/nl_factory.c
r243189r243190
5656
5757ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
5858{
59    if (m_def_param.startsWith("+"))
60        return nl_util::split(m_def_param.substr(1), ",");
61    else
62        return nl_util::pstring_list();
59   if (m_def_param.startsWith("+"))
60      return nl_util::split(m_def_param.substr(1), ",");
61   else
62      return nl_util::pstring_list();
6363}
6464
6565ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params()
6666{
67    if (m_def_param.startsWith("+") || m_def_param.equals("-"))
68        return nl_util::pstring_list();
69    else
70        return nl_util::split(m_def_param, ",");
67   if (m_def_param.startsWith("+") || m_def_param.equals("-"))
68      return nl_util::pstring_list();
69   else
70      return nl_util::split(m_def_param, ",");
7171}
7272
7373
trunk/src/emu/netlist/nl_setup.c
r243189r243190
9797
9898netlist_device_t *netlist_setup_t::register_dev(const pstring &classname, const pstring &name)
9999{
100    netlist_device_t *dev = factory().new_device_by_classname(classname);
101    if (dev == NULL)
102        netlist().error("Class %s not found!\n", classname.cstr());
103    return register_dev(dev, name);
100   netlist_device_t *dev = factory().new_device_by_classname(classname);
101   if (dev == NULL)
102      netlist().error("Class %s not found!\n", classname.cstr());
103   return register_dev(dev, name);
104104}
105105
106106template <class T>
r243189r243190
697697
698698void netlist_setup_t::start_devices()
699699{
700    //FIXME: we need a nl_getenv
700   //FIXME: we need a nl_getenv
701701   if (getenv("NL_LOGS"))
702702   {
703703      NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
trunk/src/emu/netlist/nl_setup.h
r243189r243190
146146   void namespace_push(const pstring &aname);
147147   void namespace_pop();
148148
149    netlist_factory_t &factory() { return *m_factory; }
150    const netlist_factory_t &factory() const { return *m_factory; }
149   netlist_factory_t &factory() { return *m_factory; }
150   const netlist_factory_t &factory() const { return *m_factory; }
151151
152    /* not ideal, but needed for save_state */
153    tagmap_terminal_t  m_terminals;
152   /* not ideal, but needed for save_state */
153   tagmap_terminal_t  m_terminals;
154154
155    void print_stats() const;
155   void print_stats() const;
156156
157157protected:
158158
trunk/src/emu/netlist/plists.h
r243189r243190
6060   ATTR_COLD ~plinearlist_t()
6161   {
6262      if (m_list != NULL)
63          nl_free_array(m_list);
63         nl_free_array(m_list);
6464      m_list = NULL;
6565   }
6666
r243189r243190
183183      else
184184      {
185185         if (m_list != NULL)
186             nl_free_array(m_list);
186            nl_free_array(m_list);
187187         m_list = NULL;
188188         m_count = 0;
189189      }
trunk/src/emu/netlist/pstate.c
r243189r243190
2424         "DT_INT8",
2525         "DT_INT",
2626         "DT_BOOLEAN",
27            "DT_FLOAT"
27         "DT_FLOAT"
2828   };
2929
3030   NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
r243189r243190
6464
6565template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname)
6666{
67    //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
68    pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, owner, &state);
69    m_save.add(p);
70    state.register_state(*this, stname);
67   //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
68   pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, owner, &state);
69   m_save.add(p);
70   state.register_state(*this, stname);
7171}
trunk/src/emu/parameters.c
r243189r243190
2424{
2525   m_parameters.add(tag, value);
2626}
27
trunk/src/emu/render.c
r243189r243190
207207
208208render_texinfo &render_texinfo::operator=(const render_texinfo &src)
209209{
210    free_palette();
211    base = src.base;
212    rowpixels = src.rowpixels;
213    width = src.width;
214    height = src.height;
215    seqid = src.seqid;
216    osddata = src.osddata;
217    m_palette = src.m_palette;
218    if (m_palette != NULL)
219    {
220        m_palette->ref_count++;
221    }
222    return *this;
210   free_palette();
211   base = src.base;
212   rowpixels = src.rowpixels;
213   width = src.width;
214   height = src.height;
215   seqid = src.seqid;
216   osddata = src.osddata;
217   m_palette = src.m_palette;
218   if (m_palette != NULL)
219   {
220      m_palette->ref_count++;
221   }
222   return *this;
223223}
224224
225225render_texinfo::render_texinfo(const render_texinfo &src)
226226{
227    base = src.base;
228    rowpixels = src.rowpixels;
229    width = src.width;
230    height = src.height;
231    seqid = src.seqid;
232    osddata = src.osddata;
233    m_palette = src.m_palette;
234    if (m_palette != NULL)
235    {
236        m_palette->ref_count++;
237    }
227   base = src.base;
228   rowpixels = src.rowpixels;
229   width = src.width;
230   height = src.height;
231   seqid = src.seqid;
232   osddata = src.osddata;
233   m_palette = src.m_palette;
234   if (m_palette != NULL)
235   {
236      m_palette->ref_count++;
237   }
238238}
239239
240240void render_texinfo::set_palette(const dynamic_array<rgb_t> *source)
241241{
242    free_palette();
243    if (source != NULL)
244    {
245        m_palette = global_alloc(render_palette_copy);
246        m_palette->palette.copyfrom(*source);
247        m_palette->ref_count = 1;
248    }
249    else
250    {
251        m_palette = NULL;
252    }
242   free_palette();
243   if (source != NULL)
244   {
245      m_palette = global_alloc(render_palette_copy);
246      m_palette->palette.copyfrom(*source);
247      m_palette->ref_count = 1;
248   }
249   else
250   {
251      m_palette = NULL;
252   }
253253}
254254
255255void render_texinfo::free_palette()
256256{
257    if (m_palette != NULL)
258    {
259        m_palette->ref_count--;
260        if (m_palette->ref_count == 0)
261        {
262            global_free(m_palette);
263        }
264    }
265    m_palette = NULL;
257   if (m_palette != NULL)
258   {
259      m_palette->ref_count--;
260      if (m_palette->ref_count == 0)
261      {
262         global_free(m_palette);
263      }
264   }
265   m_palette = NULL;
266266}
267267
268268
r243189r243190
277277
278278void render_primitive::reset()
279279{
280    // public state
281    type = INVALID;
282    bounds.x0 = 0;
283    bounds.y0 = 0;
284    bounds.x1 = 0;
285    bounds.y1 = 0;
286    color.a = 0;
287    color.r = 0;
288    color.g = 0;
289    color.b = 0;
290    flags = 0;
291    width = 0.0f;
292    texture.set_palette(NULL);
293    texture = render_texinfo();
294    texcoords.bl.u = 0.0f;
295    texcoords.bl.v = 0.0f;
296    texcoords.br.u = 0.0f;
297    texcoords.br.v = 0.0f;
298    texcoords.tl.u = 0.0f;
299    texcoords.tl.v = 0.0f;
300    texcoords.tr.u = 0.0f;
301    texcoords.tr.v = 0.0f;
280   // public state
281   type = INVALID;
282   bounds.x0 = 0;
283   bounds.y0 = 0;
284   bounds.x1 = 0;
285   bounds.y1 = 0;
286   color.a = 0;
287   color.r = 0;
288   color.g = 0;
289   color.b = 0;
290   flags = 0;
291   width = 0.0f;
292   texture.set_palette(NULL);
293   texture = render_texinfo();
294   texcoords.bl.u = 0.0f;
295   texcoords.bl.v = 0.0f;
296   texcoords.br.u = 0.0f;
297   texcoords.br.v = 0.0f;
298   texcoords.tl.u = 0.0f;
299   texcoords.tl.v = 0.0f;
300   texcoords.tr.u = 0.0f;
301   texcoords.tr.v = 0.0f;
302302
303    // do not clear m_next!
304    // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
303   // do not clear m_next!
304   // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
305305}
306306
307307
r243189r243190
556556      texinfo.width = swidth;
557557      texinfo.height = sheight;
558558      // will be set later
559        texinfo.set_palette(NULL);
559      texinfo.set_palette(NULL);
560560      texinfo.seqid = ++m_curseq;
561561   }
562562   else
563563   {
564        // make sure we can recover the original argb32 bitmap
565        bitmap_argb32 dummy;
566        bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
564      // make sure we can recover the original argb32 bitmap
565      bitmap_argb32 dummy;
566      bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
567567
568        // is it a size we already have?
569        scaled_texture *scaled = NULL;
570        int scalenum;
571        for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
572        {
573            scaled = &m_scaled[scalenum];
568      // is it a size we already have?
569      scaled_texture *scaled = NULL;
570      int scalenum;
571      for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
572      {
573         scaled = &m_scaled[scalenum];
574574
575            // we need a non-NULL bitmap with matching dest size
576            if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
577                break;
578        }
575         // we need a non-NULL bitmap with matching dest size
576         if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
577            break;
578      }
579579
580        // did we get one?
581        if (scalenum == ARRAY_LENGTH(m_scaled))
582        {
583            int lowest = -1;
580      // did we get one?
581      if (scalenum == ARRAY_LENGTH(m_scaled))
582      {
583         int lowest = -1;
584584
585            // didn't find one -- take the entry with the lowest seqnum
586            for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
587                if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
588                    lowest = scalenum;
589            assert_always(lowest != -1, "Too many live texture instances!");
585         // didn't find one -- take the entry with the lowest seqnum
586         for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
587            if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
588               lowest = scalenum;
589         assert_always(lowest != -1, "Too many live texture instances!");
590590
591            // throw out any existing entries
592            scaled = &m_scaled[lowest];
593            if (scaled->bitmap != NULL)
594            {
595                m_manager->invalidate_all(scaled->bitmap);
596                global_free(scaled->bitmap);
597            }
591         // throw out any existing entries
592         scaled = &m_scaled[lowest];
593         if (scaled->bitmap != NULL)
594         {
595            m_manager->invalidate_all(scaled->bitmap);
596            global_free(scaled->bitmap);
597         }
598598
599            // allocate a new bitmap
600            scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
601            scaled->seqid = ++m_curseq;
599         // allocate a new bitmap
600         scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
601         scaled->seqid = ++m_curseq;
602602
603            // let the scaler do the work
604            (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
605        }
603         // let the scaler do the work
604         (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
605      }
606606
607        // finally fill out the new info
608        primlist.add_reference(scaled->bitmap);
609        texinfo.base = &scaled->bitmap->pix32(0);
610        texinfo.rowpixels = scaled->bitmap->rowpixels();
611        texinfo.width = dwidth;
612        texinfo.height = dheight;
613        // will be set later
614        texinfo.set_palette(NULL);
615        texinfo.seqid = scaled->seqid;
607      // finally fill out the new info
608      primlist.add_reference(scaled->bitmap);
609      texinfo.base = &scaled->bitmap->pix32(0);
610      texinfo.rowpixels = scaled->bitmap->rowpixels();
611      texinfo.width = dwidth;
612      texinfo.height = dheight;
613      // will be set later
614      texinfo.set_palette(NULL);
615      texinfo.seqid = scaled->seqid;
616616   }
617617}
618618
r243189r243190
18171817               height = MIN(height, m_maxtexheight);
18181818
18191819               curitem->texture()->get_scaled(width, height, prim->texture, list);
1820                    // set the palette
1820               // set the palette
18211821#if 1
18221822               const dynamic_array<rgb_t> *adjusted_pal = curitem->texture()->get_adjusted_palette(container);
1823                    prim->texture.set_palette(adjusted_pal);
1823               prim->texture.set_palette(adjusted_pal);
18241824#else
1825                    prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
1825               prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
18261826#endif
18271827
1828                    // determine UV coordinates and apply clipping
1829                    prim->texcoords = oriented_texcoords[finalorient];
1830                    clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1828               // determine UV coordinates and apply clipping
1829               prim->texcoords = oriented_texcoords[finalorient];
1830               clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
18311831
1832                    // apply the final orientation from the quad flags and then build up the final flags
1833                    prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
1834                                    PRIMFLAG_TEXORIENT(finalorient) |
1835                                    PRIMFLAG_TEXFORMAT(curitem->texture()->format());
1836                    if (blendmode != -1)
1837                        prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
1838                    else
1839                        prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
1832               // apply the final orientation from the quad flags and then build up the final flags
1833               prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
1834                           PRIMFLAG_TEXORIENT(finalorient) |
1835                           PRIMFLAG_TEXFORMAT(curitem->texture()->format());
1836               if (blendmode != -1)
1837                  prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
1838               else
1839                  prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
18401840            }
18411841            else
18421842            {
r243189r243190
18761876            (container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list);
18771877
18781878      // determine UV coordinates
1879        prim->texcoords = oriented_texcoords[container_xform.orientation];
1879      prim->texcoords = oriented_texcoords[container_xform.orientation];
18801880
1881        // set the flags and add it to the list
1882        prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
1883                        PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
1884                        PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
1885                        PRIMFLAG_TEXSHADE(1);
1881      // set the flags and add it to the list
1882      prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
1883                  PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
1884                  PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
1885                  PRIMFLAG_TEXSHADE(1);
18861886
1887        list.append_or_return(*prim, false);
1887      list.append_or_return(*prim, false);
18881888   }
18891889}
18901890
r243189r243190
19251925
19261926      texture->get_scaled(width, height, prim->texture, list);
19271927
1928        // compute the clip rect
1929        render_bounds cliprect;
1930        cliprect.x0 = render_round_nearest(xform.xoffs);
1931        cliprect.y0 = render_round_nearest(xform.yoffs);
1932        cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
1933        cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
1934        sect_render_bounds(&cliprect, &m_bounds);
1928      // compute the clip rect
1929      render_bounds cliprect;
1930      cliprect.x0 = render_round_nearest(xform.xoffs);
1931      cliprect.y0 = render_round_nearest(xform.yoffs);
1932      cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
1933      cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
1934      sect_render_bounds(&cliprect, &m_bounds);
19351935
1936        // determine UV coordinates and apply clipping
1937        prim->texcoords = oriented_texcoords[xform.orientation];
1938        bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1936      // determine UV coordinates and apply clipping
1937      prim->texcoords = oriented_texcoords[xform.orientation];
1938      bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
19391939
19401940      // add to the list or free if we're clipped out
19411941      list.append_or_return(*prim, clipped);
trunk/src/emu/render.h
r243189r243190
213213
214214struct render_palette_copy
215215{
216    int ref_count;
217    dynamic_array<rgb_t> palette;
216   int ref_count;
217   dynamic_array<rgb_t> palette;
218218};
219219
220220class render_texinfo
221221{
222222public:
223    render_texinfo()
224    : base(NULL), rowpixels(0), width(0), height(0),
225      seqid(0), osddata(0), m_palette(NULL)
226    {}
223   render_texinfo()
224   : base(NULL), rowpixels(0), width(0), height(0),
225      seqid(0), osddata(0), m_palette(NULL)
226   {}
227227
228    render_texinfo(const render_texinfo &src);
228   render_texinfo(const render_texinfo &src);
229229
230    ~render_texinfo()
231    {
232        free_palette();
233    }
230   ~render_texinfo()
231   {
232      free_palette();
233   }
234234
235    render_texinfo &operator=(const render_texinfo &src);
235   render_texinfo &operator=(const render_texinfo &src);
236236
237237   void *              base;               // base of the data
238238   UINT32              rowpixels;          // pixels per row
r243189r243190
241241   UINT32              seqid;              // sequence ID
242242   UINT64              osddata;            // aux data to pass to osd
243243
244    const rgb_t *       palette() const { return ((m_palette == NULL) ? NULL : &m_palette->palette[0]); }
244   const rgb_t *       palette() const { return ((m_palette == NULL) ? NULL : &m_palette->palette[0]); }
245245
246    void set_palette(const dynamic_array<rgb_t> *source);
246   void set_palette(const dynamic_array<rgb_t> *source);
247247
248248private:
249    void free_palette();
249   void free_palette();
250250
251    render_palette_copy *m_palette;     // palette for PALETTE16 textures, LUTs for RGB15/RGB32
251   render_palette_copy *m_palette;     // palette for PALETTE16 textures, LUTs for RGB15/RGB32
252252};
253253
254254
trunk/src/emu/rendfont.c
r243189r243190
9292      m_osdfont = manager.machine().osd().font_alloc();
9393      if (m_osdfont != NULL)
9494      {
95          if (m_osdfont->open(manager.machine().options().font_path(), filename, m_height))
96          {
97               m_scale = 1.0f / (float)m_height;
98               m_format = FF_OSD;
99               return;
100          }
101          global_free(m_osdfont);
102          m_osdfont = NULL;
95         if (m_osdfont->open(manager.machine().options().font_path(), filename, m_height))
96         {
97            m_scale = 1.0f / (float)m_height;
98            m_format = FF_OSD;
99            return;
100         }
101         global_free(m_osdfont);
102         m_osdfont = NULL;
103103      }
104104   }
105105
r243189r243190
136136   // release the OSD font
137137   if (m_osdfont != NULL)
138138   {
139        m_osdfont->close();
140        global_free(m_osdfont);
139      m_osdfont->close();
140      global_free(m_osdfont);
141141   }
142142}
143143
trunk/src/emu/sound/qs1000.c
r243189r243190
246246
247247   save_item(NAME(m_serial_data_in));
248248   save_item(NAME(m_wave_regs));
249   
249
250250   for (int i = 0; i < QS1000_CHANNELS; i++)
251251   {
252252      save_item(NAME(m_channels[i].m_acc), i);
trunk/src/emu/sound/tiasound.c
r243189r243190
597597      chip->P5[chan] = 0;
598598      chip->P9[chan] = 0;
599599   }
600   
600
601601   tia_save_state(device, chip);
602602
603603   return chip;
trunk/src/emu/ui/barcode.c
r243189r243190
2020
2121
2222/**************************************************
23
23
2424 BARCODE READER MENU
25
25
2626 **************************************************/
2727
2828
r243189r243190
5151void ui_menu_barcode_reader::populate()
5252{
5353   if (current_device())
54   {     
54   {
5555      astring buffer;
5656      const char *new_barcode;
5757
r243189r243190
6868      {
6969         new_barcode = m_barcode_buffer;
7070      }
71     
71
7272      item_append("New Barcode:", new_barcode, 0, ITEMREF_NEW_BARCODE);
73     
73
7474      // finish up the menu
7575      item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
7676      item_append("Enter Code", NULL, 0, ITEMREF_ENTER_BARCODE);
77     
77
7878      customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;
7979   }
8080}
r243189r243190
103103            if (event->itemref == ITEMREF_SELECT_READER)
104104               previous();
105105            break;
106           
106
107107         case IPT_UI_RIGHT:
108108            if (event->itemref == ITEMREF_SELECT_READER)
109109               next();
trunk/src/emu/ui/devctrl.h
r243189r243190
99    printers)
1010    The base class contains calls to get the total number of devices of
1111    the same kind connected to the driver, and shortcuts to switch current
12    device to next one or previous one attached. This allows, for instance,
13    users to pass from a device to another one by simply pressing left/right
14    and the menu is rebuilt accordingly, without the need of a preliminary
12    device to next one or previous one attached. This allows, for instance,
13    users to pass from a device to another one by simply pressing left/right
14    and the menu is rebuilt accordingly, without the need of a preliminary
1515    submenu listing available devices of the same kind.
1616
1717    Copyright Nicola Salmoria and the MAME Team.
trunk/src/emu/ui/devopt.c
r243189r243190
6666
6767         // get cpu specific clock that takes internal multiplier/dividers into account
6868         int clock = exec->device().clock();
69         
69
7070         // count how many identical CPUs we have
7171         int count = 1;
7272         const char *name = exec->device().name();
r243189r243190
7777               if (exectags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE)
7878                  count++;
7979         }
80         
80
8181         // if more than one, prepend a #x in front of the CPU name
8282         if (count > 1)
8383            string.catprintf("  %d" UTF8_MULTIPLY, count);
8484         else
8585            string.cat("  ");
8686         string.cat(name);
87         
87
8888         // display clock in kHz or MHz
8989         if (clock >= 1000000)
9090            string.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
r243189r243190
9292            string.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
9393      }
9494   }
95   
95
9696   // display screen information
9797   screen_device_iterator scriter(*dev);
9898   if (scriter.count() > 0)
r243189r243190
101101      for (screen_device *screen = scriter.first(); screen != NULL; screen = scriter.next())
102102      {
103103         string.catprintf("  Screen '%s': ", screen->tag());
104         
104
105105         if (screen->screen_type() == SCREEN_TYPE_VECTOR)
106106            string.cat("Vector\n");
107107         else
108108         {
109109            const rectangle &visarea = screen->visible_area();
110           
110
111111            string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
112                         visarea.width(), visarea.height(),
113                         (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
114                         ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds));
112                           visarea.width(), visarea.height(),
113                           (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
114                           ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds));
115115         }
116116      }
117117   }
118   
118
119119   // loop over all sound chips
120120   sound_interface_iterator snditer(*dev);
121121   if (snditer.count() > 0)
r243189r243190
126126      {
127127         if (soundtags.add(sound->device().tag(), 1, FALSE) == TMERR_DUPLICATE)
128128            continue;
129         
129
130130         // count how many identical sound chips we have
131131         int count = 1;
132132         sound_interface_iterator sndinneriter(*dev);
r243189r243190
142142         else
143143            string.cat("  ");
144144         string.cat(sound->device().name());
145         
145
146146         // display clock in kHz or MHz
147147         int clock = sound->device().clock();
148148         if (clock >= 1000000)
r243189r243190
156156
157157   // scan for BIOS settings
158158   int bios = 0;
159   if (dev->rom_region())
159   if (dev->rom_region())
160160   {
161161      astring bios_str;
162162      // first loop through roms in search of default bios (shortname)
r243189r243190
174174               bios_str.cpy(ROM_GETHASHDATA(rom));
175175         }
176176      }
177     
177
178178      if (bios)
179179         string.catprintf("* BIOS settings:\n  %d options    [default: %s]\n", bios, bios_str.cstr());
180180   }
181   
181
182182   int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0;
183183   int input_keypad = 0, input_keyboard = 0, dips = 0, confs = 0;
184184   astring errors, dips_opt, confs_opt;
r243189r243190
265265      for (const device_image_interface *imagedev = imgiter.first(); imagedev != NULL; imagedev = imgiter.next())
266266         string.catprintf("  %s    [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag());
267267   }
268   
268
269269   slot_interface_iterator slotiter(*dev);
270270   if (slotiter.count() > 0)
271271   {
r243189r243190
275275   }
276276
277277   if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + bios + dips + confs
278      + input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard) == 0)
278         + input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard) == 0)
279279      string.cat("[None]\n");
280280
281281   const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name());
trunk/src/emu/ui/devopt.h
r243189r243190
11/***************************************************************************
22
33    ui/devopt.h
4
4
55    Internal menu for the device configuration.
6
6
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
trunk/src/emu/ui/filemngr.c
r243189r243190
6464{
6565   // get the image type/id
6666   instance.printf("%s (%s)", img->instance_name(), img->brief_instance_name());
67   
67
6868   // get the base name
6969   if (img->basename() != NULL)
7070   {
7171      filename.cpy(img->basename());
72     
72
7373      // if the image has been loaded through softlist, also show the loaded part
7474      if (img->part_entry() != NULL)
7575      {
r243189r243190
107107      item_append(m_warnings, NULL, MENU_FLAG_DISABLE, NULL);
108108      item_append("", NULL, MENU_FLAG_DISABLE, NULL);
109109   }
110     
110
111111   // cycle through all devices for this system
112112   device_iterator iter(machine().root_device());
113113   tagmap_t<UINT8> devtags;
r243189r243190
120120      // check whether it owns an image interface
121121      image_interface_iterator subiter(*dev);
122122      if (subiter.count() > 0)
123      {         
123      {
124124         // if so, cycle through all its image interfaces
125125         image_interface_iterator subiter(*dev);
126126         for (device_image_interface *scan = subiter.first(); scan != NULL; scan = subiter.next())
r243189r243190
172172         if (selected_device != NULL)
173173         {
174174            ui_menu::stack_push(selected_device->get_selection_menu(machine(), container));
175           
175
176176            // reset the existing menu
177177            reset(UI_MENU_RESET_REMEMBER_POSITION);
178178         }
r243189r243190
182182
183183// force file manager menu
184184void ui_menu_file_manager::force_file_manager(running_machine &machine, render_container *container, const char *warnings)
185{   
185{
186186   // reset the menu stack
187187   ui_menu::stack_reset(machine);
188   
188
189189   // add the quit entry followed by the game select entry
190190   ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container));
191191   quit->set_special_main_menu(true);
192192   ui_menu::stack_push(quit);
193193   ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_file_manager(machine, container, warnings)));
194   
194
195195   // force the menus on
196196   machine.ui().show_menu();
197   
197
198198   // make sure MAME is paused
199199   machine.pause();
200200}
trunk/src/emu/ui/imgcntrl.c
r243189r243190
328328      state = create_ok ? CREATE_FILE : START_FILE;
329329      handle();
330330      break;
331         
331
332332   case DO_CREATE: {
333333      astring path;
334334      zippath_combine(path, current_directory, current_file);
trunk/src/emu/ui/imgcntrl.h
r243189r243190
2727
2828protected:
2929   enum {
30      START_FILE, START_OTHER_PART, START_SOFTLIST,
31      SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
30      START_FILE, START_OTHER_PART, START_SOFTLIST,
31      SELECT_PARTLIST, SELECT_ONE_PART, SELECT_OTHER_PART,
3232      SELECT_FILE, CREATE_FILE, CREATE_CONFIRM, CHECK_CREATE, DO_CREATE, SELECT_SOFTLIST,
3333      LAST_ID
3434   };
trunk/src/emu/ui/info.c
r243189r243190
8989
9090         // display long filename
9191         item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL);
92         
92
9393         // display manufacturer and year
9494         string.catprintf("%s, %s", image->manufacturer(), image->year());
9595         item_append(string, "", MENU_FLAG_DISABLE, NULL);
9696
9797         // display supported information, if available
98         switch (image->supported())
98         switch (image->supported())
9999         {
100            case SOFTWARE_SUPPORTED_NO:
100            case SOFTWARE_SUPPORTED_NO:
101101               item_append("Not supported", "", MENU_FLAG_DISABLE, NULL);
102102               break;
103            case SOFTWARE_SUPPORTED_PARTIAL:
103            case SOFTWARE_SUPPORTED_PARTIAL:
104104               item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL);
105105               break;
106            default:
106            default:
107107               break;
108108         }
109109      }
trunk/src/emu/ui/inputmap.c
r243189r243190
487487   if (menu_event != NULL && menu_event->itemref != NULL)
488488   {
489489      // reset
490      if ((FPTR)menu_event->itemref == 1)
490      if ((FPTR)menu_event->itemref == 1)
491491      {
492492         if (menu_event->iptkey == IPT_UI_SELECT)
493493            machine().schedule_hard_reset();
r243189r243190
498498         ioport_field *field = (ioport_field *)menu_event->itemref;
499499         ioport_field::user_settings settings;
500500         int changed = false;
501         
501
502502         switch (menu_event->iptkey)
503503         {
504504            /* if selected, reset to default value */
r243189r243190
508508               field->set_user_settings(settings);
509509               changed = true;
510510               break;
511               
511
512512            /* left goes to previous setting */
513513            case IPT_UI_LEFT:
514514               field->select_previous_setting();
515515               changed = true;
516516               break;
517               
517
518518            /* right goes to next setting */
519519            case IPT_UI_RIGHT:
520520               field->select_next_setting();
521521               changed = true;
522522               break;
523523         }
524         
524
525525         /* if anything changed, rebuild the menu, trying to stay on the same field */
526526         if (changed)
527527            reset(UI_MENU_RESET_REMEMBER_REF);
r243189r243190
628628         }
629629   if (type == IPT_DIPSWITCH)
630630      custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0;
631   
631
632632   item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL);
633633   item_append("Reset",  NULL, 0, (void *)1);
634634}
r243189r243190
661661   {
662662      const ioport_diplocation *diploc;
663663      UINT32 selectedmask = 0;
664     
664
665665      // determine the mask of selected bits
666666      if ((FPTR)selectedref != 1)
667667      {
668668         ioport_field *field = (ioport_field *)selectedref;
669         
669
670670         if (field != NULL && field->first_diplocation() != NULL)
671671            for (diploc = field->first_diplocation(); diploc != NULL; diploc = diploc->next())
672672               if (strcmp(dip->name, diploc->name()) == 0)
673673                  selectedmask |= 1 << (diploc->number() - 1);
674674      }
675     
675
676676      // draw one switch
677677      custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask);
678678      y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT);
r243189r243190
884884                  }
885885
886886                  name.cpy(field->name());
887                 
887
888888                  /* allocate a data item for tracking what this menu item refers to */
889889                  data = (analog_item_data *)m_pool_alloc(sizeof(*data));
890890                  data->field = field;
trunk/src/emu/ui/sliders.c
r243189r243190
242242UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *container, UINT32 state)
243243{
244244   UINT32 result;
245   
245
246246   /* if this is the first call, push the sliders menu */
247247   if (state)
248248      ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_sliders(machine, container, true)));
249   
249
250250   /* handle standard menus */
251251   result = ui_menu::ui_handler(machine, container, state);
252   
252
253253   /* if we are cancelled, pop the sliders menu */
254254   if (result == UI_HANDLER_CANCEL)
255255      ui_menu::stack_pop(machine);
256   
256
257257   ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack);
258258   return uim && uim->menuless_mode ? 0 : UI_HANDLER_CANCEL;
259259}
trunk/src/emu/ui/slotopt.h
r243189r243190
11/***************************************************************************
22
33    ui/slotopt.h
4
4
55    Internal menu for the slot options.
6
6
77    Copyright Nicola Salmoria and the MAME Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
trunk/src/emu/ui/tapectrl.c
r243189r243190
5656void ui_menu_tape_control::populate()
5757{
5858   if (current_device())
59   {     
59   {
6060      // name of tape
6161      item_append(current_display_name(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT);
6262
r243189r243190
6767         double t0 = current_device()->get_position();
6868         double t1 = current_device()->get_length();
6969         UINT32 tapeflags = 0;
70         
70
7171         // state
7272         if (t1 > 0)
7373         {
r243189r243190
7676            if (t0 < t1)
7777               tapeflags |= MENU_FLAG_RIGHT_ARROW;
7878         }
79         
79
8080         get_time_string(timepos, current_device(), NULL, NULL);
8181         state = current_device()->get_state();
8282         item_append(
8383                  (state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
8484                  ?   "stopped"
8585                  :   ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
86                      ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
87                      : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
88                      ),
86                        ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "playing" : "(playing)")
87                        : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? "recording" : "(recording)")
88                        ),
8989                  timepos,
9090                  tapeflags,
9191                  TAPECMD_SLIDER);
92         
92
9393         // pause or stop
9494         item_append("Pause/Stop", NULL, 0, TAPECMD_STOP);
95         
95
9696         // play
9797         item_append("Play", NULL, 0, TAPECMD_PLAY);
98         
98
9999         // record
100100         item_append("Record", NULL, 0, TAPECMD_RECORD);
101         
101
102102         // rewind
103103         item_append("Rewind", NULL, 0, TAPECMD_REWIND);
104         
104
105105         // fast forward
106106         item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD);
107107      }
trunk/src/emu/video/h63484.c
r243189r243190
20012001void h63484_device::device_start()
20022002{
20032003   m_display_cb.bind_relative_to(*owner());
2004   
2004
20052005   register_save_state();
20062006}
20072007
trunk/src/emu/video/h63484.h
r243189r243190
107107   void video_registers_w(int offset);
108108   int translate_command(UINT16 data);
109109   void draw_graphics_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int vs, int y, int layer_n, bool active, bool ins_window);
110   
110
111111   void register_save_state();
112112
113113   h63484_display_delegate  m_display_cb;
trunk/src/lib/util/coretmpl.h
r243189r243190
100100   void resize_keep_and_clear_new(int count, UINT8 data = 0) { int oldcount = m_count; resize_keep(count); if (oldcount < m_count) clear_internal(oldcount, m_count - oldcount, data); }
101101
102102   // batch operations
103    void copyfrom(const dynamic_array<_ElementType> &source)
104    {
105        resize(source.count());
106        for (int i=0; i < source.count(); i++)
107            m_array[i] = source[i];
108    }
103   void copyfrom(const dynamic_array<_ElementType> &source)
104   {
105      resize(source.count());
106      for (int i=0; i < source.count(); i++)
107         m_array[i] = source[i];
108   }
109109
110110private:
111111   // internal helpers
trunk/src/lib/util/palette.h
r243189r243190
171171   // entry list getters
172172   const rgb_t *entry_list_raw() const { return m_entry_color; }
173173   const dynamic_array<rgb_t> *entry_list_adjusted_darray() const { return &m_adjusted_color; }
174    const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
174   const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
175175   const rgb_t *entry_list_adjusted_rgb15() const { return m_adjusted_rgb15; }
176176
177177   // group adjustments
trunk/src/mame/audio/mario.c
r243189r243190
4646/* ---------------------------------------------------------------------- */
4747static NETLIST_START(nl_mario_snd0)
4848
49    RES(R17, RES_K(27))               /* 20 according to parts list           */
50                                      /* 27 verified, 30K in schematics       */
51    CAP(C14, CAP_U(4.7))              /* verified                             */
49   RES(R17, RES_K(27))               /* 20 according to parts list           */
50                              /* 27 verified, 30K in schematics       */
51   CAP(C14, CAP_U(4.7))              /* verified                             */
5252
53    TTL_74123(2H_A)
54    NET_C(2H_A.VCC, V5)
55    NET_C(2H_A.GND, GND)
56    NET_C(SOUND0.Q, 2H_A.B)
57    NET_C(GND, 2H_A.A)
58    NET_C(2H_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
59    DIODE(D1, "1N4148")               /* FIXME: try to identify */
60    TTL_7404_INVERT(1H_A, 2H_A.QQ)
61    NET_C(R17.1, V5)
62    NET_C(R17.2, D1.A, C14.1)
63    NET_C(D1.K, 2H_A.RC)
64    NET_C(C14.2, 2H_A.C)
53   TTL_74123(2H_A)
54   NET_C(2H_A.VCC, V5)
55   NET_C(2H_A.GND, GND)
56   NET_C(SOUND0.Q, 2H_A.B)
57   NET_C(GND, 2H_A.A)
58   NET_C(2H_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
59   DIODE(D1, "1N4148")               /* FIXME: try to identify */
60   TTL_7404_INVERT(1H_A, 2H_A.QQ)
61   NET_C(R17.1, V5)
62   NET_C(R17.2, D1.A, C14.1)
63   NET_C(D1.K, 2H_A.RC)
64   NET_C(C14.2, 2H_A.C)
6565
66    RES(R6, RES_K(4.7))               /* verified                             */
67    CAP(C3, CAP_U(10))                /* verified                             */
66   RES(R6, RES_K(4.7))               /* verified                             */
67   CAP(C3, CAP_U(10))                /* verified                             */
6868
69    NET_C(1H_A.Q, R6.1)
70    NET_C(R6.2, C3.1, 1J_A.FC)
71    NET_C(R6.2, 2J_A.FC)
72    NET_C(C3.2, GND)
69   NET_C(1H_A.Q, R6.1)
70   NET_C(R6.2, C3.1, 1J_A.FC)
71   NET_C(R6.2, 2J_A.FC)
72   NET_C(C3.2, GND)
7373
74    //#define MR_C6       CAP_N(3.9)        /* verified                           */
74   //#define MR_C6       CAP_N(3.9)        /* verified                           */
7575
76    SN74LS629(1J_A, CAP_N(3.9))
77    NET_C(1J_A.RNG, V5)
78    NET_C(1J_A.ENQ, ttllow)
79    NET_C(GND, 1J_A.GND)
76   SN74LS629(1J_A, CAP_N(3.9))
77   NET_C(1J_A.RNG, V5)
78   NET_C(1J_A.ENQ, ttllow)
79   NET_C(GND, 1J_A.GND)
8080
81    //#define MR_C17      CAP_N(22)        /* verified                            */
81   //#define MR_C17      CAP_N(22)        /* verified                            */
8282
83    SN74LS629(2J_A, CAP_N(22))
84    NET_C(2J_A.RNG, V5)
85    NET_C(2J_A.ENQ, ttllow)
86    NET_C(GND, 2J_A.GND)
83   SN74LS629(2J_A, CAP_N(22))
84   NET_C(2J_A.RNG, V5)
85   NET_C(2J_A.ENQ, ttllow)
86   NET_C(GND, 2J_A.GND)
8787
88    TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y)
89    TTL_7408_AND(2K_A, 2H_A.Q, 1K_A)
88   TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y)
89   TTL_7408_AND(2K_A, 2H_A.Q, 1K_A)
9090NETLIST_END()
9191
9292/* ---------------------------------------------------------------------- */
r243189r243190
9696// FIXME: Diodes are 1S953
9797static NETLIST_START(nl_mario_snd7)
9898
99    RES(R61, RES_K(47))
100    CAP(C41, CAP_U(4.7))              /* verified                             */
99   RES(R61, RES_K(47))
100   CAP(C41, CAP_U(4.7))              /* verified                             */
101101
102    TTL_74123(4L_A)
103    NET_C(4L_A.VCC, V5)
104    NET_C(4L_A.GND, GND)
105    NET_C(SOUND7.Q, 4L_A.B)
106    NET_C(GND, 4L_A.A)
107    NET_C(4L_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
108    DIODE(D10, "1N4148")               /* FIXME: try to identify */
109    TTL_7404_INVERT(4J_A, 4L_A.Q)
110    NET_C(R61.1, V5)
111    NET_C(R61.2, D10.A, C41.1)
112    NET_C(D10.K, 4L_A.RC)
113    NET_C(C41.2, 4L_A.C)
102   TTL_74123(4L_A)
103   NET_C(4L_A.VCC, V5)
104   NET_C(4L_A.GND, GND)
105   NET_C(SOUND7.Q, 4L_A.B)
106   NET_C(GND, 4L_A.A)
107   NET_C(4L_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
108   DIODE(D10, "1N4148")               /* FIXME: try to identify */
109   TTL_7404_INVERT(4J_A, 4L_A.Q)
110   NET_C(R61.1, V5)
111   NET_C(R61.2, D10.A, C41.1)
112   NET_C(D10.K, 4L_A.RC)
113   NET_C(C41.2, 4L_A.C)
114114
115    RES(R65, RES_K(10))
116    CAP(C44, CAP_U(3.3))              /* verified                             */
115   RES(R65, RES_K(10))
116   CAP(C44, CAP_U(3.3))              /* verified                             */
117117
118    SN74LS629(4K_A, CAP_U(0.022))
119    NET_C(4K_A.RNG, V5)
120    NET_C(4K_A.ENQ, ttllow)
121    NET_C(GND, 4K_A.GND)
122    NET_C(R65.1, 4J_A.Q)
123    NET_C(R65.2, 4K_A.FC, C44.1)
124    NET_C(C44.2, GND)
118   SN74LS629(4K_A, CAP_U(0.022))
119   NET_C(4K_A.RNG, V5)
120   NET_C(4K_A.ENQ, ttllow)
121   NET_C(GND, 4K_A.GND)
122   NET_C(R65.1, 4J_A.Q)
123   NET_C(R65.2, 4K_A.FC, C44.1)
124   NET_C(C44.2, GND)
125125
126    CD_4020(3H, 4K_B.Y, ttllow, V5, GND)
127    TTL_7404_INVERT(4J_B, 3H.Q12)
126   CD_4020(3H, 4K_B.Y, ttllow, V5, GND)
127   TTL_7404_INVERT(4J_B, 3H.Q12)
128128
129    RES(R64, RES_K(20))
130    CAP(C43, CAP_U(3.3))              /* verified                             */
129   RES(R64, RES_K(20))
130   CAP(C43, CAP_U(3.3))              /* verified                             */
131131
132    SN74LS629(4K_B, CAP_U(0.0047))
133    NET_C(4K_B.RNG, V5)
134    NET_C(4K_B.ENQ, ttllow)
135    NET_C(GND, 4K_B.GND)
136    NET_C(R64.1, 4J_B.Q)
137    NET_C(R64.2, 4K_B.FC, C43.1)
138    NET_C(C43.2, GND)
132   SN74LS629(4K_B, CAP_U(0.0047))
133   NET_C(4K_B.RNG, V5)
134   NET_C(4K_B.ENQ, ttllow)
135   NET_C(GND, 4K_B.GND)
136   NET_C(R64.1, 4J_B.Q)
137   NET_C(R64.2, 4K_B.FC, C43.1)
138   NET_C(C43.2, GND)
139139
140    TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y)
141    TTL_7408_AND(2K_C, 4L_A.Q, 1K_C)
140   TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y)
141   TTL_7408_AND(2K_C, 4L_A.Q, 1K_C)
142142
143143NETLIST_END()
144144
r243189r243190
146146/* DAC sound                                                            */
147147/* ---------------------------------------------------------------------- */
148148static NETLIST_START(nl_mario_dac)
149    RES(R34, RES_M(2))
150    RES(R35, RES_M(1))
151    RES(R36, RES_M(1.8))
152    LM3900(3M_1)
153    NET_C(3M_1.VM, GND)
154    NET_C(3M_1.VP, V5)
149   RES(R34, RES_M(2))
150   RES(R35, RES_M(1))
151   RES(R36, RES_M(1.8))
152   LM3900(3M_1)
153   NET_C(3M_1.VM, GND)
154   NET_C(3M_1.VP, V5)
155155
156    NET_C(DAC.VOUT, R34.1)
157    NET_C(3M_1.MINUS, R34.2, R35.2)
158    NET_C(3M_1.OUT, R35.1)
159    NET_C(3M_1.PLUS, R36.1)
160    NET_C(R36.2, GND)
156   NET_C(DAC.VOUT, R34.1)
157   NET_C(3M_1.MINUS, R34.2, R35.2)
158   NET_C(3M_1.OUT, R35.1)
159   NET_C(3M_1.PLUS, R36.1)
160   NET_C(R36.2, GND)
161161
162    RES(R21, RES_M(1.8))
163    RES(R23, RES_K(10))
164    RES(R25, RES_K(10))
165    RES(R37, RES_K(750))
166    RES(R38, RES_K(360))
167    RES(R39, RES_K(750))
162   RES(R21, RES_M(1.8))
163   RES(R23, RES_K(10))
164   RES(R25, RES_K(10))
165   RES(R37, RES_K(750))
166   RES(R38, RES_K(360))
167   RES(R39, RES_K(750))
168168
169    CAP(C18, CAP_P(100))
170    CAP(C19, CAP_U(10))
171    CAP(C20, CAP_U(1))
172    CAP(C30, CAP_P(100))
169   CAP(C18, CAP_P(100))
170   CAP(C19, CAP_U(10))
171   CAP(C20, CAP_U(1))
172   CAP(C30, CAP_P(100))
173173
174    LM3900(3M_2)
175    NET_C(3M_2.VM, GND)
176    NET_C(3M_2.VP, V5)
174   LM3900(3M_2)
175   NET_C(3M_2.VM, GND)
176   NET_C(3M_2.VP, V5)
177177
178    NET_C(R35.1, C20.1)
179    NET_C(C20.2, R37.1)
180    NET_C(R37.2, R38.2, C18.1, R39.2)
178   NET_C(R35.1, C20.1)
179   NET_C(C20.2, R37.1)
180   NET_C(R37.2, R38.2, C18.1, R39.2)
181181
182    NET_C(C18.2, GND)
183    NET_C(R38.1, C30.2, 3M_2.MINUS)
184    NET_C(3M_2.OUT, R39.1, C30.1)
182   NET_C(C18.2, GND)
183   NET_C(R38.1, C30.2, 3M_2.MINUS)
184   NET_C(3M_2.OUT, R39.1, C30.1)
185185
186    NET_C(R21.1, 3M_2.PLUS)
187    NET_C(R21.2, C19.1, R25.2, R23.1)
188    NET_C(C19.2, R23.2, GND)
189    NET_C(R25.1, V5)
186   NET_C(R21.1, 3M_2.PLUS)
187   NET_C(R21.2, C19.1, R25.2, R23.1)
188   NET_C(C19.2, R23.2, GND)
189   NET_C(R25.1, V5)
190190NETLIST_END()
191191
192192static NETLIST_START(nl_mario)
193193
194    /* Standard stuff */
194   /* Standard stuff */
195195
196    SOLVER(Solver, 48000)
197    PARAM(Solver.ACCURACY, 1e-8)
198    PARAM(Solver.SOR_FACTOR, 1.0)
199    PARAM(Solver.GS_THRESHOLD, 5)
200    PARAM(Solver.GS_LOOPS, 4)
201    //PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
202    PARAM(Solver.DYNAMIC_TS,  0)
203    ANALOG_INPUT(V5, 5)
196   SOLVER(Solver, 48000)
197   PARAM(Solver.ACCURACY, 1e-8)
198   PARAM(Solver.SOR_FACTOR, 1.0)
199   PARAM(Solver.GS_THRESHOLD, 5)
200   PARAM(Solver.GS_LOOPS, 4)
201   //PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
202   PARAM(Solver.DYNAMIC_TS,  0)
203   ANALOG_INPUT(V5, 5)
204204
205    TTL_INPUT(SOUND0, 1)
206    INCLUDE(nl_mario_snd0)
205   TTL_INPUT(SOUND0, 1)
206   INCLUDE(nl_mario_snd0)
207207
208    TTL_INPUT(SOUND7, 1)
209    INCLUDE(nl_mario_snd7)
208   TTL_INPUT(SOUND7, 1)
209   INCLUDE(nl_mario_snd7)
210210
211    R2R_DAC(DAC, 3.4, 10000.0, 8)
212    NET_C(DAC.VGND, GND)
211   R2R_DAC(DAC, 3.4, 10000.0, 8)
212   NET_C(DAC.VGND, GND)
213213
214    INCLUDE(nl_mario_dac)
214   INCLUDE(nl_mario_dac)
215215
216    /* ---------------------------------------------------------------------- */
217    /* mixing                                                                 */
218    /* ---------------------------------------------------------------------- */
216   /* ---------------------------------------------------------------------- */
217   /* mixing                                                                 */
218   /* ---------------------------------------------------------------------- */
219219
220    RES(R20, RES_K(22))               /* verified                             */
221    RES(R19, RES_K(22))               /* verified                             */
222    RES(R40, RES_K(22))               /* verified                             */
223    RES(R41, RES_K(100))              /* verified                             */
224    CAP(C31, CAP_U(0.022))            /*                             */
220   RES(R20, RES_K(22))               /* verified                             */
221   RES(R19, RES_K(22))               /* verified                             */
222   RES(R40, RES_K(22))               /* verified                             */
223   RES(R41, RES_K(100))              /* verified                             */
224   CAP(C31, CAP_U(0.022))            /*                             */
225225
226    NET_C(2K_A.Q, R20.1)
227    NET_C(GND, R19.1) //FIXME
228    NET_C(2K_C.Q, R41.1)
226   NET_C(2K_A.Q, R20.1)
227   NET_C(GND, R19.1) //FIXME
228   NET_C(2K_C.Q, R41.1)
229229
230230#if 1
231    RES(DUM, RES_K(22))
232    NET_C(R39.1, DUM.1)
233    NET_C(DUM.2, GND)
234    FRONTIER(front1, R39.1, R40.1)
231   RES(DUM, RES_K(22))
232   NET_C(R39.1, DUM.1)
233   NET_C(DUM.2, GND)
234   FRONTIER(front1, R39.1, R40.1)
235235#else
236    NET_C(R39.1, R40.1)
236   NET_C(R39.1, R40.1)
237237#endif
238238
239    NET_C(R20.2, R19.2, R40.2, R41.2, C31.1)
240    NET_C(C31.2, GND)
239   NET_C(R20.2, R19.2, R40.2, R41.2, C31.1)
240   NET_C(C31.2, GND)
241241
242    CAP(C32, CAP_U(1))                /* verified                             */
243    RES(R42, RES_K(43))               /* verified                             */
244    RES(R43, RES_K(100))              /* verified                             */
242   CAP(C32, CAP_U(1))                /* verified                             */
243   RES(R42, RES_K(43))               /* verified                             */
244   RES(R43, RES_K(100))              /* verified                             */
245245
246    NET_C(C31.1, C32.1)
247    NET_C(C32.2, R42.1, R43.2, Q10.B)
248    //NET_C(C32.2, R42.1, R43.2)
249    NET_C(R43.1, V5)
250    NET_C(R42.2, GND)
246   NET_C(C31.1, C32.1)
247   NET_C(C32.2, R42.1, R43.2, Q10.B)
248   //NET_C(C32.2, R42.1, R43.2)
249   NET_C(R43.1, V5)
250   NET_C(R42.2, GND)
251251#if 1
252    RES(R63, RES_K(1))                /*                                      */
253    RES(R62, 150)                     /*                                      */
252   RES(R63, RES_K(1))                /*                                      */
253   RES(R62, 150)                     /*                                      */
254254
255    QBJT_EB(Q10, "2SC1815")
255   QBJT_EB(Q10, "2SC1815")
256256
257    NET_C(R62.2, GND)
258    NET_C(R62.1, Q10.E)
257   NET_C(R62.2, GND)
258   NET_C(R62.1, Q10.E)
259259
260    NET_C(R63.1, V5)
261    NET_C(R63.2, Q10.C)
260   NET_C(R63.1, V5)
261   NET_C(R63.2, Q10.C)
262262
263    CAP(C42, CAP_U(0.1))
264    CAP(C47, CAP_U(4.7))
265    RES(VR1, RES_K(10))
263   CAP(C42, CAP_U(0.1))
264   CAP(C47, CAP_U(4.7))
265   RES(VR1, RES_K(10))
266266
267    NET_C(C42.1, C47.1, R62.1)
268    NET_C(C42.2, GND)
269    NET_C(C47.2, VR1.1)
270    NET_C(VR1.2, GND)
267   NET_C(C42.1, C47.1, R62.1)
268   NET_C(C42.2, GND)
269   NET_C(C47.2, VR1.1)
270   NET_C(VR1.2, GND)
271271#endif
272    /* ---------------------------------------------------------------------- */
273    /* Output                                                                 */
274    /* ---------------------------------------------------------------------- */
272   /* ---------------------------------------------------------------------- */
273   /* Output                                                                 */
274   /* ---------------------------------------------------------------------- */
275275
276    RES(ROUT, 1000000)
276   RES(ROUT, 1000000)
277277
278    //NET_C(Q10.C, ROUT.1)
279    //NET_C(R43.2, ROUT.1)
280    NET_C(VR1.1, ROUT.1)
278   //NET_C(Q10.C, ROUT.1)
279   //NET_C(R43.2, ROUT.1)
280   NET_C(VR1.1, ROUT.1)
281281
282    NET_C(GND, ROUT.2)
282   NET_C(GND, ROUT.2)
283283
284284NETLIST_END()
285285
r243189r243190
790790#if OLD_SOUND
791791   m_discrete->write(space, DS_SOUND0_INP, 0);
792792#else
793    m_audio_snd0->write(data);
793   m_audio_snd0->write(data);
794794#endif
795795}
796796
r243189r243190
835835#if OLD_SOUND
836836         machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1);
837837#else
838          m_audio_snd7->write((data & 1) ^ 1);
838         m_audio_snd7->write((data & 1) ^ 1);
839839#endif
840840         break;
841841   }
r243189r243190
891891   MCFG_DISCRETE_INTF(mario)
892892   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1)
893893#else
894    MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
895    MCFG_NETLIST_SETUP(nl_mario)
896    MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
894   MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
895   MCFG_NETLIST_SETUP(nl_mario)
896   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
897897
898    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1)
899    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1)
900    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255)
898   MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1)
899   MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1)
900   MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255)
901901
902    MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1")
903    MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0)
902   MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1")
903   MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0)
904904#endif
905905
906906MACHINE_CONFIG_END
trunk/src/mame/drivers/aleck64.c
r243189r243190
178178public:
179179   aleck64_state(const machine_config &mconfig, device_type type, const char *tag)
180180      : n64_state(mconfig, type, tag),
181        m_e90_vram(*this,"e90vram"),
182        m_e90_pal(*this,"e90pal"),
181         m_e90_vram(*this,"e90vram"),
182         m_e90_pal(*this,"e90pal"),
183183         m_dip_read_offset(0) { }
184184
185185   optional_shared_ptr<UINT32> m_e90_vram;
r243189r243190
322322ADDRESS_MAP_END
323323
324324/*
325 E90 protection handlers
325 E90 protection handlers
326326*/
327327
328328READ16_MEMBER(aleck64_state::e90_prot_r)
r243189r243190
332332}
333333
334334WRITE16_MEMBER(aleck64_state::e90_prot_w)
335{   
335{
336336   switch(offset*2)
337337   {
338338      case 0x16:
r243189r243190
342342         if(data & 1) // 0 -> 1 transition
343343         {
344344            //for(int i=0;i<0x1000;i+=4)
345            //   space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
345            //  space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
346346         }
347347         break;
348348      //0x1e bit 0 probably enables the chip
r243189r243190
882882{
883883   bitmap.fill(0, cliprect);
884884   screen_update_n64(screen,bitmap,cliprect);
885   
885
886886   for(int offs=0;offs<0x1000/4;offs+=2)
887887   {
888888      int xi,yi;
r243189r243190
904904      r&=0x1f;
905905      g&=0x1f;
906906      b&=0x1f;
907      r = (r << 3) | (r >> 2);
907      r = (r << 3) | (r >> 2);
908908      g = (g << 3) | (g >> 2);
909      b = (b << 3) | (b >> 2);
909      b = (b << 3) | (b >> 2);
910910      for(yi=0;yi<8;yi++)
911911         for(xi=0;xi<8;xi++)
912912         {
913913            int res_x,res_y;
914914            res_x = x+xi + 4;
915915            res_y = y+yi + 7;
916           
916
917917            if(cliprect.contains(res_x, res_y))
918918               bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b;
919919         }
r243189r243190
926926   MCFG_CPU_PROGRAM_MAP(e90_map)
927927
928928   MCFG_SCREEN_MODIFY("screen")
929   MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_e90)   
929   MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_e90)
930930MACHINE_CONFIG_END
931931
932932DRIVER_INIT_MEMBER(aleck64_state,aleck64)
trunk/src/mame/drivers/btime.c
r243189r243190
19401940   ROM_LOAD( "w3-f.4a",     0xc000, 0x1000, CRC(9aadd252) SHA1(c6da7ef46333d525e676c59f03ccc908108b41ba) )
19411941   ROM_LOAD( "w2-f.6a",     0xd000, 0x1000, CRC(f131a5bb) SHA1(84b7dea112dce12e5cb235a13f6dc4edcfb18c06) )
19421942   ROM_LOAD( "w1-f.9a",     0xe000, 0x1000, CRC(a6ce9a19) SHA1(e8f380e17a21fb33504d6efe9d01d0f903fa25e1) )
1943//   ROM_LOAD( "w1-f",        0xe000, 0x1000, CRC(c8ec57c5) SHA1(904a9ed0a7f1230c611bf473b9bc52e63eb56dbe) ) // 0x7d3 is 0x10 instead of 0x00, 1 bit different, looks out of place, bad?
1943//  ROM_LOAD( "w1-f",        0xe000, 0x1000, CRC(c8ec57c5) SHA1(904a9ed0a7f1230c611bf473b9bc52e63eb56dbe) ) // 0x7d3 is 0x10 instead of 0x00, 1 bit different, looks out of place, bad?
19441944   ROM_LOAD( "w0-f.9a",     0xf000, 0x1000, CRC(b3787a92) SHA1(7f40621dc739c1108a5df43142ab04709a380219) )
19451945
19461946   ROM_REGION( 0x10000, "audiocpu", 0 )
trunk/src/mame/drivers/calomega.c
r243189r243190
36583658DRIVER_INIT_MEMBER(calomega_state,comg080)
36593659{
36603660   DRIVER_INIT_CALL(sys903);
3661   
3661
36623662   /* Injecting missing Start and NMI vectors...
36633663      Start = $2042;  NMI = $26f8;
36643664      Also a fake vector at $3ff8-$3ff9. The code checks these values to continue.
trunk/src/mame/drivers/cps1.c
r243189r243190
93229322   ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
93239323   ROM_LOAD16_WORD_SWAP("q5 - 34_90629b.8f", 0x00000, 0x80000, CRC(de54487f) SHA1(75b228a6c702c82d4d9a2a992933b5c3c420f6c2) )
93249324   ROM_LOAD16_WORD_SWAP("q5 - 33_90629b.6f", 0x80000, 0x80000, CRC(93248458) SHA1(9dcdc6838f52efc9a0a6333fd0d734946db12dbd) )
9325   
9325
93269326   ROM_REGION( 0x200000, "gfx", 0 )
93279327   ROMX_LOAD( "q5 - 06_90629b.8a",  0x000000, 0x80000, CRC(09d0e7ce) SHA1(ea502b975986222acce82ce8396348af72e1df72) , ROM_GROUPWORD | ROM_SKIP(6) )
93289328   ROMX_LOAD( "q5 - 08_90629b.10a", 0x000002, 0x80000, CRC(22e4ce9a) SHA1(9e49aec8e1d6d15a68da63e69765b82fd53a9562) , ROM_GROUPWORD | ROM_SKIP(6) )
trunk/src/mame/drivers/ddenlovr.c
r243189r243190
154154      : dynax_state(mconfig, type, tag),
155155      m_dsw_sel16(*this, "dsw_sel16"),
156156      m_protection1(*this, "protection1"),
157      m_protection2(*this, "protection2")   { }
158     
157      m_protection2(*this, "protection2") { }
159158
159
160160   optional_shared_ptr<UINT16> m_dsw_sel16;
161161   optional_shared_ptr<UINT16> m_protection1;
162162   optional_shared_ptr<UINT16> m_protection2;
trunk/src/mame/drivers/dec0.c
r243189r243190
530530{
531531   save_item(NAME(m_automat_adpcm_byte));
532532   save_item(NAME(m_automat_msm5205_vclk_toggle));
533   save_item(NAME(m_automat_scroll_regs));   
533   save_item(NAME(m_automat_scroll_regs));
534534}
535535
536536
trunk/src/mame/drivers/dgpix.c
r243189r243190
164164
165165   required_device<cpu_device> m_maincpu;
166166   required_ioport m_vblank;
167   
167
168168   UINT32 *m_vram;
169169   int m_vbuffer;
170170   int m_flash_roms;
171171   int m_old_vbuf;
172172   UINT32 m_flash_cmd;
173173   INT32 m_first_offset;
174   
174
175175   DECLARE_READ32_MEMBER(flash_r);
176176   DECLARE_WRITE32_MEMBER(flash_w);
177177   DECLARE_WRITE32_MEMBER(vram_w);
r243189r243190
179179   DECLARE_WRITE32_MEMBER(vbuffer_w);
180180   DECLARE_WRITE32_MEMBER(coin_w);
181181   DECLARE_READ32_MEMBER(vblank_r);
182   
182
183183   DECLARE_DRIVER_INIT(elfin);
184184   DECLARE_DRIVER_INIT(jumpjump);
185185   DECLARE_DRIVER_INIT(xfiles);
186186   DECLARE_DRIVER_INIT(xfilesk);
187187   DECLARE_DRIVER_INIT(kdynastg);
188188   DECLARE_DRIVER_INIT(fmaniac3);
189   
189
190190   virtual void machine_start();
191191   virtual void machine_reset();
192192   virtual void video_start();
193   
193
194194   UINT32 screen_update_dgpix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
195195};
196196
trunk/src/mame/drivers/dkong.c
r243189r243190
341341
342342    That kit included the following 4 EPROM's
343343
344    USA (c) 1981 Nintendo of America set
344    USA (c) 1981 Nintendo of America set
345345    ------------------------------------
346346
347347    Filename Label Type Loc/PCB *Label *Loc/PCB CSum
trunk/src/mame/drivers/dynax.c
r243189r243190
43784378
43794379   membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000],  0x8000);
43804380   membank("bank2")->configure_entries(0, 12,   &SOUND[0x8000], 0x8000);
4381   
4381
43824382   MACHINE_START_CALL_MEMBER(dynax);
43834383}
43844384
trunk/src/mame/drivers/eolith.c
r243189r243190
14941494
14951495   // Configure the sound ROM banking
14961496   membank("sound_bank")->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000);
1497   
1497
14981498   save_item(NAME(m_sound_data));
14991499}
15001500
trunk/src/mame/drivers/eolith16.c
r243189r243190
2525
2626   UINT16 *m_vram;
2727   int m_vbuffer;
28   
28
2929   DECLARE_WRITE16_MEMBER(eeprom_w);
3030   DECLARE_READ16_MEMBER(eolith16_custom_r);
3131   DECLARE_WRITE16_MEMBER(vram_w);
3232   DECLARE_READ16_MEMBER(vram_r);
33   
33
3434   DECLARE_DRIVER_INIT(eolith16);
3535   DECLARE_VIDEO_START(eolith16);
3636   DECLARE_PALETTE_INIT(eolith16);
37   
37
3838   UINT32 screen_update_eolith16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3939};
4040
trunk/src/mame/drivers/eolithsp.c
r243189r243190
8484      }
8585      n_game++;
8686   }
87   
87
8888   save_item(NAME(m_speedup_vblank));
8989   save_item(NAME(m_speedup_scanline));
9090}
trunk/src/mame/drivers/exidy.c
r243189r243190
187187WRITE8_MEMBER(exidy_state::fax_bank_select_w)
188188{
189189   membank("bank1")->set_entry(data & 0x1f);
190   
190
191191   if ((data & 0x1f) > 0x17)
192192      logerror("Banking to unpopulated ROM bank %02X!\n", data & 0x1f);
193   
193
194194}
195195
196196
trunk/src/mame/drivers/funkball.c
r243189r243190
356356static ADDRESS_MAP_START( flashbank_map, AS_PROGRAM, 32, funkball_state )
357357   AM_RANGE(0x00000000, 0x003fffff) AM_DEVREADWRITE16("u29", intel_28f320j5_device, read, write, 0xffffffff ) // needed to boot
358358   AM_RANGE(0x00400000, 0x007fffff) AM_DEVREADWRITE16("u30", intel_28f320j5_device, read, write, 0xffffffff ) // i assume it maps directly after
359//   AM_RANGE(0x02000000, 0x023fffff) AM_DEVREADWRITE16("u3", intel_28f320j5_device, read, write, 0xffffffff ) // sound program, don't think it matters where we map it, might not even be visible in this space
359//  AM_RANGE(0x02000000, 0x023fffff) AM_DEVREADWRITE16("u3", intel_28f320j5_device, read, write, 0xffffffff ) // sound program, don't think it matters where we map it, might not even be visible in this space
360360   /* it checks for 64MBit chips at 0x80000000 the way things are set up, they must return an intel Flash ID of 0x15 */
361361ADDRESS_MAP_END
362362
trunk/src/mame/drivers/galaxian.c
r243189r243190
14991499   AM_RANGE(0x1200, 0x12ff) AM_MIRROR(0x0100) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram")
15001500   AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x03ff) AM_READ(watchdog_reset_r)
15011501   AM_RANGE(0x4000, 0xbfff) AM_ROM
1502//   AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
1503//   AM_RANGE(0xc100, 0xc103) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
1502//  AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
1503//  AM_RANGE(0xc100, 0xc103) AM_MIRROR(0x3efc) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
15041504ADDRESS_MAP_END
15051505
15061506static ADDRESS_MAP_START( anteaterg_map, AS_PROGRAM, 8, galaxian_state )
trunk/src/mame/drivers/gticlub.c
r243189r243190
281281   optional_device<k001006_device> m_k001006_2;
282282   optional_device<k001604_device> m_k001604_1;
283283   optional_device<k001604_device> m_k001604_2;
284   
284
285285   required_shared_ptr<UINT32> m_work_ram;
286286   required_shared_ptr<UINT32> m_generic_paletteram_32;
287   
287
288288   optional_ioport m_analog0, m_analog1, m_analog2, m_analog3;
289   
289
290290   required_ioport_array<4> m_ports;
291   
291
292292   DECLARE_IOPORT_ARRAY(ports);
293293
294294   DECLARE_WRITE32_MEMBER(paletteram32_w);
trunk/src/mame/drivers/gts80a.c
r243189r243190
427427ADDRESS_MAP_END
428428
429429static ADDRESS_MAP_START( video_io_map, AS_IO, 8, caveman_state )
430//   AM_RANGE(0x000, 0x002) AM_READWRITE() // 8259 irq controller
431//   AM_RANGE(0x100, 0x102) AM_READWRITE() // HD46505
432//   AM_RANGE(0x200, 0x200) AM_READWRITE() // 8212 in, ?? out
433//   AM_RANGE(0x300, 0x300) AM_READWRITE() // soundlatch (command?) in, ?? out
430//  AM_RANGE(0x000, 0x002) AM_READWRITE() // 8259 irq controller
431//  AM_RANGE(0x100, 0x102) AM_READWRITE() // HD46505
432//  AM_RANGE(0x200, 0x200) AM_READWRITE() // 8212 in, ?? out
433//  AM_RANGE(0x300, 0x300) AM_READWRITE() // soundlatch (command?) in, ?? out
434434
435//   AM_RANGE(0x400, 0x400) AM_READ() // joystick inputs
436//   AM_RANGE(0x500, 0x506) AM_WRITE() // palette
435//  AM_RANGE(0x400, 0x400) AM_READ() // joystick inputs
436//  AM_RANGE(0x500, 0x506) AM_WRITE() // palette
437437
438438ADDRESS_MAP_END
439439
trunk/src/mame/drivers/model2.c
r243189r243190
24912491
24922492static MACHINE_CONFIG_DERIVED( model2a_0229, model2a )
24932493   MCFG_DEVICE_ADD("317_0229", SEGA315_5838_COMP, 0)
2494//   MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback)
2494//  MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback)
24952495MACHINE_CONFIG_END
24962496
24972497READ8_MEMBER(model2_state::driveio_port_r)
r243189r243190
25992599
26002600static MACHINE_CONFIG_DERIVED( model2b_0229, model2b )
26012601   MCFG_DEVICE_ADD("317_0229", SEGA315_5838_COMP, 0)
2602//   MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback)
2602//  MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback)
26032603MACHINE_CONFIG_END
26042604
26052605
r243189r243190
58905890ROM_END
58915891
58925892DRIVER_INIT_MEMBER(model2_state,genprot)
5893{   
5893{
58945894   //astring key = parameter(":315_5881:key");
58955895   m_maincpu->space(AS_PROGRAM).install_ram(0x01d80000, 0x01d8ffff);
58965896   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01d90000, 0x01d9ffff, read32_delegate(FUNC(model2_state::model2_5881prot_r), this), write32_delegate(FUNC(model2_state::model2_5881prot_w), this));
r243189r243190
59475947
59485948DRIVER_INIT_MEMBER(model2_state,sgt24h)
59495949{
5950//   DRIVER_INIT_CALL(genprot);
5950//  DRIVER_INIT_CALL(genprot);
59515951
59525952   m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x01a10000, 0x01a1ffff, read32_delegate(FUNC(model2_state::jaleco_network_r),this), write32_delegate(FUNC(model2_state::jaleco_network_w),this));
59535953
r243189r243190
59655965DRIVER_INIT_MEMBER(model2_state,doa)
59665966{
59675967   m_0229crypt->install_doa_protection();
5968   
5968
59695969   UINT32 *ROM = (UINT32 *)memregion("maincpu")->base();
59705970   ROM[0x630/4] = 0x08000004;
59715971   ROM[0x808/4] = 0x08000004;
trunk/src/mame/drivers/model3.c
r243189r243190
16961696      {
16971697         UINT8* base;
16981698         retvalue = m_cryptdevice->do_decrypt(base);
1699         //   retvalue = ((retvalue & 0xff00) >> 8) | ((retvalue & 0x00ff) << 8); // don't endian swap the return value on this hardware
1699         //  retvalue = ((retvalue & 0xff00) >> 8) | ((retvalue & 0x00ff) << 8); // don't endian swap the return value on this hardware
17001700         retvalue <<= 16;
17011701      }
17021702
1703   //   printf("model3_5881prot_r offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff));
1703   //  printf("model3_5881prot_r offset %08x : %08x%08x (%08x%08x)\n", offset * 8, (UINT32)(retvalue >> 32), (UINT32)(retvalue & 0xffffffff), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask & 0xffffffff));
17041704   }
17051705   else
17061706   {
r243189r243190
55845584      dat = m_maincpu->space().read_word((0xf0180000 + 4 * addr)); // every other word is unused in this RAM, probably 32-bit ram on 64-bit bus?
55855585   }
55865586
5587//   dat = ((dat & 0xff00) >> 8) | ((dat & 0x00ff) << 8);
5588//   printf("reading %04x\n", dat);
5587//  dat = ((dat & 0xff00) >> 8) | ((dat & 0x00ff) << 8);
5588//  printf("reading %04x\n", dat);
55895589
55905590   return dat;
55915591}
r243189r243190
56295629
56305630DRIVER_INIT_MEMBER(model3_state, genprot)
56315631{
5632//   astring key = parameter(":315_5881:key");
5632//  astring key = parameter(":315_5881:key");
56335633
56345634   m_maincpu->space(AS_PROGRAM).install_ram(0xf0180000, 0xf019ffff, 0, 0x0e000000);
56355635
5636   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) );                   
5636   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) );
56375637
56385638}
56395639
r243189r243190
58465846
58475847DRIVER_INIT_MEMBER(model3_state,swtrilgy)
58485848{
5849
58505849   UINT32 *rom = (UINT32*)memregion("user1")->base();
58515850   DRIVER_INIT_CALL(model3_20);
58525851
r243189r243190
58905889
58915890DRIVER_INIT_MEMBER(model3_state,daytona2)
58925891{
5893//   UINT32 *rom = (UINT32*)memregion("user1")->base();
5892//  UINT32 *rom = (UINT32*)memregion("user1")->base();
58945893   DRIVER_INIT_CALL(model3_20);
58955894
58965895   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
r243189r243190
59065905
59075906DRIVER_INIT_MEMBER(model3_state,dayto2pe)
59085907{
5909//   UINT32 *rom = (UINT32*)memregion("user1")->base();
5908//  UINT32 *rom = (UINT32*)memregion("user1")->base();
59105909   DRIVER_INIT_CALL(model3_20);
59115910
59125911   m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this));
59135912   m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" );
59145913
5915//   rom[(0x606784^4)/4] = 0x60000000;
5916//   rom[(0x69a3fc^4)/4] = 0x60000000;       // jump to encrypted code
5917//   rom[(0x618b28^4)/4] = 0x60000000;       // jump to encrypted code
5914//  rom[(0x606784^4)/4] = 0x60000000;
5915//  rom[(0x69a3fc^4)/4] = 0x60000000;       // jump to encrypted code
5916//  rom[(0x618b28^4)/4] = 0x60000000;       // jump to encrypted code
59185917
5919//   rom[(0x64ca34^4)/4] = 0x60000000;       // dec
5918//  rom[(0x64ca34^4)/4] = 0x60000000;       // dec
59205919
59215920   DRIVER_INIT_CALL(genprot);
59225921}
trunk/src/mame/drivers/overdriv.c
r243189r243190
475475
476476GAMEL( 1990, overdriv,         0, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 1)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
477477GAMEL( 1990, overdriva, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 2)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
478GAMEL( 1990, overdrivb, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 3)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
No newline at end of file
478GAMEL( 1990, overdrivb, overdriv, overdriv, overdriv, driver_device, 0, ROT90, "Konami", "Over Drive (set 3)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE, layout_overdriv )
trunk/src/mame/drivers/psychic5.c
r243189r243190
947947GAME( 1987, psychic5,  0,        psychic5, psychic5, driver_device, 0, ROT270, "Jaleco / NMK", "Psychic 5 (World)", 0 ) // "Oversea's version V2.00 CHANGED BY TAMIO NAKASATO" text present in ROM, various modifications (English names, more complete attract demo etc.)
948948GAME( 1987, psychic5j, psychic5, psychic5, psychic5, driver_device, 0, ROT270, "Jaleco / NMK", "Psychic 5 (Japan)", 0 )
949949GAME( 1988, bombsa,    0,        bombsa,   bombsa,   driver_device, 0, ROT270, "Jaleco", "Bombs Away", GAME_NOT_WORKING )
950
trunk/src/mame/drivers/seta2.c
r243189r243190
15841584   PORT_DIPSETTING(      0x0040, DEF_STR( 1C_5C ) )
15851585   PORT_DIPSETTING(      0x0000, "1 Coin/10 Credits" )
15861586
1587   PORT_START("DSW2")  // $400302.w   PORT_START("DSW2")  // $400302.w
1587   PORT_START("DSW2")  // $400302.w    PORT_START("DSW2")  // $400302.w
15881588   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1")  // used
15891589   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
15901590   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r243189r243190
16481648
16491649static INPUT_PORTS_START( endrichs )
16501650   PORT_INCLUDE(reelquak)
1651   
1651
16521652   PORT_MODIFY("DSW1")  // $400300.w
16531653   PORT_DIPNAME( 0x0001, 0x0001, "Payout Style" ) PORT_DIPLOCATION("SW1:1")
16541654   PORT_DIPSETTING(      0x0001, "Normal Payout" )
trunk/src/mame/drivers/stv.c
r243189r243190
18441844   ROM_LOAD16_WORD_SWAP( "mpr20833.9",     0x2000000, 0x0400000, CRC(cb6af231) SHA1(4a2e5d7c2fd6179c19cdefa84a03f9a34fbb9e70) ) // good (was .19s)
18451845
18461846   // 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!)
1847   ROM_PARAMETER( ":315_5881:key", "052e2901" )
1847   ROM_PARAMETER( ":315_5881:key", "052e2901" )
18481848ROM_END
18491849
18501850ROM_START( bakubaku )
trunk/src/mame/drivers/taitottl.c
r243189r243190
226226 MS06   M8  74s287      missile animated graphics
227227 MS05   11F IM5610      200pt tank R->L graphic
228228 MS05   11E IM5610      200pt tank L->R graphic
229 MS04   N7  IM5610       player missile trajectory pattern
229 MS04   N7  IM5610      player missile trajectory pattern
230230 MS03   F3  IM5610      anti-missile ack-ack graphics
231231 MS02   L12 IM5610      missile left/right position
232232 MS01   D8  IM5610      100pt tanks graphics
233
233
234234*/
235235
236236ROM_START( missilex )
237237   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 )
238238
239239   ROM_REGION( 0x0800, "roms", ROMREGION_ERASE00 )
240   ROM_LOAD( "cr11.4l",      0x0000, 0x0200, CRC(3d10a407) SHA1(1a85581c34d7e6766eaebbcc9895ed0ab2f94387) )
240   ROM_LOAD( "cr11.4l",      0x0000, 0x0200, CRC(3d10a407) SHA1(1a85581c34d7e6766eaebbcc9895ed0ab2f94387) )
241241   ROM_LOAD( "ms09.6f",      0x0000, 0x0200, CRC(80787642) SHA1(9de2419f0ba16f9c2b06e417c1ebba441fdae053) )
242   ROM_LOAD( "ms08.2c",      0x0000, 0x0200, CRC(dd785590) SHA1(7ba6b6f6091595852d6feaef5a029b2aca684440) )
243   ROM_LOAD( "ms07.8n",      0x0000, 0x0200, CRC(e278d03a) SHA1(c40975e5807936fed40cda4a6881f6aef0e7f350) )
244   ROM_LOAD( "ms06.8m",      0x0000, 0x0200, CRC(fe6c9192) SHA1(d110e010cf685ee18479ca7f890fa9da2fa71603) )
245   ROM_LOAD( "ms05.11f",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
246   ROM_LOAD( "ms05.11e",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
247   ROM_LOAD( "ms04.7n",      0x0000, 0x0020, CRC(34d0bee4) SHA1(41848def6aeb128ec985c158f3ed01c5b20bdcf6) )
248   ROM_LOAD( "ms03.3f",      0x0000, 0x0020, CRC(d139f5fa) SHA1(29c05143d05553c2cb2831f9624f307f59436850) )
249   ROM_LOAD( "ms02.12l",     0x0000, 0x0020, CRC(157b7e68) SHA1(d1a98267af1562e6126faaf0850906224f8a608d) )
250   ROM_LOAD( "ms01.8d",      0x0000, 0x0020, CRC(e89e76c3) SHA1(1149b5d1f93baa8aecd54a618083cc13b63a894d) )
242   ROM_LOAD( "ms08.2c",      0x0000, 0x0200, CRC(dd785590) SHA1(7ba6b6f6091595852d6feaef5a029b2aca684440) )
243   ROM_LOAD( "ms07.8n",      0x0000, 0x0200, CRC(e278d03a) SHA1(c40975e5807936fed40cda4a6881f6aef0e7f350) )
244   ROM_LOAD( "ms06.8m",      0x0000, 0x0200, CRC(fe6c9192) SHA1(d110e010cf685ee18479ca7f890fa9da2fa71603) )
245   ROM_LOAD( "ms05.11f",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
246   ROM_LOAD( "ms05.11e",     0x0000, 0x0020, CRC(845fe0cc) SHA1(ce8db615c1f7be242fc2ee25c1ef75e8608a771a) )
247   ROM_LOAD( "ms04.7n",      0x0000, 0x0020, CRC(34d0bee4) SHA1(41848def6aeb128ec985c158f3ed01c5b20bdcf6) )
248   ROM_LOAD( "ms03.3f",      0x0000, 0x0020, CRC(d139f5fa) SHA1(29c05143d05553c2cb2831f9624f307f59436850) )
249   ROM_LOAD( "ms02.12l",     0x0000, 0x0020, CRC(157b7e68) SHA1(d1a98267af1562e6126faaf0850906224f8a608d) )
250   ROM_LOAD( "ms01.8d",      0x0000, 0x0020, CRC(e89e76c3) SHA1(1149b5d1f93baa8aecd54a618083cc13b63a894d) )
251251ROM_END
252252
253253
trunk/src/mame/drivers/tourtabl.c
r243189r243190
2121      m_maincpu(*this, "maincpu") { }
2222
2323   required_device<cpu_device> m_maincpu;
24   
24
2525   DECLARE_WRITE8_MEMBER(tourtabl_led_w);
2626   DECLARE_READ16_MEMBER(tourtabl_read_input_port);
2727   DECLARE_READ8_MEMBER(tourtabl_get_databus_contents);
trunk/src/mame/drivers/twinkle.c
r243189r243190
669669
670670WRITE8_MEMBER(twinkle_state::shared_psx_w)
671671{
672//   printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
672//  printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
673673
674674   m_spu_shared[offset] = data;
675675
676676   if (offset == 0x03fe && data == 0xff)
677677   {
678//      printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]);
678//      printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]);
679679
680680      m_audiocpu->set_input_line(M68K_IRQ_4, HOLD_LINE);
681681   }
r243189r243190
785785            //           work for us until we figure out what's actually going on.
786786            if (m_spu_ata_dma < 0x200000)
787787            {
788               m_waveram[m_spu_ata_dma++] = data;
788               m_waveram[m_spu_ata_dma++] = data;
789789            }
790790         }
791791
r243189r243190
808808{
809809   UINT16 result = m_spu_shared[offset];
810810
811//   printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
811//  printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
812812
813813   return result;
814814}
815815
816816WRITE16_MEMBER(twinkle_state::shared_68k_w)
817817{
818//   printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
818//  printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
819819
820820   m_spu_shared[offset] = data & 0xff;
821821}
822822
823823READ16_MEMBER(twinkle_state::unk_68k_r)
824824{
825   return 0xffff;   // must return 0xff for 68000 POST to complete properly
825   return 0xffff;  // must return 0xff for 68000 POST to complete properly
826826}
827827
828828static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state )
r243189r243190
840840   AM_RANGE(0x34000e, 0x34000f) AM_WRITENOP
841841   AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)
842842   AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w )
843   AM_RANGE(0xfe0000, 0xffffff) AM_RAM   // ...and the RAM test checks this last 128k (mirror of the work RAM at 0x100000?)
843   AM_RANGE(0xfe0000, 0xffffff) AM_RAM // ...and the RAM test checks this last 128k (mirror of the work RAM at 0x100000?)
844844ADDRESS_MAP_END
845845
846846/* SCSI */
trunk/src/mame/drivers/vegaeo.c
r243189r243190
2626
2727   UINT32 *m_vega_vram;
2828   UINT8 m_vega_vbuffer;
29   
29
3030   DECLARE_WRITE32_MEMBER(vega_vram_w);
3131   DECLARE_READ32_MEMBER(vega_vram_r);
3232   DECLARE_WRITE32_MEMBER(vega_misc_w);
trunk/src/mame/drivers/vicdual.c
r243189r243190
35353535GAME( 1981, pulsar,     0,        pulsar,    pulsar,    driver_device, 0, ROT270, "Sega", "Pulsar", GAME_IMPERFECT_SOUND )
35363536GAME( 1979, heiankyo,   0,        heiankyo,  heiankyo,  driver_device, 0, ROT270, "Denki Onkyo", "Heiankyo Alien", GAME_NO_SOUND )
35373537GAME( 19??, alphaho,    0,        alphaho,   alphaho,   driver_device, 0, ROT270, "Data East Corporation", "Alpha Fighter / Head On", GAME_WRONG_COLORS | GAME_NO_SOUND )
3538
trunk/src/mame/includes/bogeyman.h
r243189r243190
2121      m_colorram(*this, "colorram"),
2222      m_colorram2(*this, "colorram2"),
2323      m_spriteram(*this, "spriteram")  { }
24   
24
2525   /* devices */
2626   required_device<cpu_device> m_maincpu;
2727   required_device<gfxdecode_device> m_gfxdecode;
2828   required_device<palette_device> m_palette;
2929   required_device<ay8910_device> m_ay1;
3030   required_device<ay8910_device> m_ay2;
31   
31
3232   /* memory pointers */
3333   required_shared_ptr<UINT8> m_videoram;
3434   required_shared_ptr<UINT8> m_videoram2;
r243189r243190
4545   int        m_psg_latch;
4646   int        m_last_write;
4747   int        m_colbank;
48   
48
4949   DECLARE_WRITE8_MEMBER(ay8910_latch_w);
5050   DECLARE_WRITE8_MEMBER(ay8910_control_w);
5151   DECLARE_WRITE8_MEMBER(videoram_w);
r243189r243190
5454   DECLARE_WRITE8_MEMBER(colorram2_w);
5555   DECLARE_WRITE8_MEMBER(paletteram_w);
5656   DECLARE_WRITE8_MEMBER(colbank_w);
57   
57
5858   TILE_GET_INFO_MEMBER(get_bg_tile_info);
5959   TILE_GET_INFO_MEMBER(get_fg_tile_info);
60   
60
6161   virtual void machine_start();
6262   virtual void machine_reset();
6363   virtual void video_start();
64   
64
6565   DECLARE_PALETTE_INIT(bogeyman);
6666   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/includes/calomega.h
r243189r243190
5151   TILE_GET_INFO_MEMBER(get_bg_tile_info);
5252   UINT32 screen_update_calomega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5353   DECLARE_PALETTE_INIT(calomega);
54   
54
5555protected:
5656   virtual void video_start();
5757
r243189r243190
6464
6565   required_shared_ptr<UINT8> m_videoram;
6666   required_shared_ptr<UINT8> m_colorram;
67   
67
6868   optional_ioport m_in0;
6969   optional_ioport m_in0_0;
7070   optional_ioport m_in0_1;
r243189r243190
7272   optional_ioport m_in0_3;
7373   optional_ioport m_frq;
7474   optional_ioport m_sw2;
75     
75
7676   UINT8 m_tx_line;
7777   int m_s903_mux_data;
7878   int m_s905_mux_data;
trunk/src/mame/includes/dec0.h
r243189r243190
2424      m_paletteram(*this, "palette"),
2525      m_robocop_shared_ram(*this, "robocop_shared"),
2626      m_hippodrm_shared_ram(*this, "hippodrm_shared") { }
27     
27
2828   required_device<cpu_device> m_maincpu;
2929   required_device<cpu_device> m_audiocpu;
3030   optional_device<cpu_device> m_subcpu;
r243189r243190
7777   DECLARE_READ16_MEMBER(ffantasybl_242024_r);
7878   DECLARE_WRITE_LINE_MEMBER(sound_irq);
7979   DECLARE_WRITE_LINE_MEMBER(sound_irq2);
80   
80
8181   DECLARE_DRIVER_INIT(robocop);
8282   DECLARE_DRIVER_INIT(hippodrm);
8383   DECLARE_DRIVER_INIT(hbarrel);
r243189r243190
8686   DECLARE_DRIVER_INIT(baddudes);
8787   DECLARE_DRIVER_INIT(midresb);
8888   DECLARE_DRIVER_INIT(ffantasybl);
89   
89
9090   virtual void machine_start();
9191   DECLARE_MACHINE_RESET(slyspy);
9292   DECLARE_VIDEO_START(dec0);
9393   DECLARE_VIDEO_START(dec0_nodma);
94   
94
9595   UINT32 screen_update_hbarrel(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9696   UINT32 screen_update_baddudes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9797   UINT32 screen_update_birdtry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
r243189r243190
9999   UINT32 screen_update_hippodrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
100100   UINT32 screen_update_slyspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101101   UINT32 screen_update_midres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102   
102
103103   void baddudes_i8751_write(int data);
104104   void birdtry_i8751_write(int data);
105105   void dec0_i8751_write(int data);
r243189r243190
118118   UINT8 m_automat_adpcm_byte;
119119   int m_automat_msm5205_vclk_toggle;
120120   UINT16 m_automat_scroll_regs[4];
121   
121
122122   DECLARE_WRITE16_MEMBER(automat_control_w);
123123   DECLARE_WRITE8_MEMBER(automat_adpcm_w);
124124   DECLARE_READ16_MEMBER( automat_palette_r );
r243189r243190
128128      COMBINE_DATA(&m_automat_scroll_regs[offset]);
129129   }
130130   DECLARE_WRITE_LINE_MEMBER(automat_vclk_cb);
131   
131
132132   virtual void machine_start();
133   
133
134134   UINT32 screen_update_automat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
135135   UINT32 screen_update_secretab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
136136};
trunk/src/mame/includes/dynax.h
r243189r243190
213213   DECLARE_WRITE8_MEMBER(jantouki_blitter2_rev2_w);
214214   DECLARE_WRITE8_MEMBER(hanamai_priority_w);
215215   DECLARE_WRITE8_MEMBER(tenkai_priority_w);
216   
216
217217   DECLARE_DRIVER_INIT(mjelct3);
218218   DECLARE_DRIVER_INIT(blktouch);
219219   DECLARE_DRIVER_INIT(mjelct3a);
220220   DECLARE_DRIVER_INIT(mjreach);
221221   DECLARE_DRIVER_INIT(maya);
222   
222
223223   UINT32 screen_update_hanamai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
224224   UINT32 screen_update_hnoridur(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
225225   UINT32 screen_update_sprtmtch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
226226   UINT32 screen_update_mjdialq2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
227227   UINT32 screen_update_jantouki_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
228228   UINT32 screen_update_jantouki_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
229   
229
230230   INTERRUPT_GEN_MEMBER(sprtmtch_vblank_interrupt);
231231   INTERRUPT_GEN_MEMBER(jantouki_vblank_interrupt);
232232   INTERRUPT_GEN_MEMBER(jantouki_sound_vblank_interrupt);
233233   INTERRUPT_GEN_MEMBER(yarunara_clock_interrupt);
234234   INTERRUPT_GEN_MEMBER(mjelctrn_vblank_interrupt);
235   
235
236236   TIMER_DEVICE_CALLBACK_MEMBER(neruton_irq_scanline);
237237   TIMER_DEVICE_CALLBACK_MEMBER(majxtal7_vblank_interrupt);
238238   TIMER_DEVICE_CALLBACK_MEMBER(tenkai_interrupt);
239   
239
240240   void tenkai_update_rombank();
241241   void gekisha_bank_postload();
242   
242
243243   DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback);
244244   DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback);
245245   DECLARE_WRITE_LINE_MEMBER(adpcm_int);
r243189r243190
268268   DECLARE_VIDEO_START(mcnpshnt);
269269   DECLARE_PALETTE_INIT(janyuki);
270270   DECLARE_VIDEO_START(neruton);
271   
271
272272   inline void blitter_plot_pixel( int layer, int mask, int x, int y, int pen, int wrap, int flags );
273273   int blitter_drawgfx( int layer, int mask, const char *gfx, int src, int pen, int x, int y, int wrap, int flags );
274274   void dynax_blitter_start( int flags );
trunk/src/mame/includes/eolith.h
r243189r243190
2727   optional_device<qs1000_device> m_qs1000;
2828   required_device<screen_device> m_screen;
2929   required_device<palette_device> m_palette;
30   
30
3131   optional_ioport m_in0; // klondkp doesn't have it
3232   optional_ioport m_eepromoutport;
3333   optional_ioport m_penx1port;
3434   optional_ioport m_peny1port;
3535   optional_ioport m_penx2port;
3636   optional_ioport m_peny2port;
37   
37
3838   optional_memory_bank m_sndbank;
39   
39
4040   int m_coin_counter_bit;
4141   int m_buffer;
4242   UINT32 *m_vram;
4343
4444   UINT8 m_sound_data;
45   
45
4646   // speedups - see machine/eolithsp.c
4747   int m_speedup_address;
4848   int m_speedup_address2;
r243189r243190
6666   DECLARE_READ8_MEMBER(qs1000_p1_r);
6767   DECLARE_WRITE8_MEMBER(qs1000_p1_w);
6868   DECLARE_WRITE8_MEMBER(soundcpu_to_qs1000);
69   
69
7070   DECLARE_DRIVER_INIT(eolith);
7171   DECLARE_DRIVER_INIT(landbrk);
7272   DECLARE_DRIVER_INIT(hidctch3);
7373   DECLARE_DRIVER_INIT(hidctch2);
7474   DECLARE_DRIVER_INIT(hidnc2k);
7575   DECLARE_DRIVER_INIT(landbrka);
76   
76
7777   DECLARE_MACHINE_RESET(eolith);
7878   DECLARE_VIDEO_START(eolith);
79   
79
8080   UINT32 screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
81   
81
8282   TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup);
8383};
trunk/src/mame/includes/exidy.h
r243189r243190
5757   required_device<gfxdecode_device> m_gfxdecode;
5858   required_device<screen_device> m_screen;
5959   required_device<palette_device> m_palette;
60   
60
6161   required_shared_ptr<UINT8> m_videoram;
6262   required_shared_ptr<UINT8> m_sprite1_xpos;
6363   required_shared_ptr<UINT8> m_sprite1_ypos;
r243189r243190
7777   bitmap_ind16 m_motion_object_1_vid;
7878   bitmap_ind16 m_motion_object_2_vid;
7979   bitmap_ind16 m_motion_object_2_clip;
80   
80
8181   DECLARE_WRITE8_MEMBER(fax_bank_select_w);
8282   DECLARE_READ8_MEMBER(exidy_interrupt_r);
83   
83
8484   DECLARE_CUSTOM_INPUT_MEMBER(teetert_input_r);
85   
85
8686   DECLARE_DRIVER_INIT(fax);
8787   DECLARE_DRIVER_INIT(sidetrac);
8888   DECLARE_DRIVER_INIT(pepper2);
r243189r243190
9393   DECLARE_DRIVER_INIT(venture);
9494   DECLARE_DRIVER_INIT(spectar);
9595   DECLARE_DRIVER_INIT(phantoma);
96   
96
9797   virtual void video_start();
9898   DECLARE_MACHINE_START(teetert);
99   
99
100100   UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
101   
101
102102   INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt);
103   
103
104104   void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
105105   inline void latch_condition(int collision);
106106   inline void set_1_color(int index, int which);
trunk/src/mame/includes/hyhoo.h
r243189r243190
3232   int m_highcolorflag;
3333   int m_flipscreen;
3434   bitmap_rgb32 m_tmpbitmap;
35   
35
3636   DECLARE_WRITE8_MEMBER(hyhoo_blitter_w);
3737   DECLARE_WRITE8_MEMBER(hyhoo_romsel_w);
38   
38
3939   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r);
40   
40
4141   virtual void video_start();
42   
42
4343   UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4444   void hyhoo_gfxdraw();
4545
trunk/src/mame/includes/m58.h
r243189r243190
1313      m_scroll_x_high(*this, "scroll_x_high"),
1414      m_scroll_y_low(*this, "scroll_y_low"),
1515      m_score_panel_disabled(*this, "score_disable") { }
16   
16
1717   /* devices */
1818   required_device<cpu_device> m_maincpu;
1919   required_device<gfxdecode_device> m_gfxdecode;
2020   required_device<screen_device> m_screen;
2121   required_device<palette_device> m_palette;
22   
22
2323   /* memory pointers */
2424   required_shared_ptr<UINT8> m_videoram;
2525   required_shared_ptr<UINT8> m_spriteram;
r243189r243190
3131   /* video-related */
3232   tilemap_t*             m_bg_tilemap;
3333   bitmap_ind16             m_scroll_panel_bitmap;
34   
34
3535   DECLARE_WRITE8_MEMBER(videoram_w);
3636   DECLARE_WRITE8_MEMBER(scroll_panel_w);
3737   DECLARE_WRITE8_MEMBER(flipscreen_w);
38   
38
3939   DECLARE_DRIVER_INIT(yard85);
4040   virtual void video_start();
4141   DECLARE_PALETTE_INIT(m58);
42   
42
4343   TILE_GET_INFO_MEMBER(get_bg_tile_info);
4444   TILEMAP_MAPPER_MEMBER(tilemap_scan_rows);
45   
45
4646   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4747   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
4848   void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect );
trunk/src/mame/includes/mario.h
r243189r243190
5454      m_discrete(*this, "discrete"),
5555#else
5656      m_audio_snd0(*this, "snd_nl:snd0"),
57        m_audio_snd7(*this, "snd_nl:snd7"),
58        m_audio_dac(*this, "snd_nl:dac"),
57      m_audio_snd7(*this, "snd_nl:snd7"),
58      m_audio_dac(*this, "snd_nl:dac"),
5959#endif
6060      m_spriteram(*this, "spriteram"),
6161      m_videoram(*this, "videoram"),
r243189r243190
7171   optional_device<discrete_device> m_discrete;
7272#else
7373   optional_device<netlist_mame_logic_input_t> m_audio_snd0;
74    optional_device<netlist_mame_logic_input_t> m_audio_snd7;
75    optional_device<netlist_mame_logic_input_t> m_audio_dac;
74   optional_device<netlist_mame_logic_input_t> m_audio_snd7;
75   optional_device<netlist_mame_logic_input_t> m_audio_dac;
7676#endif
7777
7878   /* memory pointers */
trunk/src/mame/includes/model2.h
r243189r243190
224224   DECLARE_WRITE32_MEMBER(copro_tgp_fifoout_push);
225225   DECLARE_READ8_MEMBER(virtuacop_lightgun_r);
226226   DECLARE_READ8_MEMBER(virtuacop_lightgun_offscreen_r);
227   
227
228228   UINT16 crypt_read_callback(UINT32 addr);
229229
230230   bool copro_fifoin_pop(device_t *device, UINT32 *result,UINT32 offset, UINT32 mem_mask);
trunk/src/mame/includes/nb1413m3.h
r243189r243190
129129
130130   // (static) configuration helpers
131131   static void set_type(device_t &device, int type) { downcast<nb1413m3_device &>(device).m_nb1413m3_type = type; }
132   
132
133133   enum
134134   {
135135      TIMER_CB
r243189r243190
169169   virtual void device_start();
170170   virtual void device_reset();
171171   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
172   
172
173173private:
174174
175175   int m_74ls193_counter;
trunk/src/mame/includes/paradise.h
r243189r243190
1616      m_videoram(*this, "videoram"),
1717      m_paletteram(*this, "paletteram"),
1818      m_spriteram(*this, "spriteram") { }
19     
19
2020   /* devices */
2121   required_device<cpu_device> m_maincpu;
2222   optional_device<okim6295_device> m_oki2;
r243189r243190
3636   tilemap_t *m_tilemap_0;
3737   tilemap_t *m_tilemap_1;
3838   tilemap_t *m_tilemap_2;
39   
39
4040   bitmap_ind16 m_tmpbitmap;
4141   UINT8 m_palbank;
4242   UINT8 m_priority;
4343   UINT8 m_pixbank;
4444   int m_sprite_inc;
4545   int m_irq_count;
46   
46
4747   DECLARE_WRITE8_MEMBER(paradise_rombank_w);
4848   DECLARE_WRITE8_MEMBER(torus_coin_counter_w);
4949   DECLARE_WRITE8_MEMBER(paradise_flipscreen_w);
r243189r243190
5656   DECLARE_WRITE8_MEMBER(paradise_pixmap_w);
5757   DECLARE_WRITE8_MEMBER(paradise_priority_w);
5858   DECLARE_WRITE8_MEMBER(paradise_okibank_w);
59   
59
6060   DECLARE_DRIVER_INIT(torus);
6161   DECLARE_DRIVER_INIT(paradise);
6262   DECLARE_DRIVER_INIT(tgtball);
63   
63
6464   TILE_GET_INFO_MEMBER(get_tile_info_0);
6565   TILE_GET_INFO_MEMBER(get_tile_info_1);
6666   TILE_GET_INFO_MEMBER(get_tile_info_2);
67   
67
6868   virtual void machine_start();
6969   virtual void machine_reset();
7070   virtual void video_start();
71   
71
7272   UINT32 screen_update_paradise(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7373   UINT32 screen_update_torus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7474   UINT32 screen_update_madball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75   
75
7676   INTERRUPT_GEN_MEMBER(paradise_irq);
77   
77
7878   void update_pix_palbank();
7979   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
8080};
trunk/src/mame/includes/pastelg.h
r243189r243190
3434   int m_palbank;
3535   UINT8 *m_videoram;
3636   int m_flipscreen_old;
37   
37
3838   DECLARE_READ8_MEMBER(pastelg_sndrom_r);
3939   DECLARE_READ8_MEMBER(pastelg_irq_ack_r);
4040   DECLARE_READ8_MEMBER(threeds_inputport1_r);
r243189r243190
4545   DECLARE_WRITE8_MEMBER(threeds_output_w);
4646   DECLARE_READ8_MEMBER(threeds_rom_readback_r);
4747   DECLARE_WRITE8_MEMBER(pastelg_romsel_w);
48   
48
4949   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r);
5050   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_hackbusyflag_r);
51   
51
5252   virtual void machine_start();
5353   virtual void video_start();
54   
54
5555   DECLARE_PALETTE_INIT(pastelg);
5656   UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5757   int pastelg_blitter_src_addr_r();
r243189r243190
6161protected:
6262   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
6363};
64
trunk/src/mame/includes/senjyo.h
r243189r243190
3636   required_device<dac_device> m_dac;
3737   required_device<gfxdecode_device> m_gfxdecode;
3838   required_device<palette_device> m_palette;
39   
39
4040   /* memory pointers */
4141   required_shared_ptr<UINT8> m_spriteram;
4242   required_shared_ptr<UINT8> m_fgscroll;
r243189r243190
5858   // game specific initialization
5959   int m_is_senjyo;
6060   int m_scrollhack;
61   
61
6262   UINT8 m_sound_cmd;
6363   int m_single_volume;
6464   int m_sound_state;
r243189r243190
6767   tilemap_t *m_bg1_tilemap;
6868   tilemap_t *m_bg2_tilemap;
6969   tilemap_t *m_bg3_tilemap;
70   
70
7171   DECLARE_WRITE8_MEMBER(flip_screen_w);
7272   DECLARE_WRITE8_MEMBER(paletteram_w);
7373   DECLARE_WRITE8_MEMBER(starforb_scrolly2);
r243189r243190
8282   DECLARE_WRITE8_MEMBER(sound_cmd_w);
8383   DECLARE_WRITE8_MEMBER(irq_ctrl_w);
8484   DECLARE_READ8_MEMBER(pio_pa_r);
85   
85
8686   DECLARE_DRIVER_INIT(starfora);
8787   DECLARE_DRIVER_INIT(senjyo);
8888   DECLARE_DRIVER_INIT(starfore);
8989   DECLARE_DRIVER_INIT(starforc);
90   
90
9191   TILE_GET_INFO_MEMBER(get_fg_tile_info);
9292   TILE_GET_INFO_MEMBER(senjyo_bg1_tile_info);
9393   TILE_GET_INFO_MEMBER(starforc_bg1_tile_info);
9494   TILE_GET_INFO_MEMBER(get_bg2_tile_info);
9595   TILE_GET_INFO_MEMBER(get_bg3_tile_info);
96   
96
9797   virtual void machine_start();
9898   virtual void machine_reset();
9999   virtual void video_start();
trunk/src/mame/includes/stadhero.h
r243189r243190
1919   required_device<deco_bac06_device> m_tilegen1;
2020   required_device<deco_mxc06_device> m_spritegen;
2121   required_device<gfxdecode_device> m_gfxdecode;
22   
22
2323   required_shared_ptr<UINT16> m_spriteram;
2424   required_shared_ptr<UINT16> m_pf1_data;
2525
2626   tilemap_t *m_pf1_tilemap;
27   
27
2828   DECLARE_WRITE16_MEMBER(stadhero_control_w);
2929   DECLARE_WRITE16_MEMBER(stadhero_pf1_data_w);
30   
30
3131   virtual void video_start();
32   
32
3333   TILE_GET_INFO_MEMBER(get_pf1_tile_info);
3434   UINT32 screen_update_stadhero(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3535};
trunk/src/mame/includes/stfight.h
r243189r243190
2828   required_device<msm5205_device> m_msm;
2929   required_device<gfxdecode_device> m_gfxdecode;
3030   required_device<palette_device> m_palette;
31   
31
3232   optional_shared_ptr<UINT8> m_text_char_ram;
3333   optional_shared_ptr<UINT8> m_text_attr_ram;
3434   optional_shared_ptr<UINT8> m_tx_vram;
trunk/src/mame/includes/stlforce.h
r243189r243190
3636   required_shared_ptr<UINT16> m_mhigh_scrollram;
3737   required_shared_ptr<UINT16> m_vidattrram;
3838   required_shared_ptr<UINT16> m_spriteram;
39   
39
4040   tilemap_t *m_bg_tilemap;
4141   tilemap_t *m_mlow_tilemap;
4242   tilemap_t *m_mhigh_tilemap;
4343   tilemap_t *m_tx_tilemap;
4444
4545   int m_sprxoffs;
46   
46
4747   DECLARE_WRITE16_MEMBER(stlforce_bg_videoram_w);
4848   DECLARE_WRITE16_MEMBER(stlforce_mlow_videoram_w);
4949   DECLARE_WRITE16_MEMBER(stlforce_mhigh_videoram_w);
5050   DECLARE_WRITE16_MEMBER(stlforce_tx_videoram_w);
5151   DECLARE_WRITE16_MEMBER(eeprom_w);
5252   DECLARE_WRITE16_MEMBER(oki_bank_w);
53   
53
5454   DECLARE_DRIVER_INIT(twinbrat);
5555   DECLARE_DRIVER_INIT(stlforce);
56   
56
5757   TILE_GET_INFO_MEMBER(get_stlforce_bg_tile_info);
5858   TILE_GET_INFO_MEMBER(get_stlforce_mlow_tile_info);
5959   TILE_GET_INFO_MEMBER(get_stlforce_mhigh_tile_info);
6060   TILE_GET_INFO_MEMBER(get_stlforce_tx_tile_info);
61   
61
6262   virtual void video_start();
6363   UINT32 screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6464   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
trunk/src/mame/includes/strnskil.h
r243189r243190
1515   required_device<cpu_device> m_subcpu;
1616   required_device<gfxdecode_device> m_gfxdecode;
1717   required_device<palette_device> m_palette;
18   
18
1919   required_shared_ptr<UINT8> m_videoram;
2020   required_shared_ptr<UINT8> m_xscroll;
2121   required_shared_ptr<UINT8> m_spriteram;
r243189r243190
2323   UINT8 m_scrl_ctrl;
2424   tilemap_t *m_bg_tilemap;
2525   UINT8 m_irq_source;
26   
26
2727   TIMER_DEVICE_CALLBACK_MEMBER(strnskil_irq);
2828
2929   DECLARE_READ8_MEMBER(strnskil_d800_r);
r243189r243190
3232   DECLARE_WRITE8_MEMBER(protection_w);
3333   DECLARE_WRITE8_MEMBER(strnskil_videoram_w);
3434   DECLARE_WRITE8_MEMBER(strnskil_scrl_ctrl_w);
35   
35
3636   DECLARE_DRIVER_INIT(banbam);
3737   DECLARE_DRIVER_INIT(pettanp);
38   
38
3939   TILE_GET_INFO_MEMBER(get_bg_tile_info);
40   
41   virtual void machine_start();   
40
41   virtual void machine_start();
4242   virtual void video_start();
4343   DECLARE_PALETTE_INIT(strnskil);
4444   UINT32 screen_update_strnskil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/includes/vaportra.h
r243189r243190
4444   DECLARE_WRITE16_MEMBER(vaportra_priority_w);
4545   DECLARE_WRITE16_MEMBER(vaportra_palette_24bit_rg_w);
4646   DECLARE_WRITE16_MEMBER(vaportra_palette_24bit_b_w);
47   
47
4848   DECLARE_DRIVER_INIT(vaportra);
4949   virtual void machine_start();
5050   virtual void machine_reset();
51   
51
5252   UINT32 screen_update_vaportra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5353   void update_24bitcol( int offset );
54   
54
5555   DECO16IC_BANK_CB_MEMBER(bank_callback);
5656};
trunk/src/mame/includes/xyonix.h
r243189r243190
99
1010   required_device<cpu_device> m_maincpu;
1111   required_device<gfxdecode_device> m_gfxdecode;
12   
12
1313   required_shared_ptr<UINT8> m_vidram;
14   
14
1515   tilemap_t *m_tilemap;
1616
1717   int m_e0_data;
1818   int m_credits;
1919   int m_coins;
2020   int m_prev_coin;
21   
21
2222   DECLARE_WRITE8_MEMBER(irqack_w);
2323   DECLARE_READ8_MEMBER(io_r);
2424   DECLARE_WRITE8_MEMBER(io_w);
2525   DECLARE_WRITE8_MEMBER(vidram_w);
26   
26
2727   virtual void machine_start();
2828   virtual void video_start();
2929   TILE_GET_INFO_MEMBER(get_tile_info);
3030   DECLARE_PALETTE_INIT(xyonix);
3131   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
32   
32
3333   void handle_coins(int coin);
3434};
trunk/src/mame/layout/gts80a_caveman.lay
r243189r243190
151151      <bezel name="text2" element="P4"><bounds left="100" right="180" top="90" bottom="102" /></bezel>
152152      <bezel name="text1" element="P5"><bounds left="100" right="180" top="150" bottom="162" /></bezel>
153153      <bezel name="text0" element="P6"><bounds left="100" right="180" top="210" bottom="222" /></bezel>
154   
154
155155      <screen index="0">
156156         <bounds x="320" y="0" width="320" height="240" />
157157      </screen>
158    </view>
158   </view>
159159</mamelayout>
trunk/src/mame/machine/315-5838_317-0229_comp.c
r243189r243190
11/* Sega Compression (and possibly encryption) device
22
3   315-5838 - Decathlete (ST-V)
4   317-0229 - Dead or Alive (Model 2A)
3    315-5838 - Decathlete (ST-V)
4    317-0229 - Dead or Alive (Model 2A)
55
6   Package Type: TQFP100
6    Package Type: TQFP100
77
8   This appears to be a dual channel compression chip, used in 1996, predating the 5881.
9   Decathlete uses it to compress ALL the game graphics, Dead or Alive uses it for a
10   dumb security check, decompressing a single string.
8    This appears to be a dual channel compression chip, used in 1996, predating the 5881.
9    Decathlete uses it to compress ALL the game graphics, Dead or Alive uses it for a
10    dumb security check, decompressing a single string.
1111
12   Each channel appears to be connected to a different set of ROMs, however there is
13   defintiely only a single 315-5838 chip. (could the different channels actually just
14   be mirror addresses, with part of the address determining the ROMs to use?)
12    Each channel appears to be connected to a different set of ROMs, however there is
13    defintiely only a single 315-5838 chip. (could the different channels actually just
14    be mirror addresses, with part of the address determining the ROMs to use?)
1515
16   Dead of Alive only uses a single channel, and has the source data in RAM, not ROM.
17   This is similar to how some 5881 games were set up, with the ST-V versions decrypting
18   data directly from ROM and the Model 2 ones using a RAM source buffer.
16    Dead of Alive only uses a single channel, and has the source data in RAM, not ROM.
17    This is similar to how some 5881 games were set up, with the ST-V versions decrypting
18    data directly from ROM and the Model 2 ones using a RAM source buffer.
1919
20   Looking at the values read I don't think there is any address based encryption, for
21   example many blocks where you'd expect a zero fill start with repeating patterns
22   of 8f708f70 (different lengths) channel would appear to relate to compressed 0x00 data
20    Looking at the values read I don't think there is any address based encryption, for
21    example many blocks where you'd expect a zero fill start with repeating patterns
22    of 8f708f70 (different lengths) channel would appear to relate to compressed 0x00 data
2323
24   read addr 0071253c, blah_r 8f708f70 - read count count 00000004
25   read addr 00712540, blah_r 8f708f70 - read count count 00000008
26   read addr 00712544, blah_r 8f708f70 - read count count 0000000c
27   read addr 00712548, blah_r 8f708f70 - read count count 00000010
28   read addr 0071254c, blah_r 8f708f70 - read count count 00000014
29   read addr 00712550, blah_r 8f708f70 - read count count 00000018
30   read addr 00712554, blah_r 8f708f70 - read count count 0000001c
24    read addr 0071253c, blah_r 8f708f70 - read count count 00000004
25    read addr 00712540, blah_r 8f708f70 - read count count 00000008
26    read addr 00712544, blah_r 8f708f70 - read count count 0000000c
27    read addr 00712548, blah_r 8f708f70 - read count count 00000010
28    read addr 0071254c, blah_r 8f708f70 - read count count 00000014
29    read addr 00712550, blah_r 8f708f70 - read count count 00000018
30    read addr 00712554, blah_r 8f708f70 - read count count 0000001c
3131
3232*/
3333
r243189r243190
9595
9696UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 mem_mask, int channel)
9797{
98//   UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base();
99//   UINT32 retvalue = 0xffff;
98//  UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base();
99//  UINT32 retvalue = 0xffff;
100100
101101   switch (m_channel[channel].m_srcoffset)
102102   {
r243189r243190
177177
178178void sega_315_5838_comp_device::set_prot_addr(UINT32 data, UINT32 mem_mask, int channel)
179179{
180//   printf("set_prot_addr\n");
180//  printf("set_prot_addr\n");
181181   COMBINE_DATA(&m_channel[channel].m_srcoffset);
182182
183183   //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",channel, m_channel[channel].m_decathlt_lastcount*4);
r243189r243190
361361   cpu->space(AS_PROGRAM).install_readwrite_handler(0x01d80000, 0x01dfffff, read32_delegate(FUNC(sega_315_5838_comp_device::doa_prot_r), this), write32_delegate(FUNC(sega_315_5838_comp_device::doa_prot_w), this));
362362   cpu->space(AS_PROGRAM).install_write_handler(0x01d87ff0, 0x01d87ff3, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_srcaddr_w), this)); // set compressed data source address (always set 0, data is in RAM)
363363   cpu->space(AS_PROGRAM).install_write_handler(0x01d87ff4, 0x01d87ff7, write32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_w_doa), this)); // upload tab
364//   cpu->space(AS_PROGRAM).install_read_handler(0x01d87ff8, 0x01d87ffb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_r), this)); // read decompressed data
364//  cpu->space(AS_PROGRAM).install_read_handler(0x01d87ff8, 0x01d87ffb, read32_delegate(FUNC(sega_315_5838_comp_device::decathlt_prot1_r), this)); // read decompressed data
365365
366}
No newline at end of file
366}
trunk/src/mame/machine/315-5881_crypt.c
r243189r243190
8282      {
8383         if (done_compression == 1)
8484            enc_start();
85           
8685
8786
87
8888         line_fill();
8989      }
9090      base = line_buffer + line_buffer_pos;
r243189r243190
176176
177177void key2label(uint32_t key)
178178{
179   int bcd0 = ((BIT(key,17)<<3)|(BIT(key,7)<<2)|(BIT(key,14)<<1)|BIT(key,19))^9;
180   int bcd1 = ((BIT(key,20)<<3)|(BIT(key,1)<<2)|(BIT(key,4)<<1)|BIT(key,13))^5;
181   int bcd2 = (BIT(key,9)<<1)|BIT(key,22);
182   int bcd3 = ((BIT(key,9)<<2)|BIT(key,9))^5;
183   
184   char chiplabel[13];
185   sprintf(chiplabel, "317-%d%d%d%d-%s", bcd3, bcd2, bcd1, bcd0, (BIT(key,5)?"JPN":"COM"));
186   
187   printf("%s", chiplabel);
179    int bcd0 = ((BIT(key,17)<<3)|(BIT(key,7)<<2)|(BIT(key,14)<<1)|BIT(key,19))^9;
180    int bcd1 = ((BIT(key,20)<<3)|(BIT(key,1)<<2)|(BIT(key,4)<<1)|BIT(key,13))^5;
181    int bcd2 = (BIT(key,9)<<1)|BIT(key,22);
182    int bcd3 = ((BIT(key,9)<<2)|BIT(key,9))^5;
183
184    char chiplabel[13];
185    sprintf(chiplabel, "317-%d%d%d%d-%s", bcd3, bcd2, bcd1, bcd0, (BIT(key,5)?"JPN":"COM"));
186
187    printf("%s", chiplabel);
188188}
189189
190190Given the use of the BCD-encoded security module labels, it's expected that at least other 6 additional bits be present in the
r243189r243190
196196
197197In the second Feistel Network, every key bit seem to be used at most once (the various uses of current bit #9 are fictitious, as
198198that bit really represent various bits in the real key; see comments on the use of the labels above). Given that, it seems probable
199that 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
199that 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
200200the bits provening from the game key, the sequence key and the result from the first feistel network (64+16+16=96). In the first
201201Feistel Network, as only 80 bits are available, some bits would be used twice (as can be partially seen in the current implementation).
202202The 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
r243189r243190
453453
454454      {
455455         {
456            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,           
456            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,
457457            // unused?
458458            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,
459459         },
r243189r243190
511511
512512const int sega_315_5881_crypt_device::fn1_game_key_scheduling[FN1GK][2] = {
513513   {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
514   {6,51},  {7,92},  {8,89},  {9,9},   {9,39},  {9,58},  {9,86},  {10,90},
514   {6,51},  {7,92},  {8,89},  {9,9},   {9,39},  {9,58},  {9,86},  {10,90},
515515   {11,6},  {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15}, {18,23},
516516   {18,43}, {19,82}, {20,81}, {21,32}, {22,5},  {23,66}, {24,13}, {24,45},
517517   {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25}
r243189r243190
680680
681681   prot_cur_address ++;
682682
683//   printf("get_decrypted_16 %04x\n", res);
683//  printf("get_decrypted_16 %04x\n", res);
684684
685685   return res;
686686}
r243189r243190
691691   block_pos = 0;
692692   done_compression = 0;
693693   buffer_pos = BUFFER_SIZE;
694   
694
695695   if (buffer_bit2 != 15) // if we have remaining bits in the decompression buffer we shouldn't read the next word yet but should instead use the bits we have?? (twcup98) (might just be because we should be pulling bytes not words?)
696696   {
697//      printf("buffer_bit2 is %d\n", buffer_bit2);
697//      printf("buffer_bit2 is %d\n", buffer_bit2);
698698      dec_header = (buffer2a & 0x0003) << 16;
699699   }
700700   else
r243189r243190
710710   // etc. after each block a new header must be read, it looks like compressed and uncompressed blocks
711711   // can be mixed like this, I don't know if the length is src length of decompressed length.
712712   // deathcox and others confirm format as 0x20000 bit as compressed bit, 0x1ff00 bits as block size 1, 0x000ff bits as block size 2
713   // for compressed streams the 'line size' is block size 1. 
713   // for compressed streams the 'line size' is block size 1.
714714
715715   block_numlines = ((dec_header & 0x000000ff) >> 0) + 1;
716716   int blocky = ((dec_header & 0x0001ff00) >> 8) + 1;
r243189r243190
824824
825825int sega_315_5881_crypt_device::get_compressed_bit()
826826{
827//   if(buffer_pos == BUFFER_SIZE)
828//      enc_fill();
827//  if(buffer_pos == BUFFER_SIZE)
828//      enc_fill();
829829
830830   if (buffer_bit2 == 15)
831831   {
r243189r243190
833833      buffer2a = get_decrypted_16();
834834      buffer2[0] = buffer2a;
835835      buffer2[1] = buffer2a >> 8;
836   //   block_pos+=2;
836   //  block_pos+=2;
837837      buffer_pos = 0;
838838
839839   }
r243189r243190
842842      buffer_bit2++;
843843   }
844844
845//   if (buffer_bit ==7) printf("using byte %02x\n", buffer2[(buffer_pos&1) ^ 1]);
845//  if (buffer_bit ==7) printf("using byte %02x\n", buffer2[(buffer_pos&1) ^ 1]);
846846
847847   int res = (buffer2[(buffer_pos&1)^1] >> buffer_bit) & 1;
848848   buffer_bit--;
trunk/src/mame/machine/dec0.c
r243189r243190
364364   RAM[0x1af] = 0x60; /* RTS prot area */
365365   RAM[0x1db] = 0x60; /* RTS prot area */
366366   RAM[0x21a] = 0x60; /* RTS prot area */
367   
367
368368   save_item(NAME(m_hippodrm_msb));
369369   save_item(NAME(m_hippodrm_lsb));
370370}
r243189r243190
377377   /* Slyspy sound cpu has some protection */
378378   RAM[0xf2d] = 0xea;
379379   RAM[0xf2e] = 0xea;
380   
380
381381   save_item(NAME(m_slyspy_state));
382382}
383383
trunk/src/mame/machine/stfight.c
r243189r243190
6363            ( ( ( src ^ A ) >> 1 ) & 0x08 ) |
6464            ( ~( ( src >> 6 ) ^ A ) & 0x01 );
6565   }
66   
66
6767}
6868
6969DRIVER_INIT_MEMBER(stfight_state,stfight)
trunk/src/mame/machine/stvprot.c
r243189r243190
3939         UINT16 res2 = m_cryptdevice->do_decrypt(base);
4040         res = ((res & 0xff00) >> 8) | ((res & 0x00ff) << 8);
4141         res2 = ((res2 & 0xff00) >> 8) | ((res2 & 0x00ff) << 8);
42           
43         return res2 | (res << 16);         
42
43         return res2 | (res << 16);
4444      }
4545      return m_a_bus[offset];
4646   }
trunk/src/mame/mame.lst
r243189r243190
209209warofbug        // (c) 1981 Armenia
210210warofbugu       // (c) 1981 Armenia
211211warofbugg       // German Version
212spactrai      //
212spactrai        //
213213redufo          // (c) Artic
214214redufob         // bootleg
215215exodus          // Subelectro - bootleg?
r243189r243190
26792679snowbrosd       // MIN16-02 (c) 1990 Toaplan + Dooyong license
26802680wintbob         // bootleg
26812681snowbroswb      //
2682toto         //
2682toto            //
26832683// modified snowbros 'clone' hardware
26842684honeydol        // (c) 1995 Barko Corp
26852685twinadv         // (c) 1995 Barko Corp
r243189r243190
34143414ddsomjr1        // 06/02/1996 (c) 1996 (Japan)
34153415ddsomj          // 19/06/1996 (c) 1996 (Japan)
34163416ddsoma          // 19/06/1996 (c) 1996 (Asia)
3417ddsomar1      // 08/02/1996 (c) 1996 (Asia)
3417ddsomar1        // 08/02/1996 (c) 1996 (Asia)
34183418ddsomh          // 23/02/1996 (c) 1996 (Hispanic)
34193419ddsomb          // 23/02/1996 (c) 1996 (Brazil)
34203420sfa2            // 06/03/1996 (c) 1996 (Euro)
r243189r243190
53815381sprtjam         // 2000.11.13 Sports Jam
53825382pjustic         // 2000.12 Moero Justice Gakuen / Project Justice
53835383samba2k         // 2000.12 Samba de Amigo Ver.2000
5384shaktam           // 2000.12.28 Shakatto Tambourine (Rev B)
5384shaktam         // 2000.12.28 Shakatto Tambourine (Rev B)
53855385            // 2000.?? Boat Race Ocean Heats
53865386csmash          // 2000.?? Cosmic Smash
53875387csmasho         // 2000.?? Cosmic Smash (original)
r243189r243190
67106710popn1           // GX803 (c) 1998 (Asia)
67116711//popn1j        // GX803 (c) 1998 (Japan)
67126712popn2           // GX831 (c) 1998 (Japan)
6713popn3            // GX980 (c) 1999 (Japan)
6713popn3           // GX980 (c) 1999 (Japan)
67146714//popnstex      // GX970 (c) 1999 (Japan)
67156715
67166716// Firebeat games
r243189r243190
69646964quantum1        // 136016           (c) 1982        // made by Gencomp
69656965quantump        // 136016           (c) 1982        // made by Gencomp
69666966bwidow          // 136017           (c) 1982
6967bwidowp         // (proto)         (c) 1982
6967bwidowp         // (proto)          (c) 1982
69686968starwars        // 136021           (c) 1983
69696969starwars1       // 136021           (c) 1983
69706970starwarso       // 136021           (c) 1983
trunk/src/mame/video/eolith.c
r243189r243190
3333VIDEO_START_MEMBER(eolith_state,eolith)
3434{
3535   m_vram = auto_alloc_array(machine(), UINT32, 0x40000*2/4);
36   save_pointer(NAME(m_vram), 0x40000*2/4);
36   save_pointer(NAME(m_vram), 0x40000*2/4);
3737   save_item(NAME(m_buffer));
3838}
3939
trunk/src/mame/video/gp9001.c
r243189r243190
175175   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(gp9001_fg_tmap_w) AM_SHARE("vram_fg")
176176   AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(gp9001_top_tmap_w) AM_SHARE("vram_top")
177177   AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram") AM_MIRROR(0x0800)
178//   AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror?
178//  AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror?
179179ADDRESS_MAP_END
180180
181181
trunk/src/mame/video/pastelg.c
r243189r243190
283283   int height = m_screen->height();
284284
285285   m_videoram = auto_alloc_array_clear(machine(), UINT8, width * height);
286   
286
287287   save_item(NAME(m_blitter_desty));
288288   save_item(NAME(m_blitter_sizex));
289289   save_item(NAME(m_blitter_sizey));
trunk/src/mame/video/taitoair.c
r243189r243190
230230         int xx2 = x2 >> TAITOAIR_FRAC_SHIFT;
231231         int grad_col;
232232         int base_color;
233         
233
234234         if (xx1 <= cliprect.max_x || xx2 >= cliprect.min_x)
235235         {
236236            if (xx1 < cliprect.min_x)
237237               xx1 = cliprect.min_x;
238238            if (xx2 > cliprect.max_x)
239239               xx2 = cliprect.max_x;
240           
240
241241            if(color & 0x40)
242242            {
243243               /* Non-terrain elements are colored with this. */
trunk/src/mame/video/tia.c
r243189r243190
430430   helper[0] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
431431   helper[1] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
432432   helper[2] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT);
433   
433
434434   register_save_state();
435435}
436436
trunk/src/mame/video/tia.h
r243189r243190
199199   bitmap_ind16 *helper[3];
200200
201201   UINT16 screen_height;
202   
202
203203   void register_save_state();
204204};
205205
trunk/src/mess/drivers/a2600.c
r243189r243190
316316
317317   /* Banks may have changed, reset the cpu so it uses the correct reset vector */
318318   m_maincpu->reset();
319   
319
320320   save_item(NAME(m_current_screen_height));
321321}
322322
trunk/src/mess/drivers/banctec.c
r243189r243190
5959
6060MC6845_ON_UPDATE_ADDR_CHANGED(banctec_state::crtc_addr)
6161{
62  /* What is this function meant to do ? */
62   /* What is this function meant to do ? */
6363}
6464
6565/******************************
r243189r243190
103103
104104   MCFG_GFXDECODE_ADD("gfxdecode", "palette", banctec)
105105   MCFG_PALETTE_ADD("palette", 2)
106//   MCFG_PALETTE_INIT_OWNER(banctec_state, banctec)
106//  MCFG_PALETTE_INIT_OWNER(banctec_state, banctec)
107107
108108   MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */
109109   MCFG_MC6845_SHOW_BORDER_AREA(false)
trunk/src/mess/drivers/cat.c
r243189r243190
223223    Pins:
224224    1: GND through 220k resistor r78
225225    2: ? phone hook related? anode of diode d7; one of the pins of relay k2; topmost (boardwise) pin of transistor Q10
226    3: 74HCT34 pin
226    3: 74HCT34 pin
227227
228228J5: locking-tab-type "CONN HEADER VERT 4POS .100 TIN" connector for supplying power
229229    through a small cable with a berg connector at the other end, to the floppy drive
r243189r243190
240240    /HICE is !a15
241241    /ROM_OE comes from pin 14 of DECODE_E pal, and is shorted to /ROM_OE' by the cuttable jumper B1 which is not cut
242242    /ROM_OE' goes to the two EPROMS
243   DECODE_18 is DECODE_E pal pin 18
243    DECODE_18 is DECODE_E pal pin 18
244244    pin 1 (GND) is in the lower left and the pins count low-high then to the right
245245    (gnd N/C   E_CLK     R/W    /ROM_OE a17 vcc a14 a13 a8 a9 a11 /ROM_OE' a10 a15 d7 d6 d5 d4 d3 )
246246    (GND /IPL1 DECODE_18 /RESET gnd     a16 vcc a12 a7  a6 a5 a4  a3       a2  a1  a0 d0 d1 d2 gnd)
r243189r243190
369369// pin 13 (PB3) :
370370// pin 14 (PB4) :
371371// pin 15 (PB5) :
372// pin 16 (PB6) :
372// pin 16 (PB6) :
373373// pin 17 (PB7) :
374// pin 18 (CB1) : ?from/to? Floppy connector j3 pin 8
375// pin 19 (CB2) : ?from/to? 6522 @ u35 pin 16 (PB6)
374// pin 18 (CB1) : ?from/to? Floppy connector j3 pin 8
375// pin 19 (CB2) : ?from/to? 6522 @ u35 pin 16 (PB6)
376376// pin 21 (/IRQ) : out to 68008 /IPL1 pin 41
377377// pin 22 (R/W) : in from 68008 R/W pin 30
378378// pin 23 (/CS2) : in from DECODE E pin 18
r243189r243190
384384// pin 39 (CA2) is through inductor L11 and resistor r128 to peripheral connector pin 35 <end minus 26>
385385// pin 40 (CA1) is through inductor L30 and resistor r138 to peripheral connector pin 53 <end minus 8>
386386
387// 6522 @ u35
387// 6522 @ u35
388388// pin 2 (PA0) :
389389// pin 3 (PA1) :
390390// pin 4 (PA2) :
r243189r243190
421421// pin 4 (Y2) : out to 6522 @u35 pin 11
422422// pin 5 (A2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) <ring indicator?>
423423// pin 6 (B2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) <ring indicator?>
424// pin 8 (B3) :
425// pin 9 (A3) :
426// pin 10 (Y3) :
424// pin 8 (B3) :
425// pin 9 (A3) :
426// pin 10 (Y3) :
427427// pin 11 (B4) : in from 68008 A15
428428// pin 12 (A4) : in from 68008 A15
429429// pin 13 (Y4) : out to EPROM @ U31 /CE
r243189r243190
17431743    * ||||\-------------Q? ?
17441744    * |||\--------------Q? ?
17451745    * ||\---------------Q> output to decode pal pin 2
1746    * |\----------------->? output? to ram multiplexer 'A' pins
1746    * |\----------------->? output? to ram multiplexer 'A' pins
17471747    * \------------------< ?
17481748    */
17491749   ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3))
trunk/src/mess/drivers/gamate.c
r243189r243190
2020      : driver_device(mconfig, type, tag)
2121      , m_maincpu(*this, "maincpu")
2222      , m_cart(*this, "cartslot")
23#ifdef USE_GFX     
23#ifdef USE_GFX
2424      , m_gfxdecode(*this, "gfxdecode")
2525#endif
2626      , m_io_joy(*this, "JOY")
r243189r243190
5353
5454   struct
5555   {
56     UINT8 reg[8];
57     struct {
58       bool write;
59       bool page2; // else page1
56   UINT8 reg[8];
57   struct {
58      bool write;
59      bool page2; // else page1
6060   UINT8 ypos, xpos/*tennis*/;
61       UINT8 data[2][0x100][0x20];
62     } bitmap;
63     UINT8 x, y;
61      UINT8 data[2][0x100][0x20];
62      } bitmap;
63   UINT8 x, y;
6464      bool y_increment;
6565   } video;
6666
6767   struct {
68     bool set;
68      bool set;
6969      int bit_shifter;
7070      UINT8 cartridge_byte;
7171      UINT16 address; // in reality something more like short local cartridge address offset
7272      bool unprotected;
7373      bool failed;
74     
74
7575   } card_protection;
7676
7777   required_device<cpu_device> m_maincpu;
r243189r243190
8484   required_shared_ptr<UINT8> m_bios;
8585   emu_timer *timer1;
8686   emu_timer *timer2;
87   UINT8 bank_multi; 
87   UINT8 bank_multi;
8888   UINT8 *m_cart_ptr;
8989};
9090
9191WRITE8_MEMBER( gamate_state::gamate_cart_protection_w )
9292{
93        logerror("%.6f protection write %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, data, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
94 
93      logerror("%.6f protection write %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, data, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
94
9595   switch (offset) {
9696   case 0:
9797      card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0);
r243189r243190
105105}
106106READ8_MEMBER( gamate_state::gamate_cart_protection_r )
107107{
108
109  UINT8 ret=1;
110  if (card_protection.bit_shifter==7 && card_protection.unprotected) {
111    ret=m_cart_ptr[bank_multi*0x4000];
112  } else {
108   UINT8 ret=1;
109   if (card_protection.bit_shifter==7 && card_protection.unprotected) {
110   ret=m_cart_ptr[bank_multi*0x4000];
111   } else {
113112   card_protection.bit_shifter++;
114113   if (card_protection.bit_shifter==8) {
115114      card_protection.bit_shifter=0;
r243189r243190
118117   }
119118   ret=(card_protection.cartridge_byte&0x80)?2:0;
120119   if (card_protection.bit_shifter==7 && !card_protection.failed) { // now protection chip on cartridge activates cartridge chip select on cpu accesses
121//        m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); // next time I will try to get this working
120//        m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); // next time I will try to get this working
122121   }
123122   card_protection.cartridge_byte<<=1;
124  }
125  logerror("%.6f protection read %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, ret, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
126  return ret;
123   }
124   logerror("%.6f protection read %x %x address:%x data:%x shift:%d\n",machine().time().as_double(), offset, ret, card_protection.address, card_protection.cartridge_byte, card_protection.bit_shifter);
125   return ret;
127126}
128127
129128READ8_MEMBER( gamate_state::protection_r ) { return card_protection.set? 3: 1; } // bits 0 and 1 checked
130129
131130WRITE8_MEMBER( gamate_state::protection_reset )
132131{
133  // writes 0x20
134  card_protection.address=0x6005-0x6001;
135  card_protection.bit_shifter=0;
136  card_protection.cartridge_byte=m_cart_ptr[card_protection.address++];//m_cart_rom[card_protection.address++];
137  card_protection.failed=false;
138  card_protection.unprotected=false;
132   // writes 0x20
133   card_protection.address=0x6005-0x6001;
134   card_protection.bit_shifter=0;
135   card_protection.cartridge_byte=m_cart_ptr[card_protection.address++];//m_cart_rom[card_protection.address++];
136   card_protection.failed=false;
137   card_protection.unprotected=false;
139138}
140139
141140READ8_MEMBER( gamate_state::newer_protection_set )
142141{
143  card_protection.set=true;
144  return 0;
142   card_protection.set=true;
143   return 0;
145144}
146145
147146
148147WRITE8_MEMBER( gamate_state::gamate_video_w )
149148{
150  video.reg[offset]=data;
151  switch (offset) {
152  case 1: video.bitmap.write=data&0xc0; // more addressing mode
149   video.reg[offset]=data;
150   switch (offset) {
151   case 1: video.bitmap.write=data&0xc0; // more addressing mode
153152      video.y_increment=data&0x40;
154153      break;
155154   case 2: video.bitmap.xpos=data;break; // at least 7 bits
156155   case 3: video.bitmap.ypos=data;break; // at least 7 bits
157  case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
158  case 5: video.y=data;break;
159  case 7:
160    if (video.bitmap.write) {
161      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
162        video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
163      else
164        logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
165    } else {
166        video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
167    }
168    if (video.y_increment) video.y++;
156   case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
157   case 5: video.y=data;break;
158   case 7:
159   if (video.bitmap.write) {
160      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
161      video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
162      else
163      logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
164   } else {
165      video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
166   }
167   if (video.y_increment) video.y++;
169168      else video.x++;
170  }
169   }
171170}
172171
173172WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w )
174173{
175  bank_multi=data;
176  membank("bankmulti")->set_base(m_cart_ptr+0x4000*data+1);
174   bank_multi=data;
175   membank("bankmulti")->set_base(m_cart_ptr+0x4000*data+1);
177176}
178177
179178WRITE8_MEMBER( gamate_state::cart_bankswitch_w )
r243189r243190
184183READ8_MEMBER( gamate_state::gamate_video_r )
185184{
186185   if (offset!=6) return 0;
187  UINT8 data=0;
188  if (video.bitmap.write) {
189      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
190        data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
191      else
192        logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
193  } else {
194    data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
195  }
196  if (m_maincpu->pc()<0xf000)
197    logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
198  return data;
186   UINT8 data=0;
187   if (video.bitmap.write) {
188      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
189      data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
190      else
191      logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
192   } else {
193   data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
194   }
195   if (m_maincpu->pc()<0xf000)
196   logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
197   return data;
199198}
200199
201200WRITE8_MEMBER( gamate_state::gamate_audio_w )
202201{
203  logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
202   logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
204203}
205204
206205READ8_MEMBER( gamate_state::gamate_audio_r )
207206{
208  logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
207   logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
209208   return 0;
210209}
211210
212211
213212READ8_MEMBER( gamate_state::gamate_pad_r )
214213{
215  UINT8 data=m_io_joy->read();
216  return data;
214   UINT8 data=m_io_joy->read();
215   return data;
217216}
218217
219218static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state )
220    AM_RANGE(0x0000, 0x03ff) AM_RAM
221  AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
222  AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
223  AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
224  AM_RANGE(0x5800, 0x5800) AM_READ(newer_protection_set)
225  AM_RANGE(0x5900, 0x5900) AM_WRITE(protection_reset)
226  AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
219   AM_RANGE(0x0000, 0x03ff) AM_RAM
220   AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
221   AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
222   AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
223   AM_RANGE(0x5800, 0x5800) AM_READ(newer_protection_set)
224   AM_RANGE(0x5900, 0x5900) AM_WRITE(protection_reset)
225   AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
227226
228  AM_RANGE(0x6001, 0x9fff) AM_READ_BANK("bankmulti")
229  AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
227   AM_RANGE(0x6001, 0x9fff) AM_READ_BANK("bankmulti")
228   AM_RANGE(0xa000, 0xdfff) AM_READ_BANK("bank")
230229
231230   AM_RANGE(0x6000, 0x6000) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w)
232231   AM_RANGE(0x8000, 0x8000) AM_WRITE(cart_bankswitchmulti_w)
233232   AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w)
234233
235  AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
234   AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
236235ADDRESS_MAP_END
237236
238237
r243189r243190
251250#ifdef USE_GFX
252251static const struct gfx_layout gamate_charlayout =
253252{
254        4,      /* width of object */
255        1,      /* height of object */
256        256,/* 256 characters */
257        2,      /* bits per pixel */
258        { 0,4 }, /* no bitplanes */
259        /* x offsets */
260        { 0,1,2,3 },
261        /* y offsets */
262        { 0 },
263        8*1 /* size of 1 object in bits */
253      4,      /* width of object */
254      1,      /* height of object */
255      256,/* 256 characters */
256      2,      /* bits per pixel */
257      { 0,4 }, /* no bitplanes */
258      /* x offsets */
259      { 0,1,2,3 },
260      /* y offsets */
261      { 0 },
262      8*1 /* size of 1 object in bits */
264263};
265264
266265static GFXDECODE_START( gamate )
267        GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
266      GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
268267GFXDECODE_END
269268#endif
270269
271270/* palette in red, green, blue tribles */
272271static const unsigned char gamate_colors[4][3] =
273272{
274  { 255,255,255 },
275  { 0xa0, 0xa0, 0xa0 },
276  { 0x60, 0x60, 0x60 },
277  { 0, 0, 0 }
273   { 255,255,255 },
274   { 0xa0, 0xa0, 0xa0 },
275   { 0x60, 0x60, 0x60 },
276   { 0, 0, 0 }
278277};
279278
280279PALETTE_INIT_MEMBER(gamate_state, gamate)
r243189r243190
299298
300299UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
301300{
302  int x, y, j;
303  for (y=0;y<152;y++) {
304    for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
305      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
306      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
301   int x, y, j;
302   for (y=0;y<152;y++) {
303   for (x=-(video.bitmap.xpos&7), j=0;x<160;x+=8, j++) {
304      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
305      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][(j+video.bitmap.xpos/8)&0x1f];
307306#ifdef USE_GFX
308      m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1&0xf)|((d2&0xf)<<4), 0,0,0,x+4,y);
307      m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1&0xf)|((d2&0xf)<<4), 0,0,0,x+4,y);
309308   m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1>>4)|(d2&0xf0),0,0,0,x,y);
310309#else
311      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
312      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
313#endif     
314    }
315  }
316  return 0;
310      BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
311      BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
312#endif
313   }
314   }
315   return 0;
317316}
318317
319318DRIVER_INIT_MEMBER(gamate_state,gamate)
r243189r243190
322321#ifdef USE_GFX
323322   UINT8 *gfx=memregion("gfx1")->base();
324323   for (int i=0; i<256; i++) gfx[i]=i;
325#endif   
324#endif
326325   timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this));
327326   timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this));
328327}
r243189r243190
332331{
333332   m_cart_ptr = memregion("maincpu")->base() + 0x6000;
334333   if (m_cart->exists()) {
335//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
334//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
336335      m_cart_ptr = m_cart->get_rom_base();
337336      membank("bankmulti")->set_base(m_cart->get_rom_base()+1);
338337      membank("bank")->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset
339338   }
340//   m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback
339//  m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback
341340   card_protection.set=false;
342341   bank_multi=0;
343342   card_protection.unprotected=false;
r243189r243190
390389
391390#ifdef USE_GFX
392391   MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
393#endif   
392#endif
394393   MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors))
395394   MCFG_PALETTE_INIT_OWNER(gamate_state, gamate)
396395   MCFG_DEFAULT_LAYOUT(layout_lcd)
r243189r243190
408407   ROMX_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297), ROM_BIOS(1) )
409408   ROM_SYSTEM_BIOS(1, "newer", "NEWER")
410409   ROMX_LOAD("gamate_bios_9130__unknown__bit_icasc00001_9130-bs_r32261.bin", 0xf000, 0x1000, CRC(03a5f3a7) SHA1(4e9dfbfe916ca485530ef4221593ab68738e2217), ROM_BIOS(2) )
411#ifdef USE_GFX   
410#ifdef USE_GFX
412411   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
413#endif   
412#endif
414413ROM_END
415414
416415
417416/*    YEAR  NAME      PARENT  COMPAT    MACHINE   INPUT    CLASS          INIT      COMPANY    FULLNAME */
418417CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NO_SOUND)
419
420
trunk/src/mess/drivers/hp16500.c
r243189r243190
1919    MC68000 @ 10 MHz
2020    MC68A45 CRTC
2121    Z0765A08PSC floppy controller (NEC765 type)
22   TMS9914A GPIB bus interface
22    TMS9914A GPIB bus interface
2323    SCN2661 DUART/timer
2424
2525  16500b:
r243189r243190
5050#include "video/mc6845.h"
5151#include "machine/mc68681.h"
5252
53#define MAINCPU_TAG   "maincpu"
54#define CRTC_TAG   "crtc"
55#define SCREEN_TAG   "screen"
56#define DUART_TAG   "duart"
53#define MAINCPU_TAG "maincpu"
54#define CRTC_TAG    "crtc"
55#define SCREEN_TAG  "screen"
56#define DUART_TAG   "duart"
5757
5858class hp16500_state : public driver_device
5959{
trunk/src/mess/drivers/hp9k_3xx.c
r243189r243190
11// license:BSD-3-Clause
22// copyright-holders:R. Belmont
33/***************************************************************************
4
4
55  hp9k3xx.c: preliminary driver for HP9000 300 Series (aka HP9000/3xx)
66
77  Currently supporting:
r243189r243190
1616      MC68881 FPU
1717
1818  330:
19     MC68020 CPU @ 16.67 MHz
20     MC68851 MMU
21     MC68881 FPU
19      MC68020 CPU @ 16.67 MHz
20      MC68851 MMU
21      MC68881 FPU
2222
2323  340:
2424      MC68030 CPU @ 16.67 MHz w/built-in MMU
25     MC68881 FPU
25      MC68881 FPU
2626
2727  380:
2828    MC68040 CPU @ 25 MHz w/built-in MMU and FPU
2929
3030  382:
3131    MC68040 CPU @ 25? MHz w/built-in MMU and FPU
32   Built-in VGA compatible video
32    Built-in VGA compatible video
3333
3434  All models have an MC6840 PIT on IRQ6 clocked at 250 kHz.
3535
r243189r243190
132132
133133// shared mappings for all 9000/3xx systems
134134static ADDRESS_MAP_START(hp9k3xx_common, AS_PROGRAM, 32, hp9k3xx_state)
135   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP   // writes to 1fffc are the LED
135   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP  // writes to 1fffc are the LED
136136
137   AM_RANGE(0x00500000, 0x0050000f) AM_RAM   // this is sufficient to pass the DMA test for now
137   AM_RANGE(0x00500000, 0x0050000f) AM_RAM // this is sufficient to pass the DMA test for now
138138
139   AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w)    // no "Alpha display"
140   AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w)   // no "Graphics"
141   AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w)   // no add-on FP coprocessor
139   AM_RANGE(0x00510000, 0x00510003) AM_READWRITE(buserror_r, buserror_w)   // no "Alpha display"
140   AM_RANGE(0x00538000, 0x00538003) AM_READWRITE(buserror_r, buserror_w)   // no "Graphics"
141   AM_RANGE(0x005c0000, 0x005c0003) AM_READWRITE(buserror_r, buserror_w)   // no add-on FP coprocessor
142142   AM_RANGE(0x005f8000, 0x005f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff00ff)
143143ADDRESS_MAP_END
144144
145145// 9000/310 - has onboard video that the graphics card used in other 3xxes conflicts with
146146static ADDRESS_MAP_START(hp9k310_map, AS_PROGRAM, 16, hp9k3xx_state)
147   AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP   // writes to 1fffc are the LED
147   AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP  // writes to 1fffc are the LED
148148
149   AM_RANGE(0x510000, 0x510003) AM_READWRITE(buserror16_r, buserror16_w)    // no "Alpha display"
150   AM_RANGE(0x538000, 0x538003) AM_READWRITE(buserror16_r, buserror16_w)   // no "Graphics"
151   AM_RANGE(0x5c0000, 0x5c0003) AM_READWRITE(buserror16_r, buserror16_w)   // no add-on FP coprocessor
149   AM_RANGE(0x510000, 0x510003) AM_READWRITE(buserror16_r, buserror16_w)   // no "Alpha display"
150   AM_RANGE(0x538000, 0x538003) AM_READWRITE(buserror16_r, buserror16_w)   // no "Graphics"
151   AM_RANGE(0x5c0000, 0x5c0003) AM_READWRITE(buserror16_r, buserror16_w)   // no add-on FP coprocessor
152152
153153   AM_RANGE(0x5f8000, 0x5f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff)
154154
155   AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_SHARE("vram16")   // 98544 mono framebuffer
156   AM_RANGE(0x560000, 0x563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
155   AM_RANGE(0x200000, 0x2fffff) AM_RAM AM_SHARE("vram16")  // 98544 mono framebuffer
156   AM_RANGE(0x560000, 0x563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
157157
158158   AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(buserror16_r, buserror16_w)
159159   AM_RANGE(0x800000, 0xffffff) AM_RAM
r243189r243190
161161
162162// 9000/320
163163static ADDRESS_MAP_START(hp9k320_map, AS_PROGRAM, 32, hp9k3xx_state)
164   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
165   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
164   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
165   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
166166
167167   AM_RANGE(0xffe00000, 0xffefffff) AM_READWRITE(buserror_r, buserror_w)
168168   AM_RANGE(0xfff00000, 0xffffffff) AM_RAM
r243189r243190
172172
173173// 9000/330 and 9000/340
174174static ADDRESS_MAP_START(hp9k330_map, AS_PROGRAM, 32, hp9k3xx_state)
175   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
176   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
175   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
176   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
177177
178178   AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w)
179179   AM_RANGE(0xffc00000, 0xffffffff) AM_RAM
r243189r243190
183183
184184// 9000/370 - 8 MB RAM standard
185185static ADDRESS_MAP_START(hp9k370_map, AS_PROGRAM, 32, hp9k3xx_state)
186   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")   // 98544 mono framebuffer
187   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
186   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_SHARE("vram")    // 98544 mono framebuffer
187   AM_RANGE(0x00560000, 0x00563fff) AM_ROM AM_REGION("graphics", 0x0000)   // 98544 mono ROM
188188
189189   AM_RANGE(0xff700000, 0xff7fffff) AM_READWRITE(buserror_r, buserror_w)
190190   AM_RANGE(0xff800000, 0xffffffff) AM_RAM
r243189r243190
292292   MCFG_CPU_PROGRAM_MAP(hp9k310_map)
293293
294294   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
295   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
295   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
296296   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
297297
298298   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
308308   MCFG_CPU_PROGRAM_MAP(hp9k320_map)
309309
310310   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
311   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
311   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
312312   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
313313
314314   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
324324   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
325325
326326   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
327   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
327   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
328328   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
329329
330330   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
340340   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
341341
342342   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
343   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
343   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
344344   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
345345
346346   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
356356   MCFG_CPU_PROGRAM_MAP(hp9k370_map)
357357
358358   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
359   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
359   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
360360   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
361361
362362   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
368368
369369static MACHINE_CONFIG_START( hp9k380, hp9k3xx_state )
370370   /* basic machine hardware */
371   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000)   // 25 MHz?  33?
371   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz?  33?
372372   MCFG_CPU_PROGRAM_MAP(hp9k330_map)
373373
374374   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
375   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
375   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
376376   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
377377
378378   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
384384
385385static MACHINE_CONFIG_START( hp9k382, hp9k3xx_state )
386386   /* basic machine hardware */
387   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000)   // 25 MHz?  33?
387   MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz?  33?
388388   MCFG_CPU_PROGRAM_MAP(hp9k382_map)
389389
390390   MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0)
391   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)   // from oscillator module next to the 6840
391   MCFG_PTM6840_INTERNAL_CLOCK(250000.0f)  // from oscillator module next to the 6840
392392   MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f)
393393
394394   MCFG_SCREEN_ADD( "screen", RASTER)
r243189r243190
400400
401401ROM_START( hp9k310 )
402402   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
403   ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) )
404   ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) )
403   ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) )
404   ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) )
405405
406406   ROM_REGION( 0x800, "mcu", 0 )
407   ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
408   ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) )
407   ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
408   ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) )
409409
410410   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE )
411411   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r243189r243190
413413
414414ROM_START( hp9k320 )
415415   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
416   ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) )
417   ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
418   ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
419   ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
416   ROM_LOAD16_BYTE( "5061-6538.bin", 0x000001, 0x004000, CRC(d6aafeb1) SHA1(88c6b0b2f504303cbbac0c496c26b85458ac5d63) )
417   ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
418   ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
419   ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
420420
421421   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
422422   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r243189r243190
424424
425425ROM_START( hp9k330 )
426426   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
427   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
428   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
427   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
428   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
429429
430430   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
431431   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
r243189r243190
433433
434434ROM_START( hp9k340 )
435435   ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
436   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
437   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
436   ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
437   ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
438438
439439   ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
440440   ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
trunk/src/mess/drivers/nes.c
r243189r243190
214214{
215215   m_ciram = auto_alloc_array(machine(), UINT8, 0x800);
216216   setup_disk(m_disk);
217   
217
218218   // register saves
219219   save_item(NAME(m_last_frame_flip));
220220   save_pointer(NAME(m_ciram), 0x800);
trunk/src/mess/drivers/ngen.c
r243189r243190
406406
407407// X-bus module select
408408// The bootstrap ROM creates a table at 0:FC9h, with a count, followed by the module IDs of each
409// expansion module.  The base I/O address for the currently selected module is set by writing to
409// expansion module.  The base I/O address for the currently selected module is set by writing to
410410// this register (bits 0-7 are ignored)
411411// TODO: make expansion modules slot devices
412412WRITE16_MEMBER(ngen_state::xbus_w)
r243189r243190
435435READ16_MEMBER(ngen_state::xbus_r)
436436{
437437   UINT16 ret = 0xffff;
438   
438
439439   switch(m_xbus_current)
440440   {
441441      case 0x00:
r243189r243190
647647
648648READ8_MEMBER(ngen_state::dma_3_dack_r)
649649{
650   UINT16 ret = 0xffff;
651   
650   UINT16 ret = 0xffff;
651
652652   if((m_hdc_control & 0x04) && m_disk_rom)
653653   {
654654      ret = m_disk_rom->base()[m_disk_rom_ptr++] << 8;
r243189r243190
659659         //m_dmac->dreq3_w(0);
660660      }
661661   }
662   m_dma_high_byte = ret & 0xff00;
662   m_dma_high_byte = ret & 0xff00;
663663   return ret;
664664}
665665
r243189r243190
737737
738738static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state )
739739   AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w)
740   
740
741741   // Floppy/Hard disk module
742//   AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff)  // a guess for now
743//   AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff)
744//   AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff)
745//   AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff)  // X-Bus extended address register
746//   AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff)
742//  AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff)  // a guess for now
743//  AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff)
744//  AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff)
745//  AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff)  // X-Bus extended address register
746//  AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff)
747747   // 0x0120-0x012f - WD1010 Winchester disk controller (unemulated)
748//   AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff)
749   
748//  AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff)
749
750750ADDRESS_MAP_END
751751
752752static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state )
r243189r243190
851851
852852   // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board)
853853   MCFG_DEVICE_ADD("videouart", I8251, 0)  // main clock unknown, Rx/Tx clocks are 19.53kHz
854//   MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
854//  MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w))
855855   MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd))
856856   MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen")
857857   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd))
r243189r243190
865865   MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w))
866866   MCFG_WD_FDC_FORCE_READY
867867   MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0)
868   MCFG_PIT8253_CLK0(XTAL_20MHz / 20) 
868   MCFG_PIT8253_CLK0(XTAL_20MHz / 20)
869869   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // clocked on FDC data register access
870870   MCFG_PIT8253_CLK1(XTAL_20MHz / 20)
871871   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // 1MHz
872872   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)
873   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w)) 
873   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
874874   // TODO: WD1010 HDC (not implemented), use WD2010 for now
875875   MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4)
876876   MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r))
trunk/src/mess/drivers/pasogo.c
r243189r243190
681681   astring region_tag;
682682   m_maincpu_rom = memregion("maincpu");
683683   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
684   if (!m_cart_rom)   // this should never happen, since we make carts mandatory!
684   if (!m_cart_rom)    // this should never happen, since we make carts mandatory!
685685      m_cart_rom = memregion("maincpu");
686686
687687   membank("bank27")->set_base(m_cart_rom->base());
trunk/src/mess/drivers/splitsec.c
r243189r243190
44
55  Parker Brothers Split Second
66  * TMS1400NLL MP7314-N2 (die labeled MP7314)
7 
7
88  This is an electronic handheld reflex gaming device, it's straightforward
99  to use. The included mini-games are:
1010  1, 2, 3: Mad Maze*
r243189r243190
1212  6: Auto Cross
1313  7: Stomp
1414  8: Speedball
15 
15
1616  *: higher number indicates higher difficulty
1717
1818
r243189r243190
167167{
168168   // R8: speaker out
169169   m_speaker->level_w(data >> 8 & 1);
170   
170
171171   // R9,R10: input mux
172172   // R0-R7: led columns
173173   m_r = data;
trunk/src/mess/drivers/tispeak.c
r243189r243190
693693COMP( 1980, snspella,   snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (US set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
694694COMP( 1978, snspelluk,  snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (UK set 1)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
695695COMP( 1981, snspelluka, snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (UK set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // different voice actor
696COMP( 1979, snspelljp,  snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
696COMP( 1979, snspelljp,  snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "Speak & Spell (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
697697COMP( 1980, ladictee,   snspell, 0, snspell,  snspell,  tispeak_state, snspell,  "Texas Instruments", "La Dictee Magique (France)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) // doesn't work due to missing CD2702 MCU dump, German version has CD2702 too
698698
699699COMP( 1980, snmath,     0,       0, snmath,   snmath,   driver_device, 0,        "Texas Instruments", "Speak & Math (US prototype)", GAME_IMPERFECT_SOUND ) // also US set 1
trunk/src/mess/includes/mac.h
r243189r243190
291291   INT32 m_adb_linestate;
292292   bool  m_adb_srqflag;
293293#define kADBKeyBufSize 32
294        UINT8 m_adb_keybuf[kADBKeyBufSize];
295        UINT8 m_adb_keybuf_start;
296        UINT8 m_adb_keybuf_end;
294      UINT8 m_adb_keybuf[kADBKeyBufSize];
295      UINT8 m_adb_keybuf_start;
296      UINT8 m_adb_keybuf_end;
297297
298298   // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition)
299299   UINT8 m_pm_data_send, m_pm_data_recv, m_pm_ack, m_pm_req, m_pm_cmd[32], m_pm_out[32], m_pm_dptr, m_pm_sptr, m_pm_slen, m_pm_state;
trunk/src/mess/machine/amstrad.c
r243189r243190
30343034
30353035   astring region_tag;
30363036   m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
3037   if (!m_region_cart)   // this should never happen, since we make carts mandatory!
3037   if (!m_region_cart) // this should never happen, since we make carts mandatory!
30383038      m_region_cart = memregion("maincpu");
30393039}
30403040
r243189r243190
30783078
30793079   astring region_tag;
30803080   m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
3081   if (!m_region_cart)   // this should never happen, since we make carts mandatory!
3081   if (!m_region_cart) // this should never happen, since we make carts mandatory!
30823082      m_region_cart = memregion("maincpu");
30833083}
30843084
trunk/src/mess/machine/macadb.c
r243189r243190
427427                     {
428428                        if(m_adb_keybuf_start == m_adb_keybuf_end)
429429                        {
430   //                        printf("%s: buffer empty\n", __func__);
430   //                              printf("%s: buffer empty\n", __func__);
431431                           m_adb_buffer[0] = 0xff;
432432                           m_adb_buffer[1] = 0xff;
433433                        }
trunk/src/mess/machine/nes.c
r243189r243190
139139   // bit 0 to controller port
140140   ret |= m_ctrl1->read_bit0();
141141
142   // expansion port bits (in the original FC, P2 controller was hooked to these lines
142   // expansion port bits (in the original FC, P2 controller was hooked to these lines
143143   // too, so in principle some homebrew hardware modification could use the same
144144   // connection with P1 controller too)
145145   ret |= m_ctrl1->read_exp(0);
r243189r243190
160160   // bit 0 to controller port
161161   ret |= m_ctrl2->read_bit0();
162162
163   // expansion port bits (in the original FC, P2 controller was hooked to these lines
163   // expansion port bits (in the original FC, P2 controller was hooked to these lines
164164   // too, so in principle some homebrew hardware modification could use the same
165165   // connection with P1 controller too)
166166   ret |= m_ctrl1->read_exp(1);
r243189r243190
193193{
194194   // get the pixel at the gun position
195195   UINT32 pix = m_ppu->get_pixel(x, y);
196   
196
197197   // get the color base from the ppu
198198   UINT32 color_base = m_ppu->get_colorbase();
199   
199
200200   // check if the cursor is over a bright pixel
201201   if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
202202      (pix == color_base + 0x33) || (pix == color_base + 0x34))
trunk/src/osd/modules/debugger/debug_module.h
r243189r243190
2020{
2121public:
2222
23    virtual ~debug_module() { }
23   virtual ~debug_module() { }
2424
25    virtual void init_debugger(running_machine &machine) = 0;
26    virtual void wait_for_debugger(device_t &device, bool firststop) = 0;
27    virtual void debugger_update() = 0;
25   virtual void init_debugger(running_machine &machine) = 0;
26   virtual void wait_for_debugger(device_t &device, bool firststop) = 0;
27   virtual void debugger_update() = 0;
2828};
2929
3030
trunk/src/osd/modules/debugger/debugint.c
r243189r243190
2727class debug_internal : public osd_module, public debug_module
2828{
2929public:
30    debug_internal()
31    : osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(),
32      m_machine(NULL)
33    {
34    }
30   debug_internal()
31   : osd_module(OSD_DEBUG_PROVIDER, "internal"), debug_module(),
32      m_machine(NULL)
33   {
34   }
3535
36    virtual ~debug_internal() { }
36   virtual ~debug_internal() { }
3737
38    virtual int init() { return 0;}
39    virtual void exit();
38   virtual int init() { return 0;}
39   virtual void exit();
4040
41    virtual void init_debugger(running_machine &machine);
42    virtual void wait_for_debugger(device_t &device, bool firststop);
43    virtual void debugger_update();
41   virtual void init_debugger(running_machine &machine);
42   virtual void wait_for_debugger(device_t &device, bool firststop);
43   virtual void debugger_update();
4444
4545private:
46    running_machine *m_machine;
46   running_machine *m_machine;
4747};
4848
4949
trunk/src/osd/modules/debugger/debugqt.c
r243189r243190
3737class debug_qt : public osd_module, public debug_module
3838{
3939public:
40    debug_qt()
41    : osd_module(OSD_DEBUG_PROVIDER, "qt"), debug_module(),
42      m_machine(NULL)
43    {
44    }
40   debug_qt()
41   : osd_module(OSD_DEBUG_PROVIDER, "qt"), debug_module(),
42      m_machine(NULL)
43   {
44   }
4545
46    virtual ~debug_qt() { }
46   virtual ~debug_qt() { }
4747
48    virtual int init() { return 0;}
49    virtual void exit() { }
48   virtual int init() { return 0;}
49   virtual void exit() { }
5050
51    virtual void init_debugger(running_machine &machine);
52    virtual void wait_for_debugger(device_t &device, bool firststop);
53    virtual void debugger_update();
51   virtual void init_debugger(running_machine &machine);
52   virtual void wait_for_debugger(device_t &device, bool firststop);
53   virtual void debugger_update();
5454
5555private:
56    running_machine *m_machine;
56   running_machine *m_machine;
5757};
5858
5959//============================================================
r243189r243190
357357}
358358
359359#else /* SDLMAME_UNIX */
360    MODULE_NOT_SUPPORTED(debug_qt, OSD_DEBUG_PROVIDER, "qt")
360   MODULE_NOT_SUPPORTED(debug_qt, OSD_DEBUG_PROVIDER, "qt")
361361#endif
362362
363363MODULE_DEFINITION(DEBUG_QT, debug_qt)
trunk/src/osd/modules/debugger/debugwin.c
r243189r243190
4444class debugger_windows : public osd_module, public debug_module
4545{
4646public:
47    debugger_windows()
48    : osd_module(OSD_DEBUG_PROVIDER, "windows"), debug_module(),
49      m_machine(NULL)
50    {
51    }
47   debugger_windows()
48   : osd_module(OSD_DEBUG_PROVIDER, "windows"), debug_module(),
49      m_machine(NULL)
50   {
51   }
5252
53    virtual ~debugger_windows() { }
53   virtual ~debugger_windows() { }
5454
55    virtual int init() { return 0;}
56    virtual void exit();
55   virtual int init() { return 0;}
56   virtual void exit();
5757
58    virtual void init_debugger(running_machine &machine);
59    virtual void wait_for_debugger(device_t &device, bool firststop);
60    virtual void debugger_update();
58   virtual void init_debugger(running_machine &machine);
59   virtual void wait_for_debugger(device_t &device, bool firststop);
60   virtual void debugger_update();
6161
6262private:
63    running_machine *m_machine;
63   running_machine *m_machine;
6464};
6565//============================================================
6666//  PARAMETERS
r243189r243190
30943094      smart_show_window(info->wnd, show);
30953095}
30963096#else /* not windows */
3097    MODULE_NOT_SUPPORTED(debugger_windows, OSD_DEBUG_PROVIDER, "windows")
3097   MODULE_NOT_SUPPORTED(debugger_windows, OSD_DEBUG_PROVIDER, "windows")
30983098#endif
30993099
31003100MODULE_DEFINITION(DEBUG_WINDOWS, debugger_windows)
trunk/src/osd/modules/debugger/none.c
r243189r243190
1212class debug_none : public osd_module, public debug_module
1313{
1414public:
15    debug_none()
16    : osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(),
17      m_machine(NULL)
18    {
19    }
15   debug_none()
16   : osd_module(OSD_DEBUG_PROVIDER, "none"), debug_module(),
17      m_machine(NULL)
18   {
19   }
2020
21    virtual ~debug_none() { }
21   virtual ~debug_none() { }
2222
23    virtual int init() { return 0;}
24    virtual void exit() { }
23   virtual int init() { return 0;}
24   virtual void exit() { }
2525
26    virtual void init_debugger(running_machine &machine);
27    virtual void wait_for_debugger(device_t &device, bool firststop);
28    virtual void debugger_update();
26   virtual void init_debugger(running_machine &machine);
27   virtual void wait_for_debugger(device_t &device, bool firststop);
28   virtual void debugger_update();
2929
3030private:
31    running_machine *m_machine;
31   running_machine *m_machine;
3232};
3333
3434void debug_none::init_debugger(running_machine &machine)
3535{
36    m_machine = &machine;
36   m_machine = &machine;
3737}
3838
3939void debug_none::wait_for_debugger(device_t &device, bool firststop)
trunk/src/osd/modules/font/font_module.h
r243189r243190
1818class font_module
1919{
2020public:
21    virtual ~font_module() { }
22    virtual osd_font *font_alloc() = 0;
21   virtual ~font_module() { }
22   virtual osd_font *font_alloc() = 0;
2323};
2424
2525
trunk/src/osd/modules/font/font_none.c
r243189r243190
1414class osd_font_none : public osd_font
1515{
1616public:
17    virtual ~osd_font_none() {};
17   virtual ~osd_font_none() {};
1818
19    virtual bool open(const char *font_path, const char *name, int &height);
20    virtual void close();
21    virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
19   virtual bool open(const char *font_path, const char *name, int &height);
20   virtual void close();
21   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
2222private:
2323};
2424
2525bool osd_font_none::open(const char *font_path, const char *_name, int &height)
2626{
27    return false;
27   return false;
2828}
2929
3030//-------------------------------------------------
r243189r243190
4646
4747bool osd_font_none::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
4848{
49    return false;
49   return false;
5050}
5151
5252class font_none : public osd_module, public font_module
5353{
5454public:
55    font_none()
56    : osd_module(OSD_FONT_PROVIDER, "none"), font_module()
57    {
58    }
55   font_none()
56   : osd_module(OSD_FONT_PROVIDER, "none"), font_module()
57   {
58   }
5959
60    osd_font *font_alloc()
61    {
62        return global_alloc(osd_font_none);
63    }
60   osd_font *font_alloc()
61   {
62      return global_alloc(osd_font_none);
63   }
6464};
6565
6666MODULE_DEFINITION(FONT_NONE, font_none)
67
trunk/src/osd/modules/font/font_osx.c
r243189r243190
2626class osd_font_osx : public osd_font
2727{
2828public:
29    virtual ~osd_font_osx() {};
29   virtual ~osd_font_osx() {};
3030
31    virtual bool open(const char *font_path, const char *name, int &height);
32    virtual void close();
33    virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
31   virtual bool open(const char *font_path, const char *name, int &height);
32   virtual void close();
33   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
3434private:
35    CTFontRef m_font;
35   CTFontRef m_font;
3636};
3737
3838bool osd_font_osx::open(const char *font_path, const char *_name, int &height)
3939{
40    CFStringRef font_name = NULL;
41    CTFontRef ct_font = NULL;
42    CTFontDescriptorRef font_descriptor;
43    CGAffineTransform affine_transform = CGAffineTransformIdentity;
40   CFStringRef font_name = NULL;
41   CTFontRef ct_font = NULL;
42   CTFontDescriptorRef font_descriptor;
43   CGAffineTransform affine_transform = CGAffineTransformIdentity;
4444
45    m_font = NULL;
46    astring name(_name);
47    printf("FONT NAME %s\n", _name);
45   m_font = NULL;
46   astring name(_name);
47   printf("FONT NAME %s\n", _name);
4848#if 0
49    if (name == "default")
50    {
51        name = "LucidaGrande";
52    }
49   if (name == "default")
50   {
51      name = "LucidaGrande";
52   }
5353#endif
54    /* handle bdf fonts in the core */
55    if (name.len() > 4)
56        if (name.makeupper().substr(name.len()-4,4) == ".BDF" )
57            return false;
54   /* handle bdf fonts in the core */
55   if (name.len() > 4)
56      if (name.makeupper().substr(name.len()-4,4) == ".BDF" )
57         return false;
5858
59    font_name = CFStringCreateWithCString( NULL, name.cstr(), kCFStringEncodingUTF8 );
60    if( font_name != NULL )
61    {
62        font_descriptor = CTFontDescriptorCreateWithNameAndSize( font_name, 0.0); //POINT_SIZE );
59   font_name = CFStringCreateWithCString( NULL, name.cstr(), kCFStringEncodingUTF8 );
60   if( font_name != NULL )
61   {
62      font_descriptor = CTFontDescriptorCreateWithNameAndSize( font_name, 0.0); //POINT_SIZE );
6363
64        if( font_descriptor != NULL )
65        {
66            ct_font = CTFontCreateWithFontDescriptor( font_descriptor, POINT_SIZE, &affine_transform );
64      if( font_descriptor != NULL )
65      {
66         ct_font = CTFontCreateWithFontDescriptor( font_descriptor, POINT_SIZE, &affine_transform );
6767
68            CFRelease( font_descriptor );
69        }
70    }
68         CFRelease( font_descriptor );
69      }
70   }
7171
72    CFRelease( font_name );
72   CFRelease( font_name );
7373
74    if (!ct_font)
75    {
76        osd_printf_verbose("Couldn't find/open font %s, using MAME default\n", name.cstr());
77        return false;
78    }
74   if (!ct_font)
75   {
76      osd_printf_verbose("Couldn't find/open font %s, using MAME default\n", name.cstr());
77      return false;
78   }
7979
80    CFStringRef real_name = CTFontCopyPostScriptName( ct_font );
81    char real_name_c_string[255];
82    CFStringGetCString ( real_name, real_name_c_string, 255, kCFStringEncodingUTF8 );
83    osd_printf_verbose("Matching font: %s\n", real_name_c_string);
84    CFRelease( real_name );
80   CFStringRef real_name = CTFontCopyPostScriptName( ct_font );
81   char real_name_c_string[255];
82   CFStringGetCString ( real_name, real_name_c_string, 255, kCFStringEncodingUTF8 );
83   osd_printf_verbose("Matching font: %s\n", real_name_c_string);
84   CFRelease( real_name );
8585
86    CGFloat line_height = 0.0;
87    line_height += CTFontGetAscent(ct_font);
88    line_height += CTFontGetDescent(ct_font);
89    line_height += CTFontGetLeading(ct_font);
90    height = ceilf(line_height * EXTRA_HEIGHT);
86   CGFloat line_height = 0.0;
87   line_height += CTFontGetAscent(ct_font);
88   line_height += CTFontGetDescent(ct_font);
89   line_height += CTFontGetLeading(ct_font);
90   height = ceilf(line_height * EXTRA_HEIGHT);
9191
92    m_font = ct_font;
93    return true;
92   m_font = ct_font;
93   return true;
9494}
9595
9696//-------------------------------------------------
r243189r243190
100100
101101void osd_font_osx::close()
102102{
103    if( m_font != NULL )
104    {
105        CFRelease( m_font );
106    }
103   if( m_font != NULL )
104   {
105      CFRelease( m_font );
106   }
107107}
108108
109109//-------------------------------------------------
r243189r243190
116116
117117bool osd_font_osx::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
118118{
119    UniChar uni_char;
120    CGGlyph glyph;
121    CTFontRef ct_font = m_font;
122    const CFIndex count = 1;
123    CGRect bounding_rect, success_rect;
124    CGContextRef context_ref;
119   UniChar uni_char;
120   CGGlyph glyph;
121   CTFontRef ct_font = m_font;
122   const CFIndex count = 1;
123   CGRect bounding_rect, success_rect;
124   CGContextRef context_ref;
125125
126    if( chnum == ' ' )
127    {
128        uni_char = 'n';
129        CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
130        success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
131        uni_char = chnum;
132        CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
133    }
134    else
135    {
136        uni_char = chnum;
137        CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
138        success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
139    }
126   if( chnum == ' ' )
127   {
128      uni_char = 'n';
129      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
130      success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
131      uni_char = chnum;
132      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
133   }
134   else
135   {
136      uni_char = chnum;
137      CTFontGetGlyphsForCharacters( ct_font, &uni_char, &glyph, count );
138      success_rect = CTFontGetBoundingRectsForGlyphs( ct_font, kCTFontDefaultOrientation, &glyph, &bounding_rect, count );
139   }
140140
141    if( CGRectEqualToRect( success_rect, CGRectNull ) == false )
142    {
143        size_t bitmap_width;
144        size_t bitmap_height;
141   if( CGRectEqualToRect( success_rect, CGRectNull ) == false )
142   {
143      size_t bitmap_width;
144      size_t bitmap_height;
145145
146        bitmap_width = ceilf(bounding_rect.size.width * EXTRA_WIDTH);
147        bitmap_width = bitmap_width == 0 ? 1 : bitmap_width;
146      bitmap_width = ceilf(bounding_rect.size.width * EXTRA_WIDTH);
147      bitmap_width = bitmap_width == 0 ? 1 : bitmap_width;
148148
149        bitmap_height = ceilf( (CTFontGetAscent(ct_font) + CTFontGetDescent(ct_font) + CTFontGetLeading(ct_font)) * EXTRA_HEIGHT);
149      bitmap_height = ceilf( (CTFontGetAscent(ct_font) + CTFontGetDescent(ct_font) + CTFontGetLeading(ct_font)) * EXTRA_HEIGHT);
150150
151        xoffs = yoffs = 0;
152        width = bitmap_width;
151      xoffs = yoffs = 0;
152      width = bitmap_width;
153153
154        size_t bits_per_component;
155        CGColorSpaceRef color_space;
156        CGBitmapInfo bitmap_info = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;
154      size_t bits_per_component;
155      CGColorSpaceRef color_space;
156      CGBitmapInfo bitmap_info = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;
157157
158        color_space = CGColorSpaceCreateDeviceRGB();
159        bits_per_component = 8;
158      color_space = CGColorSpaceCreateDeviceRGB();
159      bits_per_component = 8;
160160
161        bitmap.allocate(bitmap_width, bitmap_height);
161      bitmap.allocate(bitmap_width, bitmap_height);
162162
163        context_ref = CGBitmapContextCreate( bitmap.raw_pixptr(0), bitmap_width, bitmap_height, bits_per_component, bitmap.rowpixels()*4, color_space, bitmap_info );
163      context_ref = CGBitmapContextCreate( bitmap.raw_pixptr(0), bitmap_width, bitmap_height, bits_per_component, bitmap.rowpixels()*4, color_space, bitmap_info );
164164
165        if( context_ref != NULL )
166        {
167            CGFontRef font_ref;
168            font_ref = CTFontCopyGraphicsFont( ct_font, NULL );
169            CGContextSetTextPosition(context_ref, -bounding_rect.origin.x*EXTRA_WIDTH, CTFontGetDescent(ct_font)+CTFontGetLeading(ct_font) );
170            CGContextSetRGBFillColor(context_ref, 1.0, 1.0, 1.0, 1.0);
171            CGContextSetFont( context_ref, font_ref );
172            CGContextSetFontSize( context_ref, POINT_SIZE );
173            CGContextShowGlyphs( context_ref, &glyph, count );
174            CGFontRelease( font_ref );
175            CGContextRelease( context_ref );
176        }
165      if( context_ref != NULL )
166      {
167         CGFontRef font_ref;
168         font_ref = CTFontCopyGraphicsFont( ct_font, NULL );
169         CGContextSetTextPosition(context_ref, -bounding_rect.origin.x*EXTRA_WIDTH, CTFontGetDescent(ct_font)+CTFontGetLeading(ct_font) );
170         CGContextSetRGBFillColor(context_ref, 1.0, 1.0, 1.0, 1.0);
171         CGContextSetFont( context_ref, font_ref );
172         CGContextSetFontSize( context_ref, POINT_SIZE );
173         CGContextShowGlyphs( context_ref, &glyph, count );
174         CGFontRelease( font_ref );
175         CGContextRelease( context_ref );
176      }
177177
178        CGColorSpaceRelease( color_space );
179    }
178      CGColorSpaceRelease( color_space );
179   }
180180
181    return bitmap.valid();
181   return bitmap.valid();
182182}
183183
184184
185185class font_osx : public osd_module, public font_module
186186{
187187public:
188    font_osx()
189    : osd_module(OSD_FONT_PROVIDER, "osx"), font_module()
190    {
191    }
188   font_osx()
189   : osd_module(OSD_FONT_PROVIDER, "osx"), font_module()
190   {
191   }
192192
193    osd_font *font_alloc()
194    {
195        return global_alloc(osd_font_osx);
196    }
193   osd_font *font_alloc()
194   {
195      return global_alloc(osd_font_osx);
196   }
197197
198198};
199199#else /* SDLMAME_UNIX */
200    MODULE_NOT_SUPPORTED(font_osx, OSD_FONT_PROVIDER, "osx")
200   MODULE_NOT_SUPPORTED(font_osx, OSD_FONT_PROVIDER, "osx")
201201#endif
202202
203203MODULE_DEFINITION(FONT_OSX, font_osx)
trunk/src/osd/modules/font/font_sdl.c
r243189r243190
3232class osd_font_sdl : public osd_font
3333{
3434public:
35    virtual ~osd_font_sdl() {};
35   virtual ~osd_font_sdl() {};
3636
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);
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);
4040private:
4141#ifndef SDLMAME_HAIKU
42    TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles);
42   TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles);
4343#endif
44    bool BDF_Check_Magic(astring name);
45    TTF_Font * TTF_OpenFont_Magic(astring name, int fsize);
46    TTF_Font *m_font;
44   bool BDF_Check_Magic(astring name);
45   TTF_Font * TTF_OpenFont_Magic(astring name, int fsize);
46   TTF_Font *m_font;
4747};
4848
4949bool osd_font_sdl::open(const char *font_path, const char *_name, int &height)
5050{
51    TTF_Font *font = (TTF_Font *)NULL;
52    bool bakedstyles = false;
53    int style = 0;
51   TTF_Font *font = (TTF_Font *)NULL;
52   bool bakedstyles = false;
53   int style = 0;
5454
55    // accept qualifiers from the name
56    astring name(_name);
55   // accept qualifiers from the name
56   astring name(_name);
5757
58    if (name == "default")
59    {
60        name = "Liberation Sans";
61    }
58   if (name == "default")
59   {
60      name = "Liberation Sans";
61   }
6262
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);
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);
6767
68    // first up, try it as a filename
69    font = TTF_OpenFont_Magic(name, POINT_SIZE);
68   // first up, try it as a filename
69   font = TTF_OpenFont_Magic(name, POINT_SIZE);
7070
71    // if no success, try the font path
71   // if no success, try the font path
7272
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    }
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   }
8686
87    // if that didn't work, crank up the FontConfig database
87   // if that didn't work, crank up the FontConfig database
8888#ifndef SDLMAME_HAIKU
89    if (!font)
90    {
91        font = search_font_config(name, bold, italic, underline, bakedstyles);
92    }
89   if (!font)
90   {
91      font = search_font_config(name, bold, italic, underline, bakedstyles);
92   }
9393#endif
9494
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    }
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   }
103103
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
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
112112#if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9)
113    style |= strike ? TTF_STYLE_STRIKETHROUGH : 0;
113   style |= strike ? TTF_STYLE_STRIKETHROUGH : 0;
114114#else
115    if (strike)
116        osd_printf_warning("Ignoring strikethrough for SDL_TTF older than 2.0.10\n");
115   if (strike)
116      osd_printf_warning("Ignoring strikethrough for SDL_TTF older than 2.0.10\n");
117117#endif // PATCHLEVEL
118    TTF_SetFontStyle(font, style);
118   TTF_SetFontStyle(font, style);
119119
120    height = TTF_FontLineSkip(font);
120   height = TTF_FontLineSkip(font);
121121
122    m_font = font;
123    return true;
122   m_font = font;
123   return true;
124124}
125125
126126//-------------------------------------------------
r243189r243190
130130
131131void osd_font_sdl::close()
132132{
133    TTF_CloseFont(this->m_font);
133   TTF_CloseFont(this->m_font);
134134}
135135
136136//-------------------------------------------------
r243189r243190
143143
144144bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
145145{
146    TTF_Font *ttffont;
147    SDL_Surface *drawsurf;
148    SDL_Color fcol = { 0xff, 0xff, 0xff };
149    UINT16 ustr[16];
146   TTF_Font *ttffont;
147   SDL_Surface *drawsurf;
148   SDL_Color fcol = { 0xff, 0xff, 0xff };
149   UINT16 ustr[16];
150150
151    ttffont = m_font;
151   ttffont = m_font;
152152
153    memset(ustr,0,sizeof(ustr));
154    ustr[0] = (UINT16)chnum;
155    drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol);
153   memset(ustr,0,sizeof(ustr));
154   ustr[0] = (UINT16)chnum;
155   drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol);
156156
157    // was nothing returned?
158    if (drawsurf)
159    {
160        // allocate a MAME destination bitmap
161        bitmap.allocate(drawsurf->w, drawsurf->h);
157   // was nothing returned?
158   if (drawsurf)
159   {
160      // allocate a MAME destination bitmap
161      bitmap.allocate(drawsurf->w, drawsurf->h);
162162
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;
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;
168168
169            srcrow += (y * drawsurf->pitch);
169         srcrow += (y * drawsurf->pitch);
170170
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        }
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      }
176176
177        // what are these?
178        xoffs = yoffs = 0;
179        width = drawsurf->w;
177      // what are these?
178      xoffs = yoffs = 0;
179      width = drawsurf->w;
180180
181        SDL_FreeSurface(drawsurf);
182    }
181      SDL_FreeSurface(drawsurf);
182   }
183183
184    return bitmap.valid();
184   return bitmap.valid();
185185}
186186
187187TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize)
188188{
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);
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);
199199}
200200
201201bool osd_font_sdl::BDF_Check_Magic(astring name)
202202{
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    }
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   }
213213
214    return false;
214   return false;
215215}
216216
217217#ifndef SDLMAME_HAIKU
218218TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles)
219219{
220    TTF_Font *font = (TTF_Font *)NULL;
221    FcConfig *config;
222    FcPattern *pat;
223    FcObjectSet *os;
224    FcFontSet *fontset;
225    FcValue val;
220   TTF_Font *font = (TTF_Font *)NULL;
221   FcConfig *config;
222   FcPattern *pat;
223   FcObjectSet *os;
224   FcFontSet *fontset;
225   FcValue val;
226226
227    config = FcConfigGetCurrent();
228    pat = FcPatternCreate();
229    os = FcObjectSetCreate();
230    FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr());
227   config = FcConfigGetCurrent();
228   pat = FcPatternCreate();
229   os = FcObjectSetCreate();
230   FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr());
231231
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    }
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   }
252252
253    FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType");
253   FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType");
254254
255    FcObjectSetAdd(os, FC_FILE);
256    fontset = FcFontList(config, pat, os);
255   FcObjectSetAdd(os, FC_FILE);
256   fontset = FcFontList(config, pat, os);
257257
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        }
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      }
264264
265        if (val.type != FcTypeString)
266        {
267            continue;
268        }
265      if (val.type != FcTypeString)
266      {
267         continue;
268      }
269269
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        }
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      }
275275
276        if (font)
277        {
278            bakedstyles = true;
279            break;
280        }
281    }
276      if (font)
277      {
278         bakedstyles = true;
279         break;
280      }
281   }
282282
283    // didn't get a font above?  try again with no baked-in styles
284    if (!font)
285    {
286        FcPatternDestroy(pat);
287        FcFontSetDestroy(fontset);
283   // didn't get a font above?  try again with no baked-in styles
284   if (!font)
285   {
286      FcPatternDestroy(pat);
287      FcFontSetDestroy(fontset);
288288
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);
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);
294294
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            }
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         }
301301
302            if (val.type != FcTypeString)
303            {
304                continue;
305            }
302         if (val.type != FcTypeString)
303         {
304            continue;
305         }
306306
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            }
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         }
312312
313            if (font)
314            {
315                break;
316            }
317        }
318    }
313         if (font)
314         {
315            break;
316         }
317      }
318   }
319319
320    FcPatternDestroy(pat);
321    FcObjectSetDestroy(os);
322    FcFontSetDestroy(fontset);
323    return font;
320   FcPatternDestroy(pat);
321   FcObjectSetDestroy(os);
322   FcFontSetDestroy(fontset);
323   return font;
324324}
325325#endif
326326
r243189r243190
328328class font_sdl : public osd_module, public font_module
329329{
330330public:
331    font_sdl()
332    : osd_module(OSD_FONT_PROVIDER, "sdl"), font_module()
333    {
334    }
331   font_sdl()
332   : osd_module(OSD_FONT_PROVIDER, "sdl"), font_module()
333   {
334   }
335335
336    osd_font *font_alloc()
337    {
338        return global_alloc(osd_font_sdl);
339    }
336   osd_font *font_alloc()
337   {
338      return global_alloc(osd_font_sdl);
339   }
340340
341    int init()
342    {
343        if (TTF_Init() == -1)
344        {
345            osd_printf_error("SDL_ttf failed: %s\n", TTF_GetError());
346            return -1;
347        }
348        return 0;
349    }
341   int init()
342   {
343      if (TTF_Init() == -1)
344      {
345         osd_printf_error("SDL_ttf failed: %s\n", TTF_GetError());
346         return -1;
347      }
348      return 0;
349   }
350350
351    virtual void exit()
352    {
353        TTF_Quit();
354    }
351   virtual void exit()
352   {
353      TTF_Quit();
354   }
355355};
356356#else /* SDLMAME_UNIX */
357    MODULE_NOT_SUPPORTED(font_sdl, OSD_FONT_PROVIDER, "sdl")
357   MODULE_NOT_SUPPORTED(font_sdl, OSD_FONT_PROVIDER, "sdl")
358358#endif
359359
360360MODULE_DEFINITION(FONT_SDL, font_sdl)
361
362
trunk/src/osd/modules/font/font_windows.c
r243189r243190
3434class osd_font_windows : public osd_font
3535{
3636public:
37    virtual ~osd_font_windows() {};
37   virtual ~osd_font_windows() {};
3838
39    virtual bool open(const char *font_path, const char *name, int &height);
40    virtual void close();
41    virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
39   virtual bool open(const char *font_path, const char *name, int &height);
40   virtual void close();
41   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
4242private:
43    HGDIOBJ m_font;
43   HGDIOBJ m_font;
4444};
4545
4646bool osd_font_windows::open(const char *font_path, const char *_name, int &height)
4747{
48    // accept qualifiers from the name
49    astring name(_name);
50    if (name == "default") name = "Tahoma";
51    bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
52    bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
48   // accept qualifiers from the name
49   astring name(_name);
50   if (name == "default") name = "Tahoma";
51   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
52   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
5353
54    // build a basic LOGFONT description of what we want
55    LOGFONT logfont;
56    logfont.lfHeight = DEFAULT_FONT_HEIGHT;
57    logfont.lfWidth = 0;
58    logfont.lfEscapement = 0;
59    logfont.lfOrientation = 0;
60    logfont.lfWeight = bold ? FW_BOLD : FW_MEDIUM;
61    logfont.lfItalic = italic;
62    logfont.lfUnderline = FALSE;
63    logfont.lfStrikeOut = FALSE;
64    logfont.lfCharSet = ANSI_CHARSET;
65    logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
66    logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
67    logfont.lfQuality = NONANTIALIASED_QUALITY;
68    logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
54   // build a basic LOGFONT description of what we want
55   LOGFONT logfont;
56   logfont.lfHeight = DEFAULT_FONT_HEIGHT;
57   logfont.lfWidth = 0;
58   logfont.lfEscapement = 0;
59   logfont.lfOrientation = 0;
60   logfont.lfWeight = bold ? FW_BOLD : FW_MEDIUM;
61   logfont.lfItalic = italic;
62   logfont.lfUnderline = FALSE;
63   logfont.lfStrikeOut = FALSE;
64   logfont.lfCharSet = ANSI_CHARSET;
65   logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
66   logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
67   logfont.lfQuality = NONANTIALIASED_QUALITY;
68   logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
6969
70    // copy in the face name
71    TCHAR *face = tstring_from_utf8(name);
72    _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
73    logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0;
74    osd_free(face);
70   // copy in the face name
71   TCHAR *face = tstring_from_utf8(name);
72   _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
73   logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0;
74   osd_free(face);
7575
76    // create the font
77    height = logfont.lfHeight;
78    m_font = CreateFontIndirect(&logfont);
79    if (m_font == NULL)
80        return false;
76   // create the font
77   height = logfont.lfHeight;
78   m_font = CreateFontIndirect(&logfont);
79   if (m_font == NULL)
80      return false;
8181
82    // select it into a temp DC and get the real font name
83    HDC dummyDC = CreateCompatibleDC(NULL);
84    HGDIOBJ oldfont = SelectObject(dummyDC, m_font);
85    TCHAR realname[100];
86    GetTextFace(dummyDC, ARRAY_LENGTH(realname), realname);
87    SelectObject(dummyDC, oldfont);
88    DeleteDC(dummyDC);
82   // select it into a temp DC and get the real font name
83   HDC dummyDC = CreateCompatibleDC(NULL);
84   HGDIOBJ oldfont = SelectObject(dummyDC, m_font);
85   TCHAR realname[100];
86   GetTextFace(dummyDC, ARRAY_LENGTH(realname), realname);
87   SelectObject(dummyDC, oldfont);
88   DeleteDC(dummyDC);
8989
90    // if it doesn't match our request, fail
91    char *utf = utf8_from_tstring(realname);
92    int result = core_stricmp(utf, name);
93    osd_free(utf);
90   // if it doesn't match our request, fail
91   char *utf = utf8_from_tstring(realname);
92   int result = core_stricmp(utf, name);
93   osd_free(utf);
9494
95    // if we didn't match, nuke our font and fall back
96    if (result != 0)
97    {
98        DeleteObject(m_font);
99        m_font = NULL;
100        return false;
101    }
102    return true;
95   // if we didn't match, nuke our font and fall back
96   if (result != 0)
97   {
98      DeleteObject(m_font);
99      m_font = NULL;
100      return false;
101   }
102   return true;
103103}
104104
105105//-------------------------------------------------
r243189r243190
109109
110110void osd_font_windows::close()
111111{
112    // delete the font ojbect
113    if (m_font != NULL)
114        DeleteObject(m_font);
112   // delete the font ojbect
113   if (m_font != NULL)
114      DeleteObject(m_font);
115115
116116}
117117
r243189r243190
125125
126126bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
127127{
128    // create a dummy DC to work with
129    HDC dummyDC = CreateCompatibleDC(NULL);
130    HGDIOBJ oldfont = SelectObject(dummyDC, m_font);
128   // create a dummy DC to work with
129   HDC dummyDC = CreateCompatibleDC(NULL);
130   HGDIOBJ oldfont = SelectObject(dummyDC, m_font);
131131
132    // get the text metrics
133    TEXTMETRIC metrics = { 0 };
134    GetTextMetrics(dummyDC, &metrics);
132   // get the text metrics
133   TEXTMETRIC metrics = { 0 };
134   GetTextMetrics(dummyDC, &metrics);
135135
136    // get the width of this character
137    ABC abc;
138    if (!GetCharABCWidths(dummyDC, chnum, chnum, &abc))
139    {
140        abc.abcA = 0;
141        abc.abcC = 0;
142        GetCharWidth32(dummyDC, chnum, chnum, reinterpret_cast<LPINT>(&abc.abcB));
143    }
144    width = abc.abcA + abc.abcB + abc.abcC;
136   // get the width of this character
137   ABC abc;
138   if (!GetCharABCWidths(dummyDC, chnum, chnum, &abc))
139   {
140      abc.abcA = 0;
141      abc.abcC = 0;
142      GetCharWidth32(dummyDC, chnum, chnum, reinterpret_cast<LPINT>(&abc.abcB));
143   }
144   width = abc.abcA + abc.abcB + abc.abcC;
145145
146    // determine desired bitmap size
147    int bmwidth = (50 + abc.abcA + abc.abcB + abc.abcC + 50 + 31) & ~31;
148    int bmheight = 50 + metrics.tmHeight + 50;
146   // determine desired bitmap size
147   int bmwidth = (50 + abc.abcA + abc.abcB + abc.abcC + 50 + 31) & ~31;
148   int bmheight = 50 + metrics.tmHeight + 50;
149149
150    // describe the bitmap we want
151    BYTE bitmapinfodata[sizeof(BITMAPINFOHEADER)+2 * sizeof(RGBQUAD)] = { 0 };
152    BITMAPINFO &info = *reinterpret_cast<BITMAPINFO *>(bitmapinfodata);
153    info.bmiHeader.biSize = sizeof(info.bmiHeader);
154    info.bmiHeader.biWidth = bmwidth;
155    info.bmiHeader.biHeight = -bmheight;
156    info.bmiHeader.biPlanes = 1;
157    info.bmiHeader.biBitCount = 1;
158    info.bmiHeader.biCompression = BI_RGB;
159    info.bmiHeader.biSizeImage = 0;
160    info.bmiHeader.biXPelsPerMeter = GetDeviceCaps(dummyDC, HORZRES) / GetDeviceCaps(dummyDC, HORZSIZE);
161    info.bmiHeader.biYPelsPerMeter = GetDeviceCaps(dummyDC, VERTRES) / GetDeviceCaps(dummyDC, VERTSIZE);
162    info.bmiHeader.biClrUsed = 0;
163    info.bmiHeader.biClrImportant = 0;
164    RGBQUAD col1 = info.bmiColors[0];
165    RGBQUAD col2 = info.bmiColors[1];
166    col1.rgbBlue = col1.rgbGreen = col1.rgbRed = 0x00;
167    col2.rgbBlue = col2.rgbGreen = col2.rgbRed = 0xff;
150   // describe the bitmap we want
151   BYTE bitmapinfodata[sizeof(BITMAPINFOHEADER)+2 * sizeof(RGBQUAD)] = { 0 };
152   BITMAPINFO &info = *reinterpret_cast<BITMAPINFO *>(bitmapinfodata);
153   info.bmiHeader.biSize = sizeof(info.bmiHeader);
154   info.bmiHeader.biWidth = bmwidth;
155   info.bmiHeader.biHeight = -bmheight;
156   info.bmiHeader.biPlanes = 1;
157   info.bmiHeader.biBitCount = 1;
158   info.bmiHeader.biCompression = BI_RGB;
159   info.bmiHeader.biSizeImage = 0;
160   info.bmiHeader.biXPelsPerMeter = GetDeviceCaps(dummyDC, HORZRES) / GetDeviceCaps(dummyDC, HORZSIZE);
161   info.bmiHeader.biYPelsPerMeter = GetDeviceCaps(dummyDC, VERTRES) / GetDeviceCaps(dummyDC, VERTSIZE);
162   info.bmiHeader.biClrUsed = 0;
163   info.bmiHeader.biClrImportant = 0;
164   RGBQUAD col1 = info.bmiColors[0];
165   RGBQUAD col2 = info.bmiColors[1];
166   col1.rgbBlue = col1.rgbGreen = col1.rgbRed = 0x00;
167   col2.rgbBlue = col2.rgbGreen = col2.rgbRed = 0xff;
168168
169    // create a DIB to render to
170    BYTE *bits;
171    HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0);
172    HGDIOBJ oldbitmap = SelectObject(dummyDC, dib);
169   // create a DIB to render to
170   BYTE *bits;
171   HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast<VOID **>(&bits), NULL, 0);
172   HGDIOBJ oldbitmap = SelectObject(dummyDC, dib);
173173
174    // clear the bitmap
175    int rowbytes = bmwidth / 8;
176    memset(bits, 0, rowbytes * bmheight);
174   // clear the bitmap
175   int rowbytes = bmwidth / 8;
176   memset(bits, 0, rowbytes * bmheight);
177177
178    // now draw the character
179    WCHAR tempchar = chnum;
180    SetTextColor(dummyDC, RGB(0xff, 0xff, 0xff));
181    SetBkColor(dummyDC, RGB(0x00, 0x00, 0x00));
182    ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, NULL, &tempchar, 1, NULL);
178   // now draw the character
179   WCHAR tempchar = chnum;
180   SetTextColor(dummyDC, RGB(0xff, 0xff, 0xff));
181   SetBkColor(dummyDC, RGB(0x00, 0x00, 0x00));
182   ExtTextOutW(dummyDC, 50 + abc.abcA, 50, ETO_OPAQUE, NULL, &tempchar, 1, NULL);
183183
184    // characters are expected to be full-height
185    rectangle actbounds;
186    actbounds.min_y = 50;
187    actbounds.max_y = 50 + metrics.tmHeight - 1;
184   // characters are expected to be full-height
185   rectangle actbounds;
186   actbounds.min_y = 50;
187   actbounds.max_y = 50 + metrics.tmHeight - 1;
188188
189    // determine the actual left of the character
190    for (actbounds.min_x = 0; actbounds.min_x < rowbytes; actbounds.min_x++)
191    {
192        BYTE *offs = bits + actbounds.min_x;
193        UINT8 summary = 0;
194        for (int y = 0; y < bmheight; y++)
195            summary |= offs[y * rowbytes];
196        if (summary != 0)
197        {
198            actbounds.min_x *= 8;
199            if (!(summary & 0x80)) actbounds.min_x++;
200            if (!(summary & 0xc0)) actbounds.min_x++;
201            if (!(summary & 0xe0)) actbounds.min_x++;
202            if (!(summary & 0xf0)) actbounds.min_x++;
203            if (!(summary & 0xf8)) actbounds.min_x++;
204            if (!(summary & 0xfc)) actbounds.min_x++;
205            if (!(summary & 0xfe)) actbounds.min_x++;
206            break;
207        }
208    }
189   // determine the actual left of the character
190   for (actbounds.min_x = 0; actbounds.min_x < rowbytes; actbounds.min_x++)
191   {
192      BYTE *offs = bits + actbounds.min_x;
193      UINT8 summary = 0;
194      for (int y = 0; y < bmheight; y++)
195         summary |= offs[y * rowbytes];
196      if (summary != 0)
197      {
198         actbounds.min_x *= 8;
199         if (!(summary & 0x80)) actbounds.min_x++;
200         if (!(summary & 0xc0)) actbounds.min_x++;
201         if (!(summary & 0xe0)) actbounds.min_x++;
202         if (!(summary & 0xf0)) actbounds.min_x++;
203         if (!(summary & 0xf8)) actbounds.min_x++;
204         if (!(summary & 0xfc)) actbounds.min_x++;
205         if (!(summary & 0xfe)) actbounds.min_x++;
206         break;
207      }
208   }
209209
210    // determine the actual right of the character
211    for (actbounds.max_x = rowbytes - 1; actbounds.max_x >= 0; actbounds.max_x--)
212    {
213        BYTE *offs = bits + actbounds.max_x;
214        UINT8 summary = 0;
215        for (int y = 0; y < bmheight; y++)
216            summary |= offs[y * rowbytes];
217        if (summary != 0)
218        {
219            actbounds.max_x *= 8;
220            if (summary & 0x7f) actbounds.max_x++;
221            if (summary & 0x3f) actbounds.max_x++;
222            if (summary & 0x1f) actbounds.max_x++;
223            if (summary & 0x0f) actbounds.max_x++;
224            if (summary & 0x07) actbounds.max_x++;
225            if (summary & 0x03) actbounds.max_x++;
226            if (summary & 0x01) actbounds.max_x++;
227            break;
228        }
229    }
210   // determine the actual right of the character
211   for (actbounds.max_x = rowbytes - 1; actbounds.max_x >= 0; actbounds.max_x--)
212   {
213      BYTE *offs = bits + actbounds.max_x;
214      UINT8 summary = 0;
215      for (int y = 0; y < bmheight; y++)
216         summary |= offs[y * rowbytes];
217      if (summary != 0)
218      {
219         actbounds.max_x *= 8;
220         if (summary & 0x7f) actbounds.max_x++;
221         if (summary & 0x3f) actbounds.max_x++;
222         if (summary & 0x1f) actbounds.max_x++;
223         if (summary & 0x0f) actbounds.max_x++;
224         if (summary & 0x07) actbounds.max_x++;
225         if (summary & 0x03) actbounds.max_x++;
226         if (summary & 0x01) actbounds.max_x++;
227         break;
228      }
229   }
230230
231    // allocate a new bitmap
232    if (actbounds.max_x >= actbounds.min_x && actbounds.max_y >= actbounds.min_y)
233    {
234        bitmap.allocate(actbounds.max_x + 1 - actbounds.min_x, actbounds.max_y + 1 - actbounds.min_y);
231   // allocate a new bitmap
232   if (actbounds.max_x >= actbounds.min_x && actbounds.max_y >= actbounds.min_y)
233   {
234      bitmap.allocate(actbounds.max_x + 1 - actbounds.min_x, actbounds.max_y + 1 - actbounds.min_y);
235235
236        // copy the bits into it
237        for (int y = 0; y < bitmap.height(); y++)
238        {
239            UINT32 *dstrow = &bitmap.pix32(y);
240            UINT8 *srcrow = &bits[(y + actbounds.min_y) * rowbytes];
241            for (int x = 0; x < bitmap.width(); x++)
242            {
243                int effx = x + actbounds.min_x;
244                dstrow[x] = ((srcrow[effx / 8] << (effx % 8)) & 0x80) ? rgb_t(0xff, 0xff, 0xff, 0xff) : rgb_t(0x00, 0xff, 0xff, 0xff);
245            }
246        }
236      // copy the bits into it
237      for (int y = 0; y < bitmap.height(); y++)
238      {
239         UINT32 *dstrow = &bitmap.pix32(y);
240         UINT8 *srcrow = &bits[(y + actbounds.min_y) * rowbytes];
241         for (int x = 0; x < bitmap.width(); x++)
242         {
243            int effx = x + actbounds.min_x;
244            dstrow[x] = ((srcrow[effx / 8] << (effx % 8)) & 0x80) ? rgb_t(0xff, 0xff, 0xff, 0xff) : rgb_t(0x00, 0xff, 0xff, 0xff);
245         }
246      }
247247
248        // set the final offset values
249        xoffs = actbounds.min_x - (50 + abc.abcA);
250        yoffs = actbounds.max_y - (50 + metrics.tmAscent);
251    }
248      // set the final offset values
249      xoffs = actbounds.min_x - (50 + abc.abcA);
250      yoffs = actbounds.max_y - (50 + metrics.tmAscent);
251   }
252252
253    // de-select the font and release the DC
254    SelectObject(dummyDC, oldbitmap);
255    DeleteObject(dib);
256    SelectObject(dummyDC, oldfont);
257    DeleteDC(dummyDC);
258    return bitmap.valid();
253   // de-select the font and release the DC
254   SelectObject(dummyDC, oldbitmap);
255   DeleteObject(dib);
256   SelectObject(dummyDC, oldfont);
257   DeleteDC(dummyDC);
258   return bitmap.valid();
259259}
260260
261261class font_win : public osd_module, public font_module
262262{
263263public:
264    font_win()
265    : osd_module(OSD_FONT_PROVIDER, "win"), font_module()
266    {
267    }
264   font_win()
265   : osd_module(OSD_FONT_PROVIDER, "win"), font_module()
266   {
267   }
268268
269    osd_font *font_alloc()
270    {
271        return global_alloc(osd_font_windows);
272    }
269   osd_font *font_alloc()
270   {
271      return global_alloc(osd_font_windows);
272   }
273273
274274};
275275#else /* SDLMAME_UNIX */
276    MODULE_NOT_SUPPORTED(font_win, OSD_FONT_PROVIDER, "win")
276   MODULE_NOT_SUPPORTED(font_win, OSD_FONT_PROVIDER, "win")
277277#endif
278278
279279MODULE_DEFINITION(FONT_WINDOWS, font_win)
trunk/src/osd/modules/lib/osdlib_macosx.c
r243189r243190
3434
3535const char *osd_getenv(const char *name)
3636{
37    return getenv(name);
37   return getenv(name);
3838}
3939
4040//============================================================
r243189r243190
4343
4444int osd_setenv(const char *name, const char *value, int overwrite)
4545{
46    return setenv(name, value, overwrite);
46   return setenv(name, value, overwrite);
4747}
4848
4949//============================================================
r243189r243190
5252
5353void osd_process_kill(void)
5454{
55    kill(getpid(), SIGKILL);
55   kill(getpid(), SIGKILL);
5656}
5757
5858//============================================================
r243189r243190
6161
6262int osd_get_num_processors(void)
6363{
64    int processors = 1;
64   int processors = 1;
6565
66    struct host_basic_info host_basic_info;
67    unsigned int count;
68    kern_return_t r;
69    mach_port_t my_mach_host_self;
66   struct host_basic_info host_basic_info;
67   unsigned int count;
68   kern_return_t r;
69   mach_port_t my_mach_host_self;
7070
71    count = HOST_BASIC_INFO_COUNT;
72    my_mach_host_self = mach_host_self();
73    if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
74    {
75        processors = host_basic_info.avail_cpus;
76    }
77    mach_port_deallocate(mach_task_self(), my_mach_host_self);
71   count = HOST_BASIC_INFO_COUNT;
72   my_mach_host_self = mach_host_self();
73   if ( ( r = host_info(my_mach_host_self, HOST_BASIC_INFO, (host_info_t)(&host_basic_info), &count)) == KERN_SUCCESS )
74   {
75      processors = host_basic_info.avail_cpus;
76   }
77   mach_port_deallocate(mach_task_self(), my_mach_host_self);
7878
79    return processors;
79   return processors;
8080}
8181
8282//============================================================
r243189r243190
8686void *osd_malloc(size_t size)
8787{
8888#ifndef MALLOC_DEBUG
89    return malloc(size);
89   return malloc(size);
9090#else
9191#error "MALLOC_DEBUG not yet supported"
9292#endif
r243189r243190
100100void *osd_malloc_array(size_t size)
101101{
102102#ifndef MALLOC_DEBUG
103    return malloc(size);
103   return malloc(size);
104104#else
105105#error "MALLOC_DEBUG not yet supported"
106106#endif
r243189r243190
114114void osd_free(void *ptr)
115115{
116116#ifndef MALLOC_DEBUG
117    free(ptr);
117   free(ptr);
118118#else
119119#error "MALLOC_DEBUG not yet supported"
120120#endif
r243189r243190
131131void *osd_alloc_executable(size_t size)
132132{
133133#if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX)
134    return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
134   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
135135#elif defined(SDLMAME_UNIX)
136    return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
136   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
137137#endif
138138}
139139
r243189r243190
146146void osd_free_executable(void *ptr, size_t size)
147147{
148148#ifdef SDLMAME_SOLARIS
149    munmap((char *)ptr, size);
149   munmap((char *)ptr, size);
150150#else
151    munmap(ptr, size);
151   munmap(ptr, size);
152152#endif
153153}
154154
r243189r243190
158158
159159void osd_break_into_debugger(const char *message)
160160{
161    #ifdef MAME_DEBUG
162    printf("MAME exception: %s\n", message);
163    printf("Attempting to fall into debugger\n");
164    kill(getpid(), SIGTRAP);
165    #else
166    printf("Ignoring MAME exception: %s\n", message);
167    #endif
161   #ifdef MAME_DEBUG
162   printf("MAME exception: %s\n", message);
163   printf("Attempting to fall into debugger\n");
164   kill(getpid(), SIGTRAP);
165   #else
166   printf("Ignoring MAME exception: %s\n", message);
167   #endif
168168}
169169
170170
r243189r243190
191191
192192static osd_ticks_t init_cycle_counter(void)
193193{
194    osd_ticks_t start, end;
195    osd_ticks_t a, b;
194   osd_ticks_t start, end;
195   osd_ticks_t a, b;
196196
197    cycle_counter = mach_cycle_counter;
198    ticks_counter = mach_cycle_counter;
197   cycle_counter = mach_cycle_counter;
198   ticks_counter = mach_cycle_counter;
199199
200    // wait for an edge on the timeGetTime call
201    a = SDL_GetTicks();
202    do
203    {
204        b = SDL_GetTicks();
205    } while (a == b);
200   // wait for an edge on the timeGetTime call
201   a = SDL_GetTicks();
202   do
203   {
204      b = SDL_GetTicks();
205   } while (a == b);
206206
207    // get the starting cycle count
208    start = (*cycle_counter)();
207   // get the starting cycle count
208   start = (*cycle_counter)();
209209
210    // now wait for 1/4 second total
211    do
212    {
213        a = SDL_GetTicks();
214    } while (a - b < 250);
210   // now wait for 1/4 second total
211   do
212   {
213      a = SDL_GetTicks();
214   } while (a - b < 250);
215215
216    // get the ending cycle count
217    end = (*cycle_counter)();
216   // get the ending cycle count
217   end = (*cycle_counter)();
218218
219    // compute ticks_per_sec
220    ticks_per_second = (end - start) * 4;
219   // compute ticks_per_sec
220   ticks_per_second = (end - start) * 4;
221221
222    // return the current cycle count
223    return (*cycle_counter)();
222   // return the current cycle count
223   return (*cycle_counter)();
224224}
225225
226226//============================================================
r243189r243190
232232//============================================================
233233static osd_ticks_t mach_cycle_counter(void)
234234{
235    return mach_absolute_time();
235   return mach_absolute_time();
236236}
237237
238238//============================================================
r243189r243190
241241
242242osd_ticks_t osd_ticks(void)
243243{
244    return (*cycle_counter)();
244   return (*cycle_counter)();
245245}
246246
247247
r243189r243190
251251
252252osd_ticks_t osd_ticks_per_second(void)
253253{
254    if (ticks_per_second == 0)
255    {
256        // if we haven't computed the value yet, there's no time like the present
257        init_cycle_counter();
258    }
259    return ticks_per_second;
254   if (ticks_per_second == 0)
255   {
256      // if we haven't computed the value yet, there's no time like the present
257      init_cycle_counter();
258   }
259   return ticks_per_second;
260260}
261261
262262
r243189r243190
267267
268268void osd_sleep(osd_ticks_t duration)
269269{
270    UINT32 msec;
270   UINT32 msec;
271271
272    // make sure we've computed ticks_per_second
273    if (ticks_per_second == 0)
274        (void)osd_ticks();
272   // make sure we've computed ticks_per_second
273   if (ticks_per_second == 0)
274      (void)osd_ticks();
275275
276    // convert to milliseconds, rounding down
277    msec = (UINT32)(duration * 1000 / ticks_per_second);
276   // convert to milliseconds, rounding down
277   msec = (UINT32)(duration * 1000 / ticks_per_second);
278278
279    // only sleep if at least 2 full milliseconds
280    if (msec >= 2)
281    {
282        // take a couple of msecs off the top for good measure
283        msec -= 2;
284        usleep(msec*1000);
285    }
279   // only sleep if at least 2 full milliseconds
280   if (msec >= 2)
281   {
282      // take a couple of msecs off the top for good measure
283      msec -= 2;
284      usleep(msec*1000);
285   }
286286}
trunk/src/osd/modules/lib/osdlib_os2.c
r243189r243190
3131
3232const char *osd_getenv(const char *name)
3333{
34    return getenv(name);
34   return getenv(name);
3535}
3636
3737//============================================================
r243189r243190
4040
4141int osd_setenv(const char *name, const char *value, int overwrite)
4242{
43    return setenv(name, value, overwrite);
43   return setenv(name, value, overwrite);
4444}
4545
4646//============================================================
r243189r243190
4949
5050void osd_process_kill(void)
5151{
52    fprintf(stderr,"osd_process_kill missing in OS/2 build\n");
52   fprintf(stderr,"osd_process_kill missing in OS/2 build\n");
5353}
5454
5555//============================================================
r243189r243190
5858
5959int osd_get_num_processors(void)
6060{
61    ULONG numprocs = 1;
61   ULONG numprocs = 1;
6262
63    DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &numprocs, sizeof(numprocs));
63   DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &numprocs, sizeof(numprocs));
6464
65    return numprocs;
65   return numprocs;
6666}
6767
6868//============================================================
r243189r243190
7272void *osd_malloc(size_t size)
7373{
7474#ifndef MALLOC_DEBUG
75    return malloc(size);
75   return malloc(size);
7676#else
7777#error "MALLOC_DEBUG not yet supported"
7878#endif
r243189r243190
8686void *osd_malloc_array(size_t size)
8787{
8888#ifndef MALLOC_DEBUG
89    return malloc(size);
89   return malloc(size);
9090#else
9191#error "MALLOC_DEBUG not yet supported"
9292#endif
r243189r243190
100100void osd_free(void *ptr)
101101{
102102#ifndef MALLOC_DEBUG
103    free(ptr);
103   free(ptr);
104104#else
105105#error "MALLOC_DEBUG not yet supported"
106106#endif
r243189r243190
116116
117117void *osd_alloc_executable(size_t size)
118118{
119    void *p;
119   void *p;
120120
121    DosAllocMem( &p, size, fALLOC );
122    return p;
121   DosAllocMem( &p, size, fALLOC );
122   return p;
123123}
124124
125125//============================================================
r243189r243190
130130
131131void osd_free_executable(void *ptr, size_t size)
132132{
133    DosFreeMem( ptr );
133   DosFreeMem( ptr );
134134}
135135
136136//============================================================
r243189r243190
139139
140140void osd_break_into_debugger(const char *message)
141141{
142    printf("Ignoring MAME exception: %s\n", message);
142   printf("Ignoring MAME exception: %s\n", message);
143143}
144144
145145//============================================================
r243189r243190
167167
168168static osd_ticks_t init_cycle_counter(void)
169169{
170    osd_ticks_t start, end;
171    osd_ticks_t a, b;
170   osd_ticks_t start, end;
171   osd_ticks_t a, b;
172172
173    ULONG  frequency;
174    PTIB   ptib;
175    ULONG  ulClass;
176    ULONG  ulDelta;
173   ULONG  frequency;
174   PTIB   ptib;
175   ULONG  ulClass;
176   ULONG  ulDelta;
177177
178    DosGetInfoBlocks( &ptib, NULL );
179    ulClass = HIBYTE( ptib->tib_ptib2->tib2_ulpri );
180    ulDelta = LOBYTE( ptib->tib_ptib2->tib2_ulpri );
178   DosGetInfoBlocks( &ptib, NULL );
179   ulClass = HIBYTE( ptib->tib_ptib2->tib2_ulpri );
180   ulDelta = LOBYTE( ptib->tib_ptib2->tib2_ulpri );
181181
182    if ( DosTmrQueryFreq( &frequency ) == 0 )
183    {
184        // use performance counter if available as it is constant
185        cycle_counter = performance_cycle_counter;
186        ticks_counter = performance_cycle_counter;
182   if ( DosTmrQueryFreq( &frequency ) == 0 )
183   {
184      // use performance counter if available as it is constant
185      cycle_counter = performance_cycle_counter;
186      ticks_counter = performance_cycle_counter;
187187
188        ticks_per_second = frequency;
188      ticks_per_second = frequency;
189189
190        // return the current cycle count
191        return (*cycle_counter)();
192    }
193    else
194    {
195        fprintf(stderr, "No Timer available!\n");
196        exit(-1);
197    }
190      // return the current cycle count
191      return (*cycle_counter)();
192   }
193   else
194   {
195      fprintf(stderr, "No Timer available!\n");
196      exit(-1);
197   }
198198
199    // temporarily set our priority higher
200    DosSetPriority( PRTYS_THREAD, PRTYC_TIMECRITICAL, PRTYD_MAXIMUM, 0 );
199   // temporarily set our priority higher
200   DosSetPriority( PRTYS_THREAD, PRTYC_TIMECRITICAL, PRTYD_MAXIMUM, 0 );
201201
202    // wait for an edge on the timeGetTime call
203    a = SDL_GetTicks();
204    do
205    {
206        b = SDL_GetTicks();
207    } while (a == b);
202   // wait for an edge on the timeGetTime call
203   a = SDL_GetTicks();
204   do
205   {
206      b = SDL_GetTicks();
207   } while (a == b);
208208
209    // get the starting cycle count
210    start = (*cycle_counter)();
209   // get the starting cycle count
210   start = (*cycle_counter)();
211211
212    // now wait for 1/4 second total
213    do
214    {
215        a = SDL_GetTicks();
216    } while (a - b < 250);
212   // now wait for 1/4 second total
213   do
214   {
215      a = SDL_GetTicks();
216   } while (a - b < 250);
217217
218    // get the ending cycle count
219    end = (*cycle_counter)();
218   // get the ending cycle count
219   end = (*cycle_counter)();
220220
221    // compute ticks_per_sec
222    ticks_per_second = (end - start) * 4;
221   // compute ticks_per_sec
222   ticks_per_second = (end - start) * 4;
223223
224    // restore our priority
225    DosSetPriority( PRTYS_THREAD, ulClass, ulDelta, 0 );
224   // restore our priority
225   DosSetPriority( PRTYS_THREAD, ulClass, ulDelta, 0 );
226226
227    // return the current cycle count
228    return (*cycle_counter)();
227   // return the current cycle count
228   return (*cycle_counter)();
229229}
230230
231231//============================================================
r243189r243190
234234
235235static osd_ticks_t performance_cycle_counter(void)
236236{
237    QWORD qwTime;
237   QWORD qwTime;
238238
239    DosTmrQueryTime( &qwTime );
240    return (osd_ticks_t)qwTime.ulLo;
239   DosTmrQueryTime( &qwTime );
240   return (osd_ticks_t)qwTime.ulLo;
241241}
242242
243243//============================================================
r243189r243190
246246
247247osd_ticks_t osd_ticks(void)
248248{
249    return (*cycle_counter)();
249   return (*cycle_counter)();
250250}
251251
252252
r243189r243190
256256
257257osd_ticks_t osd_ticks_per_second(void)
258258{
259    if (ticks_per_second == 0)
260    {
261        // if we haven't computed the value yet, there's no time like the present
262        init_cycle_counter();
263    }
264    return ticks_per_second;
259   if (ticks_per_second == 0)
260   {
261      // if we haven't computed the value yet, there's no time like the present
262      init_cycle_counter();
263   }
264   return ticks_per_second;
265265}
266266
267267
r243189r243190
271271
272272void osd_sleep(osd_ticks_t duration)
273273{
274    UINT32 msec;
274   UINT32 msec;
275275
276    // make sure we've computed ticks_per_second
277    if (ticks_per_second == 0)
278        (void)osd_ticks();
276   // make sure we've computed ticks_per_second
277   if (ticks_per_second == 0)
278      (void)osd_ticks();
279279
280    // convert to milliseconds, rounding down
281    msec = (UINT32)(duration * 1000 / ticks_per_second);
280   // convert to milliseconds, rounding down
281   msec = (UINT32)(duration * 1000 / ticks_per_second);
282282
283    // only sleep if at least 2 full milliseconds
284    if (msec >= 2)
285    {
286        // take a couple of msecs off the top for good measure
287        msec -= 2;
288        usleep(msec*1000);
289    }
283   // only sleep if at least 2 full milliseconds
284   if (msec >= 2)
285   {
286      // take a couple of msecs off the top for good measure
287      msec -= 2;
288      usleep(msec*1000);
289   }
290290}
291
trunk/src/osd/modules/lib/osdlib_unix.c
r243189r243190
3030
3131const char *osd_getenv(const char *name)
3232{
33    return getenv(name);
33   return getenv(name);
3434}
3535
3636//============================================================
r243189r243190
3939
4040int osd_setenv(const char *name, const char *value, int overwrite)
4141{
42    return setenv(name, value, overwrite);
42   return setenv(name, value, overwrite);
4343}
4444
4545//============================================================
r243189r243190
4848
4949void osd_process_kill(void)
5050{
51    kill(getpid(), SIGKILL);
51   kill(getpid(), SIGKILL);
5252}
5353
5454//============================================================
r243189r243190
5757
5858int osd_get_num_processors(void)
5959{
60    int processors = 1;
60   int processors = 1;
6161
6262#if defined(_SC_NPROCESSORS_ONLN)
63    processors = sysconf(_SC_NPROCESSORS_ONLN);
63   processors = sysconf(_SC_NPROCESSORS_ONLN);
6464#endif
65    return processors;
65   return processors;
6666}
6767
6868//============================================================
r243189r243190
7272void *osd_malloc(size_t size)
7373{
7474#ifndef MALLOC_DEBUG
75    return malloc(size);
75   return malloc(size);
7676#else
7777#error "MALLOC_DEBUG not yet supported"
7878#endif
r243189r243190
8686void *osd_malloc_array(size_t size)
8787{
8888#ifndef MALLOC_DEBUG
89    return malloc(size);
89   return malloc(size);
9090#else
9191#error "MALLOC_DEBUG not yet supported"
9292#endif
r243189r243190
100100void osd_free(void *ptr)
101101{
102102#ifndef MALLOC_DEBUG
103    free(ptr);
103   free(ptr);
104104#else
105105#error "MALLOC_DEBUG not yet supported"
106106#endif
r243189r243190
116116void *osd_alloc_executable(size_t size)
117117{
118118#if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX)
119    return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
119   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0);
120120#elif defined(SDLMAME_UNIX)
121    return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
121   return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0);
122122#endif
123123}
124124
r243189r243190
131131void osd_free_executable(void *ptr, size_t size)
132132{
133133#ifdef SDLMAME_SOLARIS
134    munmap((char *)ptr, size);
134   munmap((char *)ptr, size);
135135#else
136    munmap(ptr, size);
136   munmap(ptr, size);
137137#endif
138138}
139139
r243189r243190
143143
144144void osd_break_into_debugger(const char *message)
145145{
146    #ifdef MAME_DEBUG
147    printf("MAME exception: %s\n", message);
148    printf("Attempting to fall into debugger\n");
149    kill(getpid(), SIGTRAP);
150    #else
151    printf("Ignoring MAME exception: %s\n", message);
152    #endif
146   #ifdef MAME_DEBUG
147   printf("MAME exception: %s\n", message);
148   printf("Attempting to fall into debugger\n");
149   kill(getpid(), SIGTRAP);
150   #else
151   printf("Ignoring MAME exception: %s\n", message);
152   #endif
153153}
154154
155155
r243189r243190
160160osd_ticks_t osd_ticks(void)
161161{
162162#ifdef SDLMAME_EMSCRIPTEN
163        return (osd_ticks_t)(emscripten_get_now() * 1000.0);
163      return (osd_ticks_t)(emscripten_get_now() * 1000.0);
164164#else
165        struct timeval    tp;
166        static osd_ticks_t start_sec = 0;
165      struct timeval    tp;
166      static osd_ticks_t start_sec = 0;
167167
168        gettimeofday(&tp, NULL);
169        if (start_sec==0)
170            start_sec = tp.tv_sec;
171        return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
168      gettimeofday(&tp, NULL);
169      if (start_sec==0)
170         start_sec = tp.tv_sec;
171      return (tp.tv_sec - start_sec) * (osd_ticks_t) 1000000 + tp.tv_usec;
172172#endif
173173}
174174
r243189r243190
179179
180180osd_ticks_t osd_ticks_per_second(void)
181181{
182    return (osd_ticks_t) 1000000;
182   return (osd_ticks_t) 1000000;
183183}
184184
185185//============================================================
r243189r243190
188188
189189void osd_sleep(osd_ticks_t duration)
190190{
191    UINT32 msec;
191   UINT32 msec;
192192
193    // convert to milliseconds, rounding down
194    msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
193   // convert to milliseconds, rounding down
194   msec = (UINT32)(duration * 1000 / osd_ticks_per_second());
195195
196    // only sleep if at least 2 full milliseconds
197    if (msec >= 2)
198    {
199        // take a couple of msecs off the top for good measure
200        msec -= 2;
201        usleep(msec*1000);
202    }
196   // only sleep if at least 2 full milliseconds
197   if (msec >= 2)
198   {
199      // take a couple of msecs off the top for good measure
200      msec -= 2;
201      usleep(msec*1000);
202   }
203203}
trunk/src/osd/modules/lib/osdlib_win32.c
r243189r243190
5353
5454const char *osd_getenv(const char *name)
5555{
56    return getenv(name);
56   return getenv(name);
5757}
5858
5959
r243189r243190
6363
6464int osd_setenv(const char *name, const char *value, int overwrite)
6565{
66    char *buf;
67    int result;
66   char *buf;
67   int result;
6868
69    if (!overwrite)
70    {
71        if (osd_getenv(name) != NULL)
72            return 0;
73    }
74    buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2);
75    sprintf(buf, "%s=%s", name, value);
76    result = putenv(buf);
69   if (!overwrite)
70   {
71      if (osd_getenv(name) != NULL)
72         return 0;
73   }
74   buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2);
75   sprintf(buf, "%s=%s", name, value);
76   result = putenv(buf);
7777
78    /* will be referenced by environment
79     * Therefore it is not freed here
80     */
78   /* will be referenced by environment
79    * Therefore it is not freed here
80    */
8181
82    return result;
82   return result;
8383}
8484
8585//============================================================
r243189r243190
8888
8989void osd_process_kill(void)
9090{
91    TerminateProcess(GetCurrentProcess(), -1);
91   TerminateProcess(GetCurrentProcess(), -1);
9292}
9393
9494//============================================================
r243189r243190
9797
9898int osd_get_num_processors(void)
9999{
100    SYSTEM_INFO info;
100   SYSTEM_INFO info;
101101
102    // otherwise, fetch the info from the system
103    GetSystemInfo(&info);
102   // otherwise, fetch the info from the system
103   GetSystemInfo(&info);
104104
105    // max out at 4 for now since scaling above that seems to do poorly
106    return MIN(info.dwNumberOfProcessors, 4);
105   // max out at 4 for now since scaling above that seems to do poorly
106   return MIN(info.dwNumberOfProcessors, 4);
107107}
108108
109109//============================================================
r243189r243190
113113void *osd_malloc(size_t size)
114114{
115115#ifndef MALLOC_DEBUG
116    return HeapAlloc(GetProcessHeap(), 0, size);
116   return HeapAlloc(GetProcessHeap(), 0, size);
117117#else
118    // add in space for the size
119    size += sizeof(size_t);
118   // add in space for the size
119   size += sizeof(size_t);
120120
121    // basic objects just come from the heap
122    void *result = HeapAlloc(GetProcessHeap(), 0, size);
121   // basic objects just come from the heap
122   void *result = HeapAlloc(GetProcessHeap(), 0, size);
123123
124    // store the size and return and pointer to the data afterward
125    *reinterpret_cast<size_t *>(result) = size;
126    return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
124   // store the size and return and pointer to the data afterward
125   *reinterpret_cast<size_t *>(result) = size;
126   return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
127127#endif
128128}
129129
r243189r243190
135135void *osd_malloc_array(size_t size)
136136{
137137#ifndef MALLOC_DEBUG
138    return HeapAlloc(GetProcessHeap(), 0, size);
138   return HeapAlloc(GetProcessHeap(), 0, size);
139139#else
140    // add in space for the size
141    size += sizeof(size_t);
140   // add in space for the size
141   size += sizeof(size_t);
142142
143    // round the size up to a page boundary
144    size_t rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
143   // round the size up to a page boundary
144   size_t rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
145145
146    // reserve that much memory, plus two guard pages
147    void *page_base = VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
148    if (page_base == NULL)
149        return NULL;
146   // reserve that much memory, plus two guard pages
147   void *page_base = VirtualAlloc(NULL, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
148   if (page_base == NULL)
149      return NULL;
150150
151    // now allow access to everything but the first and last pages
152    page_base = VirtualAlloc(reinterpret_cast<UINT8 *>(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
153    if (page_base == NULL)
154        return NULL;
151   // now allow access to everything but the first and last pages
152   page_base = VirtualAlloc(reinterpret_cast<UINT8 *>(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
153   if (page_base == NULL)
154      return NULL;
155155
156    // work backwards from the page base to get to the block base
157    void *result = GUARD_ALIGN_START ? page_base : (reinterpret_cast<UINT8 *>(page_base) + rounded_size - size);
156   // work backwards from the page base to get to the block base
157   void *result = GUARD_ALIGN_START ? page_base : (reinterpret_cast<UINT8 *>(page_base) + rounded_size - size);
158158
159    // store the size at the start with a flag indicating it has a guard page
160    *reinterpret_cast<size_t *>(result) = size | 0x80000000;
161    return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
159   // store the size at the start with a flag indicating it has a guard page
160   *reinterpret_cast<size_t *>(result) = size | 0x80000000;
161   return reinterpret_cast<UINT8 *>(result) + sizeof(size_t);
162162#endif
163163}
164164
r243189r243190
170170void osd_free(void *ptr)
171171{
172172#ifndef MALLOC_DEBUG
173    HeapFree(GetProcessHeap(), 0, ptr);
173   HeapFree(GetProcessHeap(), 0, ptr);
174174#else
175    size_t size = reinterpret_cast<size_t *>(ptr)[-1];
175   size_t size = reinterpret_cast<size_t *>(ptr)[-1];
176176
177    // if no guard page, just free the pointer
178    if ((size & 0x80000000) == 0)
179        HeapFree(GetProcessHeap(), 0, reinterpret_cast<UINT8 *>(ptr) - sizeof(size_t));
177   // if no guard page, just free the pointer
178   if ((size & 0x80000000) == 0)
179      HeapFree(GetProcessHeap(), 0, reinterpret_cast<UINT8 *>(ptr) - sizeof(size_t));
180180
181    // large items need more care
182    else
183    {
184        ULONG_PTR page_base = (reinterpret_cast<ULONG_PTR>(ptr) - sizeof(size_t)) & ~(PAGE_SIZE - 1);
185        VirtualFree(reinterpret_cast<void *>(page_base - PAGE_SIZE), 0, MEM_RELEASE);
186    }
181   // large items need more care
182   else
183   {
184      ULONG_PTR page_base = (reinterpret_cast<ULONG_PTR>(ptr) - sizeof(size_t)) & ~(PAGE_SIZE - 1);
185      VirtualFree(reinterpret_cast<void *>(page_base - PAGE_SIZE), 0, MEM_RELEASE);
186   }
187187#endif
188188}
189189
r243189r243190
197197
198198void *osd_alloc_executable(size_t size)
199199{
200    return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
200   return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
201201}
202202
203203
r243189r243190
209209
210210void osd_free_executable(void *ptr, size_t size)
211211{
212    VirtualFree(ptr, 0, MEM_RELEASE);
212   VirtualFree(ptr, 0, MEM_RELEASE);
213213}
214214
215215
r243189r243190
220220void osd_break_into_debugger(const char *message)
221221{
222222#ifdef OSD_WINDOWS
223    if (IsDebuggerPresent())
224    {
225        win_output_debug_string_utf8(message);
226        DebugBreak();
227    }
228    else if (s_debugger_stack_crawler != NULL)
229        (*s_debugger_stack_crawler)();
223   if (IsDebuggerPresent())
224   {
225      win_output_debug_string_utf8(message);
226      DebugBreak();
227   }
228   else if (s_debugger_stack_crawler != NULL)
229      (*s_debugger_stack_crawler)();
230230#else
231    if (IsDebuggerPresent())
232    {
233        OutputDebugStringA(message);
234        DebugBreak();
235    }
231   if (IsDebuggerPresent())
232   {
233      OutputDebugStringA(message);
234      DebugBreak();
235   }
236236#endif
237237}
238238
r243189r243190
252252
253253osd_ticks_t osd_ticks(void)
254254{
255    LARGE_INTEGER performance_count;
255   LARGE_INTEGER performance_count;
256256
257    // if we're suspended, just return that
258    if (suspend_ticks != 0)
259        return suspend_ticks;
257   // if we're suspended, just return that
258   if (suspend_ticks != 0)
259      return suspend_ticks;
260260
261    // if we have a per second count, just go for it
262    if (ticks_per_second != 0)
263    {
264        // QueryPerformanceCounter if we can
265        if (using_qpc)
266        {
267            QueryPerformanceCounter(&performance_count);
268            return (osd_ticks_t)performance_count.QuadPart - suspend_ticks;
269        }
261   // if we have a per second count, just go for it
262   if (ticks_per_second != 0)
263   {
264      // QueryPerformanceCounter if we can
265      if (using_qpc)
266      {
267         QueryPerformanceCounter(&performance_count);
268         return (osd_ticks_t)performance_count.QuadPart - suspend_ticks;
269      }
270270
271        // otherwise, fall back to timeGetTime
272        else
273            return (osd_ticks_t)timeGetTime() - suspend_ticks;
274    }
271      // otherwise, fall back to timeGetTime
272      else
273         return (osd_ticks_t)timeGetTime() - suspend_ticks;
274   }
275275
276    // if not, we have to determine it
277    using_qpc = QueryPerformanceFrequency(&performance_count) && (performance_count.QuadPart != 0);
278    if (using_qpc)
279        ticks_per_second = (osd_ticks_t)performance_count.QuadPart;
280    else
281        ticks_per_second = 1000;
276   // if not, we have to determine it
277   using_qpc = QueryPerformanceFrequency(&performance_count) && (performance_count.QuadPart != 0);
278   if (using_qpc)
279      ticks_per_second = (osd_ticks_t)performance_count.QuadPart;
280   else
281      ticks_per_second = 1000;
282282
283    // call ourselves to get the first value
284    return osd_ticks();
283   // call ourselves to get the first value
284   return osd_ticks();
285285}
286286
287287
r243189r243190
291291
292292osd_ticks_t osd_ticks_per_second(void)
293293{
294    if (ticks_per_second == 0)
295        osd_ticks();
296    return ticks_per_second;
294   if (ticks_per_second == 0)
295      osd_ticks();
296   return ticks_per_second;
297297}
298298
299299//============================================================
r243189r243190
302302
303303void osd_sleep(osd_ticks_t duration)
304304{
305    DWORD msec;
305   DWORD msec;
306306
307    // make sure we've computed ticks_per_second
308    if (ticks_per_second == 0)
309        (void)osd_ticks();
307   // make sure we've computed ticks_per_second
308   if (ticks_per_second == 0)
309      (void)osd_ticks();
310310
311    // convert to milliseconds, rounding down
312    msec = (DWORD)(duration * 1000 / ticks_per_second);
311   // convert to milliseconds, rounding down
312   msec = (DWORD)(duration * 1000 / ticks_per_second);
313313
314    // only sleep if at least 2 full milliseconds
315    if (msec >= 2)
316    {
317        HANDLE current_thread = GetCurrentThread();
318        int old_priority = GetThreadPriority(current_thread);
314   // only sleep if at least 2 full milliseconds
315   if (msec >= 2)
316   {
317      HANDLE current_thread = GetCurrentThread();
318      int old_priority = GetThreadPriority(current_thread);
319319
320        // take a couple of msecs off the top for good measure
321        msec -= 2;
320      // take a couple of msecs off the top for good measure
321      msec -= 2;
322322
323        // bump our thread priority super high so that we get
324        // priority when we need it
325        SetThreadPriority(current_thread, THREAD_PRIORITY_TIME_CRITICAL);
326        Sleep(msec);
327        SetThreadPriority(current_thread, old_priority);
328    }
323      // bump our thread priority super high so that we get
324      // priority when we need it
325      SetThreadPriority(current_thread, THREAD_PRIORITY_TIME_CRITICAL);
326      Sleep(msec);
327      SetThreadPriority(current_thread, old_priority);
328   }
329329}
trunk/src/osd/modules/lib/osdobj_common.c
r243189r243190
1717
1818const options_entry osd_options::s_option_entries[] =
1919{
20    { NULL,                                   NULL,       OPTION_HEADER,     "OSD FONT OPTIONS" },
21    { OSD_FONT_PROVIDER,                      "auto",     OPTION_STRING,     "provider for ui font: " },
20   { NULL,                                   NULL,       OPTION_HEADER,     "OSD FONT OPTIONS" },
21   { OSD_FONT_PROVIDER,                      "auto",     OPTION_STRING,     "provider for ui font: " },
2222
23    { NULL,                                   NULL,       OPTION_HEADER,     "OSD CLI OPTIONS" },
24    { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist",  "0",        OPTION_COMMAND,    "list available MIDI I/O devices" },
25    { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0",     OPTION_COMMAND,    "list available network adapters" },
23   { NULL,                                   NULL,       OPTION_HEADER,     "OSD CLI OPTIONS" },
24   { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist",  "0",        OPTION_COMMAND,    "list available MIDI I/O devices" },
25   { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0",     OPTION_COMMAND,    "list available network adapters" },
2626
27    // debugging options
28    { NULL,                                   NULL,       OPTION_HEADER,     "OSD DEBUGGING OPTIONS" },
29    { OSDOPTION_DEBUGGER,                     OSDOPTVAL_AUTO,      OPTION_STRING,    "debugger used : " },
30    { OSDOPTION_WATCHDOG ";wdog",             "0",        OPTION_INTEGER,    "force the program to terminate if no updates within specified number of seconds" },
27   // debugging options
28   { NULL,                                   NULL,       OPTION_HEADER,     "OSD DEBUGGING OPTIONS" },
29   { OSDOPTION_DEBUGGER,                     OSDOPTVAL_AUTO,      OPTION_STRING,    "debugger used : " },
30   { OSDOPTION_WATCHDOG ";wdog",             "0",        OPTION_INTEGER,    "force the program to terminate if no updates within specified number of seconds" },
3131
32    // performance options
33    { NULL,                                   NULL,       OPTION_HEADER,     "OSD PERFORMANCE OPTIONS" },
34    { OSDOPTION_MULTITHREADING ";mt",         "0",        OPTION_BOOLEAN,    "enable multithreading; this enables rendering and blitting on a separate thread" },
35    { OSDOPTION_NUMPROCESSORS ";np",          OSDOPTVAL_AUTO,      OPTION_STRING,     "number of processors; this overrides the number the system reports" },
36    { OSDOPTION_BENCH,                        "0",        OPTION_INTEGER,    "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" },
37    // video options
38    { NULL,                                   NULL,       OPTION_HEADER,     "OSD VIDEO OPTIONS" },
32   // performance options
33   { NULL,                                   NULL,       OPTION_HEADER,     "OSD PERFORMANCE OPTIONS" },
34   { OSDOPTION_MULTITHREADING ";mt",         "0",        OPTION_BOOLEAN,    "enable multithreading; this enables rendering and blitting on a separate thread" },
35   { OSDOPTION_NUMPROCESSORS ";np",          OSDOPTVAL_AUTO,      OPTION_STRING,     "number of processors; this overrides the number the system reports" },
36   { OSDOPTION_BENCH,                        "0",        OPTION_INTEGER,    "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" },
37   // video options
38   { NULL,                                   NULL,       OPTION_HEADER,     "OSD VIDEO OPTIONS" },
3939// OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience
40    { OSDOPTION_VIDEO,                        OSDOPTVAL_AUTO,     OPTION_STRING,     "video output method: " },
41    { OSDOPTION_NUMSCREENS "(1-4)",           "1",        OPTION_INTEGER,    "number of screens to create; usually, you want just one" },
42    { OSDOPTION_WINDOW ";w",                  "0",        OPTION_BOOLEAN,    "enable window mode; otherwise, full screen mode is assumed" },
43    { OSDOPTION_MAXIMIZE ";max",              "1",        OPTION_BOOLEAN,    "default to maximized windows; otherwise, windows will be minimized" },
44    { OSDOPTION_KEEPASPECT ";ka",             "1",        OPTION_BOOLEAN,    "constrain to the proper aspect ratio" },
45    { OSDOPTION_UNEVENSTRETCH ";ues",         "1",        OPTION_BOOLEAN,    "allow non-integer stretch factors" },
46    { OSDOPTION_WAITVSYNC ";vs",              "0",        OPTION_BOOLEAN,    "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
47    { OSDOPTION_SYNCREFRESH ";srf",           "0",        OPTION_BOOLEAN,    "enable using the start of VBLANK for throttling instead of the game time" },
40   { OSDOPTION_VIDEO,                        OSDOPTVAL_AUTO,     OPTION_STRING,     "video output method: " },
41   { OSDOPTION_NUMSCREENS "(1-4)",           "1",        OPTION_INTEGER,    "number of screens to create; usually, you want just one" },
42   { OSDOPTION_WINDOW ";w",                  "0",        OPTION_BOOLEAN,    "enable window mode; otherwise, full screen mode is assumed" },
43   { OSDOPTION_MAXIMIZE ";max",              "1",        OPTION_BOOLEAN,    "default to maximized windows; otherwise, windows will be minimized" },
44   { OSDOPTION_KEEPASPECT ";ka",             "1",        OPTION_BOOLEAN,    "constrain to the proper aspect ratio" },
45   { OSDOPTION_UNEVENSTRETCH ";ues",         "1",        OPTION_BOOLEAN,    "allow non-integer stretch factors" },
46   { OSDOPTION_WAITVSYNC ";vs",              "0",        OPTION_BOOLEAN,    "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
47   { OSDOPTION_SYNCREFRESH ";srf",           "0",        OPTION_BOOLEAN,    "enable using the start of VBLANK for throttling instead of the game time" },
4848
49    // per-window options
50    { NULL,                                   NULL,             OPTION_HEADER,    "OSD PER-WINDOW VIDEO OPTIONS" },
51    { OSDOPTION_SCREEN,                   OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
52    { OSDOPTION_ASPECT ";screen_aspect",  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio for all screens; 'auto' here will try to make a best guess" },
53    { OSDOPTION_RESOLUTION ";r",          OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
54    { OSDOPTION_VIEW,                     OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for all screens" },
49   // per-window options
50   { NULL,                                   NULL,             OPTION_HEADER,    "OSD PER-WINDOW VIDEO OPTIONS" },
51   { OSDOPTION_SCREEN,                   OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
52   { OSDOPTION_ASPECT ";screen_aspect",  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio for all screens; 'auto' here will try to make a best guess" },
53   { OSDOPTION_RESOLUTION ";r",          OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" },
54   { OSDOPTION_VIEW,                     OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for all screens" },
5555
56    { OSDOPTION_SCREEN "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
57    { OSDOPTION_ASPECT "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
58    { OSDOPTION_RESOLUTION "0;r0",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
59    { OSDOPTION_VIEW "0",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the first screen" },
56   { OSDOPTION_SCREEN "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the first screen; 'auto' here will try to make a best guess" },
57   { OSDOPTION_ASPECT "0",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the first screen; 'auto' here will try to make a best guess" },
58   { OSDOPTION_RESOLUTION "0;r0",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the first screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
59   { OSDOPTION_VIEW "0",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the first screen" },
6060
61    { OSDOPTION_SCREEN "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the second screen; 'auto' here will try to make a best guess" },
62    { OSDOPTION_ASPECT "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
63    { OSDOPTION_RESOLUTION "1;r1",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
64    { OSDOPTION_VIEW "1",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the second screen" },
61   { OSDOPTION_SCREEN "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the second screen; 'auto' here will try to make a best guess" },
62   { OSDOPTION_ASPECT "1",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the second screen; 'auto' here will try to make a best guess" },
63   { OSDOPTION_RESOLUTION "1;r1",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the second screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
64   { OSDOPTION_VIEW "1",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the second screen" },
6565
66    { OSDOPTION_SCREEN "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the third screen; 'auto' here will try to make a best guess" },
67    { OSDOPTION_ASPECT "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
68    { OSDOPTION_RESOLUTION "2;r2",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
69    { OSDOPTION_VIEW "2",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the third screen" },
66   { OSDOPTION_SCREEN "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the third screen; 'auto' here will try to make a best guess" },
67   { OSDOPTION_ASPECT "2",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the third screen; 'auto' here will try to make a best guess" },
68   { OSDOPTION_RESOLUTION "2;r2",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the third screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
69   { OSDOPTION_VIEW "2",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the third screen" },
7070
71    { OSDOPTION_SCREEN "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
72    { OSDOPTION_ASPECT "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
73    { OSDOPTION_RESOLUTION "3;r3",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
74    { OSDOPTION_VIEW "3",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the fourth screen" },
71   { OSDOPTION_SCREEN "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "explicit name of the fourth screen; 'auto' here will try to make a best guess" },
72   { OSDOPTION_ASPECT "3",                  OSDOPTVAL_AUTO,   OPTION_STRING,    "aspect ratio of the fourth screen; 'auto' here will try to make a best guess" },
73   { OSDOPTION_RESOLUTION "3;r3",        OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred resolution of the fourth screen; format is <width>x<height>[@<refreshrate>] or 'auto'" },
74   { OSDOPTION_VIEW "3",                    OSDOPTVAL_AUTO,   OPTION_STRING,    "preferred view for the fourth screen" },
7575
76    // full screen options
77    { NULL,                                   NULL,  OPTION_HEADER,     "OSD FULL SCREEN OPTIONS" },
78    { OSDOPTION_SWITCHRES,                    "0",   OPTION_BOOLEAN,    "enable resolution switching" },
76   // full screen options
77   { NULL,                                   NULL,  OPTION_HEADER,     "OSD FULL SCREEN OPTIONS" },
78   { OSDOPTION_SWITCHRES,                    "0",   OPTION_BOOLEAN,    "enable resolution switching" },
7979
80    // sound options
81    { NULL,                                   NULL,  OPTION_HEADER,     "OSD SOUND OPTIONS" },
82    { OSDOPTION_SOUND,                        OSDOPTVAL_AUTO, OPTION_STRING,     "sound output method: " },
83    { OSDOPTION_AUDIO_LATENCY "(1-5)",        "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
80   // sound options
81   { NULL,                                   NULL,  OPTION_HEADER,     "OSD SOUND OPTIONS" },
82   { OSDOPTION_SOUND,                        OSDOPTVAL_AUTO, OPTION_STRING,     "sound output method: " },
83   { OSDOPTION_AUDIO_LATENCY "(1-5)",        "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
8484
85    // End of list
86    { NULL }
85   // End of list
86   { NULL }
8787};
8888
8989osd_options::osd_options()
9090: cli_options()
9191{
92    add_entries(osd_options::s_option_entries);
92   add_entries(osd_options::s_option_entries);
9393};
9494
9595
r243189r243190
9999
100100osd_common_t::osd_common_t(osd_options &options)
101101   : m_machine(NULL),
102     m_options(options),
103     m_sound(NULL),
104     m_debugger(NULL)
102      m_options(options),
103      m_sound(NULL),
104      m_debugger(NULL)
105105
106106{
107107}
r243189r243190
110110
111111void osd_common_t::register_options()
112112{
113   REGISTER_MODULE(m_mod_man, FONT_OSX);
114   REGISTER_MODULE(m_mod_man, FONT_WINDOWS);
115   REGISTER_MODULE(m_mod_man, FONT_SDL);
116   REGISTER_MODULE(m_mod_man, FONT_NONE);
113117
114    REGISTER_MODULE(m_mod_man, FONT_OSX);
115    REGISTER_MODULE(m_mod_man, FONT_WINDOWS);
116    REGISTER_MODULE(m_mod_man, FONT_SDL);
117    REGISTER_MODULE(m_mod_man, FONT_NONE);
118   REGISTER_MODULE(m_mod_man, SOUND_DSOUND);
119   REGISTER_MODULE(m_mod_man, SOUND_JS);
120   REGISTER_MODULE(m_mod_man, SOUND_SDL);
121   REGISTER_MODULE(m_mod_man, SOUND_NONE);
118122
119    REGISTER_MODULE(m_mod_man, SOUND_DSOUND);
120    REGISTER_MODULE(m_mod_man, SOUND_JS);
121    REGISTER_MODULE(m_mod_man, SOUND_SDL);
122    REGISTER_MODULE(m_mod_man, SOUND_NONE);
123
124123#ifdef SDLMAME_MACOSX
125    REGISTER_MODULE(m_mod_man, DEBUG_OSX);
124   REGISTER_MODULE(m_mod_man, DEBUG_OSX);
126125#endif
127    REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS);
128    REGISTER_MODULE(m_mod_man, DEBUG_QT);
129    REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL);
130    REGISTER_MODULE(m_mod_man, DEBUG_NONE);
126   REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS);
127   REGISTER_MODULE(m_mod_man, DEBUG_QT);
128   REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL);
129   REGISTER_MODULE(m_mod_man, DEBUG_NONE);
131130
132    // after initialization we know which modules are supported
131   // after initialization we know which modules are supported
133132
134    const char *names[20];
135    int num;
136    m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names);
137    dynamic_array<const char *> dnames;
138    for (int i = 0; i < num; i++)
139        dnames.append(names[i]);
140    update_option(OSD_FONT_PROVIDER, dnames);
133   const char *names[20];
134   int num;
135   m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names);
136   dynamic_array<const char *> dnames;
137   for (int i = 0; i < num; i++)
138      dnames.append(names[i]);
139   update_option(OSD_FONT_PROVIDER, dnames);
141140
142    m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names);
143    dnames.reset();
144    for (int i = 0; i < num; i++)
145        dnames.append(names[i]);
146    update_option(OSD_SOUND_PROVIDER, dnames);
141   m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names);
142   dnames.reset();
143   for (int i = 0; i < num; i++)
144      dnames.append(names[i]);
145   update_option(OSD_SOUND_PROVIDER, dnames);
147146
148    // Register debugger options and update options
149    m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names);
150    dnames.reset();
151    for (int i = 0; i < num; i++)
152        dnames.append(names[i]);
153    update_option(OSD_DEBUG_PROVIDER, dnames);
147   // Register debugger options and update options
148   m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names);
149   dnames.reset();
150   for (int i = 0; i < num; i++)
151      dnames.append(names[i]);
152   update_option(OSD_DEBUG_PROVIDER, dnames);
154153
155    // Register video options and update options
156    video_options_add("none", NULL);
157    video_register();
158    update_option(OSDOPTION_VIDEO, m_video_names);
154   // Register video options and update options
155   video_options_add("none", NULL);
156   video_register();
157   update_option(OSDOPTION_VIDEO, m_video_names);
159158}
160159
161160void osd_common_t::update_option(const char * key, dynamic_array<const char *> &values)
r243189r243190
305304   // It provides an array of stereo samples in L-R order which should be
306305   // output at the configured sample_rate.
307306   //
308    m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
307   m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame);
309308}
310309
311310
r243189r243190
322321   //    while (attenuation++ < 0)
323322   //       volume /= 1.122018454;      //  = (10 ^ (1/20)) = 1dB
324323   //
325    if (m_sound != NULL)
326        m_sound->set_mastervolume(attenuation);
324   if (m_sound != NULL)
325      m_sound->set_mastervolume(attenuation);
327326}
328327
329328
r243189r243190
398397
399398bool osd_common_t::execute_command(const char *command)
400399{
401    if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0)
402    {
403        network_init();
404        osd_list_network_adapters();
405        network_exit();
406        return true;
407    }
408    else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
409    {
410        osd_list_midi_devices();
411        return true;
412    }
400   if (strcmp(command, OSDCOMMAND_LIST_NETWORK_ADAPTERS) == 0)
401   {
402      network_init();
403      osd_list_network_adapters();
404      network_exit();
405      return true;
406   }
407   else if (strcmp(command, OSDCOMMAND_LIST_MIDI_DEVICES) == 0)
408   {
409      osd_list_midi_devices();
410      return true;
411   }
413412
414    return false;
413   return false;
415414
416415}
417416
r243189r243190
437436#endif
438437   midi_init();
439438
440    m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER);
439   m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER);
441440
442    m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER);
443    m_sound->m_sample_rate = options().sample_rate();
444    m_sound->m_audio_latency = options().audio_latency();
441   m_sound = select_module_options<sound_module *>(options(), OSD_SOUND_PROVIDER);
442   m_sound->m_sample_rate = options().sample_rate();
443   m_sound->m_audio_latency = options().audio_latency();
445444
446    m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER);
445   m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER);
447446
448    m_mod_man.init();
447   m_mod_man.init();
449448
450449}
451450
r243189r243190
524523
525524void osd_common_t::osd_exit()
526525{
527    m_mod_man.exit();
526   m_mod_man.exit();
528527
529    exit_subsystems();
528   exit_subsystems();
530529}
531530
532531void osd_common_t::video_options_add(const char *name, void *type)
r243189r243190
537536
538537bool osd_common_t::midi_init()
539538{
540    // this should be done on the OS_level
541    return osd_midi_init();
539   // this should be done on the OS_level
540   return osd_midi_init();
542541}
543542
544543void osd_common_t::midi_exit()
545544{
546    osd_midi_exit();
545   osd_midi_exit();
547546}
548
549
trunk/src/osd/modules/lib/osdobj_common.h
r243189r243190
6262class osd_options : public cli_options
6363{
6464public:
65    // construction/destruction
66    osd_options();
65   // construction/destruction
66   osd_options();
6767
68    // debugging options
69    const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
70    int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
68   // debugging options
69   const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
70   int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }
7171
72    // performance options
73    bool multithreading() const { return bool_value(OSDOPTION_MULTITHREADING); }
74    const char *numprocessors() const { return value(OSDOPTION_NUMPROCESSORS); }
75    int bench() const { return int_value(OSDOPTION_BENCH); }
72   // performance options
73   bool multithreading() const { return bool_value(OSDOPTION_MULTITHREADING); }
74   const char *numprocessors() const { return value(OSDOPTION_NUMPROCESSORS); }
75   int bench() const { return int_value(OSDOPTION_BENCH); }
7676
77    // video options
78    const char *video() const { return value(OSDOPTION_VIDEO); }
79    int numscreens() const { return int_value(OSDOPTION_NUMSCREENS); }
80    bool window() const { return bool_value(OSDOPTION_WINDOW); }
81    bool maximize() const { return bool_value(OSDOPTION_MAXIMIZE); }
82    bool keep_aspect() const { return bool_value(OSDOPTION_KEEPASPECT); }
83    bool uneven_stretch() const { return bool_value(OSDOPTION_UNEVENSTRETCH); }
84    bool wait_vsync() const { return bool_value(OSDOPTION_WAITVSYNC); }
85    bool sync_refresh() const { return bool_value(OSDOPTION_SYNCREFRESH); }
77   // video options
78   const char *video() const { return value(OSDOPTION_VIDEO); }
79   int numscreens() const { return int_value(OSDOPTION_NUMSCREENS); }
80   bool window() const { return bool_value(OSDOPTION_WINDOW); }
81   bool maximize() const { return bool_value(OSDOPTION_MAXIMIZE); }
82   bool keep_aspect() const { return bool_value(OSDOPTION_KEEPASPECT); }
83   bool uneven_stretch() const { return bool_value(OSDOPTION_UNEVENSTRETCH); }
84   bool wait_vsync() const { return bool_value(OSDOPTION_WAITVSYNC); }
85   bool sync_refresh() const { return bool_value(OSDOPTION_SYNCREFRESH); }
8686
87    // per-window options
88    const char *screen() const { return value(OSDOPTION_SCREEN); }
89    const char *aspect() const { return value(OSDOPTION_ASPECT); }
90    const char *resolution() const { return value(OSDOPTION_RESOLUTION); }
91    const char *view() const { return value(OSDOPTION_VIEW); }
92    const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index)); }
93    const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index)); }
94    const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index)); }
95    const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index)); }
87   // per-window options
88   const char *screen() const { return value(OSDOPTION_SCREEN); }
89   const char *aspect() const { return value(OSDOPTION_ASPECT); }
90   const char *resolution() const { return value(OSDOPTION_RESOLUTION); }
91   const char *view() const { return value(OSDOPTION_VIEW); }
92   const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index)); }
93   const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index)); }
94   const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index)); }
95   const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index)); }
9696
97    // full screen options
98    bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
97   // full screen options
98   bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); }
9999
100    // sound options
101    const char *sound() const { return value(OSDOPTION_SOUND); }
102    int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
100   // sound options
101   const char *sound() const { return value(OSDOPTION_SOUND); }
102   int audio_latency() const { return int_value(OSDOPTION_AUDIO_LATENCY); }
103103
104104private:
105    static const options_entry s_option_entries[];
105   static const options_entry s_option_entries[];
106106};
107107
108108// ======================> osd_interface
r243189r243190
142142   // video overridables
143143   virtual void *get_slider_list();
144144
145    // command option overrides
146    virtual bool execute_command(const char *command);
145   // command option overrides
146   virtual bool execute_command(const char *command);
147147
148    osd_font *font_alloc() { return m_font_module->font_alloc(); }
148   osd_font *font_alloc() { return m_font_module->font_alloc(); }
149149
150150   // FIXME: everything below seems to be osd specific and not part of
151151   //        this INTERFACE but part of the osd IMPLEMENTATION
152152
153    // getters
154    running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
153   // getters
154   running_machine &machine() { assert(m_machine != NULL); return *m_machine; }
155155
156156
157    virtual void debugger_update();
157   virtual void debugger_update();
158158
159    virtual void init_subsystems();
159   virtual void init_subsystems();
160160
161    virtual bool video_init();
162    virtual void video_register();
163    virtual bool window_init();
161   virtual bool video_init();
162   virtual void video_register();
163   virtual bool window_init();
164164
165    virtual void input_resume();
166    virtual bool output_init();
167    virtual bool network_init();
168    virtual bool midi_init();
165   virtual void input_resume();
166   virtual bool output_init();
167   virtual bool network_init();
168   virtual bool midi_init();
169169
170    virtual void exit_subsystems();
171    virtual void video_exit();
172    virtual void window_exit();
173    virtual void input_exit();
174    virtual void output_exit();
175    virtual void network_exit();
176    virtual void midi_exit();
170   virtual void exit_subsystems();
171   virtual void video_exit();
172   virtual void window_exit();
173   virtual void input_exit();
174   virtual void output_exit();
175   virtual void network_exit();
176   virtual void midi_exit();
177177
178    virtual void osd_exit();
178   virtual void osd_exit();
179179
180    virtual void video_options_add(const char *name, void *type);
180   virtual void video_options_add(const char *name, void *type);
181181
182    osd_options &options() { return m_options; }
182   osd_options &options() { return m_options; }
183183
184184protected:
185    virtual bool input_init();
186    virtual void input_pause();
185   virtual bool input_init();
186   virtual void input_pause();
187187
188188private:
189189   // internal state
190190   running_machine *   m_machine;
191191   osd_options& m_options;
192192
193    osd_module_manager m_mod_man;
194    font_module *m_font_module;
193   osd_module_manager m_mod_man;
194   font_module *m_font_module;
195195
196196   void update_option(const char * key, dynamic_array<const char *> &values);
197    // FIXME: should be elsewhere
198    osd_module *select_module_options(const core_options &opts, const astring &opt_name)
199    {
200        astring opt_val = opts.value(opt_name);
201        if (opt_val == "auto")
202            opt_val = "";
203        else if (!m_mod_man.type_has_name(opt_name, opt_val))
204        {
205            osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.cstr(), opt_name.cstr());
206            opt_val = "";
207        }
208        return m_mod_man.select_module(opt_name, opt_val);
209    }
197   // FIXME: should be elsewhere
198   osd_module *select_module_options(const core_options &opts, const astring &opt_name)
199   {
200      astring opt_val = opts.value(opt_name);
201      if (opt_val == "auto")
202         opt_val = "";
203      else if (!m_mod_man.type_has_name(opt_name, opt_val))
204      {
205         osd_printf_warning("Value %s not supported for option %s - falling back to auto\n", opt_val.cstr(), opt_name.cstr());
206         opt_val = "";
207      }
208      return m_mod_man.select_module(opt_name, opt_val);
209   }
210210
211    template<class C>
212    C select_module_options(const core_options &opts, const astring &opt_name)
213    {
214        return dynamic_cast<C>(select_module_options(opts, opt_name));
215    }
211   template<class C>
212   C select_module_options(const core_options &opts, const astring &opt_name)
213   {
214      return dynamic_cast<C>(select_module_options(opts, opt_name));
215   }
216216
217217protected:
218218   sound_module* m_sound;
trunk/src/osd/modules/midi/none.c
r243189r243190
1010
1111struct osd_midi_device
1212{
13    int dummy;
13   int dummy;
1414};
1515
1616bool osd_midi_init()
1717{
18    return true;
18   return true;
1919}
2020
2121void osd_midi_exit()
r243189r243190
2424
2525void osd_list_midi_devices(void)
2626{
27    osd_printf_warning("\nMIDI is not supported in this build\n");
27   osd_printf_warning("\nMIDI is not supported in this build\n");
2828}
2929
3030osd_midi_device *osd_open_midi_input(const char *devname)
3131{
32    return NULL;
32   return NULL;
3333}
3434
3535osd_midi_device *osd_open_midi_output(const char *devname)
3636{
37    return NULL;
37   return NULL;
3838}
3939
4040void osd_close_midi_channel(osd_midi_device *dev)
r243189r243190
4343
4444bool osd_poll_midi_channel(osd_midi_device *dev)
4545{
46    return false;
46   return false;
4747}
4848
4949int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut)
5050{
51    return 0;
51   return 0;
5252}
5353
5454void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
trunk/src/osd/modules/midi/portmidi.c
r243189r243190
1616
1717struct osd_midi_device
1818{
19    PortMidiStream *pmStream;
20    PmEvent rx_evBuf[RX_EVENT_BUF_SIZE];
21    UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes
22    int xmit_cnt;
23    UINT8 last_status;
24    bool rx_sysex;
19   PortMidiStream *pmStream;
20   PmEvent rx_evBuf[RX_EVENT_BUF_SIZE];
21   UINT8 xmit_in[4]; // Pm_Messages mean we can at most have 3 residue bytes
22   int xmit_cnt;
23   UINT8 last_status;
24   bool rx_sysex;
2525};
2626
2727bool osd_midi_init()
2828{
29    Pm_Initialize();
30    return true;
29   Pm_Initialize();
30   return true;
3131}
3232
3333void osd_midi_exit()
3434{
35    Pm_Terminate();
35   Pm_Terminate();
3636}
3737
3838void osd_list_midi_devices(void)
3939{
40    int num_devs = Pm_CountDevices();
41    const PmDeviceInfo *pmInfo;
40   int num_devs = Pm_CountDevices();
41   const PmDeviceInfo *pmInfo;
4242
43    printf("\n");
43   printf("\n");
4444
45    if (num_devs == 0)
46    {
47        printf("No MIDI ports were found\n");
48        return;
49    }
45   if (num_devs == 0)
46   {
47      printf("No MIDI ports were found\n");
48      return;
49   }
5050
51    printf("MIDI input ports:\n");
52    for (int i = 0; i < num_devs; i++)
53    {
54        pmInfo = Pm_GetDeviceInfo(i);
51   printf("MIDI input ports:\n");
52   for (int i = 0; i < num_devs; i++)
53   {
54      pmInfo = Pm_GetDeviceInfo(i);
5555
56        if (pmInfo->input)
57        {
58            printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
59        }
60    }
56      if (pmInfo->input)
57      {
58         printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultInputDeviceID()) ? "(default)" : "");
59      }
60   }
6161
62    printf("\nMIDI output ports:\n");
63    for (int i = 0; i < num_devs; i++)
64    {
65        pmInfo = Pm_GetDeviceInfo(i);
62   printf("\nMIDI output ports:\n");
63   for (int i = 0; i < num_devs; i++)
64   {
65      pmInfo = Pm_GetDeviceInfo(i);
6666
67        if (pmInfo->output)
68        {
69            printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
70        }
71    }
67      if (pmInfo->output)
68      {
69         printf("%s %s\n", pmInfo->name, (i == Pm_GetDefaultOutputDeviceID()) ? "(default)" : "");
70      }
71   }
7272}
7373
7474osd_midi_device *osd_open_midi_input(const char *devname)
7575{
76    int num_devs = Pm_CountDevices();
77    int found_dev = -1;
78    const PmDeviceInfo *pmInfo;
79    PortMidiStream *stm;
80    osd_midi_device *ret;
76   int num_devs = Pm_CountDevices();
77   int found_dev = -1;
78   const PmDeviceInfo *pmInfo;
79   PortMidiStream *stm;
80   osd_midi_device *ret;
8181
82    if (!strcmp("default", devname))
83    {
84        found_dev = Pm_GetDefaultInputDeviceID();
85    }
86    else
87    {
88        for (int i = 0; i < num_devs; i++)
89        {
90            pmInfo = Pm_GetDeviceInfo(i);
82   if (!strcmp("default", devname))
83   {
84      found_dev = Pm_GetDefaultInputDeviceID();
85   }
86   else
87   {
88      for (int i = 0; i < num_devs; i++)
89      {
90         pmInfo = Pm_GetDeviceInfo(i);
9191
92            if (pmInfo->input)
93            {
94                if (!strcmp(devname, pmInfo->name))
95                {
96                    found_dev = i;
97                    break;
98                }
99            }
100        }
101    }
92         if (pmInfo->input)
93         {
94            if (!strcmp(devname, pmInfo->name))
95            {
96               found_dev = i;
97               break;
98            }
99         }
100      }
101   }
102102
103    if (found_dev >= 0)
104    {
105        if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError)
106        {
107            ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
108            memset(ret, 0, sizeof(osd_midi_device));
109            ret->pmStream = stm;
110            return ret;
111        }
112        else
113        {
114            printf("Couldn't open PM device\n");
115            return NULL;
116        }
117    }
118    else
119    {
120        return NULL;
121    }
103   if (found_dev >= 0)
104   {
105      if (Pm_OpenInput(&stm, found_dev, NULL, RX_EVENT_BUF_SIZE, NULL, NULL) == pmNoError)
106      {
107         ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
108         memset(ret, 0, sizeof(osd_midi_device));
109         ret->pmStream = stm;
110         return ret;
111      }
112      else
113      {
114         printf("Couldn't open PM device\n");
115         return NULL;
116      }
117   }
118   else
119   {
120      return NULL;
121   }
122122}
123123
124124osd_midi_device *osd_open_midi_output(const char *devname)
125125{
126    int num_devs = Pm_CountDevices();
127    int found_dev = -1;
128    const PmDeviceInfo *pmInfo;
129    PortMidiStream *stm;
130    osd_midi_device *ret;
126   int num_devs = Pm_CountDevices();
127   int found_dev = -1;
128   const PmDeviceInfo *pmInfo;
129   PortMidiStream *stm;
130   osd_midi_device *ret;
131131
132    if (!strcmp("default", devname))
133    {
134        found_dev = Pm_GetDefaultOutputDeviceID();
135    }
136    else
137    {
138        for (int i = 0; i < num_devs; i++)
139        {
140            pmInfo = Pm_GetDeviceInfo(i);
132   if (!strcmp("default", devname))
133   {
134      found_dev = Pm_GetDefaultOutputDeviceID();
135   }
136   else
137   {
138      for (int i = 0; i < num_devs; i++)
139      {
140         pmInfo = Pm_GetDeviceInfo(i);
141141
142            if (pmInfo->output)
143            {
144                if (!strcmp(devname, pmInfo->name))
145                {
146                    found_dev = i;
147                    break;
148                }
149            }
150        }
151    }
142         if (pmInfo->output)
143         {
144            if (!strcmp(devname, pmInfo->name))
145            {
146               found_dev = i;
147               break;
148            }
149         }
150      }
151   }
152152
153    if (found_dev >= 0)
154    {
155        if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError)
156        {
157            ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
158            memset(ret, 0, sizeof(osd_midi_device));
159            ret->pmStream = stm;
160            return ret;
161        }
162        else
163        {
164            printf("Couldn't open PM device\n");
165            return NULL;
166        }
167    }
168    else
169    {
170        return NULL;
171    }
172    return NULL;
153   if (found_dev >= 0)
154   {
155      if (Pm_OpenOutput(&stm, found_dev, NULL, 100, NULL, NULL, 0) == pmNoError)
156      {
157         ret = (osd_midi_device *)osd_malloc(sizeof(osd_midi_device));
158         memset(ret, 0, sizeof(osd_midi_device));
159         ret->pmStream = stm;
160         return ret;
161      }
162      else
163      {
164         printf("Couldn't open PM device\n");
165         return NULL;
166      }
167   }
168   else
169   {
170      return NULL;
171   }
172   return NULL;
173173}
174174
175175void osd_close_midi_channel(osd_midi_device *dev)
176176{
177    Pm_Close(dev->pmStream);
178    osd_free(dev);
177   Pm_Close(dev->pmStream);
178   osd_free(dev);
179179}
180180
181181bool osd_poll_midi_channel(osd_midi_device *dev)
182182{
183    PmError chk = Pm_Poll(dev->pmStream);
183   PmError chk = Pm_Poll(dev->pmStream);
184184
185    return (chk == pmGotData) ? true : false;
185   return (chk == pmGotData) ? true : false;
186186}
187187
188188int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut)
189189{
190    int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, RX_EVENT_BUF_SIZE);
191    int bytesOut = 0;
190   int msgsRead = Pm_Read(dev->pmStream, dev->rx_evBuf, RX_EVENT_BUF_SIZE);
191   int bytesOut = 0;
192192
193    if (msgsRead <= 0)
194    {
195        return 0;
196    }
193   if (msgsRead <= 0)
194   {
195      return 0;
196   }
197197
198    for (int msg = 0; msg < msgsRead; msg++)
199    {
200        UINT8 status = Pm_MessageStatus(dev->rx_evBuf[msg].message);
198   for (int msg = 0; msg < msgsRead; msg++)
199   {
200      UINT8 status = Pm_MessageStatus(dev->rx_evBuf[msg].message);
201201
202        if (dev->rx_sysex)
203        {
204            if (status & 0x80)  // sys real-time imposing on us?
205            {
206                if ((status == 0xf2) || (status == 0xf3))
207                {
208                    *pOut++ = status;
209                    *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
210                    *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
211                    bytesOut += 3;
212                }
213                else
214                {
215                    *pOut++ = status;
216                    bytesOut++;
217                    if (status == MIDI_EOX)
218                    {
219                        dev->rx_sysex = false;
220                    }
221                }
222            }
223            else    // shift out the sysex bytes
224            {
225                for (int i = 0; i < 4; i++)
226                {
227                    UINT8 byte = dev->rx_evBuf[msg].message & 0xff;
228                    *pOut++ = byte;
229                    bytesOut++;
230                    if (byte == MIDI_EOX)
231                    {
232                        dev->rx_sysex = false;
233                        break;
234                    }
235                    dev->rx_evBuf[msg].message >>= 8;
236                }
237            }
238        }
239        else
240        {
241            switch ((status>>4) & 0xf)
242            {
243                case 0xc:   // 2-byte messages
244                case 0xd:
245                    *pOut++ = status;
246                    *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
247                    bytesOut += 2;
248                    break;
202      if (dev->rx_sysex)
203      {
204         if (status & 0x80)  // sys real-time imposing on us?
205         {
206            if ((status == 0xf2) || (status == 0xf3))
207            {
208               *pOut++ = status;
209               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
210               *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
211               bytesOut += 3;
212            }
213            else
214            {
215               *pOut++ = status;
216               bytesOut++;
217               if (status == MIDI_EOX)
218               {
219                  dev->rx_sysex = false;
220               }
221            }
222         }
223         else    // shift out the sysex bytes
224         {
225            for (int i = 0; i < 4; i++)
226            {
227               UINT8 byte = dev->rx_evBuf[msg].message & 0xff;
228               *pOut++ = byte;
229               bytesOut++;
230               if (byte == MIDI_EOX)
231               {
232                  dev->rx_sysex = false;
233                  break;
234               }
235               dev->rx_evBuf[msg].message >>= 8;
236            }
237         }
238      }
239      else
240      {
241         switch ((status>>4) & 0xf)
242         {
243            case 0xc:   // 2-byte messages
244            case 0xd:
245               *pOut++ = status;
246               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
247               bytesOut += 2;
248               break;
249249
250                case 0xf:   // system common
251                    switch (status & 0xf)
252                    {
253                        case 0: // System Exclusive
254                        {
255                            *pOut++ = status;   // this should be OK: the shortest legal sysex is F0 tt dd F7, I believe
256                            *pOut++ = (dev->rx_evBuf[msg].message>>8) & 0xff;
257                            *pOut++ = (dev->rx_evBuf[msg].message>>16) & 0xff;
258                            UINT8 last = *pOut++ = (dev->rx_evBuf[msg].message>>24) & 0xff;
259                            bytesOut += 4;
260                            dev->rx_sysex = (last != MIDI_EOX);
261                            break;
262                        }
250            case 0xf:   // system common
251               switch (status & 0xf)
252               {
253                  case 0: // System Exclusive
254                  {
255                     *pOut++ = status;   // this should be OK: the shortest legal sysex is F0 tt dd F7, I believe
256                     *pOut++ = (dev->rx_evBuf[msg].message>>8) & 0xff;
257                     *pOut++ = (dev->rx_evBuf[msg].message>>16) & 0xff;
258                     UINT8 last = *pOut++ = (dev->rx_evBuf[msg].message>>24) & 0xff;
259                     bytesOut += 4;
260                     dev->rx_sysex = (last != MIDI_EOX);
261                     break;
262                  }
263263
264                        case 7: // End of System Exclusive
265                            *pOut++ = status;
266                            bytesOut += 1;
267                            dev->rx_sysex = false;
268                            break;
264                  case 7: // End of System Exclusive
265                     *pOut++ = status;
266                     bytesOut += 1;
267                     dev->rx_sysex = false;
268                     break;
269269
270                        case 2: // song pos
271                        case 3: // song select
272                            *pOut++ = status;
273                            *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
274                            *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
275                            bytesOut += 3;
276                            break;
270                  case 2: // song pos
271                  case 3: // song select
272                     *pOut++ = status;
273                     *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
274                     *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
275                     bytesOut += 3;
276                     break;
277277
278                        default:    // all other defined Fx messages are 1 byte
279                            break;
280                    }
281                    break;
278                  default:    // all other defined Fx messages are 1 byte
279                     break;
280               }
281               break;
282282
283                default:
284                    *pOut++ = status;
285                    *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
286                    *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
287                    bytesOut += 3;
288                    break;
289            }
290        }
291    }
283            default:
284               *pOut++ = status;
285               *pOut++ = Pm_MessageData1(dev->rx_evBuf[msg].message);
286               *pOut++ = Pm_MessageData2(dev->rx_evBuf[msg].message);
287               bytesOut += 3;
288               break;
289         }
290      }
291   }
292292
293    return bytesOut;
293   return bytesOut;
294294}
295295
296296void osd_write_midi_channel(osd_midi_device *dev, UINT8 data)
297297{
298    int bytes_needed = 0;
299    PmEvent ev;
300    ev.timestamp = 0;   // use the current time
298   int bytes_needed = 0;
299   PmEvent ev;
300   ev.timestamp = 0;   // use the current time
301301
302302//  printf("write: %02x (%d)\n", data, dev->xmit_cnt);
303303
304    // reject data bytes when no valid status exists
305    if ((dev->last_status == 0) && !(data & 0x80))
306    {
307        dev->xmit_cnt = 0;
308        return;
309    }
304   // reject data bytes when no valid status exists
305   if ((dev->last_status == 0) && !(data & 0x80))
306   {
307      dev->xmit_cnt = 0;
308      return;
309   }
310310
311    if (dev->xmit_cnt >= 4)
312    {
313        printf("MIDI out: packet assembly overflow, contact MAMEdev!\n");
314        return;
315    }
311   if (dev->xmit_cnt >= 4)
312   {
313      printf("MIDI out: packet assembly overflow, contact MAMEdev!\n");
314      return;
315   }
316316
317    // handle sysex
318    if (dev->last_status == MIDI_SYSEX)
319    {
317   // handle sysex
318   if (dev->last_status == MIDI_SYSEX)
319   {
320320//      printf("sysex: %02x (%d)\n", data, dev->xmit_cnt);
321321
322        // if we get a status that isn't sysex, assume it's system common
323        if ((data & 0x80) && (data != MIDI_EOX))
324        {
322      // if we get a status that isn't sysex, assume it's system common
323      if ((data & 0x80) && (data != MIDI_EOX))
324      {
325325//          printf("common during sysex!\n");
326            ev.message = Pm_Message(data, 0, 0);
327            Pm_Write(dev->pmStream, &ev, 1);
328            return;
329        }
326         ev.message = Pm_Message(data, 0, 0);
327         Pm_Write(dev->pmStream, &ev, 1);
328         return;
329      }
330330
331        dev->xmit_in[dev->xmit_cnt++] = data;
331      dev->xmit_in[dev->xmit_cnt++] = data;
332332
333        // if EOX or 4 bytes filled, transmit 4 bytes
334        if ((dev->xmit_cnt == 4) || (data == MIDI_EOX))
335        {
336            ev.message = dev->xmit_in[0] | (dev->xmit_in[1]<<8) | (dev->xmit_in[2]<<16) | (dev->xmit_in[3]<<24);
337            Pm_Write(dev->pmStream, &ev, 1);
338            dev->xmit_in[0] = dev->xmit_in[1] = dev->xmit_in[2] = dev->xmit_in[3] = 0;
339            dev->xmit_cnt = 0;
333      // if EOX or 4 bytes filled, transmit 4 bytes
334      if ((dev->xmit_cnt == 4) || (data == MIDI_EOX))
335      {
336         ev.message = dev->xmit_in[0] | (dev->xmit_in[1]<<8) | (dev->xmit_in[2]<<16) | (dev->xmit_in[3]<<24);
337         Pm_Write(dev->pmStream, &ev, 1);
338         dev->xmit_in[0] = dev->xmit_in[1] = dev->xmit_in[2] = dev->xmit_in[3] = 0;
339         dev->xmit_cnt = 0;
340340
341341//          printf("SysEx packet: %08x\n", ev.message);
342342
343            // if this is EOX, kill the running status
344            if (data == MIDI_EOX)
345            {
346                dev->last_status = 0;
347            }
348        }
343         // if this is EOX, kill the running status
344         if (data == MIDI_EOX)
345         {
346            dev->last_status = 0;
347         }
348      }
349349
350        return;
351    }
350      return;
351   }
352352
353    // handle running status.  don't allow system real-time messages to be considered as running status.
354    if ((dev->xmit_cnt == 0) && (data & 0x80) && (data < 0xf8))
355    {
356        dev->last_status = data;
357    }
353   // handle running status.  don't allow system real-time messages to be considered as running status.
354   if ((dev->xmit_cnt == 0) && (data & 0x80) && (data < 0xf8))
355   {
356      dev->last_status = data;
357   }
358358
359    if ((dev->xmit_cnt == 0) && !(data & 0x80))
360    {
361        dev->xmit_in[dev->xmit_cnt++] = dev->last_status;
362        dev->xmit_in[dev->xmit_cnt++] = data;
359   if ((dev->xmit_cnt == 0) && !(data & 0x80))
360   {
361      dev->xmit_in[dev->xmit_cnt++] = dev->last_status;
362      dev->xmit_in[dev->xmit_cnt++] = data;
363363//      printf("\trunning status: [%d] = %02x, [%d] = %02x, last_status = %02x\n", dev->xmit_cnt-2, dev->last_status, dev->xmit_cnt-1, data, dev->last_status);
364    }
365    else
366    {
367        dev->xmit_in[dev->xmit_cnt++] = data;
364   }
365   else
366   {
367      dev->xmit_in[dev->xmit_cnt++] = data;
368368//      printf("\tNRS: [%d] = %02x\n", dev->xmit_cnt-1, data);
369    }
369   }
370370
371    if ((dev->xmit_cnt == 1) && (dev->xmit_in[0] == MIDI_SYSEX))
372    {
371   if ((dev->xmit_cnt == 1) && (dev->xmit_in[0] == MIDI_SYSEX))
372   {
373373//      printf("Start SysEx!\n");
374        dev->last_status = MIDI_SYSEX;
375        return;
376    }
374      dev->last_status = MIDI_SYSEX;
375      return;
376   }
377377
378    // are we there yet?
378   // are we there yet?
379379//  printf("status check: %02x\n", dev->xmit_in[0]);
380    switch ((dev->xmit_in[0]>>4) & 0xf)
381    {
382        case 0xc:   // 2-byte messages
383        case 0xd:
384            bytes_needed = 2;
385            break;
380   switch ((dev->xmit_in[0]>>4) & 0xf)
381   {
382      case 0xc:   // 2-byte messages
383      case 0xd:
384         bytes_needed = 2;
385         break;
386386
387        case 0xf:   // system common
388            switch (dev->xmit_in[0] & 0xf)
389            {
390                case 0: // System Exclusive is handled above
391                    break;
387      case 0xf:   // system common
388         switch (dev->xmit_in[0] & 0xf)
389         {
390            case 0: // System Exclusive is handled above
391               break;
392392
393                case 7: // End of System Exclusive
394                    bytes_needed = 1;
395                    break;
393            case 7: // End of System Exclusive
394               bytes_needed = 1;
395               break;
396396
397                case 2: // song pos
398                case 3: // song select
399                    bytes_needed = 3;
400                    break;
397            case 2: // song pos
398            case 3: // song select
399               bytes_needed = 3;
400               break;
401401
402                default:    // all other defined Fx messages are 1 byte
403                    bytes_needed = 1;
404                    break;
405            }
406            break;
402            default:    // all other defined Fx messages are 1 byte
403               bytes_needed = 1;
404               break;
405         }
406         break;
407407
408        default:
409            bytes_needed = 3;
410            break;
411    }
408      default:
409         bytes_needed = 3;
410         break;
411   }
412412
413    if (dev->xmit_cnt == bytes_needed)
414    {
415        ev.message = Pm_Message(dev->xmit_in[0], dev->xmit_in[1], dev->xmit_in[2]);
416        Pm_Write(dev->pmStream, &ev, 1);
417        dev->xmit_cnt = 0;
418    }
413   if (dev->xmit_cnt == bytes_needed)
414   {
415      ev.message = Pm_Message(dev->xmit_in[0], dev->xmit_in[1], dev->xmit_in[2]);
416      Pm_Write(dev->pmStream, &ev, 1);
417      dev->xmit_cnt = 0;
418   }
419419
420420}
trunk/src/osd/modules/osdmodule.c
r243189r243190
77
88osd_module_manager::osd_module_manager()
99{
10    for (int i=0; i<MAX_MODULES; i++)
11    {
12        m_modules[i]  = NULL;
13        m_selected[i] = NULL;
14    }
10   for (int i=0; i<MAX_MODULES; i++)
11   {
12      m_modules[i]  = NULL;
13      m_selected[i] = NULL;
14   }
1515}
1616osd_module_manager::~osd_module_manager()
1717{
18    for (int i = 0; m_modules[i] != NULL; i++)
19    {
20        m_modules[i]->~osd_module();
21        osd_free(m_modules[i]);
22    }
18   for (int i = 0; m_modules[i] != NULL; i++)
19   {
20      m_modules[i]->~osd_module();
21      osd_free(m_modules[i]);
22   }
2323}
2424
2525void osd_module_manager::register_module(const module_type &mod_type)
2626{
27    osd_module *module = mod_type();
28    if (module->probe())
29    {
30        osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type());
27   osd_module *module = mod_type();
28   if (module->probe())
29   {
30      osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type());
3131
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_verbose("===> not supported %s %s\n", module->name(), module->type());
40        module->~osd_module();
41        osd_free(module);
42    }
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_verbose("===> not supported %s %s\n", module->name(), module->type());
40      module->~osd_module();
41      osd_free(module);
42   }
4343}
4444
4545bool osd_module_manager::type_has_name(const char *type, const char *name)
4646{
47    return (get_module_index(type, name) >= 0);
47   return (get_module_index(type, name) >= 0);
4848}
4949
5050osd_module *osd_module_manager::get_module_generic(const char *type, const char *name)
5151{
52    int i = get_module_index(type, name);
53    if (i>=0)
54        return m_modules[i];
55    else
56        return NULL;
52   int i = get_module_index(type, name);
53   if (i>=0)
54      return m_modules[i];
55   else
56      return NULL;
5757}
5858
5959osd_module *osd_module_manager::select_module(const char *type, const char *name)
6060{
61    osd_module *m = get_module_generic(type, name);
61   osd_module *m = get_module_generic(type, name);
6262
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;
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;
6969}
7070
7171void osd_module_manager::init()
7272{
73    for (int i = 0; m_selected[i] != NULL; i++)
74    {
75        m_selected[i]->init();
76    }
73   for (int i = 0; m_selected[i] != NULL; i++)
74   {
75      m_selected[i]->init();
76   }
7777}
7878
7979void osd_module_manager::exit()
8080{
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    }
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   }
9090}
9191
9292int osd_module_manager::get_module_index(const char *type, const char *name)
9393{
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;
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;
100100}
101101
102102void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[])
103103{
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        }
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      }
112112
113    }
113   }
114114}
115
116
trunk/src/osd/modules/osdmodule.h
r243189r243190
2626{
2727public:
2828
29    osd_module(const char *type, const char *name)
30    : m_name(name), m_type(type)
31    {}
32    virtual ~osd_module() { }
29   osd_module(const char *type, const char *name)
30   : m_name(name), m_type(type)
31   {}
32   virtual ~osd_module() { }
3333
34    const char * name() const { return m_name; }
35    const char * type() const { return m_type; }
34   const char * name() const { return m_name; }
35   const char * type() const { return m_type; }
3636
37    virtual bool probe() const { return true; }
37   virtual bool probe() const { return true; }
3838
39    virtual int init() { return 0; }
40    virtual void exit() { }
39   virtual int init() { return 0; }
40   virtual void exit() { }
4141
4242private:
43    astring     m_name;
44    astring     m_type;
43   astring     m_name;
44   astring     m_type;
4545};
4646
4747// a module_type is simply a pointer to its alloc function
r243189r243190
5151template<class _ModuleClass>
5252osd_module *module_creator()
5353{
54    void *p = osd_malloc(sizeof(_ModuleClass));
55    return new(p) _ModuleClass;
54   void *p = osd_malloc(sizeof(_ModuleClass));
55   return new(p) _ModuleClass;
5656}
5757
5858class osd_module_manager
5959{
6060public:
6161
62    static const int MAX_MODULES = 32;
62   static const int MAX_MODULES = 32;
6363
64    osd_module_manager();
65    ~osd_module_manager();
64   osd_module_manager();
65   ~osd_module_manager();
6666
67    void register_module(const module_type &mod_type);
68    bool type_has_name(const char *type, const char *name);
67   void register_module(const module_type &mod_type);
68   bool type_has_name(const char *type, const char *name);
6969
70    osd_module *get_module_generic(const char *type, const char *name);
70   osd_module *get_module_generic(const char *type, const char *name);
7171
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    }
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   }
7777
78    osd_module *select_module(const char *type, const char *name = "");
78   osd_module *select_module(const char *type, const char *name = "");
7979
80    void get_module_names(const char *type, const int max, int *num, const char *names[]);
80   void get_module_names(const char *type, const int max, int *num, const char *names[]);
8181
82    void init();
82   void init();
8383
84    void exit();
84   void exit();
8585
8686private:
87    int get_module_index(const char *type, const char *name);
87   int get_module_index(const char *type, const char *name);
8888
89    osd_module *m_modules[MAX_MODULES];
90    osd_module *m_selected[MAX_MODULES];
89   osd_module *m_modules[MAX_MODULES];
90   osd_module *m_selected[MAX_MODULES];
9191};
9292
9393#define MODULE_DEFINITION(_id, _class) \
94    extern const module_type _id ;  \
95    const module_type _id = &module_creator< _class >;
94   extern const module_type _id ;  \
95   const module_type _id = &module_creator< _class >;
9696
9797
9898#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    };
99   class _mod : public osd_module { \
100   public: \
101      _mod () \
102      : osd_module(_type, _name) {} \
103      bool probe() const { return false; } \
104   };
105105
106106#endif  /* __OSDMODULE_H__ */
trunk/src/osd/modules/sound/direct_sound.c
r243189r243190
5151{
5252public:
5353
54    sound_direct_sound()
55    : osd_module(OSD_SOUND_PROVIDER, "dsound"), sound_module()
56    {
57    }
58    virtual ~sound_direct_sound() { }
54   sound_direct_sound()
55   : osd_module(OSD_SOUND_PROVIDER, "dsound"), sound_module()
56   {
57   }
58   virtual ~sound_direct_sound() { }
5959
60    virtual int init();
61    virtual void exit();
60   virtual int init();
61   virtual void exit();
6262
63    // sound_module
63   // sound_module
6464
65    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
66    virtual void set_mastervolume(int attenuation);
65   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
66   virtual void set_mastervolume(int attenuation);
6767
6868private:
69    HRESULT      dsound_init();
70    void         dsound_kill();
71    HRESULT      dsound_create_buffers();
72    void         dsound_destroy_buffers();
73    void         copy_sample_data(const INT16 *data, int bytes_to_copy);
69   HRESULT      dsound_init();
70   void         dsound_kill();
71   HRESULT      dsound_create_buffers();
72   void         dsound_destroy_buffers();
73   void         copy_sample_data(const INT16 *data, int bytes_to_copy);
7474
7575};
7676
r243189r243190
448448}
449449
450450#else /* SDLMAME_UNIX */
451    MODULE_NOT_SUPPORTED(sound_direct_sound, OSD_SOUND_PROVIDER, "dsound")
451   MODULE_NOT_SUPPORTED(sound_direct_sound, OSD_SOUND_PROVIDER, "dsound")
452452#endif
453453
454454MODULE_DEFINITION(SOUND_DSOUND, sound_direct_sound)
trunk/src/osd/modules/sound/js_sound.c
r243189r243190
1919{
2020public:
2121
22    sound_js()
23    : osd_module(OSD_SOUND_PROVIDER, "js"), sound_module()
24    {
25    }
26    virtual ~sound_js() { }
22   sound_js()
23   : osd_module(OSD_SOUND_PROVIDER, "js"), sound_module()
24   {
25   }
26   virtual ~sound_js() { }
2727
28    virtual int init();
29    virtual void exit();
28   virtual int init();
29   virtual void exit();
3030
31    // sound_module
31   // sound_module
3232
33    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
34    {
35        EM_ASM_ARGS({
36        // Forward audio stream update on to JS backend implementation.
37        jsmess_update_audio_stream($1, $2);
38        }, (unsigned int)buffer, samples_this_frame);
39    }
40    virtual void set_mastervolume(int attenuation)
41    {
42        EM_ASM_ARGS({
43        // Forward volume update on to JS backend implementation.
44        jsmess_set_mastervolume($0);
45        }, attenuation);
46    }
33   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame)
34   {
35      EM_ASM_ARGS({
36      // Forward audio stream update on to JS backend implementation.
37      jsmess_update_audio_stream($1, $2);
38      }, (unsigned int)buffer, samples_this_frame);
39   }
40   virtual void set_mastervolume(int attenuation)
41   {
42      EM_ASM_ARGS({
43      // Forward volume update on to JS backend implementation.
44      jsmess_set_mastervolume($0);
45      }, attenuation);
46   }
4747
4848};
4949
5050#else /* SDLMAME_UNIX */
51    MODULE_NOT_SUPPORTED(sound_js, OSD_SOUND_PROVIDER, "js")
51   MODULE_NOT_SUPPORTED(sound_js, OSD_SOUND_PROVIDER, "js")
5252#endif
5353
5454MODULE_DEFINITION(SOUND_JS, sound_js)
trunk/src/osd/modules/sound/none.c
r243189r243190
1414class sound_none : public osd_module, public sound_module
1515{
1616public:
17    sound_none()
18    : osd_module(OSD_SOUND_PROVIDER, "none"), sound_module()
19    {
20    }
21    virtual ~sound_none() { }
17   sound_none()
18   : osd_module(OSD_SOUND_PROVIDER, "none"), sound_module()
19   {
20   }
21   virtual ~sound_none() { }
2222
23    virtual int init() { return 0; }
24    virtual void exit() { }
23   virtual int init() { return 0; }
24   virtual void exit() { }
2525
26    // sound_module
26   // sound_module
2727
28    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) { }
29    virtual void set_mastervolume(int attenuation) { }
28   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) { }
29   virtual void set_mastervolume(int attenuation) { }
3030
3131};
3232
trunk/src/osd/modules/sound/sdl_sound.c
r243189r243190
4343{
4444public:
4545
46    friend void sdl_callback(void *userdata, Uint8 *stream, int len);
46   friend void sdl_callback(void *userdata, Uint8 *stream, int len);
4747
48    // number of samples per SDL callback
49    static const int SDL_XFER_SAMPLES = 512;
48   // number of samples per SDL callback
49   static const int SDL_XFER_SAMPLES = 512;
5050
51    sound_sdl()
52    : osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(),
53      stream_in_initialized(0),
54      stream_loop(0),
55      attenuation(0)
56    {
57        sdl_xfer_samples = SDL_XFER_SAMPLES;
58    }
59    virtual ~sound_sdl() { }
51   sound_sdl()
52   : osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(),
53      stream_in_initialized(0),
54      stream_loop(0),
55      attenuation(0)
56   {
57      sdl_xfer_samples = SDL_XFER_SAMPLES;
58   }
59   virtual ~sound_sdl() { }
6060
61    virtual int init();
62    virtual void exit();
61   virtual int init();
62   virtual void exit();
6363
64    // sound_module
64   // sound_module
6565
66    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
67    virtual void set_mastervolume(int attenuation);
66   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame);
67   virtual void set_mastervolume(int attenuation);
6868
6969private:
70    int lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2);
71    void unlock_buffer(void);
72    void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy);
73    void copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy);
74    int sdl_create_buffers(void);
75    void sdl_destroy_buffers(void);
70   int lock_buffer(bool is_throttled, long offset, long size, void **buffer1, long *length1, void **buffer2, long *length2);
71   void unlock_buffer(void);
72   void att_memcpy(void *dest, const INT16 *data, int bytes_to_copy);
73   void copy_sample_data(bool is_throttled, const INT16 *data, int bytes_to_copy);
74   int sdl_create_buffers(void);
75   void sdl_destroy_buffers(void);
7676
77    int sdl_xfer_samples;
78    int stream_in_initialized;
79    int stream_loop;
80    int attenuation;
77   int sdl_xfer_samples;
78   int stream_in_initialized;
79   int stream_loop;
80   int attenuation;
8181
82    int              buf_locked;
82   int              buf_locked;
8383
84    INT8             *stream_buffer;
85    volatile INT32   stream_playpos;
84   INT8             *stream_buffer;
85   volatile INT32   stream_playpos;
8686
87    UINT32           stream_buffer_size;
88    UINT32           stream_buffer_in;
87   UINT32           stream_buffer_size;
88   UINT32           stream_buffer_in;
8989
90    // buffer over/underflow counts
91    int              buffer_underflows;
92    int              buffer_overflows;
90   // buffer over/underflow counts
91   int              buffer_underflows;
92   int              buffer_overflows;
9393
9494
9595};
r243189r243190
354354//============================================================
355355static void sdl_callback(void *userdata, Uint8 *stream, int len)
356356{
357    sound_sdl *thiz = (sound_sdl *) userdata;
357   sound_sdl *thiz = (sound_sdl *) userdata;
358358   int len1, len2, sb_in;
359359
360360   sb_in = thiz->stream_buffer_in;
r243189r243190
379379      len2 = 0;
380380   }
381381
382    memcpy(stream, thiz->stream_buffer + thiz->stream_playpos, len1);
383    memset(thiz->stream_buffer + thiz->stream_playpos, 0, len1); // no longer needed
384    if (len2)
385    {
386        memcpy(stream+len1, thiz->stream_buffer, len2);
387        memset(thiz->stream_buffer, 0, len2); // no longer needed
388    }
382   memcpy(stream, thiz->stream_buffer + thiz->stream_playpos, len1);
383   memset(thiz->stream_buffer + thiz->stream_playpos, 0, len1); // no longer needed
384   if (len2)
385   {
386      memcpy(stream+len1, thiz->stream_buffer, len2);
387      memset(thiz->stream_buffer, 0, len2); // no longer needed
388   }
389389
390390
391391   // move the play cursor
392    thiz->stream_playpos += len1 + len2;
392   thiz->stream_playpos += len1 + len2;
393393   if (thiz->stream_playpos >= thiz->stream_buffer_size)
394394   {
395       thiz->stream_playpos -= thiz->stream_buffer_size;
395      thiz->stream_playpos -= thiz->stream_buffer_size;
396396      thiz->stream_loop = 0;
397397
398398      if (LOG_SOUND)
r243189r243190
416416   SDL_AudioSpec   aspec, obtained;
417417   char audio_driver[16] = "";
418418
419    if (LOG_SOUND)
420        sound_log = fopen(SDLMAME_SOUND_LOG, "w");
419   if (LOG_SOUND)
420      sound_log = fopen(SDLMAME_SOUND_LOG, "w");
421421
422    // skip if sound disabled
423    if (sample_rate() != 0)
424    {
425        if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
426            osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
427            return -1;
428        }
422   // skip if sound disabled
423   if (sample_rate() != 0)
424   {
425      if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
426         osd_printf_error("Could not initialize SDL %s\n", SDL_GetError());
427         return -1;
428      }
429429
430        osd_printf_verbose("Audio: Start initialization\n");
431    #if (SDLMAME_SDL2)
432        strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
433    #else
434        SDL_AudioDriverName(audio_driver, sizeof(audio_driver));
435    #endif
436        osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
430      osd_printf_verbose("Audio: Start initialization\n");
431   #if (SDLMAME_SDL2)
432      strncpy(audio_driver, SDL_GetCurrentAudioDriver(), sizeof(audio_driver));
433   #else
434      SDL_AudioDriverName(audio_driver, sizeof(audio_driver));
435   #endif
436      osd_printf_verbose("Audio: Driver is %s\n", audio_driver);
437437
438        sdl_xfer_samples = SDL_XFER_SAMPLES;
439        stream_in_initialized = 0;
440        stream_loop = 0;
438      sdl_xfer_samples = SDL_XFER_SAMPLES;
439      stream_in_initialized = 0;
440      stream_loop = 0;
441441
442        // set up the audio specs
443        aspec.freq = sample_rate();
444        aspec.format = AUDIO_S16SYS;    // keep endian independent
445        aspec.channels = n_channels;
446        aspec.samples = sdl_xfer_samples;
447        aspec.callback = sdl_callback;
448        aspec.userdata = this;
442      // set up the audio specs
443      aspec.freq = sample_rate();
444      aspec.format = AUDIO_S16SYS;    // keep endian independent
445      aspec.channels = n_channels;
446      aspec.samples = sdl_xfer_samples;
447      aspec.callback = sdl_callback;
448      aspec.userdata = this;
449449
450        if (SDL_OpenAudio(&aspec, &obtained) < 0)
451            goto cant_start_audio;
450      if (SDL_OpenAudio(&aspec, &obtained) < 0)
451         goto cant_start_audio;
452452
453        osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
454                            obtained.freq, obtained.channels, obtained.samples);
453      osd_printf_verbose("Audio: frequency: %d, channels: %d, samples: %d\n",
454                     obtained.freq, obtained.channels, obtained.samples);
455455
456        sdl_xfer_samples = obtained.samples;
456      sdl_xfer_samples = obtained.samples;
457457
458        audio_latency = m_audio_latency;
458      audio_latency = m_audio_latency;
459459
460        // pin audio latency
461        if (audio_latency > MAX_AUDIO_LATENCY)
462        {
463            audio_latency = MAX_AUDIO_LATENCY;
464        }
465        else if (audio_latency < 1)
466        {
467            audio_latency = 1;
468        }
460      // pin audio latency
461      if (audio_latency > MAX_AUDIO_LATENCY)
462      {
463         audio_latency = MAX_AUDIO_LATENCY;
464      }
465      else if (audio_latency < 1)
466      {
467         audio_latency = 1;
468      }
469469
470        // compute the buffer sizes
471        stream_buffer_size = (sample_rate() * 2 * sizeof(INT16) * (2 + audio_latency)) / 30;
472        stream_buffer_size = (stream_buffer_size / 1024) * 1024;
473        if (stream_buffer_size < 1024)
474            stream_buffer_size = 1024;
470      // compute the buffer sizes
471      stream_buffer_size = (sample_rate() * 2 * sizeof(INT16) * (2 + audio_latency)) / 30;
472      stream_buffer_size = (stream_buffer_size / 1024) * 1024;
473      if (stream_buffer_size < 1024)
474         stream_buffer_size = 1024;
475475
476        // create the buffers
477        if (sdl_create_buffers())
478            goto cant_create_buffers;
476      // create the buffers
477      if (sdl_create_buffers())
478         goto cant_create_buffers;
479479
480        // set the startup volume
481        set_mastervolume(attenuation);
482        osd_printf_verbose("Audio: End initialization\n");
483        return 0;
480      // set the startup volume
481      set_mastervolume(attenuation);
482      osd_printf_verbose("Audio: End initialization\n");
483      return 0;
484484
485        // error handling
486    cant_create_buffers:
487    cant_start_audio:
488        osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
485      // error handling
486   cant_create_buffers:
487   cant_start_audio:
488      osd_printf_verbose("Audio: Initialization failed. SDL error: %s\n", SDL_GetError());
489489
490        return -1;
491    }
490      return -1;
491   }
492492
493    return 0;
493   return 0;
494494}
495495
496496
r243189r243190
501501
502502void sound_sdl::exit()
503503{
504    // if nothing to do, don't do it
505    if (sample_rate() == 0)
506        return;
504   // if nothing to do, don't do it
505   if (sample_rate() == 0)
506      return;
507507
508    osd_printf_verbose("sdl_kill: closing audio\n");
508   osd_printf_verbose("sdl_kill: closing audio\n");
509509   SDL_CloseAudio();
510510
511511   SDL_QuitSubSystem(SDL_INIT_AUDIO);
512512
513    // kill the buffers
514    sdl_destroy_buffers();
513   // kill the buffers
514   sdl_destroy_buffers();
515515
516    // print out over/underflow stats
517    if (buffer_overflows || buffer_underflows)
518        osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
516   // print out over/underflow stats
517   if (buffer_overflows || buffer_underflows)
518      osd_printf_verbose("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
519519
520    if (LOG_SOUND)
521    {
522        fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
523        fclose(sound_log);
524    }
520   if (LOG_SOUND)
521   {
522      fprintf(sound_log, "Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows);
523      fclose(sound_log);
524   }
525525}
526526
527527
r243189r243190
555555
556556
557557#else /* SDLMAME_UNIX */
558    MODULE_NOT_SUPPORTED(sound_sdl, OSD_SOUND_PROVIDER, "sdl")
558   MODULE_NOT_SUPPORTED(sound_sdl, OSD_SOUND_PROVIDER, "sdl")
559559#endif
560560
561561MODULE_DEFINITION(SOUND_SDL, sound_sdl)
trunk/src/osd/modules/sound/sound_module.h
r243189r243190
1818class sound_module
1919{
2020public:
21    sound_module() : m_sample_rate(0), m_audio_latency(1) { }
21   sound_module() : m_sample_rate(0), m_audio_latency(1) { }
2222
23    virtual ~sound_module() { }
23   virtual ~sound_module() { }
2424
25    virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) = 0;
26    virtual void set_mastervolume(int attenuation) = 0;
25   virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) = 0;
26   virtual void set_mastervolume(int attenuation) = 0;
2727
28    int sample_rate() { return m_sample_rate; }
28   int sample_rate() { return m_sample_rate; }
2929
30    int m_sample_rate;
31    int m_audio_latency;
30   int m_sample_rate;
31   int m_audio_latency;
3232};
3333
3434#endif /* FONT_MODULE_H_ */
trunk/src/osd/modules/sync/sync_mini.c
r243189r243190
160160void osd_thread_wait_free(osd_thread *thread)
161161{
162162}
163
trunk/src/osd/modules/sync/sync_ntc.c
r243189r243190
411411{
412412   if (timeout == OSD_EVENT_WAIT_INFINITE)
413413      timeout = osd_ticks_per_second() * (osd_ticks_t)10000;
414   
414
415415   pthread_mutex_lock(&event->mutex);
416416   if (!timeout)
417417   {
r243189r243190
531531   pthread_join(thread->thread, NULL);
532532   free(thread);
533533}
534
trunk/src/osd/modules/sync/sync_os2.c
r243189r243190
388388{
389389   ULONG rc;
390390   ULONG timeout_param;
391   
391
392392   if (timeout == OSD_EVENT_WAIT_INFINITE)
393393      timeout_param = SEM_INDEFINITE_WAIT;
394394   else
trunk/src/osd/modules/sync/sync_sdl.c
r243189r243190
326326   thread->callback = callback;
327327   thread->param = cbparam;
328328#ifdef SDLMAME_SDL2
329    thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread);
329   thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread);
330330#else
331    thread->thread = SDL_CreateThread(worker_thread_entry, thread);
331   thread->thread = SDL_CreateThread(worker_thread_entry, thread);
332332#endif
333333   if ( thread->thread == NULL )
334334   {
r243189r243190
366366   SDL_WaitThread(thread->thread, &status);
367367   free(thread);
368368}
369
trunk/src/osd/modules/sync/sync_tc.c
r243189r243190
246246{
247247   if (timeout == OSD_EVENT_WAIT_INFINITE)
248248      timeout = osd_ticks_per_second() * (osd_ticks_t)10000;
249   
249
250250   pthread_mutex_lock(&event->mutex);
251251   if (!timeout)
252252   {
r243189r243190
389389   pthread_join(thread->thread, NULL);
390390   free(thread);
391391}
392
trunk/src/osd/modules/sync/sync_windows.c
r243189r243190
244244      timeout_param = INFINITE;
245245   else
246246      timeout_param = timeout * 1000 / osd_ticks_per_second();
247   
247
248248   int ret = WaitForSingleObject((HANDLE) event, timeout_param);
249249   return (ret == WAIT_OBJECT_0);
250250}
trunk/src/osd/modules/sync/work_osd.c
r243189r243190
7070template<typename _PtrType>
7171static void spin_while(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout, const int invert = 0)
7272{
73    osd_ticks_t stopspin = osd_ticks() + timeout;
73   osd_ticks_t stopspin = osd_ticks() + timeout;
7474
75    do {
76        int spin = 10000;
77        while (--spin)
78        {
79            if ((*ptr != val) ^ invert)
80                return;
81        }
82    } while (((*ptr == val) ^ invert) && osd_ticks() < stopspin);
75   do {
76      int spin = 10000;
77      while (--spin)
78      {
79         if ((*ptr != val) ^ invert)
80            return;
81      }
82   } while (((*ptr == val) ^ invert) && osd_ticks() < stopspin);
8383}
8484
8585template<typename _PtrType>
8686static void spin_while_not(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout)
8787{
88    spin_while(ptr, val, timeout, 1);
88   spin_while(ptr, val, timeout, 1);
8989}
9090
9191
r243189r243190
553553   if (item->event == NULL)
554554   {
555555      // TODO: do we need to measure the spin time here as well? and how can we do it?
556        spin_while(&item->done, 0, timeout);
556      spin_while(&item->done, 0, timeout);
557557   }
558558
559559   // otherwise, block on the event until done
trunk/src/osd/osdcore.c
r243189r243190
5454output_delegate osd_set_output_channel(output_channel channel, output_delegate callback)
5555{
5656   if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull())
57    {
58       throw std::exception();
59    }
57   {
58      throw std::exception();
59   }
6060
6161   /* return the originals if requested */
6262   output_delegate prevcb = output_cb[channel];
r243189r243190
166166   va_end(argptr);
167167}
168168#endif
169
trunk/src/osd/osdepend.h
r243189r243190
3232class osd_font
3333{
3434public:
35    virtual ~osd_font() {}
35   virtual ~osd_font() {}
3636
37    virtual bool open(const char *font_path, const char *name, int &height) = 0;
38    virtual void close() = 0;
39    virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
37   virtual bool open(const char *font_path, const char *name, int &height) = 0;
38   virtual void close() = 0;
39   virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
4040};
4141
4242// ======================> osd_interface
trunk/src/osd/osdmini/minimisc.c
r243189r243190
8181   // can't support clipboards generically
8282   return NULL;
8383}
84
trunk/src/osd/sdl/blit13.h
r243189r243190
114114
115115#define TEXCOPY_M( _name, _src_type, _dest_type,  _op, _len_div) \
116116INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo *texsource) { \
117    ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
117   ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
118118   int x, y; \
119119   /* loop over Y */ \
120120   for (y = 0; y < texsource->height; y++) { \
r243189r243190
134134
135135#define TEXROT( _name, _src_type, _dest_type, _op) \
136136INLINE void texcopy_rot_##_name (const texture_info *texture, const render_texinfo *texsource) { \
137    ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
137   ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
138138   int x, y; \
139139   const quad_setup_data *setup = &texture->m_setup; \
140140   int dudx = setup->dudx; \
trunk/src/osd/sdl/draw13.c
r243189r243190
4848
4949static inline bool is_opaque(const float &a)
5050{
51    return (a >= 1.0f);
51   return (a >= 1.0f);
5252}
5353
5454static inline bool is_transparent(const float &a)
5555{
56    return (a <  0.0001f);
56   return (a <  0.0001f);
5757}
5858
5959//============================================================
r243189r243190
6363
6464struct quad_setup_data
6565{
66    quad_setup_data()
67    : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
68      rotwidth(0), rotheight(0)
69    {}
70    void compute(const render_primitive &prim);
66   quad_setup_data()
67   : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
68      rotwidth(0), rotheight(0)
69   {}
70   void compute(const render_primitive &prim);
7171
7272   INT32           dudx, dvdx, dudy, dvdy;
7373   INT32           startu, startv;
r243189r243190
105105/* texture_info holds information about a texture */
106106class texture_info
107107{
108    friend class simple_list<texture_info>;
108   friend class simple_list<texture_info>;
109109public:
110    texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags);
111    ~texture_info();
110   texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags);
111   ~texture_info();
112112
113    void set_data(const render_texinfo &texsource, const UINT32 flags);
114    void render_quad(const render_primitive *prim, const int x, const int y);
115    bool matches(const render_primitive &prim, const quad_setup_data &setup);
113   void set_data(const render_texinfo &texsource, const UINT32 flags);
114   void render_quad(const render_primitive *prim, const int x, const int y);
115   bool matches(const render_primitive &prim, const quad_setup_data &setup);
116116
117    copy_info_t *compute_size_type();
117   copy_info_t *compute_size_type();
118118
119119   void                *m_pixels;            // pixels for the texture
120120   int                 m_pitch;
r243189r243190
125125   osd_ticks_t         m_last_access;
126126
127127   int raw_width() const { return m_texinfo.width; }
128    int raw_height() const { return m_texinfo.height; }
128   int raw_height() const { return m_texinfo.height; }
129129
130    texture_info *next() { return m_next; }
131    const render_texinfo &texinfo() const { return m_texinfo; }
132    render_texinfo &texinfo() { return m_texinfo; }
130   texture_info *next() { return m_next; }
131   const render_texinfo &texinfo() const { return m_texinfo; }
132   render_texinfo &texinfo() { return m_texinfo; }
133133
134    const HashT hash() const { return m_hash; }
135    const UINT32 flags() const { return m_flags; }
136    const bool is_pixels_owned() const { // do we own / allocated it ?
137        return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
138                && (m_copyinfo->func != NULL)) ;
139    }
134   const HashT hash() const { return m_hash; }
135   const UINT32 flags() const { return m_flags; }
136   const bool is_pixels_owned() const { // do we own / allocated it ?
137      return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
138            && (m_copyinfo->func != NULL)) ;
139   }
140140
141141private:
142    Uint32              m_sdl_access;
143    SDL_Renderer *      m_renderer;
144    render_texinfo      m_texinfo;            // copy of the texture info
145    HashT               m_hash;               // hash value for the texture (must be >= pointer size)
146    UINT32              m_flags;              // rendering flags
142   Uint32              m_sdl_access;
143   SDL_Renderer *      m_renderer;
144   render_texinfo      m_texinfo;            // copy of the texture info
145   HashT               m_hash;               // hash value for the texture (must be >= pointer size)
146   UINT32              m_flags;              // rendering flags
147147
148    SDL_Texture *       m_texture_id;
149    int                 m_is_rotated;
148   SDL_Texture *       m_texture_id;
149   int                 m_is_rotated;
150150
151    int                 m_format;             // texture format
152    SDL_BlendMode       m_sdl_blendmode;
151   int                 m_format;             // texture format
152   SDL_BlendMode       m_sdl_blendmode;
153153
154    texture_info *      m_next;               // next texture in the list
154   texture_info *      m_next;               // next texture in the list
155155};
156156
157157/* sdl_info is the information about SDL for the current screen */
158158struct sdl_info
159159{
160    sdl_info()
161    : m_blittimer(0), m_renderer(NULL),
162      m_hofs(0), m_vofs(0),
163      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
164      m_last_blit_time(0), m_last_blit_pixels(0)
165    {}
160   sdl_info()
161   : m_blittimer(0), m_renderer(NULL),
162      m_hofs(0), m_vofs(0),
163      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
164      m_last_blit_time(0), m_last_blit_pixels(0)
165   {}
166166
167    void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
167   void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
168168
169    texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
170    texture_info *texture_update(const render_primitive &prim);
169   texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
170   texture_info *texture_update(const render_primitive &prim);
171171
172172   INT32           m_blittimer;
173173
r243189r243190
389389   target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0);
390390   target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0);
391391
392    SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode);
393    set_coloralphamode(m_texture_id, &prim->color);
394    SDL_RenderCopy(m_renderer,  m_texture_id, NULL, &target_rect);
392   SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode);
393   set_coloralphamode(m_texture_id, &prim->color);
394   SDL_RenderCopy(m_renderer,  m_texture_id, NULL, &target_rect);
395395}
396396
397397void sdl_info::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y)
398398{
399    SDL_Rect target_rect;
399   SDL_Rect target_rect;
400400
401    target_rect.x = x;
402    target_rect.y = y;
403    target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0);
404    target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0);
401   target_rect.x = x;
402   target_rect.y = y;
403   target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0);
404   target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0);
405405
406    if (texture)
407    {
408        copy_info_t *copyinfo = texture->m_copyinfo;
409        copyinfo->time -= osd_ticks();
410        texture->render_quad(prim, x, y);
411        copyinfo->time += osd_ticks();
406   if (texture)
407   {
408      copy_info_t *copyinfo = texture->m_copyinfo;
409      copyinfo->time -= osd_ticks();
410      texture->render_quad(prim, x, y);
411      copyinfo->time += osd_ticks();
412412
413        copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->raw_width() * texture->raw_height()));
414        if (m_last_blit_pixels)
415        {
416            copyinfo->time += (m_last_blit_time * (INT64) (texture->raw_width() * texture->raw_height())) / (INT64) m_last_blit_pixels;
417        }
418        copyinfo->samples++;
419        copyinfo->perf = ( texture->m_copyinfo->pixel_count * (osd_ticks_per_second()/1000)) / texture->m_copyinfo->time;
420    }
421    else
422    {
423        UINT32 sr = (UINT32)(255.0f * prim->color.r);
424        UINT32 sg = (UINT32)(255.0f * prim->color.g);
425        UINT32 sb = (UINT32)(255.0f * prim->color.b);
426        UINT32 sa = (UINT32)(255.0f * prim->color.a);
413      copyinfo->pixel_count += MAX(STAT_PIXEL_THRESHOLD , (texture->raw_width() * texture->raw_height()));
414      if (m_last_blit_pixels)
415      {
416         copyinfo->time += (m_last_blit_time * (INT64) (texture->raw_width() * texture->raw_height())) / (INT64) m_last_blit_pixels;
417      }
418      copyinfo->samples++;
419      copyinfo->perf = ( texture->m_copyinfo->pixel_count * (osd_ticks_per_second()/1000)) / texture->m_copyinfo->time;
420   }
421   else
422   {
423      UINT32 sr = (UINT32)(255.0f * prim->color.r);
424      UINT32 sg = (UINT32)(255.0f * prim->color.g);
425      UINT32 sb = (UINT32)(255.0f * prim->color.b);
426      UINT32 sa = (UINT32)(255.0f * prim->color.a);
427427
428        SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
429        SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa);
430        SDL_RenderFillRect(m_renderer, &target_rect);
431    }
428      SDL_SetRenderDrawBlendMode(m_renderer, map_blendmode(PRIMFLAG_GET_BLENDMODE(prim->flags)));
429      SDL_SetRenderDrawColor(m_renderer, sr, sg, sb, sa);
430      SDL_RenderFillRect(m_renderer, &target_rect);
431   }
432432}
433433
434434static int RendererSupportsFormat(SDL_Renderer *renderer, Uint32 format, Uint32 access, const char *sformat)
r243189r243190
518518   else
519519      osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
520520
521    /* Enable bilinear filtering in case it is supported.
522     * This applies to all texture operations. However, artwort is pre-scaled
523     * and thus shouldn't be affected.
524     */
525    if (video_config.filter)
526    {
527        SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
528    }
529    else
530    {
531        SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
532    }
521   /* Enable bilinear filtering in case it is supported.
522    * This applies to all texture operations. However, artwort is pre-scaled
523    * and thus shouldn't be affected.
524    */
525   if (video_config.filter)
526   {
527      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
528   }
529   else
530   {
531      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
532   }
533533
534534   return 0;
535535}
r243189r243190
604604   {
605605      SDL_DisplayMode mode;
606606      //SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode);
607        SDL_GetWindowDisplayMode(window->sdl_window, &mode);
607      SDL_GetWindowDisplayMode(window->sdl_window, &mode);
608608      sdl->m_original_mode = mode;
609609      mode.w = width;
610610      mode.h = height;
r243189r243190
630630            osd_printf_warning("Ignoring depth %d\n", window->depth);
631631         }
632632      }
633        SDL_SetWindowDisplayMode(window->sdl_window, &mode);    // Try to set mode
633      SDL_SetWindowDisplayMode(window->sdl_window, &mode);    // Try to set mode
634634#ifndef SDLMAME_WIN32
635        /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
636         * is in place after the mode switch - which will most likely be the case
637         * This is a hack to work around a deficiency in SDL2
638         */
639        SDL_WarpMouseInWindow(window->sdl_window, 1, 1);
635      /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
636       * is in place after the mode switch - which will most likely be the case
637       * This is a hack to work around a deficiency in SDL2
638       */
639      SDL_WarpMouseInWindow(window->sdl_window, 1, 1);
640640#endif
641641   }
642642   else
r243189r243190
736736      SDL_GetWindowSize(window->sdl_window, &window->width, &window->height);
737737      sdl->m_resize_pending = 0;
738738      SDL_RenderSetViewport(sdl->m_renderer, NULL);
739       //sdlvideo_monitor_refresh(window->monitor());
739      //sdlvideo_monitor_refresh(window->monitor());
740740
741741   }
742742
r243189r243190
855855
856856   drawsdl2_destroy_all_textures(window);
857857
858    if (window->fullscreen() && video_config.switchres)
859    {
860        SDL_SetWindowFullscreen(window->sdl_window, 0);    // Try to set mode
861        SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode);    // Try to set mode
862        SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
863    }
858   if (window->fullscreen() && video_config.switchres)
859   {
860      SDL_SetWindowFullscreen(window->sdl_window, 0);    // Try to set mode
861      SDL_SetWindowDisplayMode(window->sdl_window, &sdl->m_original_mode);    // Try to set mode
862      SDL_SetWindowFullscreen(window->sdl_window, SDL_WINDOW_FULLSCREEN);    // Try to set mode
863   }
864864
865    SDL_DestroyWindow(window->sdl_window);
865   SDL_DestroyWindow(window->sdl_window);
866866
867867   global_free(sdl);
868868   window->dxdata = NULL;
r243189r243190
889889      {
890890         if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname))
891891         {
892             int perf = bi->perf;
892            int perf = bi->perf;
893893            if (perf == 0)
894894               return bi;
895895            else if (perf > (maxperf * 102) / 100)
r243189r243190
920920
921921bool texture_info::matches(const render_primitive &prim, const quad_setup_data &setup)
922922{
923    return  texinfo().base == prim.texture.base &&
924            texinfo().width == prim.texture.width &&
925            texinfo().height == prim.texture.height &&
926            texinfo().rowpixels == prim.texture.rowpixels &&
927            m_setup.dudx == setup.dudx &&
928            m_setup.dvdx == setup.dvdx &&
929            m_setup.dudy == setup.dudy &&
930            m_setup.dvdy == setup.dvdy &&
931            ((flags() ^ prim.flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0;
923   return  texinfo().base == prim.texture.base &&
924         texinfo().width == prim.texture.width &&
925         texinfo().height == prim.texture.height &&
926         texinfo().rowpixels == prim.texture.rowpixels &&
927         m_setup.dudx == setup.dudx &&
928         m_setup.dvdx == setup.dvdx &&
929         m_setup.dudy == setup.dudy &&
930         m_setup.dvdy == setup.dvdy &&
931         ((flags() ^ prim.flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0;
932932}
933933
934934//============================================================
r243189r243190
937937
938938texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags)
939939{
940
941940   // fill in the core data
942    m_renderer = renderer;
941   m_renderer = renderer;
943942   m_hash = texture_compute_hash(texsource, flags);
944943   m_flags = flags;
945944   m_texinfo = texsource;
r243189r243190
997996
998997   if (m_sdl_access == SDL_TEXTUREACCESS_STATIC)
999998   {
1000       if (m_copyinfo->func != NULL)
1001           m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->dst_bpp);
1002       else
1003           m_pixels = NULL;
999      if (m_copyinfo->func != NULL)
1000         m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->dst_bpp);
1001      else
1002         m_pixels = NULL;
10041003   }
10051004   m_last_access = osd_ticks();
10061005
r243189r243190
10081007
10091008texture_info::~texture_info()
10101009{
1011    if ( is_pixels_owned() && (m_pixels != NULL) )
1012        free(m_pixels);
1013    SDL_DestroyTexture(m_texture_id);
1010   if ( is_pixels_owned() && (m_pixels != NULL) )
1011      free(m_pixels);
1012   SDL_DestroyTexture(m_texture_id);
10141013}
10151014
10161015//============================================================
r243189r243190
10821081
10831082#if 0
10841083   printf("tl.u %f tl.v %f\n", texcoords->tl.u, texcoords->tl.v);
1085    printf("tr.u %f tr.v %f\n", texcoords->tr.u, texcoords->tr.v);
1086    printf("bl.u %f bl.v %f\n", texcoords->bl.u, texcoords->bl.v);
1087    printf("br.u %f br.v %f\n", texcoords->br.u, texcoords->br.v);
1084   printf("tr.u %f tr.v %f\n", texcoords->tr.u, texcoords->tr.v);
1085   printf("bl.u %f bl.v %f\n", texcoords->bl.u, texcoords->bl.v);
1086   printf("br.u %f br.v %f\n", texcoords->br.u, texcoords->br.v);
10881087   /* compute start and delta U,V coordinates now */
10891088#endif
10901089
r243189r243190
11621161   if (texture == NULL && prim.texture.base != NULL)
11631162   {
11641163      texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags));
1165       /* add us to the texture list */
1164      /* add us to the texture list */
11661165      m_texlist.prepend(*texture);
11671166
11681167   }
r243189r243190
11911190   if(window->primlist)
11921191   {
11931192      window->primlist->acquire_lock();
1194        sdl->m_texlist.reset();
1195        window->primlist->release_lock();
1193      sdl->m_texlist.reset();
1194      window->primlist->release_lock();
11961195   }
11971196   else
1198        sdl->m_texlist.reset();
1197      sdl->m_texlist.reset();
11991198}
trunk/src/osd/sdl/drawogl.c
r243189r243190
161161/* texture_info holds information about a texture */
162162struct texture_info
163163{
164    texture_info()
165    : hash(0), flags(0), rawwidth(0), rawheight(0),
166      rawwidth_create(0), rawheight_create(0),
167      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
168      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
169      data_own(0), texCoordBufferName(0)
170    {
171        for (int i=0; i<2; i++)
172        {
173            mpass_textureunit[i] = 0;
174            mpass_texture_mamebm[i] = 0;
175            mpass_fbo_mamebm[i] = 0;
176            mpass_texture_scrn[i] = 0;
177            mpass_fbo_scrn[i] = 0;
178        }
179        for (int i=0; i<8; i++)
180            texCoord[i] = 0.0f;
181    }
164   texture_info()
165   : hash(0), flags(0), rawwidth(0), rawheight(0),
166      rawwidth_create(0), rawheight_create(0),
167      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
168      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
169      data_own(0), texCoordBufferName(0)
170   {
171      for (int i=0; i<2; i++)
172      {
173         mpass_textureunit[i] = 0;
174         mpass_texture_mamebm[i] = 0;
175         mpass_fbo_mamebm[i] = 0;
176         mpass_texture_scrn[i] = 0;
177         mpass_fbo_scrn[i] = 0;
178      }
179      for (int i=0; i<8; i++)
180         texCoord[i] = 0.0f;
181   }
182182
183183   HashT               hash;               // hash value for the texture (must be >= pointer size)
184184   UINT32              flags;              // rendering flags
r243189r243190
217217/* sdl_info is the information about SDL for the current screen */
218218struct sdl_info
219219{
220    sdl_info()
221    : blittimer(0), extra_flags(0),
220   sdl_info()
221   : blittimer(0), extra_flags(0),
222222#if (SDLMAME_SDL2)
223      gl_context_id(0),
223      gl_context_id(0),
224224#else
225      sdlsurf(NULL),
225      sdlsurf(NULL),
226226#endif
227      initialized(0),
228      last_blendmode(0),
229      texture_max_width(0),
230      texture_max_height(0),
231      texpoweroftwo(0),
232      usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL),
233      glsl_program_num(0),
234      glsl_program_mb2sc(0),
235      usetexturerect(0),
236      init_context(0),
237      last_hofs(0.0f),
238      last_vofs(0.0f),
239      surf_w(0),
240      surf_h(0)
241    {
242        for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++)
243            texhash[i] = NULL;
244        for (int i=0; i < 2*GLSL_SHADER_MAX; i++)
245            glsl_program[i] = 0;
246        for (int i=0; i < 8; i++)
247            texVerticex[i] = 0.0f;
248    }
227      initialized(0),
228      last_blendmode(0),
229      texture_max_width(0),
230      texture_max_height(0),
231      texpoweroftwo(0),
232      usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL),
233      glsl_program_num(0),
234      glsl_program_mb2sc(0),
235      usetexturerect(0),
236      init_context(0),
237      last_hofs(0.0f),
238      last_vofs(0.0f),
239      surf_w(0),
240      surf_h(0)
241   {
242      for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++)
243         texhash[i] = NULL;
244      for (int i=0; i < 2*GLSL_SHADER_MAX; i++)
245         glsl_program[i] = 0;
246      for (int i=0; i < 8; i++)
247         texVerticex[i] = 0.0f;
248   }
249249
250250   INT32           blittimer;
251251   UINT32          extra_flags;
r243189r243190
30793079      sdl->texhash[i] = NULL;
30803080      if (texture != NULL)
30813081      {
3082            if(sdl->usevbo)
3083            {
3084                pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3085                texture->texCoordBufferName=0;
3086            }
3082         if(sdl->usevbo)
3083         {
3084            pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3085            texture->texCoordBufferName=0;
3086         }
30873087
3088            if(sdl->usepbo && texture->pbo)
3089            {
3090                pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3091                texture->pbo=0;
3092            }
3088         if(sdl->usepbo && texture->pbo)
3089         {
3090            pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3091            texture->pbo=0;
3092         }
30933093
3094            if( sdl->glsl_program_num > 1 )
3095            {
3096                assert(sdl->usefbo);
3097                pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3098                glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3099            }
3094         if( sdl->glsl_program_num > 1 )
3095         {
3096            assert(sdl->usefbo);
3097            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3098            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3099         }
31003100
3101            if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 )
3102            {
3103                assert(sdl->usefbo);
3104                pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3105                glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3106            }
3101         if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 )
3102         {
3103            assert(sdl->usefbo);
3104            pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3105            glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3106         }
31073107
3108            glDeleteTextures(1, (GLuint *)&texture->texture);
3109            if ( texture->data_own )
3110            {
3111                free(texture->data);
3112                texture->data=NULL;
3113                texture->data_own=FALSE;
3114            }
3115            global_free(texture);
3108         glDeleteTextures(1, (GLuint *)&texture->texture);
3109         if ( texture->data_own )
3110         {
3111            free(texture->data);
3112            texture->data=NULL;
3113            texture->data_own=FALSE;
3114         }
3115         global_free(texture);
31163116      }
31173117      i++;
31183118   }
trunk/src/osd/sdl/input.c
r243189r243190
19861986            else
19871987            {
19881988#ifndef SDLMAME_WIN32
1989                /* FIXME: SDL2 sends some spurious resize events on Ubuntu
1990                 * while in fullscreen mode. Ignore them for now.
1991                 */
1992                if (!window->fullscreen())
1989               /* FIXME: SDL2 sends some spurious resize events on Ubuntu
1990                * while in fullscreen mode. Ignore them for now.
1991                */
1992               if (!window->fullscreen())
19931993#endif
1994                {
1995                       //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
1996                       if (event.window.data1 != window->width || event.window.data2 != window->height)
1997                           window->window_resize(event.window.data1, event.window.data2);
1998                }
1994               {
1995                  //printf("event data1,data2 %d x %d %ld\n", event.window.data1, event.window.data2, sizeof(SDL_Event));
1996                  if (event.window.data1 != window->width || event.window.data2 != window->height)
1997                     window->window_resize(event.window.data1, event.window.data2);
1998               }
19991999            }
20002000            focus_window = window;
20012001            break;
trunk/src/osd/sdl/netdev_pcap.c
r243189r243190
9898      return;
9999   }
100100
101    while(devs)
102    {
103        add_netdev(devs->name, devs->description, create_pcap);
104        devs = devs->next;
105    }
101   while(devs)
102   {
103      add_netdev(devs->name, devs->description, create_pcap);
104      devs = devs->next;
105   }
106106}
107107
108108void deinit_pcap()
trunk/src/osd/sdl/netdev_pcap_osx.c
r243189r243190
150150   }
151151
152152#if 1
153    while(devs)
154    {
155        add_netdev(devs->name, devs->description, create_pcap);
156        devs = devs->next;
157    }
153   while(devs)
154   {
155      add_netdev(devs->name, devs->description, create_pcap);
156      devs = devs->next;
157   }
158158#else
159159   if (devs)
160160   {
trunk/src/osd/sdl/osdsdl.h
r243189r243190
3030      #define SDL13_COMBINE_RESIZE (0)
3131   #endif
3232#else
33    #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
33   #define SDLMAME_INIT_IN_WORKER_THREAD   (0)
3434   #define SDL13_COMBINE_RESIZE (0)
3535#endif
3636
r243189r243190
199199   #ifdef USE_NETWORK
200200   virtual bool network_init();
201201   #endif
202    //virtual bool midi_init();
202   //virtual bool midi_init();
203203
204204   virtual void video_exit();
205205   virtual void window_exit();
r243189r243190
208208   #ifdef USE_NETWORK
209209   virtual void network_exit();
210210   #endif
211    //virtual void midi_exit();
211   //virtual void midi_exit();
212212
213    sdl_options &options() { return m_options; }
213   sdl_options &options() { return m_options; }
214214
215215private:
216216   virtual void osd_exit();
r243189r243190
220220   // FIXME: remove machine usage
221221   void extract_video_config(running_machine &machine);
222222
223    sdl_options &m_options;
223   sdl_options &m_options;
224224
225225   watchdog *m_watchdog;
226226
trunk/src/osd/sdl/sdl.mak
r243189r243190
738738   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o
739739
740740DEFS += -DUSE_QTDEBUG=1
741   
741
742742else
743743DEFS += -DUSE_QTDEBUG=0
744744endif
trunk/src/osd/sdl/sdldir.c
r243189r243190
152152
153153   if (tmpstr[0] == '$')
154154   {
155
156155      envstr = (char *) osd_malloc_array(strlen(tmpstr)+1);
157156
158157      strcpy(envstr, tmpstr);
trunk/src/osd/sdl/sdlfile.c
r243189r243190
188188
189189      envstr[i] = '\0';
190190
191        const char *envval = osd_getenv(&envstr[1]);
191      const char *envval = osd_getenv(&envstr[1]);
192192      if (envval != NULL)
193193      {
194194         j = strlen(envval) + strlen(tmpstr) + 1;
r243189r243190
505505
506506osd_directory_entry *osd_stat(const char *path)
507507{
508    int err;
509    osd_directory_entry *result = NULL;
510    #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
511    struct stat st;
512    #else
513    struct stat64 st;
514    #endif
508   int err;
509   osd_directory_entry *result = NULL;
510   #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
511   struct stat st;
512   #else
513   struct stat64 st;
514   #endif
515515
516    #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
517    err = stat(path, &st);
518    #else
519    err = stat64(path, &st);
520    #endif
516   #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN)
517   err = stat(path, &st);
518   #else
519   err = stat64(path, &st);
520   #endif
521521
522    if( err == -1) return NULL;
522   if( err == -1) return NULL;
523523
524    // create an osd_directory_entry; be sure to make sure that the caller can
525    // free all resources by just freeing the resulting osd_directory_entry
526    result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1);
527    strcpy(((char *) result) + sizeof(*result), path);
528    result->name = ((char *) result) + sizeof(*result);
529    result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
530    result->size = (UINT64)st.st_size;
524   // create an osd_directory_entry; be sure to make sure that the caller can
525   // free all resources by just freeing the resulting osd_directory_entry
526   result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1);
527   strcpy(((char *) result) + sizeof(*result), path);
528   result->name = ((char *) result) + sizeof(*result);
529   result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
530   result->size = (UINT64)st.st_size;
531531
532    return result;
532   return result;
533533}
534534
535535//============================================================
r243189r243190
538538
539539file_error osd_get_full_path(char **dst, const char *path)
540540{
541    file_error err;
542    char path_buffer[512];
541   file_error err;
542   char path_buffer[512];
543543
544    err = FILERR_NONE;
544   err = FILERR_NONE;
545545
546    if (getcwd(path_buffer, 511) == NULL)
547    {
548        printf("osd_get_full_path: failed!\n");
549        err = FILERR_FAILURE;
550    }
551    else
552    {
553        *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3);
546   if (getcwd(path_buffer, 511) == NULL)
547   {
548      printf("osd_get_full_path: failed!\n");
549      err = FILERR_FAILURE;
550   }
551   else
552   {
553      *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3);
554554
555        // if it's already a full path, just pass it through
556        if (path[0] == '/')
557        {
558            strcpy(*dst, path);
559        }
560        else
561        {
562            sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path);
563        }
564    }
555      // if it's already a full path, just pass it through
556      if (path[0] == '/')
557      {
558         strcpy(*dst, path);
559      }
560      else
561      {
562         sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path);
563      }
564   }
565565
566    return err;
566   return err;
567567}
568568
569569//============================================================
r243189r243190
572572
573573const char *osd_get_volume_name(int idx)
574574{
575    if (idx!=0) return NULL;
576    return "/";
575   if (idx!=0) return NULL;
576   return "/";
577577}
578578
579579#endif
trunk/src/osd/sdl/sdlmain.c
r243189r243190
319319#endif
320320
321321   {
322       sdl_options options;
322      sdl_options options;
323323      sdl_osd_interface osd(options);
324324      osd.register_options();
325325      cli_frontend frontend(options, osd);
r243189r243190
688688}
689689
690690#endif
691
692
trunk/src/osd/sdl/sdlos_macosx.c
r243189r243190
121121
122122   return result;
123123}
124
trunk/src/osd/sdl/sdlos_unix.c
r243189r243190
147147   return result;
148148}
149149#endif
150
151
152
trunk/src/osd/sdl/sdlos_win32.c
r243189r243190
101101
102102   return result;
103103}
104
trunk/src/osd/sdl/sdlptty_unix.c
r243189r243190
111111
112112file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize)
113113{
114    return FILERR_ACCESS_DENIED;
114   return FILERR_ACCESS_DENIED;
115115}
116116
117117file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
118118{
119    return FILERR_ACCESS_DENIED;
119   return FILERR_ACCESS_DENIED;
120120}
121121
122122file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
123123{
124    return FILERR_ACCESS_DENIED;
124   return FILERR_ACCESS_DENIED;
125125}
126126
127127file_error sdl_close_ptty(osd_file *file)
128128{
129    return FILERR_ACCESS_DENIED;
129   return FILERR_ACCESS_DENIED;
130130}
131131#endif
trunk/src/osd/sdl/strconv.c
r243189r243190
127127
128128int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count)
129129{
130    wchar_t wch;
130   wchar_t wch;
131131
132    count = mbstowcs(&wch, (char *)osdchar, 1);
133    if (count != -1)
134        *uchar = wch;
135    else
136        *uchar = 0;
132   count = mbstowcs(&wch, (char *)osdchar, 1);
133   if (count != -1)
134      *uchar = wch;
135   else
136      *uchar = 0;
137137
138    return count;
138   return count;
139139}
140140
141141#endif
trunk/src/osd/sdl/video.c
r243189r243190
154154
155155   #if defined(SDLMAME_WIN32)
156156   SDL_GetDesktopDisplayMode(monitor->handle, &dmode);
157    #else
158    SDL_GetCurrentDisplayMode(monitor->handle, &dmode);
159    #endif
157   #else
158   SDL_GetCurrentDisplayMode(monitor->handle, &dmode);
159   #endif
160160   monitor->monitor_width = dmode.w;
161161   monitor->monitor_height = dmode.h;
162162   monitor->center_width = dmode.w;
trunk/src/osd/sdl/window.c
r243189r243190
270270    * The code below will document which hints were set.
271271    */
272272   const char * hints[] = { SDL_HINT_FRAMEBUFFER_ACCELERATION,
273           SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_OPENGL_SHADERS,
274            SDL_HINT_RENDER_SCALE_QUALITY,
275            SDL_HINT_RENDER_VSYNC,
276            SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA,
277            SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD,
278            SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
279            SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED,
280            SDL_HINT_ORIENTATIONS,
281            SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG,
282            SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_HINT_ALLOW_TOPMOST,
283            SDL_HINT_TIMER_RESOLUTION,
273         SDL_HINT_RENDER_DRIVER, SDL_HINT_RENDER_OPENGL_SHADERS,
274         SDL_HINT_RENDER_SCALE_QUALITY,
275         SDL_HINT_RENDER_VSYNC,
276         SDL_HINT_VIDEO_X11_XVIDMODE, SDL_HINT_VIDEO_X11_XINERAMA,
277         SDL_HINT_VIDEO_X11_XRANDR, SDL_HINT_GRAB_KEYBOARD,
278         SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
279         SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_HINT_IDLE_TIMER_DISABLED,
280         SDL_HINT_ORIENTATIONS,
281         SDL_HINT_XINPUT_ENABLED, SDL_HINT_GAMECONTROLLERCONFIG,
282         SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_HINT_ALLOW_TOPMOST,
283         SDL_HINT_TIMER_RESOLUTION,
284284#if SDL_VERSION_ATLEAST(2, 0, 2)
285            SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
286            SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK,
287            SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
288            SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
285         SDL_HINT_RENDER_DIRECT3D_THREADSAFE, SDL_HINT_VIDEO_ALLOW_SCREENSAVER,
286         SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK,
287         SDL_HINT_VIDEO_WIN_D3DCOMPILER, SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
288         SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES,
289289#endif
290290#if SDL_VERSION_ATLEAST(2, 0, 3)
291            SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED,
292            SDL_HINT_WINRT_PRIVACY_POLICY_URL, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL,
293            SDL_HINT_WINRT_HANDLE_BACK_BUTTON,
291         SDL_HINT_RENDER_DIRECT3D11_DEBUG, SDL_HINT_VIDEO_HIGHDPI_DISABLED,
292         SDL_HINT_WINRT_PRIVACY_POLICY_URL, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL,
293         SDL_HINT_WINRT_HANDLE_BACK_BUTTON,
294294#endif
295            NULL
296    };
295         NULL
296   };
297297
298298
299    osd_printf_verbose("\nHints:\n");
300    for (int i = 0; hints[i] != NULL; i++)
301        osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i]));
299   osd_printf_verbose("\nHints:\n");
300   for (int i = 0; hints[i] != NULL; i++)
301      osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i]));
302302#endif
303303
304304   // set up the window list
r243189r243190
10181018
10191019      if (osd_event_wait(rendered_event, event_wait_ticks))
10201020      {
1021          if ((!fullscreen()) || (video_config.switchres))
1022          {
1023              blit_surface_size(width, height);
1024          }
1025          else
1026          {
1027              blit_surface_size(monitor()->center_width, monitor()->center_height);
1028          }
1021         if ((!fullscreen()) || (video_config.switchres))
1022         {
1023            blit_surface_size(width, height);
1024         }
1025         else
1026         {
1027            blit_surface_size(monitor()->center_width, monitor()->center_height);
1028         }
10291029
10301030         // ensure the target bounds are up-to-date, and then get the primitives
1031          set_target_bounds(this);
1031         set_target_bounds(this);
10321032
10331033         render_primitive_list &primlist = target->get_primitives();
10341034
trunk/src/osd/sdl/window.h
r243189r243190
6161      m_fullscreen = !video_config.windowed;
6262      prescale = video_config.prescale;
6363
64        windowed_width = config->width;
65        windowed_height = config->height;
64      windowed_width = config->width;
65      windowed_height = config->height;
6666   }
6767
6868   void video_window_update(running_machine &machine);
trunk/src/osd/windows/vconv.c
r243189r243190
9191   // warning C4510: 'xxx' : default constructor could not be generated
9292   // warning C4512: 'xxx' : assignment operator could not be generated
9393   // warning C4514: 'xxx' : unreferenced inline function has been removed
94   // warning C4619: #pragma warning : there is no warning number 'xxx'
94   // warning C4619: #pragma warning : there is no warning number 'xxx'
9595   // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
9696   // warning C4610: struct 'xxx' can never be instantiated - user defined constructor required
9797   // warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted
trunk/src/osd/windows/windows.mak
r243189r243190
313313
314314ifeq ($(CROSS_BUILD),1)
315315   LDFLAGS += -static
316endif   
316endif
317317
318318# TODO: needs to use $(CC)
319319TEST_GCC := $(shell gcc --version)
trunk/src/tools/chdman.c
r243189r243190
17021702            report_error(1, "Invalid size string");
17031703      }
17041704   }
1705   
1705
17061706   // process compression
17071707   chd_codec_type compression[4];
17081708   memcpy(compression, s_default_hd_compression, sizeof(compression));
r243189r243190
17571757      if (sscanf(metadata, HARD_DISK_METADATA_FORMAT, &cylinders, &heads, &sectors, &sector_size) != 4)
17581758         report_error(1, "Error parsing hard disk metadata in parent CHD");
17591759   }
1760     
1760
17611761   // validate the size
17621762   if (filesize % sector_size != 0)
17631763      report_error(1, "Data size is not divisible by sector size %d", sector_size);
trunk/src/tools/nltool.c
r243189r243190
8888};
8989
9090NETLIST_START(dummy)
91    /* Standard stuff */
91   /* Standard stuff */
9292
93    CLOCK(clk, 1000) // 1000 Hz
94    SOLVER(Solver, 48000)
93   CLOCK(clk, 1000) // 1000 Hz
94   SOLVER(Solver, 48000)
9595
9696NETLIST_END()
9797
r243189r243190
172172      nl_util::pstring_list ll = nl_util::split(m_logs, ":");
173173      for (int i=0; i < ll.count(); i++)
174174      {
175            pstring name = "log_" + ll[i];
175         pstring name = "log_" + ll[i];
176176         /*netlist_device_t *nc = */ m_setup->register_dev("nld_log", name);
177177         m_setup->register_link(name + ".I", ll[i]);
178178      }
r243189r243190
241241   nt.init();
242242   const netlist_factory_t::list_t &list = nt.setup().factory().list();
243243
244    netlist_sources_t sources;
244   netlist_sources_t sources;
245245
246    sources.add(netlist_source_t("dummy", &netlist_dummy));
247    sources.parse(nt.setup(),"dummy");
246   sources.add(netlist_source_t("dummy", &netlist_dummy));
247   sources.parse(nt.setup(),"dummy");
248248
249249   nt.setup().start_devices();
250250   nt.setup().resolve_inputs();
trunk/src/version.c
r243189r243190
88
99***************************************************************************/
1010
11#define BARE_BUILD_VERSION "0.157"
11#define BARE_BUILD_VERSION "0.158"
1212
1313extern const char bare_build_version[];
1414extern const char build_version[];


Previous 199869 Revisions Next


© 1997-2024 The MAME Team