| Previous | 199869 Revisions | Next |
| r34721 Wednesday 28th January, 2015 at 18:37:34 UTC by Couriersud |
|---|
| Merge remote-tracking branch 'origin/master' |
| [/trunk] | makefile |
| [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 miracle.h 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/h8] | h8.c |
| [src/emu/cpu/i386] | i386dasm.c |
| [src/emu/cpu/m6502] | m4510.c m6502.c m6502.h om4510.lst om65ce02.lst |
| [src/emu/cpu/m68000] | m68k_in.c m68kcpu.c m68kfpu.inc |
| [src/emu/cpu/tms0980] | tms0980.c |
| [src/emu/drivers] | xtal.h |
| [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 seibu.c seibu.h |
| [src/mame/drivers] | aleck64.c backfire.c bfm_sc4h.c bfm_sc5.c bfm_swp.c bishi.c btime.c cabal.c calomega.c cps1.c ddenlovr.c dec0.c deco156.c dgpix.c dkong.c dynax.c eolith.c eolith16.c eolithsp.c exidy.c funkball.c galaxian.c gticlub.c gts80a.c gunpey.c maygayep.c midas.c model2.c model3.c nmk16.c overdriv.c psychic5.c seta2.c shanghai.c silkroad.c stv.c taitottl.c toaplan2.c tourtabl.c twinkle.c tx1.c vegaeo.c vicdual.c zn.c |
| [src/mame/includes] | bfm_sc45.h bfm_sc5.h bishi.h bogeyman.h calomega.h cave.h dec0.h dynax.h eolith.h exidy.h hyhoo.h m58.h mario.h model2.h nb1413m3.h nmk16.h paradise.h pastelg.h powerins.h quizpani.h senjyo.h silkroad.h stadhero.h stfight.h stlforce.h strnskil.h toaplan2.h tx1.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 mie.c mie.h stfight.c stvprot.c |
| [src/mame/video] | eolith.c gp9001.c pastelg.c taitoair.c tia.c tia.h tx1.c |
| [src/mess] | mess.mak |
| [src/mess/drivers] | a2600.c banctec.c c65.c cat.c gamate.c hp16500.c hp9k_3xx.c nes.c ngen.c pasogo.c splitsec.c tispeak.c |
| [src/mess/includes] | c65.h mac.h |
| [src/mess/machine] | amstrad.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 |
| r243232 | r243233 | |
|---|---|---|
| 38 | 38 | <publisher>Texas Instruments</publisher> |
| 39 | 39 | <part name="cart" interface="lantutor"> |
| 40 | 40 | <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" /> --> | |
| 43 | 43 | <rom name="cd2317.vsm" size="0x4000" crc="53231c0b" sha1="472117c3d0e28437fa8faa054f98088e06efc2a1" offset="0x8000" /> |
| 44 | 44 | <rom name="cd2318.vsm" size="0x4000" crc="6c0727bc" sha1="132e39755b122f2cbec6f3e767f5d256a9c1e7ae" offset="0xc000" /> |
| 45 | 45 | </dataarea> |
| r243232 | r243233 | |
|---|---|---|
| 2 | 2 | <!DOCTYPE softwarelist SYSTEM "softwarelist.dtd"> |
| 3 | 3 | <softwarelist name="pasogo" description="Koei PasoGo cartridges"> |
| 4 | 4 | |
| 5 | <!-- | |
| 5 | <!-- | |
| 6 | 6 | Koei PasoGo (パソ碁) undumped games |
| 7 | 7 | |
| 8 | 8 | Taikyoku-kun I ~ 対局くん I [KS-1001] |
| r243232 | r243233 | |
|---|---|---|
| 931 | 931 | $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ) |
| 932 | 932 | @echo Linking $@... |
| 933 | 933 | ifeq ($(TARGETOS),emscripten) |
| 934 | ||
| 934 | # Emscripten's linker seems to be stricter about the ordering of .a files | |
| 935 | 935 | $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) -Wl,--start-group $^ -Wl,--end-group $(LIBS) -o $@ |
| 936 | 936 | else |
| 937 | 937 | $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) $^ $(LIBS) -o $@ |
| r243232 | r243233 | |
|---|---|---|
| 217 | 217 | SLOT_INTERFACE_START(a8sio_cards) |
| 218 | 218 | SLOT_INTERFACE("cassette", A8SIO_CASSETTE) |
| 219 | 219 | SLOT_INTERFACE_END |
| 220 |
| r243232 | r243233 | |
|---|---|---|
| 115 | 115 | break; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 |
| r243232 | r243233 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | Copyright MESS Team. |
| 6 | 6 | 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 | |
| 10 | 10 | slot system! |
| 11 | 11 | A real Four Score would be connected to both the controller ports of |
| 12 | 12 | the NES, but current core cannot emulate something like this until |
| 13 | 13 | devices can live their own life and being connected to other devices |
| 14 | 14 | 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 | |
| 16 | 16 | the two ports and each enables 2 inputs (this is more or less as hacky |
| 17 | 17 | as the non-slot previous one, where the 4 ports were always available |
| 18 | 18 | to the emulated system, but it's not a great consolation :( ) |
| r243232 | r243233 | |
| 22 | 22 | since we could at best have two switches to disable the second player |
| 23 | 23 | inputs. |
| 24 | 24 | |
| 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 | |
| 26 | 26 | passthrough for 2 standard joypad devices, in order to show in the |
| 27 | 27 | internal UI that they belong to P1+P3 and P2+P4, otherwise they would |
| 28 | 28 | be listed as P1+P2 and P3+P4 respectively. This *HAS* to be changed |
| r243232 | r243233 | |
| 171 | 171 | { |
| 172 | 172 | if (data & 0x01) |
| 173 | 173 | return; |
| 174 | ||
| 174 | ||
| 175 | 175 | // P3 & P4 inputs in NES Four Score are read serially with P1 & P2 |
| 176 | 176 | m_latch = m_joypad1->read(); |
| 177 | m_latch |= (m_joypad3->read() << 8); // pad 3 | |
| 177 | m_latch |= (m_joypad3->read() << 8); // pad 3 | |
| 178 | 178 | m_latch |= (0x08 << 16); // signature |
| 179 | 179 | } |
| 180 | 180 | |
| r243232 | r243233 | |
| 182 | 182 | { |
| 183 | 183 | if (data & 0x01) |
| 184 | 184 | return; |
| 185 | ||
| 185 | ||
| 186 | 186 | // P3 & P4 inputs in NES Four Score are read serially with P1 & P2 |
| 187 | 187 | m_latch = m_joypad2->read(); |
| 188 | m_latch |= (m_joypad4->read() << 8); // pad 4 | |
| 188 | m_latch |= (m_joypad4->read() << 8); // pad 4 | |
| 189 | 189 | m_latch |= (0x04 << 16); // signature |
| 190 | 190 | } |
| r243232 | r243233 | |
|---|---|---|
| 47 | 47 | public: |
| 48 | 48 | // construction/destruction |
| 49 | 49 | nes_4score_p1p3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 50 | ||
| 50 | ||
| 51 | 51 | virtual ioport_constructor device_input_ports() const; |
| 52 | ||
| 52 | ||
| 53 | 53 | protected: |
| 54 | 54 | virtual void write(UINT8 data); |
| 55 | ||
| 55 | ||
| 56 | 56 | private: |
| 57 | 57 | required_ioport m_joypad1; |
| 58 | 58 | required_ioport m_joypad3; |
| r243232 | r243233 | |
| 67 | 67 | nes_4score_p2p4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 68 | 68 | |
| 69 | 69 | virtual ioport_constructor device_input_ports() const; |
| 70 | ||
| 70 | ||
| 71 | 71 | protected: |
| 72 | 72 | virtual void write(UINT8 data); |
| 73 | ||
| 73 | ||
| 74 | 74 | private: |
| 75 | 75 | required_ioport m_joypad2; |
| 76 | 76 | required_ioport m_joypad4; |
| r243232 | r243233 | |
|---|---|---|
| 105 | 105 | UINT8 nes_vausfc_device::read_exp(offs_t offset) |
| 106 | 106 | { |
| 107 | 107 | UINT8 ret = 0; |
| 108 | if (offset == 0) | |
| 108 | if (offset == 0) //$4016 | |
| 109 | 109 | ret = m_button->read() << 1; |
| 110 | else | |
| 110 | else //$4017 | |
| 111 | 111 | { |
| 112 | 112 | ret = (m_latch & 0x80) >> 6; |
| 113 | 113 | m_latch <<= 1; |
| r243232 | r243233 | |
|---|---|---|
| 56 | 56 | public: |
| 57 | 57 | // construction/destruction |
| 58 | 58 | nes_vausfc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 59 | ||
| 59 | ||
| 60 | 60 | protected: |
| 61 | 61 | virtual UINT8 read_bit34() { return 0; } |
| 62 | 62 | virtual UINT8 read_exp(offs_t offset); |
| r243232 | r243233 | |
|---|---|---|
| 5 | 5 | TODO: this should be actually emulated as a standalone system with |
| 6 | 6 | a few 7segments LEDs, once we get a dump of its BIOS |
| 7 | 7 | At the moment we only emulated the connection with a Famicom |
| 8 | ||
| 8 | ||
| 9 | 9 | Copyright MESS Team. |
| 10 | 10 | Visit http://mamedev.org for licensing and usage restrictions. |
| 11 | 11 | |
| r243232 | r243233 | |
| 57 | 57 | if (m_reader->get_byte_length() == 13) |
| 58 | 58 | { |
| 59 | 59 | 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'; | |
| 61 | 61 | } |
| 62 | 62 | else if (m_reader->get_byte_length() == 8) |
| 63 | 63 | { |
| 64 | 64 | for (int i = 0; i < 5; i++) |
| 65 | m_current_barcode[i] = 0x20; | |
| 65 | m_current_barcode[i] = 0x20; | |
| 66 | 66 | 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'; | |
| 68 | 68 | } |
| 69 | 69 | // read one more, to reset the internal byte counter |
| 70 | 70 | m_reader->read_code(); |
| 71 | 71 | |
| 72 | 72 | // 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; | |
| 80 | 80 | m_pending_code = 1; |
| 81 | 81 | } |
| 82 | 82 | m_new_code = m_reader->get_pending_code(); |
| r243232 | r243233 | |
| 110 | 110 | // and sending the proper serial bits, instead of our read_current_bit() function! |
| 111 | 111 | battler_timer = timer_alloc(TIMER_BATTLER); |
| 112 | 112 | battler_timer->adjust(attotime::zero, 0, machine().device<cpu_device>("maincpu")->cycles_to_attotime(1000)); |
| 113 | ||
| 113 | ||
| 114 | 114 | save_item(NAME(m_current_barcode)); |
| 115 | 115 | save_item(NAME(m_new_code)); |
| 116 | 116 | save_item(NAME(m_pending_code)); |
| r243232 | r243233 | |
| 184 | 184 | UINT8 nes_bcbattle_device::read_exp(offs_t offset) |
| 185 | 185 | { |
| 186 | 186 | UINT8 ret = 0; |
| 187 | if (offset == 1) | |
| 187 | if (offset == 1) //$4017 | |
| 188 | 188 | { |
| 189 | 189 | ret |= read_current_bit() << 2; |
| 190 | 190 | } |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | Nintendo Family Computer & Entertainment System controller ports | |
| 3 | Nintendo Family Computer & Entertainment System controller ports | |
| 4 | 4 | and Family Computer expansion port emulation |
| 5 | 5 | |
| 6 | 6 | Here we emulate in fact 3 different kind of ports, which are |
| r243232 | r243233 | |
| 9 | 9 | corresponding address ($4016 for port1, $4017 for port2) |
| 10 | 10 | - FC controller ports: these are only hooked to bit 0 of the |
| 11 | 11 | 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 | |
| 13 | 13 | would not be detected) |
| 14 | 14 | - FC expansion port: this is hooked to bits 0-4 of both addresses |
| 15 | 15 | To make things a little bit more complex, old FC models have the |
| 16 | 16 | 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, | |
| 18 | 18 | microphone inputs from P2 go to $4016 bit 2) |
| 19 | 19 | |
| 20 | Even if the controller port and the expansion port are | |
| 20 | Even if the controller port and the expansion port are | |
| 21 | 21 | physically different (the FC expansion is a 15pin port, while |
| 22 | 22 | the controller ports are 7pin), we emulate them as variants of a |
| 23 | 23 | common device, exposing the following handlers: |
| r243232 | r243233 | |
| 25 | 25 | inputs from controllers |
| 26 | 26 | - read_bit34: for bit3,4 reading, expected to be at the correct |
| 27 | 27 | 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 | |
| 29 | 29 | parameter to decide whether we are reading from $4016 and $4017 |
| 30 | 30 | - write: to acknowledge writes to $4016 |
| 31 | 31 | |
| 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 | |
| 37 | 37 | port calling read_exp too. |
| 38 | 38 | |
| 39 | 39 | Copyright MESS Team. |
| r243232 | r243233 | |
| 168 | 168 | SLOT_INTERFACE("joypad", NES_JOYPAD) |
| 169 | 169 | SLOT_INTERFACE("zapper", NES_ZAPPER) |
| 170 | 170 | SLOT_INTERFACE("4score_p1p3", NES_4SCORE_P1P3) |
| 171 | // | |
| 171 | // SLOT_INTERFACE("miracle_piano", NES_MIRACLE) | |
| 172 | 172 | SLOT_INTERFACE_END |
| 173 | 173 | |
| 174 | 174 | SLOT_INTERFACE_START( nes_control_port2_devices ) |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | Nintendo Family Computer & Entertainment System controller port | |
| 3 | Nintendo Family Computer & Entertainment System controller port | |
| 4 | 4 | emulation |
| 5 | 5 | |
| 6 | 6 | Copyright MESS Team. |
| r243232 | r243233 | |
| 32 | 32 | // construction/destruction |
| 33 | 33 | device_nes_control_port_interface(const machine_config &mconfig, device_t &device); |
| 34 | 34 | virtual ~device_nes_control_port_interface(); |
| 35 | ||
| 35 | ||
| 36 | 36 | virtual UINT8 read_bit0() { return 0; }; |
| 37 | 37 | virtual UINT8 read_bit34() { return 0; }; |
| 38 | 38 | virtual UINT8 read_exp(offs_t offset) { return 0; }; |
| 39 | 39 | virtual void write(UINT8 data) { }; |
| 40 | ||
| 40 | ||
| 41 | 41 | protected: |
| 42 | 42 | nes_control_port_device *m_port; |
| 43 | 43 | }; |
| r243232 | r243233 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | static INPUT_PORTS_START( fc_keyboard ) |
| 20 | 20 | 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) | |
| 23 | 23 | 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) | |
| 27 | 27 | 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) | |
| 29 | 29 | |
| 30 | 30 | 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)) | |
| 32 | 32 | 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('-') | |
| 38 | 38 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('^') |
| 39 | 39 | |
| 40 | 40 | 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)) | |
| 42 | 42 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 43 | 43 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') |
| 44 | 44 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| r243232 | r243233 | |
| 48 | 48 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 49 | 49 | |
| 50 | 50 | 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)) | |
| 52 | 52 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 53 | 53 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 54 | 54 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| r243232 | r243233 | |
| 58 | 58 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 59 | 59 | |
| 60 | 60 | 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)) | |
| 62 | 62 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 63 | 63 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 64 | 64 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| r243232 | r243233 | |
| 68 | 68 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 69 | 69 | |
| 70 | 70 | 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)) | |
| 72 | 72 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 73 | 73 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 74 | 74 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| r243232 | r243233 | |
| 78 | 78 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 79 | 79 | |
| 80 | 80 | 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)) | |
| 82 | 82 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 83 | 83 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 84 | 84 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| r243232 | r243233 | |
| 88 | 88 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 89 | 89 | |
| 90 | 90 | 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') | |
| 99 | 99 | |
| 100 | 100 | 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) | |
| 109 | 109 | INPUT_PORTS_END |
| 110 | 110 | |
| 111 | 111 | |
| r243232 | r243233 | |
| 183 | 183 | UINT8 nes_fckeybrd_device::read_exp(offs_t offset) |
| 184 | 184 | { |
| 185 | 185 | UINT8 ret = 0; |
| 186 | if (offset == 0) | |
| 186 | if (offset == 0) //$4016 | |
| 187 | 187 | { |
| 188 | 188 | // FC Keyboard: tape input |
| 189 | 189 | if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) |
| r243232 | r243233 | |
| 195 | 195 | ret |= 0x02; |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | else | |
| 198 | else //$4017 | |
| 199 | 199 | { |
| 200 | 200 | // FC Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4 |
| 201 | 201 | if (m_fck_scan < 9) |
| r243232 | r243233 | |
| 216 | 216 | // tape output (not fully tested) |
| 217 | 217 | if ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_RECORD) |
| 218 | 218 | m_cassette->output(((data & 0x07) == 0x07) ? +1.0 : -1.0); |
| 219 | ||
| 219 | ||
| 220 | 220 | if (BIT(data, 2)) // keyboard active |
| 221 | 221 | { |
| 222 | 222 | UINT8 out = BIT(data, 1); // scan |
| 223 | ||
| 223 | ||
| 224 | 224 | if (m_fck_mode && !out && ++m_fck_scan > 9) |
| 225 | 225 | m_fck_scan = 0; |
| 226 | ||
| 226 | ||
| 227 | 227 | m_fck_mode = out; // access lower or upper 4 bits |
| 228 | ||
| 228 | ||
| 229 | 229 | if (BIT(data, 0)) // reset |
| 230 | 230 | m_fck_scan = 0; |
| 231 | 231 | } |
| r243232 | r243233 | |
|---|---|---|
| 119 | 119 | UINT8 nes_ftrainer_device::read_exp(offs_t offset) |
| 120 | 120 | { |
| 121 | 121 | UINT8 ret = 0; |
| 122 | if (offset == 1) | |
| 122 | if (offset == 1) //$4017 | |
| 123 | 123 | { |
| 124 | 124 | if (!BIT(m_row_scan, 0)) |
| 125 | 125 | { |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | 3 | 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 | |
| 6 | 6 | (default mode) it behaves like a Hori Twin adapter, in 4P mode |
| 7 | 7 | it has P1 and P2 inputs overwriting the inputs coming from the |
| 8 | 8 | main controllers (possibly creating a bit of confusion, since |
| r243232 | r243233 | |
| 117 | 117 | UINT8 nes_horitwin_device::read_exp(offs_t offset) |
| 118 | 118 | { |
| 119 | 119 | UINT8 ret = 0; |
| 120 | if (offset == 0) | |
| 120 | if (offset == 0) //$4016 | |
| 121 | 121 | ret |= (m_port1->read_bit0() << 1); |
| 122 | else | |
| 122 | else //$4017 | |
| 123 | 123 | ret |= (m_port2->read_bit0() << 1); |
| 124 | 124 | return ret; |
| 125 | 125 | } |
| r243232 | r243233 | |
| 127 | 127 | UINT8 nes_hori4p_device::read_exp(offs_t offset) |
| 128 | 128 | { |
| 129 | 129 | UINT8 ret = 0; |
| 130 | if (m_cfg->read() == 0) | |
| 130 | if (m_cfg->read() == 0) // 2P | |
| 131 | 131 | { |
| 132 | if (offset == 0) | |
| 132 | if (offset == 0) //$4016 | |
| 133 | 133 | ret |= (m_port1->read_bit0() << 1); |
| 134 | else | |
| 134 | else //$4017 | |
| 135 | 135 | ret |= (m_port2->read_bit0() << 1); |
| 136 | 136 | } |
| 137 | else | |
| 137 | else // 4P | |
| 138 | 138 | { |
| 139 | if (offset == 0) | |
| 139 | if (offset == 0) //$4016 | |
| 140 | 140 | { |
| 141 | 141 | ret |= (m_port1->read_bit0() << 0); |
| 142 | 142 | ret |= (m_port3->read_bit0() << 1); |
| 143 | 143 | } |
| 144 | else | |
| 144 | else //$4017 | |
| 145 | 145 | { |
| 146 | 146 | ret |= (m_port2->read_bit0() << 0); |
| 147 | 147 | ret |= (m_port4->read_bit0() << 1); |
| r243232 | r243233 | |
|---|---|---|
| 51 | 51 | public: |
| 52 | 52 | // construction/destruction |
| 53 | 53 | nes_hori4p_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 54 | ||
| 54 | ||
| 55 | 55 | virtual ioport_constructor device_input_ports() const; |
| 56 | 56 | virtual machine_config_constructor device_mconfig_additions() const; |
| 57 | ||
| 58 | protected: | |
| 57 | ||
| 58 | protected: | |
| 59 | 59 | // device-level overrides |
| 60 | 60 | virtual void device_start() {} |
| 61 | ||
| 61 | ||
| 62 | 62 | virtual UINT8 read_exp(offs_t offset); |
| 63 | 63 | virtual void write(UINT8 data); |
| 64 | ||
| 64 | ||
| 65 | 65 | private: |
| 66 | 66 | required_device<nes_control_port_device> m_port1; |
| 67 | 67 | required_device<nes_control_port_device> m_port2; |
| r243232 | r243233 | |
|---|---|---|
| 3 | 3 | Nintendo Family Computer & Entertainment System Joypads |
| 4 | 4 | |
| 5 | 5 | 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 | |
| 7 | 7 | Start nor Select buttons, but had a built-in microphone (with |
| 8 | 8 | very limited capabilities, since it basically only detected two |
| 9 | 9 | states: something blowing into it / nothing blowing into it) for |
| 10 | 10 | 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 | |
| 16 | 16 | sticks like in the arcade control panel. However, we emulate them |
| 17 | 17 | separately so to map the controls to a friendlier default. |
| 18 | 18 | |
| r243232 | r243233 | |
| 20 | 20 | by Hori, but possibly licensed by Nintendo, since it use the official |
| 21 | 21 | logo and brand) which fits into the expansion port and allows to |
| 22 | 22 | 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 | |
| 24 | 24 | Dodgeball Bu manual) |
| 25 | ||
| 25 | ||
| 26 | 26 | Copyright MESS Team. |
| 27 | 27 | Visit http://mamedev.org for licensing and usage restrictions. |
| 28 | 28 | |
| r243232 | r243233 | |
| 45 | 45 | PORT_START("JOYPAD") |
| 46 | 46 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") |
| 47 | 47 | 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 ) | |
| 50 | 50 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY |
| 51 | 51 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 52 | 52 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r243232 | r243233 | |
| 58 | 58 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") |
| 59 | 59 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") |
| 60 | 60 | 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 ) | |
| 62 | 62 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY |
| 63 | 63 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 64 | 64 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r243232 | r243233 | |
| 69 | 69 | PORT_START("JOYPAD") |
| 70 | 70 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 71 | 71 | 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 ) | |
| 74 | 74 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY |
| 75 | 75 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY |
| 76 | 76 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_8WAY |
| r243232 | r243233 | |
| 81 | 81 | PORT_START("JOYPAD") |
| 82 | 82 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 83 | 83 | 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 ) | |
| 86 | 86 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY |
| 87 | 87 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT ) PORT_8WAY |
| 88 | 88 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY |
| r243232 | r243233 | |
| 103 | 103 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("B") |
| 104 | 104 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT ) |
| 105 | 105 | 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) | |
| 114 | 114 | INPUT_PORTS_END |
| 115 | 115 | |
| 116 | 116 | //------------------------------------------------- |
| r243232 | r243233 | |
| 245 | 245 | UINT8 nes_fcpad2_device::read_exp(offs_t offset) |
| 246 | 246 | { |
| 247 | 247 | UINT8 ret = 0; |
| 248 | if (!offset) | |
| 248 | if (!offset) // microphone input | |
| 249 | 249 | ret |= m_joypad->read() & 0x04; |
| 250 | 250 | |
| 251 | 251 | return ret; |
| r243232 | r243233 | |
| 260 | 260 | UINT8 nes_arcstick_device::read_exp(offs_t offset) |
| 261 | 261 | { |
| 262 | 262 | UINT8 ret = 0; |
| 263 | if (offset == 0) | |
| 263 | if (offset == 0) //$4016 | |
| 264 | 264 | { |
| 265 | if ((m_cfg->read() & 2) == 0) | |
| 265 | if ((m_cfg->read() & 2) == 0) // we are P1 input | |
| 266 | 266 | { |
| 267 | 267 | ret |= (m_latch & 1) << 1; |
| 268 | 268 | m_latch >>= 1; |
| r243232 | r243233 | |
| 270 | 270 | else |
| 271 | 271 | ret |= m_daisychain->read_exp(0); |
| 272 | 272 | } |
| 273 | else | |
| 273 | else //$4017 | |
| 274 | 274 | { |
| 275 | if ((m_cfg->read() & 2) == 2) | |
| 275 | if ((m_cfg->read() & 2) == 2) // we are P2 input | |
| 276 | 276 | { |
| 277 | 277 | ret |= (m_latch & 1) << 1; |
| 278 | 278 | m_latch >>= 1; |
| r243232 | r243233 | |
| 280 | 280 | else |
| 281 | 281 | ret |= m_daisychain->read_exp(1); |
| 282 | 282 | } |
| 283 | ||
| 283 | ||
| 284 | 284 | return ret; |
| 285 | 285 | } |
| 286 | 286 | |
| r243232 | r243233 | |
| 292 | 292 | { |
| 293 | 293 | if (data & 0x01) |
| 294 | 294 | return; |
| 295 | ||
| 295 | ||
| 296 | 296 | m_latch = m_joypad->read(); |
| 297 | 297 | } |
| 298 | 298 | |
| r243232 | r243233 | |
| 311 | 311 | |
| 312 | 312 | if (data & 0x01) |
| 313 | 313 | return; |
| 314 | ||
| 314 | ||
| 315 | 315 | m_latch = m_joypad->read(); |
| 316 | 316 | } |
| 317 |
| r243232 | r243233 | |
|---|---|---|
| 51 | 51 | public: |
| 52 | 52 | // construction/destruction |
| 53 | 53 | nes_fcpad2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 54 | ||
| 54 | ||
| 55 | 55 | virtual ioport_constructor device_input_ports() const; |
| 56 | ||
| 56 | ||
| 57 | 57 | protected: |
| 58 | 58 | virtual UINT8 read_exp(offs_t offset); |
| 59 | 59 | virtual void write(UINT8 data); |
| r243232 | r243233 | |
| 66 | 66 | public: |
| 67 | 67 | // construction/destruction |
| 68 | 68 | nes_ccpadl_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 69 | ||
| 69 | ||
| 70 | 70 | virtual ioport_constructor device_input_ports() const; |
| 71 | 71 | }; |
| 72 | 72 | |
| r243232 | r243233 | |
| 77 | 77 | public: |
| 78 | 78 | // construction/destruction |
| 79 | 79 | nes_ccpadr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 80 | ||
| 80 | ||
| 81 | 81 | virtual ioport_constructor device_input_ports() const; |
| 82 | 82 | }; |
| 83 | 83 | |
| r243232 | r243233 | |
| 88 | 88 | public: |
| 89 | 89 | // construction/destruction |
| 90 | 90 | nes_arcstick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 91 | ||
| 91 | ||
| 92 | 92 | virtual ioport_constructor device_input_ports() const; |
| 93 | 93 | virtual machine_config_constructor device_mconfig_additions() const; |
| 94 | 94 | |
| r243232 | r243233 | |
| 96 | 96 | virtual UINT8 read_bit0() { return 0; } |
| 97 | 97 | virtual UINT8 read_exp(offs_t offset); |
| 98 | 98 | virtual void write(UINT8 data); |
| 99 | ||
| 99 | ||
| 100 | 100 | required_device<nes_control_port_device> m_daisychain; |
| 101 | 101 | required_ioport m_cfg; |
| 102 | 102 | }; |
| r243232 | r243233 | |
|---|---|---|
| 81 | 81 | UINT8 nes_konamihs_device::read_exp(offs_t offset) |
| 82 | 82 | { |
| 83 | 83 | UINT8 ret = 0; |
| 84 | if (offset == 1) | |
| 84 | if (offset == 1) //$4017 | |
| 85 | 85 | { |
| 86 | 86 | ret |= m_latch_p1 << 1; |
| 87 | 87 | ret |= m_latch_p2 << 3; |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | 3 | Nintendo Entertainment System - Miracle Piano Keyboard |
| 4 | ||
| 5 | TODO: basically everything, this is just a skeleton with no | |
| 6 | real MIDI handling at the moment. | |
| 7 | 4 | |
| 5 | TODO: MIDI input, output is now working. | |
| 6 | ||
| 8 | 7 | Copyright MESS Team. |
| 9 | 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 10 | 9 | |
| r243232 | r243233 | |
| 44 | 43 | { |
| 45 | 44 | m_strobe_clock++; |
| 46 | 45 | } |
| 46 | else | |
| 47 | { | |
| 48 | device_serial_interface::device_timer(timer, id, param, ptr); | |
| 49 | } | |
| 47 | 50 | } |
| 48 | 51 | |
| 49 | 52 | //************************************************************************** |
| r243232 | r243233 | |
| 157 | 160 | m_strobe_on = 1; |
| 158 | 161 | return; |
| 159 | 162 | } |
| 160 | ||
| 163 | ||
| 161 | 164 | if (m_strobe_on) |
| 162 | 165 | { |
| 163 | 166 | // was timer running? |
| r243232 | r243233 | |
| 204 | 207 | |
| 205 | 208 | void nes_miracle_device::tra_complete() // Tx completed sending byte |
| 206 | 209 | { |
| 207 | // printf("Tx complete\n"); | |
| 208 | 210 | // is there more waiting to send? |
| 209 | 211 | if (m_xmit_read != m_xmit_write) |
| 210 | 212 | { |
| r243232 | r243233 | |
| 222 | 224 | |
| 223 | 225 | void nes_miracle_device::tra_callback() // Tx send bit |
| 224 | 226 | { |
| 227 | UINT8 bit = transmit_register_get_data_bit(); | |
| 228 | ||
| 225 | 229 | // send this to midi out |
| 226 | m_midiout->write_txd( | |
| 230 | m_midiout->write_txd(bit); | |
| 227 | 231 | } |
| 228 | 232 | |
| 229 | 233 | void nes_miracle_device::xmit_char(UINT8 data) |
| 230 | 234 | { |
| 231 | // printf("xmit %02x\n", data); | |
| 232 | ||
| 233 | 235 | // if tx is busy it'll pick this up automatically when it completes |
| 234 | 236 | // if not, send now! |
| 235 | 237 | if (!m_tx_busy) |
| r243232 | r243233 | |
|---|---|---|
| 28 | 28 | public device_nes_control_port_interface |
| 29 | 29 | { |
| 30 | 30 | public: |
| 31 | static const int XMIT_RING_SIZE = | |
| 31 | static const int XMIT_RING_SIZE = 64; | |
| 32 | 32 | |
| 33 | 33 | // construction/destruction |
| 34 | 34 | nes_miracle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| r243232 | r243233 | |
|---|---|---|
| 18 | 18 | |
| 19 | 19 | static INPUT_PORTS_START( nes_mjpanel ) |
| 20 | 20 | PORT_START("MJPANEL.0") |
| 21 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 21 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 22 | 22 | |
| 23 | 23 | 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 ) | |
| 31 | 31 | |
| 32 | 32 | 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 ) | |
| 41 | 41 | |
| 42 | 42 | 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") | |
| 51 | 51 | INPUT_PORTS_END |
| 52 | 52 | |
| 53 | 53 | |
| r243232 | r243233 | |
| 124 | 124 | { |
| 125 | 125 | if (data & 0x01) |
| 126 | 126 | return; |
| 127 | ||
| 127 | ||
| 128 | 128 | if (data & 0xf8) |
| 129 | 129 | logerror("Error: Mahjong panel read with mux data %02x\n", (data & 0xfe)); |
| 130 | 130 | else |
| r243232 | r243233 | |
|---|---|---|
| 20 | 20 | PORT_START("JOYPAD") |
| 21 | 21 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("A") |
| 22 | 22 | 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 ) | |
| 25 | 25 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY |
| 26 | 26 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 27 | 27 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r243232 | r243233 | |
| 85 | 85 | { |
| 86 | 86 | UINT8 ret = 0; |
| 87 | 87 | // this controller behaves like a standard P3 joypad, with longer stream of inputs |
| 88 | if (offset == 0) | |
| 88 | if (offset == 0) //$4016 | |
| 89 | 89 | { |
| 90 | 90 | ret |= (m_latch & 1) << 1; |
| 91 | 91 | m_latch >>= 1; |
| r243232 | r243233 | |
| 101 | 101 | { |
| 102 | 102 | if (data & 0x01) |
| 103 | 103 | return; |
| 104 | ||
| 104 | ||
| 105 | 105 | m_latch = m_joypad->read(); |
| 106 | 106 | m_latch |= ((m_trigger->read() ^ 0xff) & 0xff) << 8; |
| 107 | 107 | m_latch |= 0xff0000; |
| r243232 | r243233 | |
|---|---|---|
| 81 | 81 | UINT8 nes_partytap_device::read_exp(offs_t offset) |
| 82 | 82 | { |
| 83 | 83 | UINT8 ret = 0; |
| 84 | if (offset == 1) | |
| 84 | if (offset == 1) //$4017 | |
| 85 | 85 | { |
| 86 | 86 | ret |= m_latch & 0x1c; |
| 87 | 87 | m_latch >>= 3; |
| r243232 | r243233 | |
|---|---|---|
| 130 | 130 | { |
| 131 | 131 | if (data & 0x01) |
| 132 | 132 | return; |
| 133 | ||
| 133 | ||
| 134 | 134 | m_latch[0] = m_ipt1->read(); |
| 135 | 135 | m_latch[1] = m_ipt2->read() | 0xf0; |
| 136 | 136 | } |
| r243232 | r243233 | |
|---|---|---|
| 22 | 22 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') |
| 23 | 23 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') |
| 24 | 24 | 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)) | |
| 26 | 26 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') |
| 27 | 27 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') |
| 28 | 28 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') |
| r243232 | r243233 | |
| 32 | 32 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') |
| 33 | 33 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') |
| 34 | 34 | 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)) | |
| 36 | 36 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') |
| 37 | 37 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| 38 | 38 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') |
| 39 | 39 | |
| 40 | 40 | 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") | |
| 44 | 44 | 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") | |
| 47 | 47 | 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)) | |
| 49 | 49 | |
| 50 | 50 | PORT_START("SUBOR.3") |
| 51 | 51 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') |
| 52 | 52 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') |
| 53 | 53 | 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)) | |
| 56 | 56 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') |
| 57 | 57 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') |
| 58 | 58 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') |
| 59 | 59 | |
| 60 | 60 | 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)) | |
| 69 | 69 | |
| 70 | 70 | PORT_START("SUBOR.5") |
| 71 | 71 | 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)) | |
| 73 | 73 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 74 | 74 | 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)) | |
| 76 | 76 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') |
| 77 | 77 | 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) | |
| 79 | 79 | |
| 80 | 80 | PORT_START("SUBOR.6") |
| 81 | 81 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') |
| 82 | 82 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') |
| 83 | 83 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') |
| 84 | 84 | 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)) | |
| 86 | 86 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') |
| 87 | 87 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 88 | 88 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') |
| r243232 | r243233 | |
| 92 | 92 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') |
| 93 | 93 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') |
| 94 | 94 | 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)) | |
| 96 | 96 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') |
| 97 | 97 | 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) | |
| 99 | 99 | |
| 100 | 100 | PORT_START("SUBOR.8") |
| 101 | 101 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') |
| 102 | 102 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') |
| 103 | 103 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') |
| 104 | 104 | 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)) | |
| 106 | 106 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') |
| 107 | 107 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') |
| 108 | 108 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') |
| r243232 | r243233 | |
| 111 | 111 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 112 | 112 | |
| 113 | 113 | 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") | |
| 115 | 115 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) |
| 116 | 116 | 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)) | |
| 119 | 119 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) |
| 120 | 120 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) |
| 121 | 121 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) |
| r243232 | r243233 | |
| 124 | 124 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD)PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) |
| 125 | 125 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) |
| 126 | 126 | 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)) | |
| 130 | 130 | 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)) | |
| 132 | 132 | |
| 133 | 133 | 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('`') | |
| 135 | 135 | 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)) | |
| 139 | 139 | 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) | |
| 141 | 141 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 142 | 142 | INPUT_PORTS_END |
| 143 | 143 | |
| r243232 | r243233 | |
| 198 | 198 | UINT8 nes_suborkey_device::read_exp(offs_t offset) |
| 199 | 199 | { |
| 200 | 200 | UINT8 ret = 0; |
| 201 | if (offset == 1) | |
| 201 | if (offset == 1) //$4017 | |
| 202 | 202 | { |
| 203 | 203 | // Subor Keyboard: rows of the keyboard matrix are read 4-bits at time and returned as bit1->bit4 |
| 204 | 204 | if (m_fck_scan < 13) |
| r243232 | r243233 | |
| 206 | 206 | else |
| 207 | 207 | ret |= 0x1e; |
| 208 | 208 | } |
| 209 | ||
| 209 | ||
| 210 | 210 | return ret; |
| 211 | 211 | } |
| 212 | 212 | |
| r243232 | r243233 | |
| 218 | 218 | { |
| 219 | 219 | if (BIT(data, 2)) // keyboard active |
| 220 | 220 | { |
| 221 | UINT8 out = BIT(data, 1); // scan | |
| 221 | UINT8 out = BIT(data, 1); // scan | |
| 222 | 222 | if (m_fck_mode && !out && ++m_fck_scan > 12) |
| 223 | 223 | m_fck_scan = 0; |
| 224 | ||
| 224 | ||
| 225 | 225 | m_fck_mode = out; // access lower or upper 4 bits |
| 226 | ||
| 226 | ||
| 227 | 227 | if (BIT(data, 0)) // reset |
| 228 | 228 | m_fck_scan = 0; |
| 229 | 229 | } |
| r243232 | r243233 | |
|---|---|---|
| 80 | 80 | UINT8 nes_zapper_device::read_bit34() |
| 81 | 81 | { |
| 82 | 82 | UINT8 ret = m_trigger->read(); |
| 83 | if (!m_port->m_brightpixel_cb.isnull() && | |
| 83 | if (!m_port->m_brightpixel_cb.isnull() && | |
| 84 | 84 | m_port->m_brightpixel_cb(m_lightx->read(), m_lighty->read())) |
| 85 | 85 | ret &= ~0x08; // sprite hit |
| 86 | 86 | else |
| r243232 | r243233 | |
| 91 | 91 | UINT8 nes_zapper_device::read_exp(offs_t offset) |
| 92 | 92 | { |
| 93 | 93 | UINT8 ret = 0; |
| 94 | if (offset == 1) | |
| 94 | if (offset == 1) // $4017 | |
| 95 | 95 | ret |= nes_zapper_device::read_bit34(); |
| 96 | 96 | return ret; |
| 97 | 97 | } |
| r243232 | r243233 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | static INPUT_PORTS_START( sms_joypad ) |
| 22 | 22 | 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 | |
| 27 | 27 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // Vcc |
| 28 | 28 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // TL |
| 29 | 29 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // TH |
| r243232 | r243233 | |
|---|---|---|
| 37 | 37 | save_item(NAME(m_df[i].music_mode), i); |
| 38 | 38 | save_item(NAME(m_df[i].osc_clk), i); |
| 39 | 39 | } |
| 40 | ||
| 40 | ||
| 41 | 41 | save_item(NAME(m_movamt)); |
| 42 | 42 | save_item(NAME(m_latch_62)); |
| 43 | 43 | save_item(NAME(m_latch_64)); |
| r243232 | r243233 | |
|---|---|---|
| 36 | 36 | class media_identifier |
| 37 | 37 | { |
| 38 | 38 | public: |
| 39 | // construction/destruction | |
| 40 | media_identifier(cli_options &options); | |
| 39 | // construction/destruction | |
| 40 | media_identifier(cli_options &options); | |
| 41 | 41 | |
| 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; } | |
| 46 | 46 | |
| 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); | |
| 53 | 53 | |
| 54 | 54 | private: |
| 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; | |
| 60 | 60 | }; |
| 61 | 61 | |
| 62 | 62 | |
| r243232 | r243233 | |
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | 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()); | |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 |
| r243232 | r243233 | |
|---|---|---|
| 60 | 60 | cli_options::cli_options() |
| 61 | 61 | : emu_options() |
| 62 | 62 | { |
| 63 | ||
| 63 | add_entries(cli_options::s_option_entries); | |
| 64 | 64 | } |
| 65 |
| r243232 | r243233 | |
|---|---|---|
| 51 | 51 | arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 52 | 52 | : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__) |
| 53 | 53 | , 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 ) ) | |
| 55 | 55 | { |
| 56 | 56 | } |
| 57 | 57 |
| r243232 | r243233 | |
|---|---|---|
| 60 | 60 | public: |
| 61 | 61 | // construction/destruction |
| 62 | 62 | arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 63 | ||
| 63 | ||
| 64 | 64 | DECLARE_READ32_MEMBER( arcompact_auxreg002_LPSTART_r); |
| 65 | 65 | DECLARE_WRITE32_MEMBER(arcompact_auxreg002_LPSTART_w); |
| 66 | 66 | DECLARE_READ32_MEMBER( arcompact_auxreg003_LPEND_r); |
| 67 | 67 | DECLARE_WRITE32_MEMBER(arcompact_auxreg003_LPEND_w); |
| 68 | ||
| 68 | ||
| 69 | 69 | DECLARE_READ32_MEMBER( arcompact_auxreg00a_STATUS32_r); |
| 70 | 70 | DECLARE_READ32_MEMBER( arcompact_auxreg025_INTVECTORBASE_r); |
| 71 | 71 | DECLARE_WRITE32_MEMBER( arcompact_auxreg025_INTVECTORBASE_w); |
| 72 | 72 | |
| 73 | ||
| 73 | ||
| 74 | 74 | protected: |
| 75 | 75 | // device-level overrides |
| 76 | 76 | virtual void device_start(); |
| r243232 | r243233 | |
| 184 | 184 | ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32); |
| 185 | 185 | ARCOMPACT_RETTYPE arcompact_handle04_1d(OPS_32); |
| 186 | 186 | // ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32); |
| 187 | // | |
| 187 | // ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32); | |
| 188 | 188 | ARCOMPACT_RETTYPE arcompact_handle04_22(OPS_32); |
| 189 | 189 | ARCOMPACT_RETTYPE arcompact_handle04_23(OPS_32); |
| 190 | 190 | ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32); |
| 191 | 191 | ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32); |
| 192 | // | |
| 192 | // ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32); | |
| 193 | 193 | // ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32); |
| 194 | 194 | ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32); |
| 195 | 195 | ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32); |
| 196 | 196 | // ARCOMPACT_RETTYPE arcompact_handle04_2f_02(OPS_32); |
| 197 | // | |
| 197 | // ARCOMPACT_RETTYPE arcompact_handle04_2f_03(OPS_32); | |
| 198 | 198 | ARCOMPACT_RETTYPE arcompact_handle04_2f_04(OPS_32); |
| 199 | 199 | ARCOMPACT_RETTYPE arcompact_handle04_2f_05(OPS_32); |
| 200 | 200 | ARCOMPACT_RETTYPE arcompact_handle04_2f_06(OPS_32); |
| r243232 | r243233 | |
| 770 | 770 | ARCOMPACT_RETTYPE arcompact_handle19_0x_helper(OPS_16, const char* optext, int shift, int format); |
| 771 | 771 | ARCOMPACT_RETTYPE arcompact_handle1e_0x_helper(OPS_16, const char* optext); |
| 772 | 772 | ARCOMPACT_RETTYPE arcompact_handle1e_03_0x_helper(OPS_16, const char* optext); |
| 773 | ||
| 774 | 773 | |
| 774 | ||
| 775 | 775 | UINT32 handle_jump_to_addr(int delay, int link, UINT32 address, UINT32 next_addr); |
| 776 | 776 | UINT32 handle_jump_to_register(int delay, int link, UINT32 reg, UINT32 next_addr, int flag); |
| 777 | 777 |
| r243232 | r243233 | |
|---|---|---|
| 2142 | 2142 | size = 8; |
| 2143 | 2143 | } |
| 2144 | 2144 | |
| 2145 | // | |
| 2145 | // c = limm; | |
| 2146 | 2146 | |
| 2147 | 2147 | } |
| 2148 | 2148 | else |
| r243232 | r243233 | |
| 2151 | 2151 | // Jcc [c] 0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ |
| 2152 | 2152 | // no conditional links to ILINK1, ILINK2? |
| 2153 | 2153 | |
| 2154 | // | |
| 2154 | // c = m_regs[creg]; | |
| 2155 | 2155 | } |
| 2156 | 2156 | |
| 2157 | 2157 | if (!check_condition(condition)) |
| r243232 | r243233 | |
|---|---|---|
| 114 | 114 | save_item(NAME(EXR)); |
| 115 | 115 | save_item(NAME(CCR)); |
| 116 | 116 | save_item(NAME(TMP1)); |
| 117 | save_item(NAME(TMP2)); | |
| 117 | 118 | save_item(NAME(inst_state)); |
| 118 | 119 | save_item(NAME(inst_substate)); |
| 120 | save_item(NAME(irq_vector)); | |
| 121 | save_item(NAME(taken_irq_vector)); | |
| 122 | save_item(NAME(irq_level)); | |
| 123 | save_item(NAME(taken_irq_level)); | |
| 124 | save_item(NAME(irq_nmi)); | |
| 119 | 125 | |
| 120 | 126 | m_icountptr = &icount; |
| 121 | 127 |
| r243232 | r243233 | |
|---|---|---|
| 98 | 98 | #define ALWAYS64 0x400 |
| 99 | 99 | #define SPECIAL64 0x800 |
| 100 | 100 | #define SPECIAL64_ENT(x) (SPECIAL64 | ((x) << 24)) |
| 101 | #define GROUP_MOD | |
| 101 | #define GROUP_MOD 0x1000 | |
| 102 | 102 | |
| 103 | 103 | struct I386_OPCODE { |
| 104 | 104 | const char *mnemonic; |
| r243232 | r243233 | |
| 1953 | 1953 | { "group0F0D", group0F0D_table }, |
| 1954 | 1954 | { "group0F12", group0F12_table }, |
| 1955 | 1955 | { "group0F16", group0F16_table }, |
| 1956 | { "group0F18", | |
| 1956 | { "group0F18", group0F18_table }, | |
| 1957 | 1957 | { "group0F71", group0F71_table }, |
| 1958 | 1958 | { "group0F72", group0F72_table }, |
| 1959 | 1959 | { "group0F73", group0F73_table }, |
| r243232 | r243233 | |
|---|---|---|
| 75 | 75 | nomap = true; |
| 76 | 76 | |
| 77 | 77 | // Wild guess, this setting makes the cpu start executing some code in the c65 driver |
| 78 | map_offset[1] = 0x30000; | |
| 79 | map_enable = 0x80; | |
| 78 | //map_offset[1] = 0x2e000; | |
| 79 | //map_enable = 0x80; | |
| 80 | 80 | m65ce02_device::device_reset(); |
| 81 | 81 | } |
| 82 | 82 | |
| r243232 | r243233 | |
| 86 | 86 | { |
| 87 | 87 | address = map(address); |
| 88 | 88 | } |
| 89 | ||
| 89 | ||
| 90 | 90 | return true; |
| 91 | 91 | } |
| 92 | 92 |
| r243232 | r243233 | |
|---|---|---|
| 579 | 579 | break; |
| 580 | 580 | |
| 581 | 581 | case DASM_rw2: |
| 582 | sprintf(buffer, " $%04x", (pc & 0xf0000) | UINT16(pc + | |
| 582 | sprintf(buffer, " $%04x", (pc & 0xf0000) | UINT16(pc + 2 + INT16((opram[2] << 8) | opram[1]))); | |
| 583 | 583 | flags |= 3; |
| 584 | 584 | break; |
| 585 | 585 |
| r243232 | r243233 | |
|---|---|---|
| 220 | 220 | |
| 221 | 221 | // inline helpers |
| 222 | 222 | static inline bool page_changing(UINT16 base, int delta) { return ((base + delta) ^ base) & 0xff00; } |
| 223 | static inline UINT16 set_l(UINT16 base, UINT8 val) { return (base & 0xff00) | val; } | |
| 224 | static inline UINT16 set_h(UINT16 base, UINT8 val) { return (base & 0x00ff) | (val << 8); } | |
| 223 | static inline UINT16 set_l(UINT16 base, UINT16 val) { return (base & 0xff00) | val; } | |
| 224 | static inline UINT16 set_h(UINT16 base, UINT16 val) { return (base & 0x00ff) | (val << 8); } | |
| 225 | 225 | |
| 226 | 226 | inline void dec_SP() { SP = set_l(SP, SP-1); } |
| 227 | 227 | inline void inc_SP() { SP = set_l(SP, SP+1); } |
| r243232 | r243233 | |
|---|---|---|
| 9 | 9 | map_offset[0] = (A<<8) | ((X & 0xf) << 16); |
| 10 | 10 | map_offset[1] = (Y<<8) | ((Z & 0xf) << 16); |
| 11 | 11 | map_enable = ((X & 0xf0) >> 4) | (Z & 0xf0); |
| 12 | logerror("MAP execute\n"); | |
| 13 | logerror("0x0000 - 0x1fff = %08x\n",map_enable & 1 ? map_offset[0]+0x0000 : 0x0000); | |
| 14 | logerror("0x2000 - 0x3fff = %08x\n",map_enable & 2 ? map_offset[0]+0x2000 : 0x2000); | |
| 15 | logerror("0x4000 - 0x5fff = %08x\n",map_enable & 4 ? map_offset[0]+0x4000 : 0x4000); | |
| 16 | logerror("0x6000 - 0x7fff = %08x\n",map_enable & 8 ? map_offset[0]+0x6000 : 0x6000); | |
| 17 | logerror("0x8000 - 0x9fff = %08x\n",map_enable & 16 ? map_offset[1]+0x8000 : 0x8000); | |
| 18 | logerror("0xa000 - 0xbfff = %08x\n",map_enable & 32 ? map_offset[1]+0xa000 : 0xa000); | |
| 19 | logerror("0xc000 - 0xdfff = %08x\n",map_enable & 64 ? map_offset[1]+0xc000 : 0xc000); | |
| 20 | logerror("0xe000 - 0xffff = %08x\n",map_enable & 128 ? map_offset[1]+0xe000 : 0xe000); | |
| 12 | 21 | prefetch(); |
| r243232 | r243233 | |
|---|---|---|
| 245 | 245 | TMP = read_pc(); |
| 246 | 246 | TMP = set_h(TMP, read_pc()); |
| 247 | 247 | if(!(P & F_C)) |
| 248 | PC += TMP; | |
| 248 | PC += TMP-1; | |
| 249 | 249 | prefetch(); |
| 250 | 250 | |
| 251 | 251 | bcs_ce_rel |
| r243232 | r243233 | |
| 258 | 258 | TMP = read_pc(); |
| 259 | 259 | TMP = set_h(TMP, read_pc()); |
| 260 | 260 | if(P & F_C) |
| 261 | PC += TMP; | |
| 261 | PC += TMP-1; | |
| 262 | 262 | prefetch(); |
| 263 | 263 | |
| 264 | 264 | beq_ce_rel |
| r243232 | r243233 | |
| 271 | 271 | TMP = read_pc(); |
| 272 | 272 | TMP = set_h(TMP, read_pc()); |
| 273 | 273 | if(P & F_Z) |
| 274 | PC += TMP; | |
| 274 | PC += TMP-1; | |
| 275 | 275 | prefetch(); |
| 276 | 276 | |
| 277 | 277 | bit_ce_abx |
| r243232 | r243233 | |
| 307 | 307 | TMP = read_pc(); |
| 308 | 308 | TMP = set_h(TMP, read_pc()); |
| 309 | 309 | if(P & F_N) |
| 310 | PC += TMP; | |
| 310 | PC += TMP-1; | |
| 311 | 311 | prefetch(); |
| 312 | 312 | |
| 313 | 313 | bne_ce_rel |
| r243232 | r243233 | |
| 320 | 320 | TMP = read_pc(); |
| 321 | 321 | TMP = set_h(TMP, read_pc()); |
| 322 | 322 | if(!(P & F_Z)) |
| 323 | PC += TMP; | |
| 323 | PC += TMP-1; | |
| 324 | 324 | prefetch(); |
| 325 | 325 | |
| 326 | 326 | bpl_ce_rel |
| r243232 | r243233 | |
| 333 | 333 | TMP = read_pc(); |
| 334 | 334 | TMP = set_h(TMP, read_pc()); |
| 335 | 335 | if(!(P & F_N)) |
| 336 | PC += TMP; | |
| 336 | PC += TMP-1; | |
| 337 | 337 | prefetch(); |
| 338 | 338 | |
| 339 | 339 | bra_ce_rel |
| r243232 | r243233 | |
| 344 | 344 | bra_rw2 |
| 345 | 345 | TMP = read_pc(); |
| 346 | 346 | TMP = set_h(TMP, read_pc()); |
| 347 | PC += TMP; | |
| 347 | PC += TMP - 1; | |
| 348 | 348 | prefetch(); |
| 349 | 349 | |
| 350 | 350 | brk_ce_imp |
| r243232 | r243233 | |
| 379 | 379 | write(SP, PC); |
| 380 | 380 | dec_SP_ce(); |
| 381 | 381 | TMP = set_h(TMP, read_pc()); |
| 382 | PC += TMP; | |
| 382 | PC += TMP-1; | |
| 383 | 383 | prefetch(); |
| 384 | 384 | |
| 385 | 385 | bvc_ce_rel |
| r243232 | r243233 | |
| 392 | 392 | TMP = read_pc(); |
| 393 | 393 | TMP = set_h(TMP, read_pc()); |
| 394 | 394 | if(!(P & F_V)) |
| 395 | PC += TMP; | |
| 395 | PC += TMP-1; | |
| 396 | 396 | prefetch(); |
| 397 | 397 | |
| 398 | 398 | bvs_ce_rel |
| r243232 | r243233 | |
| 405 | 405 | TMP = read_pc(); |
| 406 | 406 | TMP = set_h(TMP, read_pc()); |
| 407 | 407 | if(P & F_V) |
| 408 | PC += TMP; | |
| 408 | PC += TMP-1; | |
| 409 | 409 | prefetch(); |
| 410 | 410 | |
| 411 | 411 | clc_ce_imp |
| r243232 | r243233 | |
| 419 | 419 | cle_imp |
| 420 | 420 | read_pc_noinc(); |
| 421 | 421 | P &= ~F_E; |
| 422 | logerror("CLE\n"); | |
| 422 | 423 | prefetch(); |
| 423 | 424 | |
| 424 | 425 | cli_ce_imp |
| r243232 | r243233 | |
|---|---|---|
| 272 | 272 | extern void m68040_fpu_op0(m68000_base_device *m68k); |
| 273 | 273 | extern void m68040_fpu_op1(m68000_base_device *m68k); |
| 274 | 274 | extern void m68881_mmu_ops(m68000_base_device *m68k); |
| 275 | extern void m68881_ftrap(m68000_base_device *m68k); | |
| 275 | extern void m68881_ftrap(m68000_base_device *m68k); | |
| 276 | 276 | |
| 277 | 277 | /* ======================================================================== */ |
| 278 | 278 | /* ========================= INSTRUCTION HANDLERS ========================= */ |
| r243232 | r243233 | |
|---|---|---|
| 699 | 699 | { |
| 700 | 700 | /* only the 68010 throws this unique type-1000 frame */ |
| 701 | 701 | m68ki_stack_frame_1000(m68k, REG_PPC(m68k), sr, EXCEPTION_BUS_ERROR); |
| 702 | } | |
| 702 | } | |
| 703 | 703 | else if (m68k->mmu_tmp_buserror_address == REG_PPC(m68k)) |
| 704 | 704 | { |
| 705 | 705 | m68ki_stack_frame_1010(m68k, sr, EXCEPTION_BUS_ERROR, REG_PPC(m68k), m68k->mmu_tmp_buserror_address); |
| r243232 | r243233 | |
|---|---|---|
| 2177 | 2177 | // trap here |
| 2178 | 2178 | m68ki_exception_trap(m68k, EXCEPTION_TRAPV); |
| 2179 | 2179 | } |
| 2180 | else | |
| 2180 | else // fall through, requires eating the operand | |
| 2181 | 2181 | { |
| 2182 | 2182 | switch (m68k->ir & 0x7) |
| 2183 | 2183 | { |
| 2184 | case 2: | |
| 2184 | case 2: // word operand | |
| 2185 | 2185 | OPER_I_16(m68k); |
| 2186 | 2186 | break; |
| 2187 | 2187 | |
| r243232 | r243233 | |
| 2189 | 2189 | OPER_I_32(m68k); |
| 2190 | 2190 | break; |
| 2191 | 2191 | |
| 2192 | case 4: | |
| 2192 | case 4: // no operand | |
| 2193 | 2193 | break; |
| 2194 | 2194 | } |
| 2195 | 2195 | } |
| 2196 | 2196 | } |
| 2197 |
| r243232 | r243233 | |
|---|---|---|
| 1037 | 1037 | |
| 1038 | 1038 | m_ps = m_ps << 4 | m_pa; |
| 1039 | 1039 | m_pa = m_pb; |
| 1040 | ||
| 1040 | ||
| 1041 | 1041 | m_cs = m_cs << 2 | m_ca; |
| 1042 | 1042 | m_ca = m_cb; |
| 1043 | 1043 | } |
| r243232 | r243233 | |
| 1057 | 1057 | |
| 1058 | 1058 | m_pc = m_sr & m_pc_mask; |
| 1059 | 1059 | m_sr >>= m_pc_bits; |
| 1060 | ||
| 1060 | ||
| 1061 | 1061 | m_pa = m_pb = m_ps & 0xf; |
| 1062 | 1062 | m_ps >>= 4; |
| 1063 | ||
| 1063 | ||
| 1064 | 1064 | m_ca = m_cb = m_cs & 3; |
| 1065 | 1065 | m_cs >>= 2; |
| 1066 | 1066 | } |
| r243232 | r243233 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | void finder_base::printf_warning(const char *format, ...) |
| 116 | 116 | { |
| 117 | va_list argptr; | |
| 118 | char buffer[1024]; | |
| 117 | va_list argptr; | |
| 118 | char buffer[1024]; | |
| 119 | 119 | |
| 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); | |
| 125 | 125 | } |
| r243232 | r243233 | |
|---|---|---|
| 57 | 57 | void *find_memshare(UINT8 width, size_t &bytes, bool required); |
| 58 | 58 | bool report_missing(bool found, const char *objname, bool required); |
| 59 | 59 | |
| 60 | ||
| 60 | void printf_warning(const char *format, ...) ATTR_PRINTF(2,3); | |
| 61 | 61 | |
| 62 | 62 | // internal state |
| 63 | 63 | finder_base *m_next; |
| r243232 | r243233 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | device_state_entry::device_state_entry(int index, device_state_interface *dev) |
| 91 | 91 | : m_device_state(dev), |
| 92 | | |
| 92 | m_next(NULL), | |
| 93 | 93 | m_index(index), |
| 94 | 94 | m_dataptr(NULL), |
| 95 | 95 | m_datamask(0), |
| r243232 | r243233 | |
|---|---|---|
| 57 | 57 | XTAL_2_5MHz = 2500000, /* Janken Man units */ |
| 58 | 58 | XTAL_3MHz = 3000000, /* Probably only used to drive 68705 or similar MCUs on 80's Taito PCBs */ |
| 59 | 59 | XTAL_3_12MHz = 3120000, /* SP0250 clock on Gottlieb games */ |
| 60 | XTAL_3_5MHz = 3500000, /* Reported by Commodore 65 document, true xtal unchecked on PCB */ | |
| 60 | 61 | XTAL_3_52128MHz = 3521280, /* RCA COSMAC VIP */ |
| 61 | 62 | XTAL_3_579545MHz = 3579545, /* NTSC color subcarrier, extremely common, used on 100's of PCBs (Keytronic custom part #48-300-010 is equivalent) */ |
| 62 | 63 | XTAL_3_6864MHz = 3686400, /* CPS3 */ |
| r243232 | r243233 | |
|---|---|---|
| 17 | 17 | emu_fatalerror::emu_fatalerror(const char *format, ...) |
| 18 | 18 | : code(0) |
| 19 | 19 | { |
| 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); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | emu_fatalerror::emu_fatalerror(const char *format, va_list ap) |
| 35 | 35 | : code(0) |
| 36 | 36 | { |
| 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); | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, ...) |
| 49 | 49 | : code(_exitcode) |
| 50 | 50 | { |
| 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 | } | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | emu_fatalerror::emu_fatalerror(int _exitcode, const char *format, va_list ap) |
| 65 | 65 | : code(_exitcode) |
| 66 | 66 | { |
| 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 | } | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
| r243232 | r243233 | |
| 89 | 89 | |
| 90 | 90 | void fatalerror(const char *format, ...) |
| 91 | 91 | { |
| 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; | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | void fatalerror_exitcode(running_machine &machine, int exitcode, const char *format, ...) |
| 100 | 100 | { |
| 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; | |
| 106 | 106 | } |
| r243232 | r243233 | |
|---|---|---|
| 150 | 150 | |
| 151 | 151 | // debugging options |
| 152 | 152 | { 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" }, | |
| 157 | 157 | { OPTION_UPDATEINPAUSE, "0", OPTION_BOOLEAN, "keep calling video updates while in pause" }, |
| 158 | 158 | { OPTION_DEBUGSCRIPT, NULL, OPTION_STRING, "script for debugger" }, |
| 159 | 159 |
| r243232 | r243233 | |
|---|---|---|
| 318 | 318 | bool joystick_contradictory() const { return bool_value(OPTION_JOYSTICK_CONTRADICTORY); } |
| 319 | 319 | int coin_impulse() const { return int_value(OPTION_COIN_IMPULSE); } |
| 320 | 320 | |
| 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); } | |
| 326 | 326 | const char *debug_script() const { return value(OPTION_DEBUGSCRIPT); } |
| 327 | 327 | bool update_in_pause() const { return bool_value(OPTION_UPDATEINPAUSE); } |
| 328 | 328 |
| r243232 | r243233 | |
|---|---|---|
| 714 | 714 | render_container &rc = sc->container(); |
| 715 | 715 | ui_manager &ui = sc->machine().ui(); |
| 716 | 716 | 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); | |
| 719 | 719 | |
| 720 | 720 | return 0; |
| 721 | 721 | } |
| r243232 | r243233 | |
|---|---|---|
| 108 | 108 | |
| 109 | 109 | osd_interface &running_machine::osd() const |
| 110 | 110 | { |
| 111 | ||
| 111 | return m_manager.osd(); | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | //------------------------------------------------- |
| r243232 | r243233 | |
| 142 | 142 | m_save(*this), |
| 143 | 143 | m_memory(*this), |
| 144 | 144 | m_ioport(*this), |
| 145 | m_parameters(*this), | |
| 145 | m_parameters(*this), | |
| 146 | 146 | m_scheduler(*this) |
| 147 | 147 | { |
| 148 | 148 | memset(&m_base_time, 0, sizeof(m_base_time)); |
| r243232 | r243233 | |
|---|---|---|
| 253 | 253 | m_size = 0x400000; |
| 254 | 254 | m_maker_id = MFG_INTEL; |
| 255 | 255 | m_device_id = 0x14; |
| 256 | // | |
| 256 | // m_sector_is_4k = true; 128kb? | |
| 257 | 257 | map = ADDRESS_MAP_NAME( memory_map16_32Mb ); |
| 258 | 258 | break; |
| 259 | 259 | case FLASH_SST_39VF020: |
| r243232 | r243233 | |
|---|---|---|
| 48 | 48 | // - have the message length without the two header bytes but with the checksum byte in the second byte |
| 49 | 49 | // - have at least one command byte |
| 50 | 50 | if(send_size < 3 || send_buffer[0] == 0x00 || send_buffer[1] != send_size-1) { |
| 51 | logerror("JVS checksum error\n"); | |
| 52 | } /* | |
| 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; | |
| 60 | ||
| 61 | } else */ { | |
| 51 | logerror("JVS checksum error\n"); | |
| 52 | // "This message is crap" doesn't exist so call it checksum error | |
| 53 | recv_buffer[0] = 0x00; | |
| 54 | recv_buffer[1] = 0x02; | |
| 55 | recv_buffer[2] = 0x03; | |
| 56 | recv_size = 3; | |
| 57 | } else { | |
| 62 | 58 | if(first_device) { |
| 63 | 59 | first_device->message(send_buffer[0], send_buffer+2, send_size-2, recv_buffer+2, recv_size); |
| 64 | 60 | recv_is_encoded = false; |
| r243232 | r243233 | |
| 120 | 116 | if(!size) |
| 121 | 117 | return; |
| 122 | 118 | UINT32 add = 1; |
| 119 | UINT8 sum = 0; | |
| 123 | 120 | for(UINT32 i=0; i<size; i++) |
| 121 | sum += buffer[i]; | |
| 122 | buffer[size++] = sum; | |
| 123 | for(UINT32 i=0; i<size; i++) | |
| 124 | 124 | if(buffer[i] == 0xd0 || buffer[i] == 0xe0) |
| 125 | 125 | add++; |
| 126 | UINT32 nsize = size+add; | |
| 127 | 126 | for(UINT32 i=size; i; i--) { |
| 128 | 127 | UINT8 t = buffer[i-1]; |
| 129 | 128 | if(t == 0xd0 || t == 0xe0) { |
| r243232 | r243233 | |
| 134 | 133 | buffer[i+add-1] = t; |
| 135 | 134 | } |
| 136 | 135 | buffer[0] = 0xe0; |
| 137 | UINT8 sum = 0; | |
| 138 | for(UINT32 i=1; i<nsize; i++) | |
| 139 | sum += buffer[i]; | |
| 140 | buffer[nsize++] = sum; | |
| 141 | size = nsize; | |
| 136 | size += add; | |
| 142 | 137 | } |
| 143 | 138 | |
| 144 | 139 | void jvs_host::decode(UINT8 *buffer, UINT32 &size) |
| r243232 | r243233 | |
| 146 | 141 | if(!size) |
| 147 | 142 | return; |
| 148 | 143 | UINT32 pos = 0; |
| 149 | for(UINT32 i=0; i<size | |
| 144 | for(UINT32 i=0; i<size; i++) { | |
| 150 | 145 | UINT8 t = buffer[i]; |
| 151 | 146 | if(!i && t == 0xe0) |
| 152 | 147 | continue; |
| r243232 | r243233 | |
| 156 | 151 | } |
| 157 | 152 | buffer[pos++] = t; |
| 158 | 153 | } |
| 159 | size = pos; | |
| 154 | size = pos ? pos - 1 : 0; | |
| 160 | 155 | } |
| r243232 | r243233 | |
|---|---|---|
| 440 | 440 | if (td != NULL) save_pointer(td, s->m_name, s->m_count); |
| 441 | 441 | } |
| 442 | 442 | 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; | |
| 449 | 449 | case DT_INT64: |
| 450 | 450 | save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count); |
| 451 | 451 | break; |
| r243232 | r243233 | |
|---|---|---|
| 94 | 94 | |
| 95 | 95 | osd_interface &machine_manager::osd() const |
| 96 | 96 | { |
| 97 | ||
| 97 | return m_osd; | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 |
| r243232 | r243233 | |
|---|---|---|
| 14 | 14 | public: |
| 15 | 15 | |
| 16 | 16 | netlist_matrix_solver_direct_t(const netlist_solver_parameters_t ¶ms, int size); |
| 17 | ||
| 17 | netlist_matrix_solver_direct_t(const eSolverType type, const netlist_solver_parameters_t ¶ms, int size); | |
| 18 | 18 | |
| 19 | 19 | virtual ~netlist_matrix_solver_direct_t(); |
| 20 | 20 | |
| r243232 | r243233 | |
| 69 | 69 | { |
| 70 | 70 | //delete[] m_A[k]; |
| 71 | 71 | } |
| 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; | |
| 79 | 79 | //delete[] m_RHS; |
| 80 | 80 | nl_free_array(m_terms); |
| 81 | 81 | nl_free_array(m_rails_temp); |
| r243232 | r243233 | |
| 193 | 193 | * Sorting as a general matrix pre-conditioning is mentioned in |
| 194 | 194 | * literature but I have found no articles about Gauss Seidel. |
| 195 | 195 | * |
| 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 | * | |
| 199 | 199 | */ |
| 200 | 200 | |
| 201 | ||
| 201 | int sort_order = (type() == GAUSS_SEIDEL ? 1 : -1); | |
| 202 | 202 | |
| 203 | 203 | for (int k = 0; k < N() / 2; k++) |
| 204 | 204 | for (int i = 0; i < N() - 1; i++) |
| 205 | 205 | { |
| 206 | ||
| 206 | if ((m_terms[i]->m_railstart - m_terms[i+1]->m_railstart) * sort_order < 0) | |
| 207 | 207 | { |
| 208 | 208 | std::swap(m_terms[i],m_terms[i+1]); |
| 209 | 209 | m_nets.swap(i, i+1); |
| r243232 | r243233 | |
| 475 | 475 | , m_dim(size) |
| 476 | 476 | , m_lp_fact(0) |
| 477 | 477 | { |
| 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()); | |
| 480 | 480 | |
| 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()); | |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 |
| r243232 | r243233 | |
|---|---|---|
| 17 | 17 | public: |
| 18 | 18 | |
| 19 | 19 | netlist_matrix_solver_gauss_seidel_t(const netlist_solver_parameters_t ¶ms, int size) |
| 20 | ||
| 20 | : netlist_matrix_solver_direct_t<m_N, _storage_N>(netlist_matrix_solver_t::GAUSS_SEIDEL, params, size) | |
| 21 | 21 | , m_lp_fact(0) |
| 22 | 22 | , m_gs_fail(0) |
| 23 | 23 | , m_gs_total(0) |
| 24 | 24 | { |
| 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; | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | virtual ~netlist_matrix_solver_gauss_seidel_t() {} |
| r243232 | r243233 | |
| 52 | 52 | template <int m_N, int _storage_N> |
| 53 | 53 | void netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::log_stats() |
| 54 | 54 | { |
| 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 | } | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | template <int m_N, int _storage_N> |
| r243232 | r243233 | |
| 299 | 299 | //if (fabs(gabs_t - fabs(gtot_t)) > 1e-20) |
| 300 | 300 | // printf("%d %e abs: %f tot: %f\n",k, gabs_t / gtot_t -1.0, gabs_t, gtot_t); |
| 301 | 301 | |
| 302 | ||
| 302 | gabs_t *= 0.95; // avoid rounding issues | |
| 303 | 303 | if (!USE_GABS || gabs_t <= gtot_t) |
| 304 | 304 | { |
| 305 | 305 | w[k] = ws / gtot_t; |
| r243232 | r243233 | |
| 343 | 343 | this->m_nets[k]->m_cur_Analog = new_V[k]; |
| 344 | 344 | |
| 345 | 345 | this->m_gs_total += resched_cnt; |
| 346 | ||
| 346 | this->m_stat_calculations++; | |
| 347 | 347 | |
| 348 | 348 | if (resched) |
| 349 | 349 | { |
| r243232 | r243233 | |
|---|---|---|
| 31 | 31 | NET_C(R1.2, R2.2, G1.ON) |
| 32 | 32 | VCVS(G1) |
| 33 | 33 | PARAM(G1.G, 10000000) |
| 34 | ||
| 34 | //PARAM(G1.RI, 1) | |
| 35 | 35 | PARAM(G1.RO, RES_K(8)) |
| 36 | 36 | |
| 37 | 37 | NETLIST_END() |
| r243232 | r243233 | |
|---|---|---|
| 99 | 99 | |
| 100 | 100 | ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t ¶ms) |
| 101 | 101 | : 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) | |
| 107 | 107 | { |
| 108 | 108 | } |
| 109 | 109 | |
| r243232 | r243233 | |
| 257 | 257 | template<class C > |
| 258 | 258 | void netlist_matrix_solver_t::solve_base(C *p) |
| 259 | 259 | { |
| 260 | ||
| 260 | m_stat_vsolver_calls++; | |
| 261 | 261 | if (is_dynamic()) |
| 262 | 262 | { |
| 263 | 263 | int this_resched; |
| r243232 | r243233 | |
| 270 | 270 | newton_loops++; |
| 271 | 271 | } while (this_resched > 1 && newton_loops < m_params.m_nr_loops); |
| 272 | 272 | |
| 273 | ||
| 273 | m_stat_newton_raphson += newton_loops; | |
| 274 | 274 | // reschedule .... |
| 275 | 275 | if (this_resched > 1 && !m_Q_sync.net().is_queued()) |
| 276 | 276 | { |
| r243232 | r243233 | |
| 438 | 438 | return nl_alloc(netlist_matrix_solver_direct2_t, m_params); |
| 439 | 439 | else |
| 440 | 440 | { |
| 441 | | |
| 441 | typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N; | |
| 442 | 442 | if (size >= gs_threshold) |
| 443 | 443 | return nl_alloc(solver_N, m_params, size); |
| 444 | 444 | else |
| r243232 | r243233 | |
|---|---|---|
| 197 | 197 | |
| 198 | 198 | enum eSolverType |
| 199 | 199 | { |
| 200 | GAUSSIAN_ELIMINATION, | |
| 201 | GAUSS_SEIDEL | |
| 200 | GAUSSIAN_ELIMINATION, | |
| 201 | GAUSS_SEIDEL | |
| 202 | 202 | }; |
| 203 | 203 | |
| 204 | 204 | ATTR_COLD netlist_matrix_solver_t(const eSolverType type, const netlist_solver_parameters_t ¶ms); |
| r243232 | r243233 | |
| 243 | 243 | plinearlist_t<netlist_analog_net_t *> m_nets; |
| 244 | 244 | plinearlist_t<netlist_analog_output_t *> m_inps; |
| 245 | 245 | |
| 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; | |
| 249 | 249 | |
| 250 | 250 | const netlist_solver_parameters_t &m_params; |
| 251 | 251 | |
| r243232 | r243233 | |
| 264 | 264 | |
| 265 | 265 | ATTR_HOT void update_inputs(); |
| 266 | 266 | |
| 267 | ||
| 267 | const eSolverType m_type; | |
| 268 | 268 | }; |
| 269 | 269 | |
| 270 | 270 |
| r243232 | r243233 | |
|---|---|---|
| 78 | 78 | ENTRY(VCCS, VCCS, "-") |
| 79 | 79 | ENTRY(CCCS, CCCS, "-") |
| 80 | 80 | ENTRY(dummy_input, DUMMY_INPUT, "-") |
| 81 | ||
| 81 | ENTRY(frontier, FRONTIER, "+I,Q") | |
| 82 | 82 | ENTRY(QBJT_EB, QBJT_EB, "model") |
| 83 | 83 | ENTRY(QBJT_switch, QBJT_SW, "model") |
| 84 | 84 | ENTRY(ttl_input, TTL_INPUT, "IN") |
| r243232 | r243233 | |
| 148 | 148 | ENTRY(SN74LS629_dip, SN74LS629_DIP, "1.CAP1,2.CAP2") |
| 149 | 149 | ENTRY(NE555_dip, NE555_DIP, "-") |
| 150 | 150 | } |
| 151 |
| r243232 | r243233 | |
|---|---|---|
| 43 | 43 | register_output("Q5", m_Q[4]); |
| 44 | 44 | register_output("Q6", m_Q[5]); |
| 45 | 45 | register_output("Q7", m_Q[6]); |
| 46 | ||
| 46 | register_output("Q8", m_Q[7]); | |
| 47 | 47 | register_output("Q9", m_Q[8]); |
| 48 | 48 | register_output("Q10", m_Q[9]); |
| 49 | 49 | register_output("Q11", m_Q[10]); |
| r243232 | r243233 | |
|---|---|---|
| 21 | 21 | |
| 22 | 22 | protected: |
| 23 | 23 | 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 | }; | |
| 29 | 29 | ATTR_HOT void reset() {}; |
| 30 | 30 | |
| 31 | 31 | public: |
| r243232 | r243233 | |
|---|---|---|
| 40 | 40 | NET_REGISTER_DEV(dummy_input, _name) |
| 41 | 41 | |
| 42 | 42 | #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) | |
| 47 | 46 | // ----------------------------------------------------------------------------- |
| 48 | 47 | // mainclock |
| 49 | 48 | // ----------------------------------------------------------------------------- |
| r243232 | r243233 | |
| 159 | 158 | class NETLIB_NAME(frontier) : public netlist_device_t |
| 160 | 159 | { |
| 161 | 160 | public: |
| 162 | ATTR_COLD NETLIB_NAME(frontier)() | |
| 163 | : netlist_device_t(DUMMY) { } | |
| 161 | ATTR_COLD NETLIB_NAME(frontier)() | |
| 162 | : netlist_device_t(DUMMY) { } | |
| 164 | 163 | |
| 165 | ||
| 164 | ATTR_COLD virtual ~NETLIB_NAME(frontier)() {} | |
| 166 | 165 | |
| 167 | 166 | protected: |
| 168 | 167 | |
| 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 | } | |
| 174 | 173 | |
| 175 | ATTR_COLD void reset() | |
| 176 | { | |
| 177 | } | |
| 174 | ATTR_COLD void reset() | |
| 175 | { | |
| 176 | } | |
| 178 | 177 | |
| 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 | } | |
| 183 | 182 | |
| 184 | 183 | private: |
| 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; | |
| 187 | 186 | |
| 188 | 187 | }; |
| 189 | 188 |
| r243232 | r243233 | |
|---|---|---|
| 1001 | 1001 | net.toggle_new_Q(); |
| 1002 | 1002 | net.set_time(netlist().time() + m_inc); |
| 1003 | 1003 | } |
| 1004 |
| r243232 | r243233 | |
|---|---|---|
| 337 | 337 | CAPACITOR, // Capacitor |
| 338 | 338 | DIODE, // Diode |
| 339 | 339 | DUMMY, // DUMMY device without function |
| 340 | ||
| 340 | FRONTIER, // Net frontier | |
| 341 | 341 | BJT_EB, // BJT(Ebers-Moll) |
| 342 | 342 | BJT_SWITCH, // BJT(Switch) |
| 343 | 343 | VCVS, // Voltage controlled voltage source |
| r243232 | r243233 | |
| 1268 | 1268 | |
| 1269 | 1269 | ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const |
| 1270 | 1270 | { |
| 1271 | ||
| 1271 | nl_assert(family() == LOGIC); | |
| 1272 | 1272 | return static_cast<const netlist_logic_net_t &>(*this); |
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() |
| 1276 | 1276 | { |
| 1277 | ||
| 1277 | nl_assert(family() == ANALOG); | |
| 1278 | 1278 | return static_cast<netlist_analog_net_t &>(*this); |
| 1279 | 1279 | } |
| 1280 | 1280 |
| r243232 | r243233 | |
|---|---|---|
| 121 | 121 | class nl_fatalerror : public std::exception |
| 122 | 122 | { |
| 123 | 123 | public: |
| 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 | } | |
| 139 | 139 | }; |
| 140 | 140 | |
| 141 | 141 | //============================================================ |
| r243232 | r243233 | |
|---|---|---|
| 56 | 56 | |
| 57 | 57 | ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list() |
| 58 | 58 | { |
| 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(); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params() |
| 66 | 66 | { |
| 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, ","); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 |
| r243232 | r243233 | |
|---|---|---|
| 97 | 97 | |
| 98 | 98 | netlist_device_t *netlist_setup_t::register_dev(const pstring &classname, const pstring &name) |
| 99 | 99 | { |
| 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); | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | template <class T> |
| r243232 | r243233 | |
| 697 | 697 | |
| 698 | 698 | void netlist_setup_t::start_devices() |
| 699 | 699 | { |
| 700 | ||
| 700 | //FIXME: we need a nl_getenv | |
| 701 | 701 | if (getenv("NL_LOGS")) |
| 702 | 702 | { |
| 703 | 703 | NL_VERBOSE_OUT(("Creating dynamic logs ...\n")); |
| r243232 | r243233 | |
|---|---|---|
| 146 | 146 | void namespace_push(const pstring &aname); |
| 147 | 147 | void namespace_pop(); |
| 148 | 148 | |
| 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; } | |
| 151 | 151 | |
| 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; | |
| 154 | 154 | |
| 155 | ||
| 155 | void print_stats() const; | |
| 156 | 156 | |
| 157 | 157 | protected: |
| 158 | 158 |
| r243232 | r243233 | |
|---|---|---|
| 60 | 60 | ATTR_COLD ~plinearlist_t() |
| 61 | 61 | { |
| 62 | 62 | if (m_list != NULL) |
| 63 | | |
| 63 | nl_free_array(m_list); | |
| 64 | 64 | m_list = NULL; |
| 65 | 65 | } |
| 66 | 66 | |
| r243232 | r243233 | |
| 183 | 183 | else |
| 184 | 184 | { |
| 185 | 185 | if (m_list != NULL) |
| 186 | | |
| 186 | nl_free_array(m_list); | |
| 187 | 187 | m_list = NULL; |
| 188 | 188 | m_count = 0; |
| 189 | 189 | } |
| r243232 | r243233 | |
|---|---|---|
| 24 | 24 | "DT_INT8", |
| 25 | 25 | "DT_INT", |
| 26 | 26 | "DT_BOOLEAN", |
| 27 | ||
| 27 | "DT_FLOAT" | |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | 30 | NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr)); |
| r243232 | r243233 | |
| 64 | 64 | |
| 65 | 65 | template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname) |
| 66 | 66 | { |
| 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); | |
| 71 | 71 | } |
| r243232 | r243233 | |
|---|---|---|
| 24 | 24 | { |
| 25 | 25 | m_parameters.add(tag, value); |
| 26 | 26 | } |
| 27 |
| r243232 | r243233 | |
|---|---|---|
| 207 | 207 | |
| 208 | 208 | render_texinfo &render_texinfo::operator=(const render_texinfo &src) |
| 209 | 209 | { |
| 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; | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | render_texinfo::render_texinfo(const render_texinfo &src) |
| 226 | 226 | { |
| 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 | } | |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | void render_texinfo::set_palette(const dynamic_array<rgb_t> *source) |
| 241 | 241 | { |
| 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 | } | |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | void render_texinfo::free_palette() |
| 256 | 256 | { |
| 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; | |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
| r243232 | r243233 | |
| 277 | 277 | |
| 278 | 278 | void render_primitive::reset() |
| 279 | 279 | { |
| 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; | |
| 302 | 302 | |
| 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)); | |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
| r243232 | r243233 | |
| 556 | 556 | texinfo.width = swidth; |
| 557 | 557 | texinfo.height = sheight; |
| 558 | 558 | // will be set later |
| 559 | ||
| 559 | texinfo.set_palette(NULL); | |
| 560 | 560 | texinfo.seqid = ++m_curseq; |
| 561 | 561 | } |
| 562 | 562 | else |
| 563 | 563 | { |
| 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; | |
| 567 | 567 | |
| 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]; | |
| 574 | 574 | |
| 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 | } | |
| 579 | 579 | |
| 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; | |
| 584 | 584 | |
| 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!"); | |
| 590 | 590 | |
| 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 | } | |
| 598 | 598 | |
| 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; | |
| 602 | 602 | |
| 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 | } | |
| 606 | 606 | |
| 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; | |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
| r243232 | r243233 | |
| 1817 | 1817 | height = MIN(height, m_maxtexheight); |
| 1818 | 1818 | |
| 1819 | 1819 | curitem->texture()->get_scaled(width, height, prim->texture, list); |
| 1820 | ||
| 1820 | // set the palette | |
| 1821 | 1821 | #if 1 |
| 1822 | 1822 | const dynamic_array<rgb_t> *adjusted_pal = curitem->texture()->get_adjusted_palette(container); |
| 1823 | ||
| 1823 | prim->texture.set_palette(adjusted_pal); | |
| 1824 | 1824 | #else |
| 1825 | ||
| 1825 | prim->texture.palette = curitem->texture()->get_adjusted_palette(container); | |
| 1826 | 1826 | #endif |
| 1827 | 1827 | |
| 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); | |
| 1831 | 1831 | |
| 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())); | |
| 1840 | 1840 | } |
| 1841 | 1841 | else |
| 1842 | 1842 | { |
| r243232 | r243233 | |
| 1876 | 1876 | (container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list); |
| 1877 | 1877 | |
| 1878 | 1878 | // determine UV coordinates |
| 1879 | ||
| 1879 | prim->texcoords = oriented_texcoords[container_xform.orientation]; | |
| 1880 | 1880 | |
| 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); | |
| 1886 | 1886 | |
| 1887 | ||
| 1887 | list.append_or_return(*prim, false); | |
| 1888 | 1888 | } |
| 1889 | 1889 | } |
| 1890 | 1890 | |
| r243232 | r243233 | |
| 1925 | 1925 | |
| 1926 | 1926 | texture->get_scaled(width, height, prim->texture, list); |
| 1927 | 1927 | |
| 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); | |
| 1935 | 1935 | |
| 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); | |
| 1939 | 1939 | |
| 1940 | 1940 | // add to the list or free if we're clipped out |
| 1941 | 1941 | list.append_or_return(*prim, clipped); |
| r243232 | r243233 | |
|---|---|---|
| 213 | 213 | |
| 214 | 214 | struct render_palette_copy |
| 215 | 215 | { |
| 216 | int ref_count; | |
| 217 | dynamic_array<rgb_t> palette; | |
| 216 | int ref_count; | |
| 217 | dynamic_array<rgb_t> palette; | |
| 218 | 218 | }; |
| 219 | 219 | |
| 220 | 220 | class render_texinfo |
| 221 | 221 | { |
| 222 | 222 | public: |
| 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 | {} | |
| 227 | 227 | |
| 228 | ||
| 228 | render_texinfo(const render_texinfo &src); | |
| 229 | 229 | |
| 230 | ~render_texinfo() | |
| 231 | { | |
| 232 | free_palette(); | |
| 233 | } | |
| 230 | ~render_texinfo() | |
| 231 | { | |
| 232 | free_palette(); | |
| 233 | } | |
| 234 | 234 | |
| 235 | ||
| 235 | render_texinfo &operator=(const render_texinfo &src); | |
| 236 | 236 | |
| 237 | 237 | void * base; // base of the data |
| 238 | 238 | UINT32 rowpixels; // pixels per row |
| r243232 | r243233 | |
| 241 | 241 | UINT32 seqid; // sequence ID |
| 242 | 242 | UINT64 osddata; // aux data to pass to osd |
| 243 | 243 | |
| 244 | ||
| 244 | const rgb_t * palette() const { return ((m_palette == NULL) ? NULL : &m_palette->palette[0]); } | |
| 245 | 245 | |
| 246 | ||
| 246 | void set_palette(const dynamic_array<rgb_t> *source); | |
| 247 | 247 | |
| 248 | 248 | private: |
| 249 | ||
| 249 | void free_palette(); | |
| 250 | 250 | |
| 251 | ||
| 251 | render_palette_copy *m_palette; // palette for PALETTE16 textures, LUTs for RGB15/RGB32 | |
| 252 | 252 | }; |
| 253 | 253 | |
| 254 | 254 |
| r243232 | r243233 | |
|---|---|---|
| 92 | 92 | m_osdfont = manager.machine().osd().font_alloc(); |
| 93 | 93 | if (m_osdfont != NULL) |
| 94 | 94 | { |
| 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; | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| r243232 | r243233 | |
| 136 | 136 | // release the OSD font |
| 137 | 137 | if (m_osdfont != NULL) |
| 138 | 138 | { |
| 139 | m_osdfont->close(); | |
| 140 | global_free(m_osdfont); | |
| 139 | m_osdfont->close(); | |
| 140 | global_free(m_osdfont); | |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 |
| r243232 | r243233 | |
|---|---|---|
| 246 | 246 | |
| 247 | 247 | save_item(NAME(m_serial_data_in)); |
| 248 | 248 | save_item(NAME(m_wave_regs)); |
| 249 | ||
| 249 | ||
| 250 | 250 | for (int i = 0; i < QS1000_CHANNELS; i++) |
| 251 | 251 | { |
| 252 | 252 | save_item(NAME(m_channels[i].m_acc), i); |
| r243232 | r243233 | |
|---|---|---|
| 597 | 597 | chip->P5[chan] = 0; |
| 598 | 598 | chip->P9[chan] = 0; |
| 599 | 599 | } |
| 600 | ||
| 600 | ||
| 601 | 601 | tia_save_state(device, chip); |
| 602 | 602 | |
| 603 | 603 | return chip; |
| r243232 | r243233 | |
|---|---|---|
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | /************************************************** |
| 23 | ||
| 23 | ||
| 24 | 24 | BARCODE READER MENU |
| 25 | ||
| 25 | ||
| 26 | 26 | **************************************************/ |
| 27 | 27 | |
| 28 | 28 | |
| r243232 | r243233 | |
| 51 | 51 | void ui_menu_barcode_reader::populate() |
| 52 | 52 | { |
| 53 | 53 | if (current_device()) |
| 54 | { | |
| 54 | { | |
| 55 | 55 | astring buffer; |
| 56 | 56 | const char *new_barcode; |
| 57 | 57 | |
| r243232 | r243233 | |
| 68 | 68 | { |
| 69 | 69 | new_barcode = m_barcode_buffer; |
| 70 | 70 | } |
| 71 | ||
| 71 | ||
| 72 | 72 | item_append("New Barcode:", new_barcode, 0, ITEMREF_NEW_BARCODE); |
| 73 | ||
| 73 | ||
| 74 | 74 | // finish up the menu |
| 75 | 75 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 76 | 76 | item_append("Enter Code", NULL, 0, ITEMREF_ENTER_BARCODE); |
| 77 | ||
| 77 | ||
| 78 | 78 | customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; |
| 79 | 79 | } |
| 80 | 80 | } |
| r243232 | r243233 | |
| 103 | 103 | if (event->itemref == ITEMREF_SELECT_READER) |
| 104 | 104 | previous(); |
| 105 | 105 | break; |
| 106 | ||
| 106 | ||
| 107 | 107 | case IPT_UI_RIGHT: |
| 108 | 108 | if (event->itemref == ITEMREF_SELECT_READER) |
| 109 | 109 | next(); |
| r243232 | r243233 | |
|---|---|---|
| 9 | 9 | printers) |
| 10 | 10 | The base class contains calls to get the total number of devices of |
| 11 | 11 | 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 | |
| 15 | 15 | submenu listing available devices of the same kind. |
| 16 | 16 | |
| 17 | 17 | Copyright Nicola Salmoria and the MAME Team. |
| r243232 | r243233 | |
|---|---|---|
| 66 | 66 | |
| 67 | 67 | // get cpu specific clock that takes internal multiplier/dividers into account |
| 68 | 68 | int clock = exec->device().clock(); |
| 69 | ||
| 69 | ||
| 70 | 70 | // count how many identical CPUs we have |
| 71 | 71 | int count = 1; |
| 72 | 72 | const char *name = exec->device().name(); |
| r243232 | r243233 | |
| 77 | 77 | if (exectags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE) |
| 78 | 78 | count++; |
| 79 | 79 | } |
| 80 | ||
| 80 | ||
| 81 | 81 | // if more than one, prepend a #x in front of the CPU name |
| 82 | 82 | if (count > 1) |
| 83 | 83 | string.catprintf(" %d" UTF8_MULTIPLY, count); |
| 84 | 84 | else |
| 85 | 85 | string.cat(" "); |
| 86 | 86 | string.cat(name); |
| 87 | ||
| 87 | ||
| 88 | 88 | // display clock in kHz or MHz |
| 89 | 89 | if (clock >= 1000000) |
| 90 | 90 | string.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); |
| r243232 | r243233 | |
| 92 | 92 | string.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | ||
| 95 | ||
| 96 | 96 | // display screen information |
| 97 | 97 | screen_device_iterator scriter(*dev); |
| 98 | 98 | if (scriter.count() > 0) |
| r243232 | r243233 | |
| 101 | 101 | for (screen_device *screen = scriter.first(); screen != NULL; screen = scriter.next()) |
| 102 | 102 | { |
| 103 | 103 | string.catprintf(" Screen '%s': ", screen->tag()); |
| 104 | ||
| 104 | ||
| 105 | 105 | if (screen->screen_type() == SCREEN_TYPE_VECTOR) |
| 106 | 106 | string.cat("Vector\n"); |
| 107 | 107 | else |
| 108 | 108 | { |
| 109 | 109 | const rectangle &visarea = screen->visible_area(); |
| 110 | ||
| 110 | ||
| 111 | 111 | 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)); | |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | ||
| 118 | ||
| 119 | 119 | // loop over all sound chips |
| 120 | 120 | sound_interface_iterator snditer(*dev); |
| 121 | 121 | if (snditer.count() > 0) |
| r243232 | r243233 | |
| 126 | 126 | { |
| 127 | 127 | if (soundtags.add(sound->device().tag(), 1, FALSE) == TMERR_DUPLICATE) |
| 128 | 128 | continue; |
| 129 | ||
| 129 | ||
| 130 | 130 | // count how many identical sound chips we have |
| 131 | 131 | int count = 1; |
| 132 | 132 | sound_interface_iterator sndinneriter(*dev); |
| r243232 | r243233 | |
| 142 | 142 | else |
| 143 | 143 | string.cat(" "); |
| 144 | 144 | string.cat(sound->device().name()); |
| 145 | ||
| 145 | ||
| 146 | 146 | // display clock in kHz or MHz |
| 147 | 147 | int clock = sound->device().clock(); |
| 148 | 148 | if (clock >= 1000000) |
| r243232 | r243233 | |
| 156 | 156 | |
| 157 | 157 | // scan for BIOS settings |
| 158 | 158 | int bios = 0; |
| 159 | if (dev->rom_region()) | |
| 159 | if (dev->rom_region()) | |
| 160 | 160 | { |
| 161 | 161 | astring bios_str; |
| 162 | 162 | // first loop through roms in search of default bios (shortname) |
| r243232 | r243233 | |
| 174 | 174 | bios_str.cpy(ROM_GETHASHDATA(rom)); |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | ||
| 177 | ||
| 178 | 178 | if (bios) |
| 179 | 179 | string.catprintf("* BIOS settings:\n %d options [default: %s]\n", bios, bios_str.cstr()); |
| 180 | 180 | } |
| 181 | ||
| 181 | ||
| 182 | 182 | int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0; |
| 183 | 183 | int input_keypad = 0, input_keyboard = 0, dips = 0, confs = 0; |
| 184 | 184 | astring errors, dips_opt, confs_opt; |
| r243232 | r243233 | |
| 265 | 265 | for (const device_image_interface *imagedev = imgiter.first(); imagedev != NULL; imagedev = imgiter.next()) |
| 266 | 266 | string.catprintf(" %s [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag()); |
| 267 | 267 | } |
| 268 | ||
| 268 | ||
| 269 | 269 | slot_interface_iterator slotiter(*dev); |
| 270 | 270 | if (slotiter.count() > 0) |
| 271 | 271 | { |
| r243232 | r243233 | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + bios + dips + confs |
| 278 | | |
| 278 | + input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard) == 0) | |
| 279 | 279 | string.cat("[None]\n"); |
| 280 | 280 | |
| 281 | 281 | const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name()); |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | ui/devopt.h |
| 4 | ||
| 4 | ||
| 5 | 5 | Internal menu for the device configuration. |
| 6 | ||
| 6 | ||
| 7 | 7 | Copyright Nicola Salmoria and the MAME Team. |
| 8 | 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | 9 |
| r243232 | r243233 | |
|---|---|---|
| 64 | 64 | { |
| 65 | 65 | // get the image type/id |
| 66 | 66 | instance.printf("%s (%s)", img->instance_name(), img->brief_instance_name()); |
| 67 | ||
| 67 | ||
| 68 | 68 | // get the base name |
| 69 | 69 | if (img->basename() != NULL) |
| 70 | 70 | { |
| 71 | 71 | filename.cpy(img->basename()); |
| 72 | ||
| 72 | ||
| 73 | 73 | // if the image has been loaded through softlist, also show the loaded part |
| 74 | 74 | if (img->part_entry() != NULL) |
| 75 | 75 | { |
| r243232 | r243233 | |
| 107 | 107 | item_append(m_warnings, NULL, MENU_FLAG_DISABLE, NULL); |
| 108 | 108 | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 109 | 109 | } |
| 110 | ||
| 110 | ||
| 111 | 111 | // cycle through all devices for this system |
| 112 | 112 | device_iterator iter(machine().root_device()); |
| 113 | 113 | tagmap_t<UINT8> devtags; |
| r243232 | r243233 | |
| 120 | 120 | // check whether it owns an image interface |
| 121 | 121 | image_interface_iterator subiter(*dev); |
| 122 | 122 | if (subiter.count() > 0) |
| 123 | { | |
| 123 | { | |
| 124 | 124 | // if so, cycle through all its image interfaces |
| 125 | 125 | image_interface_iterator subiter(*dev); |
| 126 | 126 | for (device_image_interface *scan = subiter.first(); scan != NULL; scan = subiter.next()) |
| r243232 | r243233 | |
| 172 | 172 | if (selected_device != NULL) |
| 173 | 173 | { |
| 174 | 174 | ui_menu::stack_push(selected_device->get_selection_menu(machine(), container)); |
| 175 | ||
| 175 | ||
| 176 | 176 | // reset the existing menu |
| 177 | 177 | reset(UI_MENU_RESET_REMEMBER_POSITION); |
| 178 | 178 | } |
| r243232 | r243233 | |
| 182 | 182 | |
| 183 | 183 | // force file manager menu |
| 184 | 184 | void ui_menu_file_manager::force_file_manager(running_machine &machine, render_container *container, const char *warnings) |
| 185 | { | |
| 185 | { | |
| 186 | 186 | // reset the menu stack |
| 187 | 187 | ui_menu::stack_reset(machine); |
| 188 | ||
| 188 | ||
| 189 | 189 | // add the quit entry followed by the game select entry |
| 190 | 190 | ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container)); |
| 191 | 191 | quit->set_special_main_menu(true); |
| 192 | 192 | ui_menu::stack_push(quit); |
| 193 | 193 | ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_file_manager(machine, container, warnings))); |
| 194 | ||
| 194 | ||
| 195 | 195 | // force the menus on |
| 196 | 196 | machine.ui().show_menu(); |
| 197 | ||
| 197 | ||
| 198 | 198 | // make sure MAME is paused |
| 199 | 199 | machine.pause(); |
| 200 | 200 | } |
| r243232 | r243233 | |
|---|---|---|
| 328 | 328 | state = create_ok ? CREATE_FILE : START_FILE; |
| 329 | 329 | handle(); |
| 330 | 330 | break; |
| 331 | ||
| 331 | ||
| 332 | 332 | case DO_CREATE: { |
| 333 | 333 | astring path; |
| 334 | 334 | zippath_combine(path, current_directory, current_file); |
| r243232 | r243233 | |
|---|---|---|
| 27 | 27 | |
| 28 | 28 | protected: |
| 29 | 29 | 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, | |
| 32 | 32 | SELECT_FILE, CREATE_FILE, CREATE_CONFIRM, CHECK_CREATE, DO_CREATE, SELECT_SOFTLIST, |
| 33 | 33 | LAST_ID |
| 34 | 34 | }; |
| r243232 | r243233 | |
|---|---|---|
| 89 | 89 | |
| 90 | 90 | // display long filename |
| 91 | 91 | item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL); |
| 92 | ||
| 92 | ||
| 93 | 93 | // display manufacturer and year |
| 94 | 94 | string.catprintf("%s, %s", image->manufacturer(), image->year()); |
| 95 | 95 | item_append(string, "", MENU_FLAG_DISABLE, NULL); |
| 96 | 96 | |
| 97 | 97 | // display supported information, if available |
| 98 | switch (image->supported()) | |
| 98 | switch (image->supported()) | |
| 99 | 99 | { |
| 100 | case SOFTWARE_SUPPORTED_NO: | |
| 100 | case SOFTWARE_SUPPORTED_NO: | |
| 101 | 101 | item_append("Not supported", "", MENU_FLAG_DISABLE, NULL); |
| 102 | 102 | break; |
| 103 | case SOFTWARE_SUPPORTED_PARTIAL: | |
| 103 | case SOFTWARE_SUPPORTED_PARTIAL: | |
| 104 | 104 | item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL); |
| 105 | 105 | break; |
| 106 | default: | |
| 106 | default: | |
| 107 | 107 | break; |
| 108 | 108 | } |
| 109 | 109 | } |
| r243232 | r243233 | |
|---|---|---|
| 487 | 487 | if (menu_event != NULL && menu_event->itemref != NULL) |
| 488 | 488 | { |
| 489 | 489 | // reset |
| 490 | if ((FPTR)menu_event->itemref == 1) | |
| 490 | if ((FPTR)menu_event->itemref == 1) | |
| 491 | 491 | { |
| 492 | 492 | if (menu_event->iptkey == IPT_UI_SELECT) |
| 493 | 493 | machine().schedule_hard_reset(); |
| r243232 | r243233 | |
| 498 | 498 | ioport_field *field = (ioport_field *)menu_event->itemref; |
| 499 | 499 | ioport_field::user_settings settings; |
| 500 | 500 | int changed = false; |
| 501 | ||
| 501 | ||
| 502 | 502 | switch (menu_event->iptkey) |
| 503 | 503 | { |
| 504 | 504 | /* if selected, reset to default value */ |
| r243232 | r243233 | |
| 508 | 508 | field->set_user_settings(settings); |
| 509 | 509 | changed = true; |
| 510 | 510 | break; |
| 511 | ||
| 511 | ||
| 512 | 512 | /* left goes to previous setting */ |
| 513 | 513 | case IPT_UI_LEFT: |
| 514 | 514 | field->select_previous_setting(); |
| 515 | 515 | changed = true; |
| 516 | 516 | break; |
| 517 | ||
| 517 | ||
| 518 | 518 | /* right goes to next setting */ |
| 519 | 519 | case IPT_UI_RIGHT: |
| 520 | 520 | field->select_next_setting(); |
| 521 | 521 | changed = true; |
| 522 | 522 | break; |
| 523 | 523 | } |
| 524 | ||
| 524 | ||
| 525 | 525 | /* if anything changed, rebuild the menu, trying to stay on the same field */ |
| 526 | 526 | if (changed) |
| 527 | 527 | reset(UI_MENU_RESET_REMEMBER_REF); |
| r243232 | r243233 | |
| 628 | 628 | } |
| 629 | 629 | if (type == IPT_DIPSWITCH) |
| 630 | 630 | custombottom = dipcount ? dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING : 0; |
| 631 | ||
| 631 | ||
| 632 | 632 | item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); |
| 633 | 633 | item_append("Reset", NULL, 0, (void *)1); |
| 634 | 634 | } |
| r243232 | r243233 | |
| 661 | 661 | { |
| 662 | 662 | const ioport_diplocation *diploc; |
| 663 | 663 | UINT32 selectedmask = 0; |
| 664 | ||
| 664 | ||
| 665 | 665 | // determine the mask of selected bits |
| 666 | 666 | if ((FPTR)selectedref != 1) |
| 667 | 667 | { |
| 668 | 668 | ioport_field *field = (ioport_field *)selectedref; |
| 669 | ||
| 669 | ||
| 670 | 670 | if (field != NULL && field->first_diplocation() != NULL) |
| 671 | 671 | for (diploc = field->first_diplocation(); diploc != NULL; diploc = diploc->next()) |
| 672 | 672 | if (strcmp(dip->name, diploc->name()) == 0) |
| 673 | 673 | selectedmask |= 1 << (diploc->number() - 1); |
| 674 | 674 | } |
| 675 | ||
| 675 | ||
| 676 | 676 | // draw one switch |
| 677 | 677 | custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask); |
| 678 | 678 | y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT); |
| r243232 | r243233 | |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | name.cpy(field->name()); |
| 887 | ||
| 887 | ||
| 888 | 888 | /* allocate a data item for tracking what this menu item refers to */ |
| 889 | 889 | data = (analog_item_data *)m_pool_alloc(sizeof(*data)); |
| 890 | 890 | data->field = field; |
| r243232 | r243233 | |
|---|---|---|
| 242 | 242 | UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *container, UINT32 state) |
| 243 | 243 | { |
| 244 | 244 | UINT32 result; |
| 245 | ||
| 245 | ||
| 246 | 246 | /* if this is the first call, push the sliders menu */ |
| 247 | 247 | if (state) |
| 248 | 248 | ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_sliders(machine, container, true))); |
| 249 | ||
| 249 | ||
| 250 | 250 | /* handle standard menus */ |
| 251 | 251 | result = ui_menu::ui_handler(machine, container, state); |
| 252 | ||
| 252 | ||
| 253 | 253 | /* if we are cancelled, pop the sliders menu */ |
| 254 | 254 | if (result == UI_HANDLER_CANCEL) |
| 255 | 255 | ui_menu::stack_pop(machine); |
| 256 | ||
| 256 | ||
| 257 | 257 | ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack); |
| 258 | 258 | return uim && uim->menuless_mode ? 0 : UI_HANDLER_CANCEL; |
| 259 | 259 | } |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | 3 | ui/slotopt.h |
| 4 | ||
| 4 | ||
| 5 | 5 | Internal menu for the slot options. |
| 6 | ||
| 6 | ||
| 7 | 7 | Copyright Nicola Salmoria and the MAME Team. |
| 8 | 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | 9 |
| r243232 | r243233 | |
|---|---|---|
| 56 | 56 | void ui_menu_tape_control::populate() |
| 57 | 57 | { |
| 58 | 58 | if (current_device()) |
| 59 | { | |
| 59 | { | |
| 60 | 60 | // name of tape |
| 61 | 61 | item_append(current_display_name(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT); |
| 62 | 62 | |
| r243232 | r243233 | |
| 67 | 67 | double t0 = current_device()->get_position(); |
| 68 | 68 | double t1 = current_device()->get_length(); |
| 69 | 69 | UINT32 tapeflags = 0; |
| 70 | ||
| 70 | ||
| 71 | 71 | // state |
| 72 | 72 | if (t1 > 0) |
| 73 | 73 | { |
| r243232 | r243233 | |
| 76 | 76 | if (t0 < t1) |
| 77 | 77 | tapeflags |= MENU_FLAG_RIGHT_ARROW; |
| 78 | 78 | } |
| 79 | ||
| 79 | ||
| 80 | 80 | get_time_string(timepos, current_device(), NULL, NULL); |
| 81 | 81 | state = current_device()->get_state(); |
| 82 | 82 | item_append( |
| 83 | 83 | (state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED |
| 84 | 84 | ? "stopped" |
| 85 | 85 | : ((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 | ), | |
| 89 | 89 | timepos, |
| 90 | 90 | tapeflags, |
| 91 | 91 | TAPECMD_SLIDER); |
| 92 | ||
| 92 | ||
| 93 | 93 | // pause or stop |
| 94 | 94 | item_append("Pause/Stop", NULL, 0, TAPECMD_STOP); |
| 95 | ||
| 95 | ||
| 96 | 96 | // play |
| 97 | 97 | item_append("Play", NULL, 0, TAPECMD_PLAY); |
| 98 | ||
| 98 | ||
| 99 | 99 | // record |
| 100 | 100 | item_append("Record", NULL, 0, TAPECMD_RECORD); |
| 101 | ||
| 101 | ||
| 102 | 102 | // rewind |
| 103 | 103 | item_append("Rewind", NULL, 0, TAPECMD_REWIND); |
| 104 | ||
| 104 | ||
| 105 | 105 | // fast forward |
| 106 | 106 | item_append("Fast Forward", NULL, 0, TAPECMD_FAST_FORWARD); |
| 107 | 107 | } |
| r243232 | r243233 | |
|---|---|---|
| 2001 | 2001 | void h63484_device::device_start() |
| 2002 | 2002 | { |
| 2003 | 2003 | m_display_cb.bind_relative_to(*owner()); |
| 2004 | ||
| 2004 | ||
| 2005 | 2005 | register_save_state(); |
| 2006 | 2006 | } |
| 2007 | 2007 |
| r243232 | r243233 | |
|---|---|---|
| 107 | 107 | void video_registers_w(int offset); |
| 108 | 108 | int translate_command(UINT16 data); |
| 109 | 109 | void draw_graphics_line(bitmap_ind16 &bitmap, const rectangle &cliprect, int vs, int y, int layer_n, bool active, bool ins_window); |
| 110 | ||
| 110 | ||
| 111 | 111 | void register_save_state(); |
| 112 | 112 | |
| 113 | 113 | h63484_display_delegate m_display_cb; |
| r243232 | r243233 | |
|---|---|---|
| 100 | 100 | 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); } |
| 101 | 101 | |
| 102 | 102 | // 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 | } | |
| 109 | 109 | |
| 110 | 110 | private: |
| 111 | 111 | // internal helpers |
| r243232 | r243233 | |
|---|---|---|
| 171 | 171 | // entry list getters |
| 172 | 172 | const rgb_t *entry_list_raw() const { return m_entry_color; } |
| 173 | 173 | const dynamic_array<rgb_t> *entry_list_adjusted_darray() const { return &m_adjusted_color; } |
| 174 | ||
| 174 | const rgb_t *entry_list_adjusted() const { return m_adjusted_color; } | |
| 175 | 175 | const rgb_t *entry_list_adjusted_rgb15() const { return m_adjusted_rgb15; } |
| 176 | 176 | |
| 177 | 177 | // group adjustments |
| r243232 | r243233 | |
|---|---|---|
| 46 | 46 | /* ---------------------------------------------------------------------- */ |
| 47 | 47 | static NETLIST_START(nl_mario_snd0) |
| 48 | 48 | |
| 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 */ | |
| 52 | 52 | |
| 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) | |
| 65 | 65 | |
| 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 */ | |
| 68 | 68 | |
| 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) | |
| 73 | 73 | |
| 74 | ||
| 74 | //#define MR_C6 CAP_N(3.9) /* verified */ | |
| 75 | 75 | |
| 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) | |
| 80 | 80 | |
| 81 | ||
| 81 | //#define MR_C17 CAP_N(22) /* verified */ | |
| 82 | 82 | |
| 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) | |
| 87 | 87 | |
| 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) | |
| 90 | 90 | NETLIST_END() |
| 91 | 91 | |
| 92 | 92 | /* ---------------------------------------------------------------------- */ |
| r243232 | r243233 | |
| 96 | 96 | // FIXME: Diodes are 1S953 |
| 97 | 97 | static NETLIST_START(nl_mario_snd7) |
| 98 | 98 | |
| 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 */ | |
| 101 | 101 | |
| 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) | |
| 114 | 114 | |
| 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 */ | |
| 117 | 117 | |
| 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) | |
| 125 | 125 | |
| 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) | |
| 128 | 128 | |
| 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 */ | |
| 131 | 131 | |
| 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) | |
| 139 | 139 | |
| 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) | |
| 142 | 142 | |
| 143 | 143 | NETLIST_END() |
| 144 | 144 | |
| r243232 | r243233 | |
| 146 | 146 | /* DAC sound */ |
| 147 | 147 | /* ---------------------------------------------------------------------- */ |
| 148 | 148 | static 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) | |
| 155 | 155 | |
| 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) | |
| 161 | 161 | |
| 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)) | |
| 168 | 168 | |
| 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)) | |
| 173 | 173 | |
| 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) | |
| 177 | 177 | |
| 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) | |
| 181 | 181 | |
| 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) | |
| 185 | 185 | |
| 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) | |
| 190 | 190 | NETLIST_END() |
| 191 | 191 | |
| 192 | 192 | static NETLIST_START(nl_mario) |
| 193 | 193 | |
| 194 | ||
| 194 | /* Standard stuff */ | |
| 195 | 195 | |
| 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) | |
| 204 | 204 | |
| 205 | TTL_INPUT(SOUND0, 1) | |
| 206 | INCLUDE(nl_mario_snd0) | |
| 205 | TTL_INPUT(SOUND0, 1) | |
| 206 | INCLUDE(nl_mario_snd0) | |
| 207 | 207 | |
| 208 | TTL_INPUT(SOUND7, 1) | |
| 209 | INCLUDE(nl_mario_snd7) | |
| 208 | TTL_INPUT(SOUND7, 1) | |
| 209 | INCLUDE(nl_mario_snd7) | |
| 210 | 210 | |
| 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) | |
| 213 | 213 | |
| 214 | ||
| 214 | INCLUDE(nl_mario_dac) | |
| 215 | 215 | |
| 216 | /* ---------------------------------------------------------------------- */ | |
| 217 | /* mixing */ | |
| 218 | /* ---------------------------------------------------------------------- */ | |
| 216 | /* ---------------------------------------------------------------------- */ | |
| 217 | /* mixing */ | |
| 218 | /* ---------------------------------------------------------------------- */ | |
| 219 | 219 | |
| 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)) /* */ | |
| 225 | 225 | |
| 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) | |
| 229 | 229 | |
| 230 | 230 | #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) | |
| 235 | 235 | #else |
| 236 | ||
| 236 | NET_C(R39.1, R40.1) | |
| 237 | 237 | #endif |
| 238 | 238 | |
| 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) | |
| 241 | 241 | |
| 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 */ | |
| 245 | 245 | |
| 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) | |
| 251 | 251 | #if 1 |
| 252 | RES(R63, RES_K(1)) /* */ | |
| 253 | RES(R62, 150) /* */ | |
| 252 | RES(R63, RES_K(1)) /* */ | |
| 253 | RES(R62, 150) /* */ | |
| 254 | 254 | |
| 255 | ||
| 255 | QBJT_EB(Q10, "2SC1815") | |
| 256 | 256 | |
| 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) | |
| 259 | 259 | |
| 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) | |
| 262 | 262 | |
| 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)) | |
| 266 | 266 | |
| 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) | |
| 271 | 271 | #endif |
| 272 | /* ---------------------------------------------------------------------- */ | |
| 273 | /* Output */ | |
| 274 | /* ---------------------------------------------------------------------- */ | |
| 272 | /* ---------------------------------------------------------------------- */ | |
| 273 | /* Output */ | |
| 274 | /* ---------------------------------------------------------------------- */ | |
| 275 | 275 | |
| 276 | ||
| 276 | RES(ROUT, 1000000) | |
| 277 | 277 | |
| 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) | |
| 281 | 281 | |
| 282 | ||
| 282 | NET_C(GND, ROUT.2) | |
| 283 | 283 | |
| 284 | 284 | NETLIST_END() |
| 285 | 285 | |
| r243232 | r243233 | |
| 790 | 790 | #if OLD_SOUND |
| 791 | 791 | m_discrete->write(space, DS_SOUND0_INP, 0); |
| 792 | 792 | #else |
| 793 | ||
| 793 | m_audio_snd0->write(data); | |
| 794 | 794 | #endif |
| 795 | 795 | } |
| 796 | 796 | |
| r243232 | r243233 | |
| 835 | 835 | #if OLD_SOUND |
| 836 | 836 | machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1); |
| 837 | 837 | #else |
| 838 | | |
| 838 | m_audio_snd7->write((data & 1) ^ 1); | |
| 839 | 839 | #endif |
| 840 | 840 | break; |
| 841 | 841 | } |
| r243232 | r243233 | |
| 891 | 891 | MCFG_DISCRETE_INTF(mario) |
| 892 | 892 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1) |
| 893 | 893 | #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) | |
| 897 | 897 | |
| 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) | |
| 901 | 901 | |
| 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) | |
| 904 | 904 | #endif |
| 905 | 905 | |
| 906 | 906 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 229 | 229 | update_irq_lines(RST18_CLEAR); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | ||
| 232 | WRITE_LINE_MEMBER( seibu_sound_device::fm_irqhandler ) | |
| 233 | 233 | { |
| 234 | update_irq_lines(linestate ? RST10_ASSERT : RST10_CLEAR); | |
| 235 | } | |
| 236 | ||
| 237 | WRITE_LINE_MEMBER( seibu_sound_device::ym2151_irqhandler ) | |
| 238 | { | |
| 239 | 234 | update_irq_lines(state ? RST10_ASSERT : RST10_CLEAR); |
| 240 | 235 | } |
| 241 | 236 | |
| 242 | void seibu_sound_device::ym2203_irqhandler(int linestate) | |
| 243 | { | |
| 244 | update_irq_lines(linestate ? RST10_ASSERT : RST10_CLEAR); | |
| 245 | } | |
| 246 | ||
| 247 | 237 | WRITE8_MEMBER( seibu_sound_device::bank_w ) |
| 248 | 238 | { |
| 249 | 239 | space.machine().root_device().membank("bank1")->set_entry(data & 1); |
| r243232 | r243233 | |
|---|---|---|
| 45 | 45 | |
| 46 | 46 | DECLARE_READ16_MEMBER( main_word_r ); |
| 47 | 47 | DECLARE_WRITE16_MEMBER( main_word_w ); |
| 48 | ||
| 49 | 48 | DECLARE_WRITE16_MEMBER( main_mustb_w ); |
| 50 | ||
| 51 | 49 | DECLARE_WRITE8_MEMBER( irq_clear_w ); |
| 52 | 50 | DECLARE_WRITE8_MEMBER( rst10_ack_w ); |
| 53 | 51 | DECLARE_WRITE8_MEMBER( rst18_ack_w ); |
| 54 | 52 | DECLARE_WRITE8_MEMBER( bank_w ); |
| 55 | 53 | DECLARE_WRITE8_MEMBER( coin_w ); |
| 56 | void ym3812_irqhandler(int linestate); | |
| 57 | WRITE_LINE_MEMBER(ym2151_irqhandler); | |
| 58 | void ym2203_irqhandler(int linestate); | |
| 54 | WRITE_LINE_MEMBER( fm_irqhandler ); | |
| 59 | 55 | DECLARE_READ8_MEMBER( soundlatch_r ); |
| 60 | 56 | DECLARE_READ8_MEMBER( main_data_pending_r ); |
| 61 | 57 | DECLARE_WRITE8_MEMBER( main_data_w ); |
| r243232 | r243233 | |
| 193 | 189 | #define SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(freq1,freq2) \ |
| 194 | 190 | MCFG_SPEAKER_STANDARD_MONO("mono") \ |
| 195 | 191 | \ |
| 196 | MCFG_SOUND_ADD("ymsnd", YM3812, freq1) \ | |
| 197 | MCFG_YM3812_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, ym3812_irqhandler)) \ | |
| 192 | MCFG_SOUND_ADD("ymsnd", YM3812, freq1) \ | |
| 193 | MCFG_YM3812_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) \ | |
| 198 | 194 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) \ |
| 199 | 195 | \ |
| 200 | 196 | MCFG_OKIM6295_ADD("oki", freq2, OKIM6295_PIN7_LOW) \ |
| r243232 | r243233 | |
| 203 | 199 | #define SEIBU_SOUND_SYSTEM_YM3812_RAIDEN_INTERFACE(freq1,freq2) \ |
| 204 | 200 | MCFG_SPEAKER_STANDARD_MONO("mono") \ |
| 205 | 201 | \ |
| 206 | MCFG_SOUND_ADD("ymsnd", YM3812, freq1) \ | |
| 207 | MCFG_YM3812_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, ym3812_irqhandler)) \ | |
| 202 | MCFG_SOUND_ADD("ymsnd", YM3812, freq1) \ | |
| 203 | MCFG_YM3812_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) \ | |
| 208 | 204 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) \ |
| 209 | 205 | \ |
| 210 | 206 | MCFG_OKIM6295_ADD("oki", freq2, OKIM6295_PIN7_HIGH) \ |
| r243232 | r243233 | |
| 213 | 209 | #define SEIBU_SOUND_SYSTEM_YM2151_INTERFACE(freq1,freq2) \ |
| 214 | 210 | MCFG_SPEAKER_STANDARD_MONO("mono") \ |
| 215 | 211 | \ |
| 216 | MCFG_YM2151_ADD("ymsnd", freq1) \ | |
| 217 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, ym2151_irqhandler)) \ | |
| 212 | MCFG_YM2151_ADD("ymsnd", freq1) \ | |
| 213 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) \ | |
| 218 | 214 | MCFG_SOUND_ROUTE(0, "mono", 0.50) \ |
| 219 | 215 | MCFG_SOUND_ROUTE(1, "mono", 0.50) \ |
| 220 | 216 | \ |
| r243232 | r243233 | |
| 224 | 220 | #define SEIBU_AIRRAID_SOUND_SYSTEM_YM2151_INTERFACE(freq1) \ |
| 225 | 221 | MCFG_SPEAKER_STANDARD_MONO("mono") \ |
| 226 | 222 | \ |
| 227 | MCFG_YM2151_ADD("ymsnd", freq1) \ | |
| 228 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, ym2151_irqhandler)) \ | |
| 223 | MCFG_YM2151_ADD("ymsnd", freq1) \ | |
| 224 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) \ | |
| 229 | 225 | MCFG_SOUND_ROUTE(0, "mono", 0.50) \ |
| 230 | 226 | MCFG_SOUND_ROUTE(1, "mono", 0.50) |
| 231 | 227 | |
| 232 | #define SEIBU_SOUND_SYSTEM_YM2151_RAIDEN2_INTERFACE(freq1,freq2,regiona, regionb) | |
| 228 | #define SEIBU_SOUND_SYSTEM_YM2151_RAIDEN2_INTERFACE(freq1, freq2, regiona, regionb) \ | |
| 233 | 229 | MCFG_SPEAKER_STANDARD_MONO("mono") \ |
| 234 | 230 | \ |
| 235 | MCFG_YM2151_ADD("ymsnd", freq1) \ | |
| 236 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, ym2151_irqhandler)) \ | |
| 231 | MCFG_YM2151_ADD("ymsnd", freq1) \ | |
| 232 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) \ | |
| 237 | 233 | MCFG_SOUND_ROUTE(0, "mono", 0.50) \ |
| 238 | 234 | MCFG_SOUND_ROUTE(1, "mono", 0.50) \ |
| 239 | 235 | \ |
| r243232 | r243233 | |
| 247 | 243 | MCFG_SPEAKER_STANDARD_MONO("mono") \ |
| 248 | 244 | \ |
| 249 | 245 | MCFG_SOUND_ADD("ym1", YM2203, freq) \ |
| 250 | MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, | |
| 246 | MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) \ | |
| 251 | 247 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) \ |
| 252 | 248 | \ |
| 253 | 249 | MCFG_SOUND_ADD("ym2", YM2203, freq) \ |
| r243232 | r243233 | |
| 255 | 251 | |
| 256 | 252 | #define SEIBU_SOUND_SYSTEM_ADPCM_INTERFACE \ |
| 257 | 253 | MCFG_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) \ |
| 258 | MCFG_SEIBU_ADPCM_ROMREGION("adpcm1") \ | |
| 254 | MCFG_SEIBU_ADPCM_ROMREGION("adpcm1") \ | |
| 259 | 255 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) \ |
| 260 | 256 | \ |
| 261 | 257 | MCFG_SOUND_ADD("adpcm2", SEIBU_ADPCM, 8000) \ |
| 262 | MCFG_SEIBU_ADPCM_ROMREGION("adpcm2") \ | |
| 258 | MCFG_SEIBU_ADPCM_ROMREGION("adpcm2") \ | |
| 263 | 259 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 264 | 260 | |
| 265 | 261 | /**************************************************************************/ |
| r243232 | r243233 | |
|---|---|---|
| 178 | 178 | public: |
| 179 | 179 | aleck64_state(const machine_config &mconfig, device_type type, const char *tag) |
| 180 | 180 | : 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"), | |
| 183 | 183 | m_dip_read_offset(0) { } |
| 184 | 184 | |
| 185 | 185 | optional_shared_ptr<UINT32> m_e90_vram; |
| r243232 | r243233 | |
| 322 | 322 | ADDRESS_MAP_END |
| 323 | 323 | |
| 324 | 324 | /* |
| 325 | E90 protection handlers | |
| 325 | E90 protection handlers | |
| 326 | 326 | */ |
| 327 | 327 | |
| 328 | 328 | READ16_MEMBER(aleck64_state::e90_prot_r) |
| r243232 | r243233 | |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | WRITE16_MEMBER(aleck64_state::e90_prot_w) |
| 335 | { | |
| 335 | { | |
| 336 | 336 | switch(offset*2) |
| 337 | 337 | { |
| 338 | 338 | case 0x16: |
| r243232 | r243233 | |
| 342 | 342 | if(data & 1) // 0 -> 1 transition |
| 343 | 343 | { |
| 344 | 344 | //for(int i=0;i<0x1000;i+=4) |
| 345 | // | |
| 345 | // space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i)); | |
| 346 | 346 | } |
| 347 | 347 | break; |
| 348 | 348 | //0x1e bit 0 probably enables the chip |
| r243232 | r243233 | |
| 882 | 882 | { |
| 883 | 883 | bitmap.fill(0, cliprect); |
| 884 | 884 | screen_update_n64(screen,bitmap,cliprect); |
| 885 | ||
| 885 | ||
| 886 | 886 | for(int offs=0;offs<0x1000/4;offs+=2) |
| 887 | 887 | { |
| 888 | 888 | int xi,yi; |
| r243232 | r243233 | |
| 904 | 904 | r&=0x1f; |
| 905 | 905 | g&=0x1f; |
| 906 | 906 | b&=0x1f; |
| 907 | r = (r << 3) | (r >> 2); | |
| 907 | r = (r << 3) | (r >> 2); | |
| 908 | 908 | g = (g << 3) | (g >> 2); |
| 909 | b = (b << 3) | (b >> 2); | |
| 909 | b = (b << 3) | (b >> 2); | |
| 910 | 910 | for(yi=0;yi<8;yi++) |
| 911 | 911 | for(xi=0;xi<8;xi++) |
| 912 | 912 | { |
| 913 | 913 | int res_x,res_y; |
| 914 | 914 | res_x = x+xi + 4; |
| 915 | 915 | res_y = y+yi + 7; |
| 916 | ||
| 916 | ||
| 917 | 917 | if(cliprect.contains(res_x, res_y)) |
| 918 | 918 | bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b; |
| 919 | 919 | } |
| r243232 | r243233 | |
| 926 | 926 | MCFG_CPU_PROGRAM_MAP(e90_map) |
| 927 | 927 | |
| 928 | 928 | MCFG_SCREEN_MODIFY("screen") |
| 929 | MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_e90) | |
| 929 | MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_e90) | |
| 930 | 930 | MACHINE_CONFIG_END |
| 931 | 931 | |
| 932 | 932 | DRIVER_INIT_MEMBER(aleck64_state,aleck64) |
| r243232 | r243233 | |
|---|---|---|
| 106 | 106 | required_ioport m_io_in3; |
| 107 | 107 | required_device<palette_device> m_palette; |
| 108 | 108 | required_shared_ptr<UINT32> m_generic_paletteram_32; |
| 109 | DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); | |
| 110 | 109 | }; |
| 111 | 110 | |
| 112 | 111 | //UINT32 *backfire_180010, *backfire_188010; |
| r243232 | r243233 | |
| 439 | 438 | GFXDECODE_END |
| 440 | 439 | |
| 441 | 440 | |
| 442 | WRITE_LINE_MEMBER(backfire_state::sound_irq_gen) | |
| 443 | { | |
| 444 | logerror("sound irq\n"); | |
| 445 | } | |
| 446 | ||
| 447 | 441 | INTERRUPT_GEN_MEMBER(backfire_state::deco32_vbl_interrupt) |
| 448 | 442 | { |
| 449 | 443 | device.execute().set_input_line(ARM_IRQ_LINE, HOLD_LINE); |
| r243232 | r243233 | |
| 559 | 553 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 560 | 554 | |
| 561 | 555 | MCFG_SOUND_ADD("ymz", YMZ280B, 28000000 / 2) |
| 562 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(backfire_state, sound_irq_gen)) | |
| 563 | 556 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 564 | 557 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 565 | 558 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | |
| 613 | WRITE_LINE_MEMBER(sc4_state::bfm_sc4_irqhandler) | |
| 614 | { | |
| 615 | logerror("YMZ280 is generating an interrupt. State=%08x\n",state); | |
| 616 | } | |
| 617 | ||
| 618 | ||
| 619 | ||
| 620 | 613 | WRITE_LINE_MEMBER(sc4_state::bfm_sc4_duart_irq_handler) |
| 621 | 614 | { |
| 622 | 615 | // triggers after reel tests on luckb, at the start on dnd... |
| r243232 | r243233 | |
| 709 | 702 | // MCFG_DEFAULT_LAYOUT(layout_bfm_sc4) |
| 710 | 703 | |
| 711 | 704 | MCFG_SOUND_ADD("ymz", YMZ280B, 16000000) // ?? Mhz |
| 712 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(sc4_state, bfm_sc4_irqhandler)) | |
| 713 | 705 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 714 | 706 | MACHINE_CONFIG_END |
| 715 | 707 |
| r243232 | r243233 | |
|---|---|---|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
| 189 | ||
| 190 | WRITE_LINE_MEMBER(bfm_sc5_state::bfm_sc5_ym_irqhandler) | |
| 191 | { | |
| 192 | logerror("YMZ280 is generating an interrupt. State=%08x\n",state); | |
| 193 | } | |
| 194 | ||
| 195 | ||
| 196 | ||
| 197 | 189 | WRITE_LINE_MEMBER(bfm_sc5_state::bfm_sc5_duart_irq_handler) |
| 198 | 190 | { |
| 199 | 191 | printf("bfm_sc5_duart_irq_handler\n"); |
| r243232 | r243233 | |
| 235 | 227 | MCFG_DEFAULT_LAYOUT(layout_bfm_sc5) |
| 236 | 228 | |
| 237 | 229 | MCFG_SOUND_ADD("ymz", YMZ280B, 16000000) // ?? Mhz |
| 238 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(bfm_sc5_state, bfm_sc5_ym_irqhandler)) | |
| 239 | 230 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 240 | 231 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 122 | 122 | { |
| 123 | 123 | return 0; |
| 124 | 124 | } |
| 125 | DECLARE_WRITE_LINE_MEMBER(irqhandler); | |
| 126 | 125 | |
| 127 | 126 | protected: |
| 128 | 127 | |
| r243232 | r243233 | |
| 132 | 131 | virtual void machine_start(); |
| 133 | 132 | }; |
| 134 | 133 | |
| 135 | ||
| 136 | WRITE_LINE_MEMBER(bfm_swp_state::irqhandler) | |
| 137 | { | |
| 138 | } | |
| 139 | ||
| 140 | ||
| 141 | 134 | READ32_MEMBER(bfm_swp_state::bfm_swp_mem_r) |
| 142 | 135 | { |
| 143 | 136 | int pc = space.device().safe_pc(); |
| r243232 | r243233 | |
| 218 | 211 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 219 | 212 | |
| 220 | 213 | MCFG_SOUND_ADD("ymz", YMZ280B, 10000000 ) |
| 221 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(bfm_swp_state, irqhandler)) | |
| 222 | 214 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 223 | 215 | MACHINE_CONFIG_END |
| 224 | 216 |
| r243232 | r243233 | |
|---|---|---|
| 357 | 357 | INPUT_PORTS_END |
| 358 | 358 | |
| 359 | 359 | |
| 360 | WRITE_LINE_MEMBER(bishi_state::sound_irq_gen) | |
| 361 | { | |
| 362 | m_maincpu->set_input_line(M68K_IRQ_1, (state) ? ASSERT_LINE : CLEAR_LINE); | |
| 363 | } | |
| 364 | ||
| 365 | ||
| 366 | 360 | void bishi_state::machine_start() |
| 367 | 361 | { |
| 368 | 362 | save_item(NAME(m_cur_control)); |
| r243232 | r243233 | |
| 413 | 407 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 414 | 408 | |
| 415 | 409 | MCFG_SOUND_ADD("ymz", YMZ280B, SOUND_CLOCK) /* 16.9344MHz */ |
| 416 | MCFG_YMZ280B_IRQ_HANDLER( | |
| 410 | MCFG_YMZ280B_IRQ_HANDLER(INPUTLINE("maincpu", M68K_IRQ_1)) | |
| 417 | 411 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 418 | 412 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 419 | 413 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 1940 | 1940 | ROM_LOAD( "w3-f.4a", 0xc000, 0x1000, CRC(9aadd252) SHA1(c6da7ef46333d525e676c59f03ccc908108b41ba) ) |
| 1941 | 1941 | ROM_LOAD( "w2-f.6a", 0xd000, 0x1000, CRC(f131a5bb) SHA1(84b7dea112dce12e5cb235a13f6dc4edcfb18c06) ) |
| 1942 | 1942 | ROM_LOAD( "w1-f.9a", 0xe000, 0x1000, CRC(a6ce9a19) SHA1(e8f380e17a21fb33504d6efe9d01d0f903fa25e1) ) |
| 1943 | // | |
| 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? | |
| 1944 | 1944 | ROM_LOAD( "w0-f.9a", 0xf000, 0x1000, CRC(b3787a92) SHA1(7f40621dc739c1108a5df43142ab04709a380219) ) |
| 1945 | 1945 | |
| 1946 | 1946 | ROM_REGION( 0x10000, "audiocpu", 0 ) |
| r243232 | r243233 | |
|---|---|---|
| 484 | 484 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 485 | 485 | |
| 486 | 486 | MCFG_YM2151_ADD("ymsnd", XTAL_3_579545MHz) /* verified on pcb */ |
| 487 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, | |
| 487 | MCFG_YM2151_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) | |
| 488 | 488 | MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono", 0.80) |
| 489 | 489 | |
| 490 | 490 | MCFG_SOUND_ADD("adpcm1", SEIBU_ADPCM, 8000) /* it should use the msm5205 */ |
| r243232 | r243233 | |
|---|---|---|
| 3658 | 3658 | DRIVER_INIT_MEMBER(calomega_state,comg080) |
| 3659 | 3659 | { |
| 3660 | 3660 | DRIVER_INIT_CALL(sys903); |
| 3661 | ||
| 3661 | ||
| 3662 | 3662 | /* Injecting missing Start and NMI vectors... |
| 3663 | 3663 | Start = $2042; NMI = $26f8; |
| 3664 | 3664 | Also a fake vector at $3ff8-$3ff9. The code checks these values to continue. |
| r243232 | r243233 | |
|---|---|---|
| 9322 | 9322 | ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 code */ |
| 9323 | 9323 | ROM_LOAD16_WORD_SWAP("q5 - 34_90629b.8f", 0x00000, 0x80000, CRC(de54487f) SHA1(75b228a6c702c82d4d9a2a992933b5c3c420f6c2) ) |
| 9324 | 9324 | ROM_LOAD16_WORD_SWAP("q5 - 33_90629b.6f", 0x80000, 0x80000, CRC(93248458) SHA1(9dcdc6838f52efc9a0a6333fd0d734946db12dbd) ) |
| 9325 | ||
| 9325 | ||
| 9326 | 9326 | ROM_REGION( 0x200000, "gfx", 0 ) |
| 9327 | 9327 | ROMX_LOAD( "q5 - 06_90629b.8a", 0x000000, 0x80000, CRC(09d0e7ce) SHA1(ea502b975986222acce82ce8396348af72e1df72) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| 9328 | 9328 | ROMX_LOAD( "q5 - 08_90629b.10a", 0x000002, 0x80000, CRC(22e4ce9a) SHA1(9e49aec8e1d6d15a68da63e69765b82fd53a9562) , ROM_GROUPWORD | ROM_SKIP(6) ) |
| r243232 | r243233 | |
|---|---|---|
| 154 | 154 | : dynax_state(mconfig, type, tag), |
| 155 | 155 | m_dsw_sel16(*this, "dsw_sel16"), |
| 156 | 156 | m_protection1(*this, "protection1"), |
| 157 | m_protection2(*this, "protection2") { } | |
| 158 | ||
| 157 | m_protection2(*this, "protection2") { } | |
| 159 | 158 | |
| 159 | ||
| 160 | 160 | optional_shared_ptr<UINT16> m_dsw_sel16; |
| 161 | 161 | optional_shared_ptr<UINT16> m_protection1; |
| 162 | 162 | optional_shared_ptr<UINT16> m_protection2; |
| r243232 | r243233 | |
|---|---|---|
| 530 | 530 | { |
| 531 | 531 | save_item(NAME(m_automat_adpcm_byte)); |
| 532 | 532 | save_item(NAME(m_automat_msm5205_vclk_toggle)); |
| 533 | save_item(NAME(m_automat_scroll_regs)); | |
| 533 | save_item(NAME(m_automat_scroll_regs)); | |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 |
| r243232 | r243233 | |
|---|---|---|
| 66 | 66 | UINT32 screen_update_wcvol95(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 67 | 67 | INTERRUPT_GEN_MEMBER(deco32_vbl_interrupt); |
| 68 | 68 | void descramble_sound( const char *tag ); |
| 69 | DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); | |
| 70 | 69 | DECO16IC_BANK_CB_MEMBER(bank_callback); |
| 71 | 70 | DECOSPR_PRIORITY_CB_MEMBER(pri_callback); |
| 72 | 71 | }; |
| r243232 | r243233 | |
| 315 | 314 | |
| 316 | 315 | /**********************************************************************************/ |
| 317 | 316 | |
| 318 | WRITE_LINE_MEMBER(deco156_state::sound_irq_gen) | |
| 319 | { | |
| 320 | logerror("sound irq\n"); | |
| 321 | } | |
| 322 | ||
| 323 | 317 | INTERRUPT_GEN_MEMBER(deco156_state::deco32_vbl_interrupt) |
| 324 | 318 | { |
| 325 | 319 | device.execute().set_input_line(ARM_IRQ_LINE, HOLD_LINE); |
| r243232 | r243233 | |
| 441 | 435 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 442 | 436 | |
| 443 | 437 | MCFG_SOUND_ADD("ymz", YMZ280B, 28000000 / 2) |
| 444 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(deco156_state, sound_irq_gen)) | |
| 445 | 438 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 446 | 439 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 447 | 440 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 164 | 164 | |
| 165 | 165 | required_device<cpu_device> m_maincpu; |
| 166 | 166 | required_ioport m_vblank; |
| 167 | ||
| 167 | ||
| 168 | 168 | UINT32 *m_vram; |
| 169 | 169 | int m_vbuffer; |
| 170 | 170 | int m_flash_roms; |
| 171 | 171 | int m_old_vbuf; |
| 172 | 172 | UINT32 m_flash_cmd; |
| 173 | 173 | INT32 m_first_offset; |
| 174 | ||
| 174 | ||
| 175 | 175 | DECLARE_READ32_MEMBER(flash_r); |
| 176 | 176 | DECLARE_WRITE32_MEMBER(flash_w); |
| 177 | 177 | DECLARE_WRITE32_MEMBER(vram_w); |
| r243232 | r243233 | |
| 179 | 179 | DECLARE_WRITE32_MEMBER(vbuffer_w); |
| 180 | 180 | DECLARE_WRITE32_MEMBER(coin_w); |
| 181 | 181 | DECLARE_READ32_MEMBER(vblank_r); |
| 182 | ||
| 182 | ||
| 183 | 183 | DECLARE_DRIVER_INIT(elfin); |
| 184 | 184 | DECLARE_DRIVER_INIT(jumpjump); |
| 185 | 185 | DECLARE_DRIVER_INIT(xfiles); |
| 186 | 186 | DECLARE_DRIVER_INIT(xfilesk); |
| 187 | 187 | DECLARE_DRIVER_INIT(kdynastg); |
| 188 | 188 | DECLARE_DRIVER_INIT(fmaniac3); |
| 189 | ||
| 189 | ||
| 190 | 190 | virtual void machine_start(); |
| 191 | 191 | virtual void machine_reset(); |
| 192 | 192 | virtual void video_start(); |
| 193 | ||
| 193 | ||
| 194 | 194 | UINT32 screen_update_dgpix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 195 | 195 | }; |
| 196 | 196 |
| r243232 | r243233 | |
|---|---|---|
| 341 | 341 | |
| 342 | 342 | That kit included the following 4 EPROM's |
| 343 | 343 | |
| 344 | USA (c) 1981 Nintendo of America set | |
| 344 | USA (c) 1981 Nintendo of America set | |
| 345 | 345 | ------------------------------------ |
| 346 | 346 | |
| 347 | 347 | Filename Label Type Loc/PCB *Label *Loc/PCB CSum |
| r243232 | r243233 | |
|---|---|---|
| 4378 | 4378 | |
| 4379 | 4379 | membank("bank1")->configure_entries(0, 0x10, &MAIN[0x8000], 0x8000); |
| 4380 | 4380 | membank("bank2")->configure_entries(0, 12, &SOUND[0x8000], 0x8000); |
| 4381 | ||
| 4381 | ||
| 4382 | 4382 | MACHINE_START_CALL_MEMBER(dynax); |
| 4383 | 4383 | } |
| 4384 | 4384 |
| r243232 | r243233 | |
|---|---|---|
| 1494 | 1494 | |
| 1495 | 1495 | // Configure the sound ROM banking |
| 1496 | 1496 | membank("sound_bank")->configure_entries(0, 16, memregion("sounddata")->base(), 0x8000); |
| 1497 | ||
| 1497 | ||
| 1498 | 1498 | save_item(NAME(m_sound_data)); |
| 1499 | 1499 | } |
| 1500 | 1500 |
| r243232 | r243233 | |
|---|---|---|
| 25 | 25 | |
| 26 | 26 | UINT16 *m_vram; |
| 27 | 27 | int m_vbuffer; |
| 28 | ||
| 28 | ||
| 29 | 29 | DECLARE_WRITE16_MEMBER(eeprom_w); |
| 30 | 30 | DECLARE_READ16_MEMBER(eolith16_custom_r); |
| 31 | 31 | DECLARE_WRITE16_MEMBER(vram_w); |
| 32 | 32 | DECLARE_READ16_MEMBER(vram_r); |
| 33 | ||
| 33 | ||
| 34 | 34 | DECLARE_DRIVER_INIT(eolith16); |
| 35 | 35 | DECLARE_VIDEO_START(eolith16); |
| 36 | 36 | DECLARE_PALETTE_INIT(eolith16); |
| 37 | ||
| 37 | ||
| 38 | 38 | UINT32 screen_update_eolith16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 39 | 39 | }; |
| 40 | 40 |
| r243232 | r243233 | |
|---|---|---|
| 84 | 84 | } |
| 85 | 85 | n_game++; |
| 86 | 86 | } |
| 87 | ||
| 87 | ||
| 88 | 88 | save_item(NAME(m_speedup_vblank)); |
| 89 | 89 | save_item(NAME(m_speedup_scanline)); |
| 90 | 90 | } |
| r243232 | r243233 | |
|---|---|---|
| 187 | 187 | WRITE8_MEMBER(exidy_state::fax_bank_select_w) |
| 188 | 188 | { |
| 189 | 189 | membank("bank1")->set_entry(data & 0x1f); |
| 190 | ||
| 190 | ||
| 191 | 191 | if ((data & 0x1f) > 0x17) |
| 192 | 192 | logerror("Banking to unpopulated ROM bank %02X!\n", data & 0x1f); |
| 193 | ||
| 193 | ||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 |
| r243232 | r243233 | |
|---|---|---|
| 356 | 356 | static ADDRESS_MAP_START( flashbank_map, AS_PROGRAM, 32, funkball_state ) |
| 357 | 357 | AM_RANGE(0x00000000, 0x003fffff) AM_DEVREADWRITE16("u29", intel_28f320j5_device, read, write, 0xffffffff ) // needed to boot |
| 358 | 358 | AM_RANGE(0x00400000, 0x007fffff) AM_DEVREADWRITE16("u30", intel_28f320j5_device, read, write, 0xffffffff ) // i assume it maps directly after |
| 359 | // | |
| 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 | |
| 360 | 360 | /* it checks for 64MBit chips at 0x80000000 the way things are set up, they must return an intel Flash ID of 0x15 */ |
| 361 | 361 | ADDRESS_MAP_END |
| 362 | 362 |
| r243232 | r243233 | |
|---|---|---|
| 1499 | 1499 | AM_RANGE(0x1200, 0x12ff) AM_MIRROR(0x0100) AM_RAM_WRITE(galaxian_objram_w) AM_SHARE("spriteram") |
| 1500 | 1500 | AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x03ff) AM_READ(watchdog_reset_r) |
| 1501 | 1501 | 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) | |
| 1504 | 1504 | ADDRESS_MAP_END |
| 1505 | 1505 | |
| 1506 | 1506 | static ADDRESS_MAP_START( anteaterg_map, AS_PROGRAM, 8, galaxian_state ) |
| r243232 | r243233 | |
|---|---|---|
| 281 | 281 | optional_device<k001006_device> m_k001006_2; |
| 282 | 282 | optional_device<k001604_device> m_k001604_1; |
| 283 | 283 | optional_device<k001604_device> m_k001604_2; |
| 284 | ||
| 284 | ||
| 285 | 285 | required_shared_ptr<UINT32> m_work_ram; |
| 286 | 286 | required_shared_ptr<UINT32> m_generic_paletteram_32; |
| 287 | ||
| 287 | ||
| 288 | 288 | optional_ioport m_analog0, m_analog1, m_analog2, m_analog3; |
| 289 | ||
| 289 | ||
| 290 | 290 | required_ioport_array<4> m_ports; |
| 291 | ||
| 291 | ||
| 292 | 292 | DECLARE_IOPORT_ARRAY(ports); |
| 293 | 293 | |
| 294 | 294 | DECLARE_WRITE32_MEMBER(paletteram32_w); |
| r243232 | r243233 | |
|---|---|---|
| 427 | 427 | ADDRESS_MAP_END |
| 428 | 428 | |
| 429 | 429 | static 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 | |
| 434 | 434 | |
| 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 | |
| 437 | 437 | |
| 438 | 438 | ADDRESS_MAP_END |
| 439 | 439 |
| r243232 | r243233 | |
|---|---|---|
| 263 | 263 | |
| 264 | 264 | int write_dest_byte(UINT8 usedata); |
| 265 | 265 | //UINT16 main_m_vram[0x800][0x800]; |
| 266 | ||
| 267 | DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); | |
| 268 | 266 | }; |
| 269 | 267 | |
| 270 | 268 | |
| r243232 | r243233 | |
| 1316 | 1314 | |
| 1317 | 1315 | /***************************************************************************************/ |
| 1318 | 1316 | |
| 1319 | ||
| 1320 | WRITE_LINE_MEMBER(gunpey_state::sound_irq_gen) | |
| 1321 | { | |
| 1322 | logerror("sound irq\n"); | |
| 1323 | } | |
| 1324 | ||
| 1325 | ||
| 1326 | /***************************************************************************************/ | |
| 1327 | ||
| 1328 | 1317 | static INPUT_PORTS_START( gunpey ) |
| 1329 | 1318 | PORT_START("DSW1") // IN0 - 7f40 |
| 1330 | 1319 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2") |
| r243232 | r243233 | |
| 1467 | 1456 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) |
| 1468 | 1457 | |
| 1469 | 1458 | MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) |
| 1470 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(gunpey_state, sound_irq_gen)) | |
| 1471 | 1459 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) |
| 1472 | 1460 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) |
| 1473 | 1461 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 50 | 50 | required_device<cpu_device> m_maincpu; |
| 51 | 51 | public: |
| 52 | 52 | DECLARE_DRIVER_INIT(maygayep); |
| 53 | DECLARE_WRITE_LINE_MEMBER(irqhandler); | |
| 54 | 53 | }; |
| 55 | 54 | |
| 56 | 55 | // bp 29e58 in ep_simp reads the 'INITIALISE . . .' string |
| r243232 | r243233 | |
| 101 | 100 | |
| 102 | 101 | } |
| 103 | 102 | |
| 104 | WRITE_LINE_MEMBER(maygayep_state::irqhandler) | |
| 105 | { | |
| 106 | } | |
| 107 | ||
| 108 | ||
| 109 | 103 | static MACHINE_CONFIG_START( maygayep, maygayep_state ) |
| 110 | 104 | MCFG_CPU_ADD("maincpu", H83002, 16000000 ) |
| 111 | 105 | MCFG_CPU_PROGRAM_MAP( maygayep_map ) |
| r243232 | r243233 | |
| 113 | 107 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 114 | 108 | |
| 115 | 109 | MCFG_SOUND_ADD("ymz", YMZ280B, 10000000 ) |
| 116 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(maygayep_state, irqhandler)) | |
| 117 | 110 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 118 | 111 | MACHINE_CONFIG_END |
| 119 | 112 |
| r243232 | r243233 | |
|---|---|---|
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | UINT32 screen_update_midas(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 88 | DECLARE_WRITE_LINE_MEMBER(livequiz_irqhandler); | |
| 89 | 88 | required_device<cpu_device> m_maincpu; |
| 90 | 89 | required_device<eeprom_serial_93cxx_device> m_eeprom; |
| 91 | 90 | required_device<gfxdecode_device> m_gfxdecode; |
| r243232 | r243233 | |
| 607 | 606 | { |
| 608 | 607 | } |
| 609 | 608 | |
| 610 | ||
| 611 | ||
| 612 | ||
| 613 | WRITE_LINE_MEMBER(midas_state::livequiz_irqhandler) | |
| 614 | { | |
| 615 | logerror("YMZ280 is generating an interrupt. State=%08x\n",state); | |
| 616 | } | |
| 617 | ||
| 618 | ||
| 619 | 609 | void midas_state::screen_eof_midas(screen_device &screen, bool state) |
| 620 | 610 | { |
| 621 | 611 | if (state) m_sprgen->buffer_vram(); |
| r243232 | r243233 | |
| 647 | 637 | /* sound hardware */ |
| 648 | 638 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 649 | 639 | MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) |
| 650 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(midas_state, livequiz_irqhandler)) | |
| 651 | 640 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.80) |
| 652 | 641 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.80) |
| 653 | 642 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
| 681 | 670 | /* sound hardware */ |
| 682 | 671 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 683 | 672 | MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) |
| 684 | MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(midas_state, livequiz_irqhandler)) | |
| 685 | 673 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.80) |
| 686 | 674 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.80) |
| 687 | 675 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 2491 | 2491 | |
| 2492 | 2492 | static MACHINE_CONFIG_DERIVED( model2a_0229, model2a ) |
| 2493 | 2493 | MCFG_DEVICE_ADD("317_0229", SEGA315_5838_COMP, 0) |
| 2494 | // | |
| 2494 | // MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback) | |
| 2495 | 2495 | MACHINE_CONFIG_END |
| 2496 | 2496 | |
| 2497 | 2497 | READ8_MEMBER(model2_state::driveio_port_r) |
| r243232 | r243233 | |
| 2599 | 2599 | |
| 2600 | 2600 | static MACHINE_CONFIG_DERIVED( model2b_0229, model2b ) |
| 2601 | 2601 | MCFG_DEVICE_ADD("317_0229", SEGA315_5838_COMP, 0) |
| 2602 | // | |
| 2602 | // MCFG_SET_5838_READ_CALLBACK(model2_state, crypt_read_callback) | |
| 2603 | 2603 | MACHINE_CONFIG_END |
| 2604 | 2604 | |
| 2605 | 2605 | |
| r243232 | r243233 | |
| 5890 | 5890 | ROM_END |
| 5891 | 5891 | |
| 5892 | 5892 | DRIVER_INIT_MEMBER(model2_state,genprot) |
| 5893 | { | |
| 5893 | { | |
| 5894 | 5894 | //astring key = parameter(":315_5881:key"); |
| 5895 | 5895 | m_maincpu->space(AS_PROGRAM).install_ram(0x01d80000, 0x01d8ffff); |
| 5896 | 5896 | 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)); |
| r243232 | r243233 | |
| 5947 | 5947 | |
| 5948 | 5948 | DRIVER_INIT_MEMBER(model2_state,sgt24h) |
| 5949 | 5949 | { |
| 5950 | // | |
| 5950 | // DRIVER_INIT_CALL(genprot); | |
| 5951 | 5951 | |
| 5952 | 5952 | 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)); |
| 5953 | 5953 | |
| r243232 | r243233 | |
| 5965 | 5965 | DRIVER_INIT_MEMBER(model2_state,doa) |
| 5966 | 5966 | { |
| 5967 | 5967 | m_0229crypt->install_doa_protection(); |
| 5968 | ||
| 5968 | ||
| 5969 | 5969 | UINT32 *ROM = (UINT32 *)memregion("maincpu")->base(); |
| 5970 | 5970 | ROM[0x630/4] = 0x08000004; |
| 5971 | 5971 | ROM[0x808/4] = 0x08000004; |
| r243232 | r243233 | |
|---|---|---|
| 1696 | 1696 | { |
| 1697 | 1697 | UINT8* base; |
| 1698 | 1698 | retvalue = m_cryptdevice->do_decrypt(base); |
| 1699 | // | |
| 1699 | // retvalue = ((retvalue & 0xff00) >> 8) | ((retvalue & 0x00ff) << 8); // don't endian swap the return value on this hardware | |
| 1700 | 1700 | retvalue <<= 16; |
| 1701 | 1701 | } |
| 1702 | 1702 | |
| 1703 | // | |
| 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)); | |
| 1704 | 1704 | } |
| 1705 | 1705 | else |
| 1706 | 1706 | { |
| r243232 | r243233 | |
| 5584 | 5584 | 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? |
| 5585 | 5585 | } |
| 5586 | 5586 | |
| 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); | |
| 5589 | 5589 | |
| 5590 | 5590 | return dat; |
| 5591 | 5591 | } |
| r243232 | r243233 | |
| 5629 | 5629 | |
| 5630 | 5630 | DRIVER_INIT_MEMBER(model3_state, genprot) |
| 5631 | 5631 | { |
| 5632 | // | |
| 5632 | // astring key = parameter(":315_5881:key"); | |
| 5633 | 5633 | |
| 5634 | 5634 | m_maincpu->space(AS_PROGRAM).install_ram(0xf0180000, 0xf019ffff, 0, 0x0e000000); |
| 5635 | 5635 | |
| 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) ); | |
| 5637 | 5637 | |
| 5638 | 5638 | } |
| 5639 | 5639 | |
| r243232 | r243233 | |
| 5846 | 5846 | |
| 5847 | 5847 | DRIVER_INIT_MEMBER(model3_state,swtrilgy) |
| 5848 | 5848 | { |
| 5849 | ||
| 5850 | 5849 | UINT32 *rom = (UINT32*)memregion("user1")->base(); |
| 5851 | 5850 | DRIVER_INIT_CALL(model3_20); |
| 5852 | 5851 | |
| r243232 | r243233 | |
| 5890 | 5889 | |
| 5891 | 5890 | DRIVER_INIT_MEMBER(model3_state,daytona2) |
| 5892 | 5891 | { |
| 5893 | // | |
| 5892 | // UINT32 *rom = (UINT32*)memregion("user1")->base(); | |
| 5894 | 5893 | DRIVER_INIT_CALL(model3_20); |
| 5895 | 5894 | |
| 5896 | 5895 | m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this)); |
| r243232 | r243233 | |
| 5906 | 5905 | |
| 5907 | 5906 | DRIVER_INIT_MEMBER(model3_state,dayto2pe) |
| 5908 | 5907 | { |
| 5909 | // | |
| 5908 | // UINT32 *rom = (UINT32*)memregion("user1")->base(); | |
| 5910 | 5909 | DRIVER_INIT_CALL(model3_20); |
| 5911 | 5910 | |
| 5912 | 5911 | m_maincpu->space(AS_PROGRAM).install_write_handler(0xc3800000, 0xc3800007, write64_delegate(FUNC(model3_state::daytona2_rombank_w),this)); |
| 5913 | 5912 | m_maincpu->space(AS_PROGRAM).install_read_bank(0xc3000000, 0xc37fffff, "bank2" ); |
| 5914 | 5913 | |
| 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 | |
| 5918 | 5917 | |
| 5919 | // | |
| 5918 | // rom[(0x64ca34^4)/4] = 0x60000000; // dec | |
| 5920 | 5919 | |
| 5921 | 5920 | DRIVER_INIT_CALL(genprot); |
| 5922 | 5921 | } |
| r243232 | r243233 | |
|---|---|---|
| 3780 | 3780 | GFXDECODE_END |
| 3781 | 3781 | |
| 3782 | 3782 | |
| 3783 | ||
| 3784 | ||
| 3785 | WRITE_LINE_MEMBER(nmk16_state::ym2203_irqhandler) | |
| 3786 | { | |
| 3787 | m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); | |
| 3788 | } | |
| 3789 | 3783 | /* |
| 3790 | 3784 | ---- |
| 3791 | 3785 | |
| r243232 | r243233 | |
| 3894 | 3888 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 3895 | 3889 | |
| 3896 | 3890 | MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) |
| 3897 | MCFG_YM2203_IRQ_HANDLER( | |
| 3891 | MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) | |
| 3898 | 3892 | MCFG_SOUND_ROUTE(0, "mono", 0.50) |
| 3899 | 3893 | MCFG_SOUND_ROUTE(1, "mono", 0.50) |
| 3900 | 3894 | MCFG_SOUND_ROUTE(2, "mono", 0.50) |
| r243232 | r243233 | |
| 4421 | 4415 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4422 | 4416 | |
| 4423 | 4417 | MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) |
| 4424 | MCFG_YM2203_IRQ_HANDLER( | |
| 4418 | MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) | |
| 4425 | 4419 | MCFG_SOUND_ROUTE(0, "mono", 0.50) |
| 4426 | 4420 | MCFG_SOUND_ROUTE(1, "mono", 0.50) |
| 4427 | 4421 | MCFG_SOUND_ROUTE(2, "mono", 0.50) |
| r243232 | r243233 | |
| 4464 | 4458 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4465 | 4459 | |
| 4466 | 4460 | MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) |
| 4467 | MCFG_YM2203_IRQ_HANDLER( | |
| 4461 | MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) | |
| 4468 | 4462 | MCFG_SOUND_ROUTE(0, "mono", 0.50) |
| 4469 | 4463 | MCFG_SOUND_ROUTE(1, "mono", 0.50) |
| 4470 | 4464 | MCFG_SOUND_ROUTE(2, "mono", 0.50) |
| r243232 | r243233 | |
| 4506 | 4500 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4507 | 4501 | |
| 4508 | 4502 | MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) |
| 4509 | MCFG_YM2203_IRQ_HANDLER( | |
| 4503 | MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) | |
| 4510 | 4504 | MCFG_SOUND_ROUTE(0, "mono", 0.50) |
| 4511 | 4505 | MCFG_SOUND_ROUTE(1, "mono", 0.50) |
| 4512 | 4506 | MCFG_SOUND_ROUTE(2, "mono", 0.50) |
| r243232 | r243233 | |
| 4636 | 4630 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4637 | 4631 | |
| 4638 | 4632 | MCFG_SOUND_ADD("ymsnd", YM2203, 1500000) |
| 4639 | MCFG_YM2203_IRQ_HANDLER( | |
| 4633 | MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) | |
| 4640 | 4634 | MCFG_SOUND_ROUTE(0, "mono", 0.50) |
| 4641 | 4635 | MCFG_SOUND_ROUTE(1, "mono", 0.50) |
| 4642 | 4636 | MCFG_SOUND_ROUTE(2, "mono", 0.50) |
| r243232 | r243233 | |
|---|---|---|
| 475 | 475 | |
| 476 | 476 | GAMEL( 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 ) |
| 477 | 477 | GAMEL( 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 ) |
| 478 | GAMEL( 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 | ||
| 478 | GAMEL( 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 ) |
| r243232 | r243233 | |
|---|---|---|
| 947 | 947 | GAME( 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.) |
| 948 | 948 | GAME( 1987, psychic5j, psychic5, psychic5, psychic5, driver_device, 0, ROT270, "Jaleco / NMK", "Psychic 5 (Japan)", 0 ) |
| 949 | 949 | GAME( 1988, bombsa, 0, bombsa, bombsa, driver_device, 0, ROT270, "Jaleco", "Bombs Away", GAME_NOT_WORKING ) |
| 950 |
| r243232 | r243233 | |
|---|---|---|
| 1584 | 1584 | PORT_DIPSETTING( 0x0040, DEF_STR( 1C_5C ) ) |
| 1585 | 1585 | PORT_DIPSETTING( 0x0000, "1 Coin/10 Credits" ) |
| 1586 | 1586 | |
| 1587 | PORT_START("DSW2") // $400302.w | |
| 1587 | PORT_START("DSW2") // $400302.w PORT_START("DSW2") // $400302.w | |
| 1588 | 1588 | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") // used |
| 1589 | 1589 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 1590 | 1590 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| r243232 | r243233 | |
| 1648 | 1648 | |
| 1649 | 1649 | static INPUT_PORTS_START( endrichs ) |
| 1650 | 1650 | PORT_INCLUDE(reelquak) |
| 1651 | ||
| 1651 | ||
| 1652 | 1652 | PORT_MODIFY("DSW1") // $400300.w |
| 1653 | 1653 | PORT_DIPNAME( 0x0001, 0x0001, "Payout Style" ) PORT_DIPLOCATION("SW1:1") |
| 1654 | 1654 | PORT_DIPSETTING( 0x0001, "Normal Payout" ) |
| r243232 | r243233 | |
|---|---|---|
| 514 | 514 | |
| 515 | 515 | /* same as standard seibu ym2203, but "ym1" also reads "DSW" */ |
| 516 | 516 | MCFG_SOUND_ADD("ym1", YM2203, XTAL_16MHz/4) |
| 517 | MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, | |
| 517 | MCFG_YM2203_IRQ_HANDLER(DEVWRITELINE("seibu_sound", seibu_sound_device, fm_irqhandler)) | |
| 518 | 518 | MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW")) |
| 519 | 519 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) |
| 520 | 520 |
| r243232 | r243233 | |
|---|---|---|
| 388 | 388 | ROM_END |
| 389 | 389 | |
| 390 | 390 | |
| 391 | GAME( 1999, silkroad, 0, silkroad, silkroad, driver_device, 0, ROT0, "Unico", "The Legend of Silkroad", 0 ) | |
| 392 | GAME( 1999, silkroada, silkroad, silkroad, silkroad, driver_device, 0, ROT0, "Unico", "The Legend of Silkroad (larger ROMs)", 0 ) // same content but fewer GFX roms of a larger size | |
| 391 | GAME( 1999, silkroad, 0, silkroad, silkroad, driver_device, 0, ROT0, "Unico", "The Legend of Silkroad", GAME_SUPPORTS_SAVE ) | |
| 392 | GAME( 1999, silkroada, silkroad, silkroad, silkroad, driver_device, 0, ROT0, "Unico", "The Legend of Silkroad (larger ROMs)", GAME_SUPPORTS_SAVE ) // same content but fewer GFX roms of a larger size |
| r243232 | r243233 | |
|---|---|---|
| 1844 | 1844 | ROM_LOAD16_WORD_SWAP( "mpr20833.9", 0x2000000, 0x0400000, CRC(cb6af231) SHA1(4a2e5d7c2fd6179c19cdefa84a03f9a34fbb9e70) ) // good (was .19s) |
| 1845 | 1845 | |
| 1846 | 1846 | // 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" ) | |
| 1848 | 1848 | ROM_END |
| 1849 | 1849 | |
| 1850 | 1850 | ROM_START( bakubaku ) |
| r243232 | r243233 | |
|---|---|---|
| 226 | 226 | MS06 M8 74s287 missile animated graphics |
| 227 | 227 | MS05 11F IM5610 200pt tank R->L graphic |
| 228 | 228 | MS05 11E IM5610 200pt tank L->R graphic |
| 229 | MS04 N7 IM5610 | |
| 229 | MS04 N7 IM5610 player missile trajectory pattern | |
| 230 | 230 | MS03 F3 IM5610 anti-missile ack-ack graphics |
| 231 | 231 | MS02 L12 IM5610 missile left/right position |
| 232 | 232 | MS01 D8 IM5610 100pt tanks graphics |
| 233 | ||
| 233 | ||
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | 236 | ROM_START( missilex ) |
| 237 | 237 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) |
| 238 | 238 | |
| 239 | 239 | 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) ) | |
| 241 | 241 | 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) ) | |
| 251 | 251 | ROM_END |
| 252 | 252 | |
| 253 | 253 |
| r243232 | r243233 | |
|---|---|---|
| 3049 | 3049 | GFXDECODE_END |
| 3050 | 3050 | |
| 3051 | 3051 | |
| 3052 | WRITE_LINE_MEMBER(toaplan2_state::bbakraid_irqhandler) | |
| 3053 | { | |
| 3054 | // Not used ??? Connected to a test pin (TP082) | |
| 3055 | logerror("YMZ280 is generating an interrupt. State=%08x\n",state); | |
| 3056 | } | |
| 3057 | ||
| 3058 | ||
| 3059 | 3052 | static MACHINE_CONFIG_START( tekipaki, toaplan2_state ) |
| 3060 | 3053 | |
| 3061 | 3054 | /* basic machine hardware */ |
| r243232 | r243233 | |
| 4003 | 3996 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 4004 | 3997 | |
| 4005 | 3998 | MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) |
| 4006 | | |
| 3999 | // IRQ not used ??? Connected to a test pin (TP082) | |
| 4007 | 4000 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 4008 | 4001 | MACHINE_CONFIG_END |
| 4009 | 4002 |
| r243232 | r243233 | |
|---|---|---|
| 21 | 21 | m_maincpu(*this, "maincpu") { } |
| 22 | 22 | |
| 23 | 23 | required_device<cpu_device> m_maincpu; |
| 24 | ||
| 24 | ||
| 25 | 25 | DECLARE_WRITE8_MEMBER(tourtabl_led_w); |
| 26 | 26 | DECLARE_READ16_MEMBER(tourtabl_read_input_port); |
| 27 | 27 | DECLARE_READ8_MEMBER(tourtabl_get_databus_contents); |
| r243232 | r243233 | |
|---|---|---|
| 669 | 669 | |
| 670 | 670 | WRITE8_MEMBER(twinkle_state::shared_psx_w) |
| 671 | 671 | { |
| 672 | // | |
| 672 | // printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask); | |
| 673 | 673 | |
| 674 | 674 | m_spu_shared[offset] = data; |
| 675 | 675 | |
| 676 | 676 | if (offset == 0x03fe && data == 0xff) |
| 677 | 677 | { |
| 678 | // | |
| 678 | // printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]); | |
| 679 | 679 | |
| 680 | 680 | m_audiocpu->set_input_line(M68K_IRQ_4, HOLD_LINE); |
| 681 | 681 | } |
| r243232 | r243233 | |
| 785 | 785 | // work for us until we figure out what's actually going on. |
| 786 | 786 | if (m_spu_ata_dma < 0x200000) |
| 787 | 787 | { |
| 788 | m_waveram[m_spu_ata_dma++] = data; | |
| 788 | m_waveram[m_spu_ata_dma++] = data; | |
| 789 | 789 | } |
| 790 | 790 | } |
| 791 | 791 | |
| r243232 | r243233 | |
| 808 | 808 | { |
| 809 | 809 | UINT16 result = m_spu_shared[offset]; |
| 810 | 810 | |
| 811 | // | |
| 811 | // printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask); | |
| 812 | 812 | |
| 813 | 813 | return result; |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | WRITE16_MEMBER(twinkle_state::shared_68k_w) |
| 817 | 817 | { |
| 818 | // | |
| 818 | // printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask); | |
| 819 | 819 | |
| 820 | 820 | m_spu_shared[offset] = data & 0xff; |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | READ16_MEMBER(twinkle_state::unk_68k_r) |
| 824 | 824 | { |
| 825 | return 0xffff; | |
| 825 | return 0xffff; // must return 0xff for 68000 POST to complete properly | |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state ) |
| r243232 | r243233 | |
| 840 | 840 | AM_RANGE(0x34000e, 0x34000f) AM_WRITENOP |
| 841 | 841 | AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w) |
| 842 | 842 | AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w ) |
| 843 | AM_RANGE(0xfe0000, 0xffffff) AM_RAM | |
| 843 | AM_RANGE(0xfe0000, 0xffffff) AM_RAM // ...and the RAM test checks this last 128k (mirror of the work RAM at 0x100000?) | |
| 844 | 844 | ADDRESS_MAP_END |
| 845 | 845 | |
| 846 | 846 | /* SCSI */ |
| r243232 | r243233 | |
|---|---|---|
| 795 | 795 | ROM_REGION( 0x10000, "audio_cpu", 0 ) |
| 796 | 796 | ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) ) |
| 797 | 797 | |
| 798 | ROM_REGION( 0x | |
| 798 | ROM_REGION( 0x8000, "char_tiles", 0 ) | |
| 799 | 799 | ROM_LOAD( "8411-136027-156.204", 0x0000, 0x4000, CRC(60f3c616) SHA1(59c4361891e4274e27e6279c919e8fd6803af7cf) ) |
| 800 | 800 | ROM_LOAD( "8411-136027-155.174", 0x4000, 0x4000, CRC(e59a6b72) SHA1(c10efa77ab421ac60b97227a8d547f50f8415670) ) |
| 801 | 801 | |
| 802 | ROM_REGION( 0x | |
| 802 | ROM_REGION( 0x10000, "obj_tiles", 0 ) | |
| 803 | 803 | ROM_LOAD( "8411-136027-114.203", 0x0000, 0x4000, CRC(fc91328b) SHA1(e57fd2056b65d37cf2e1f0af56616c6555df3006) ) |
| 804 | 804 | ROM_LOAD( "8411-136027-116.258", 0x4000, 0x4000, CRC(5745f671) SHA1(6e471633cd6de9926b3361a84430c088e1f6a097) ) |
| 805 | 805 | ROM_LOAD( "8411-136027-115.173", 0x8000, 0x4000, CRC(720e5873) SHA1(151d9063c35b26f5876cf94bdf0c2665ec701bbd) ) |
| 806 | 806 | ROM_LOAD( "8411-136027-117.232", 0xc000, 0x4000, CRC(3c68d0bc) SHA1(2dbaf2a268b90214fd61c016ac945d4371057826) ) |
| 807 | 807 | |
| 808 | ROM_REGION( 0x | |
| 808 | ROM_REGION( 0x6000, "road", 0 ) | |
| 809 | 809 | ROM_LOAD( "8411-136027-146.56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) ) |
| 810 | 810 | ROM_LOAD( "8411-136027-147.66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) ) |
| 811 | 811 | ROM_LOAD( "8411-136027-148.76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) ) |
| r243232 | r243233 | |
| 816 | 816 | ROM_LOAD16_BYTE( "136027-143.ic223", 0x8000, 0x0200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) ) |
| 817 | 817 | ROM_LOAD16_BYTE( "136027-142.ic213", 0x8001, 0x0200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) ) |
| 818 | 818 | |
| 819 | ROM_REGION( 0x | |
| 819 | ROM_REGION( 0x8000, "obj_map", 0 ) | |
| 820 | 820 | ROM_LOAD( "8411-136027-119.106", 0x0000, 0x4000, CRC(88eec0fb) SHA1(81d7a69dc1a4b3b81d7f28d97a3f80697cdcc6eb) ) |
| 821 | 821 | ROM_LOAD( "8411-136027-120.73", 0x4000, 0x4000, CRC(407cbe65) SHA1(e1c11b65f3c6abde6d55afeaffdb39cdd6d66377) ) |
| 822 | 822 | |
| 823 | ROM_REGION( 0x | |
| 823 | ROM_REGION( 0x6000, "obj_luts", 0 ) | |
| 824 | 824 | ROM_LOAD( "8411-136027-113.48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) ) |
| 825 | 825 | ROM_LOAD( "8411-136027-118.281", 0x2000, 0x4000, CRC(de418dc7) SHA1(1233e2f7499ec5a73a40ee336d3fe26c06187784) ) |
| 826 | 826 | |
| r243232 | r243233 | |
| 882 | 882 | ROM_REGION( 0x10000, "audio_cpu", 0 ) |
| 883 | 883 | ROM_LOAD( "tx1_22h.ic9", 0x00000, 0x2000, CRC(66376232) SHA1(b8a026dae47173e7760eea4f52e67e525ad1b70b) ) |
| 884 | 884 | |
| 885 | ROM_REGION( 0x | |
| 885 | ROM_REGION( 0x8000, "char_tiles", 0 ) | |
| 886 | 886 | ROM_LOAD( "tx1_21a.ic204", 0x0000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) ) |
| 887 | 887 | ROM_LOAD( "tx1_20a.ic174", 0x4000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) ) |
| 888 | 888 | |
| 889 | ROM_REGION( 0x | |
| 889 | ROM_REGION( 0x10000, "obj_tiles", 0 ) | |
| 890 | 890 | ROM_LOAD( "tx1_16b.ic203", 0x0000, 0x4000, CRC(1141c965) SHA1(4b90c1428bcbd72d0449c064856a5596269b3fc6) ) |
| 891 | 891 | ROM_LOAD( "tx1_18b.ic258", 0x4000, 0x4000, CRC(0ad36d68) SHA1(fd5a65c56557c1bc9c0f3916f15f62500b52bfe0) ) |
| 892 | 892 | ROM_LOAD( "tx1_15b.ic173", 0x8000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) ) |
| 893 | 893 | ROM_LOAD( "tx1_17b.ic232", 0xc000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) ) |
| 894 | 894 | |
| 895 | ROM_REGION( 0x | |
| 895 | ROM_REGION( 0x6000, "road", 0 ) | |
| 896 | 896 | ROM_LOAD( "tx1_5a.ic56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) ) |
| 897 | 897 | ROM_LOAD( "tx1_6a.ic66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) ) |
| 898 | 898 | ROM_LOAD( "tx1_7a.ic76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) ) |
| r243232 | r243233 | |
| 903 | 903 | ROM_LOAD16_BYTE( "xb02b.ic223", 0x8000, 0x0200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) ) |
| 904 | 904 | ROM_LOAD16_BYTE( "xb01b.ic213", 0x8001, 0x0200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) ) |
| 905 | 905 | |
| 906 | ROM_REGION( 0x | |
| 906 | ROM_REGION( 0x8000, "obj_map", 0 ) | |
| 907 | 907 | ROM_LOAD( "tx1_14b.ic106", 0x0000, 0x4000, CRC(68c63d6e) SHA1(110e02b99c44d31041be588bd14642e26890ecbd) ) |
| 908 | 908 | ROM_LOAD( "tx1_13b.ic73", 0x4000, 0x4000, CRC(b0c581b2) SHA1(20926bc15e7c97045b219b828acfcdd99b8712a6) ) |
| 909 | 909 | |
| 910 | ROM_REGION( 0x | |
| 910 | ROM_REGION( 0x6000, "obj_luts", 0 ) | |
| 911 | 911 | ROM_LOAD( "tx1_12b.ic48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) ) |
| 912 | 912 | ROM_LOAD( "tx1_19b.ic281", 0x2000, 0x4000, CRC(cb250de6) SHA1(4bf3006986fb8cbb3dd4fa988e6471633614e4bb) ) |
| 913 | 913 | |
| r243232 | r243233 | |
| 963 | 963 | ROM_REGION( 0x10000, "audio_cpu", 0 ) /* Label was missing */ |
| 964 | 964 | ROM_LOAD( "8411-136027-157.11", 0x00000, 0x2000, CRC(10ae3075) SHA1(69c5f62f2473aba848383eed3cecf15e273d86ca) ) /* Unconfirmed TC013A or the later TC013B */ |
| 965 | 965 | |
| 966 | ROM_REGION( 0x | |
| 966 | ROM_REGION( 0x8000, "char_tiles", 0 ) | |
| 967 | 967 | ROM_LOAD( "tx1_21a.ic204", 0x0000, 0x4000, CRC(cd3441ad) SHA1(8e6597b3177b8aaa34ed3373d85fc4b6231e1333) ) |
| 968 | 968 | ROM_LOAD( "tx1_20a.ic174", 0x4000, 0x4000, CRC(dbe595fc) SHA1(1ed2f775f0a1b46a2ffbc056eb4ef732ed546d3c) ) |
| 969 | 969 | |
| 970 | ROM_REGION( 0x | |
| 970 | ROM_REGION( 0x10000, "obj_tiles", 0 ) | |
| 971 | 971 | ROM_LOAD( "tx1_16b.ic203", 0x0000, 0x4000, CRC(1141c965) SHA1(4b90c1428bcbd72d0449c064856a5596269b3fc6) ) |
| 972 | 972 | ROM_LOAD( "tx1_18b.ic258", 0x4000, 0x4000, CRC(0ad36d68) SHA1(fd5a65c56557c1bc9c0f3916f15f62500b52bfe0) ) |
| 973 | 973 | ROM_LOAD( "tx1_15b.ic173", 0x8000, 0x4000, CRC(30d1a8d5) SHA1(b4c585b7b8a8920bb3949d643e9e10c17d4009a0) ) |
| 974 | 974 | ROM_LOAD( "tx1_17b.ic232", 0xc000, 0x4000, CRC(364bb354) SHA1(a26581ca1088b979285471e2c6595048df84d75e) ) |
| 975 | 975 | |
| 976 | ROM_REGION( 0x | |
| 976 | ROM_REGION( 0x6000, "road", 0 ) | |
| 977 | 977 | ROM_LOAD( "tx1_5a.ic56", 0x0000, 0x2000, CRC(5635b8c1) SHA1(5cc9437a2ff0843f1917f2451852d4561c240b24) ) |
| 978 | 978 | ROM_LOAD( "tx1_6a.ic66", 0x2000, 0x2000, CRC(03d83cf8) SHA1(5c0cfc6bf02ad2b3f37e1ceb493f69eb9829ab1e) ) |
| 979 | 979 | ROM_LOAD( "tx1_7a.ic76", 0x4000, 0x2000, CRC(ad56013a) SHA1(ae3a91f58f30daff334754476db33ad1d12569fc) ) |
| r243232 | r243233 | |
| 984 | 984 | ROM_LOAD16_BYTE( "xb02b.ic223", 0x8000, 0x0200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) ) |
| 985 | 985 | ROM_LOAD16_BYTE( "xb01b.ic213", 0x8001, 0x0200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) ) |
| 986 | 986 | |
| 987 | ROM_REGION( 0x | |
| 987 | ROM_REGION( 0x8000, "obj_map", 0 ) | |
| 988 | 988 | ROM_LOAD( "tx1_14b.ic106", 0x0000, 0x4000, CRC(68c63d6e) SHA1(110e02b99c44d31041be588bd14642e26890ecbd) ) |
| 989 | 989 | ROM_LOAD( "tx1_13b.ic73", 0x4000, 0x4000, CRC(b0c581b2) SHA1(20926bc15e7c97045b219b828acfcdd99b8712a6) ) |
| 990 | 990 | |
| 991 | ROM_REGION( 0x | |
| 991 | ROM_REGION( 0x6000, "obj_luts", 0 ) | |
| 992 | 992 | ROM_LOAD( "tx1_12b.ic48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) ) |
| 993 | 993 | ROM_LOAD( "tx1_19b.ic281", 0x2000, 0x4000, CRC(cb250de6) SHA1(4bf3006986fb8cbb3dd4fa988e6471633614e4bb) ) |
| 994 | 994 | |
| r243232 | r243233 | |
| 1072 | 1072 | ROM_LOAD( "bug25.157", 0x2c000, 0x4000, CRC(80c4e045) SHA1(be3b537d3ed3ee74fc51059aa744dca4d63431f6) ) |
| 1073 | 1073 | ROM_RELOAD( 0x38000, 0x4000 ) |
| 1074 | 1074 | |
| 1075 | ROM_REGION( 0x | |
| 1075 | ROM_REGION( 0x8000, "road", 0 ) | |
| 1076 | 1076 | ROM_LOAD( "bug12.58", 0x0000, 0x2000, CRC(bd34d55c) SHA1(05a719a6eff5af3aaaa1e0ee783b18597582ed64) ) |
| 1077 | 1077 | ROM_LOAD( "bug11.57", 0x2000, 0x2000, CRC(a44d43eb) SHA1(c4d68c7e123506acaa6adc353579cac19ecb3a9d) ) |
| 1078 | 1078 | ROM_LOAD( "bb3.137", 0x4000, 0x0200, CRC(ad76f3fb) SHA1(bf96f903b32e009a2592df0f28cc3e20b039f4d4) ) |
| r243232 | r243233 | |
| 1086 | 1086 | ROM_LOAD16_BYTE( "bb1.245", 0x8000, 0x0200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) ) |
| 1087 | 1087 | ROM_LOAD16_BYTE( "bb2.220", 0x8001, 0x0200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) ) |
| 1088 | 1088 | |
| 1089 | ROM_REGION( 0x10000 | |
| 1089 | ROM_REGION( 0x10000, "obj_map", 0 ) | |
| 1090 | 1090 | ROM_LOAD( "bug16.210", 0x0000, 0x4000, CRC(8b64409e) SHA1(1fb4c6923e6a9e1f2a63a2c335b63e2bdc44b61f) ) |
| 1091 | 1091 | ROM_LOAD( "bug14.209", 0x4000, 0x4000, CRC(4e765282) SHA1(f7d69d39823a8b33bd0e5b1bd78a5d68a293e221) ) |
| 1092 | 1092 | ROM_LOAD( "bug17.182", 0x8000, 0x4000, CRC(a5d84df6) SHA1(4e33ef0bee383e0d47b0c679cd2a54edb7ca0e3e) ) |
| 1093 | 1093 | ROM_LOAD( "bug15.181", 0xc000, 0x4000, CRC(d519de10) SHA1(535d05e11af65be65f3d9924b0c48faf8dcfd1bf) ) |
| 1094 | 1094 | |
| 1095 | ROM_REGION( 0x | |
| 1095 | ROM_REGION( 0x6000, "obj_luts", 0 ) | |
| 1096 | 1096 | ROM_LOAD( "bug13.124", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) ) |
| 1097 | 1097 | ROM_LOAD( "bug18.156", 0x2000, 0x4000, CRC(e58321a6) SHA1(81be87d3c6046bb375c74362dc940f0269b39d1d) ) |
| 1098 | 1098 | |
| r243232 | r243233 | |
| 1161 | 1161 | ROM_LOAD( "bug30s.145", 0x20000, 0x8000, CRC(11d8e2a8) SHA1(9bf198229a12d331e8e7352b7ee3f39f6891f517) ) |
| 1162 | 1162 | ROM_LOAD( "bug23s.142", 0x28000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) ) |
| 1163 | 1163 | |
| 1164 | ROM_REGION( 0x | |
| 1164 | ROM_REGION( 0x8000, "road", 0 ) | |
| 1165 | 1165 | ROM_LOAD( "bug11s.225",0x0000, 0x4000, CRC(771af4e1) SHA1(a42b164dd0567c78c0d308ee48d63e5a284897bb) ) |
| 1166 | 1166 | ROM_LOAD( "bb3s.195", 0x4000, 0x0200, CRC(2ab3d5ff) SHA1(9f8359cb4ba2e7d15dbb9dc21cd71c0902cd2153) ) |
| 1167 | 1167 | ROM_LOAD( "bb4s.193", 0x4200, 0x0200, CRC(630f68a4) SHA1(d730f050353c688f81d090e33e00cd35e7b7b6fa) ) |
| r243232 | r243233 | |
| 1174 | 1174 | ROM_LOAD16_BYTE( "bb1.163", 0x8000, 0x0200, CRC(0ddbd36d) SHA1(7a08901a350c315d46ab8d0aa881db384b9f37d2) ) |
| 1175 | 1175 | ROM_LOAD16_BYTE( "bb2.162", 0x8001, 0x0200, CRC(71d47de1) SHA1(2da9aeb3f2ebb1114631c8042a37c4f4c18e741b) ) |
| 1176 | 1176 | |
| 1177 | ROM_REGION( 0x10000 | |
| 1177 | ROM_REGION( 0x10000, "obj_map", 0 ) | |
| 1178 | 1178 | ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) ) |
| 1179 | 1179 | ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) ) |
| 1180 | 1180 | |
| 1181 | ROM_REGION( 0x | |
| 1181 | ROM_REGION( 0x6000, "obj_luts", 0 ) | |
| 1182 | 1182 | ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) ) |
| 1183 | 1183 | ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) ) |
| 1184 | 1184 |
| r243232 | r243233 | |
|---|---|---|
| 26 | 26 | |
| 27 | 27 | UINT32 *m_vega_vram; |
| 28 | 28 | UINT8 m_vega_vbuffer; |
| 29 | ||
| 29 | ||
| 30 | 30 | DECLARE_WRITE32_MEMBER(vega_vram_w); |
| 31 | 31 | DECLARE_READ32_MEMBER(vega_vram_r); |
| 32 | 32 | DECLARE_WRITE32_MEMBER(vega_misc_w); |
| r243232 | r243233 | |
|---|---|---|
| 3535 | 3535 | GAME( 1981, pulsar, 0, pulsar, pulsar, driver_device, 0, ROT270, "Sega", "Pulsar", GAME_IMPERFECT_SOUND ) |
| 3536 | 3536 | GAME( 1979, heiankyo, 0, heiankyo, heiankyo, driver_device, 0, ROT270, "Denki Onkyo", "Heiankyo Alien", GAME_NO_SOUND ) |
| 3537 | 3537 | GAME( 19??, alphaho, 0, alphaho, alphaho, driver_device, 0, ROT270, "Data East Corporation", "Alpha Fighter / Head On", GAME_WRONG_COLORS | GAME_NO_SOUND ) |
| 3538 |
| r243232 | r243233 | |
|---|---|---|
| 90 | 90 | DECLARE_WRITE8_MEMBER(coh1001l_bank_w); |
| 91 | 91 | DECLARE_WRITE16_MEMBER(coh1001l_latch_w); |
| 92 | 92 | DECLARE_WRITE16_MEMBER(coh1001l_sound_unk_w); |
| 93 | DECLARE_WRITE_LINE_MEMBER(coh1001l_ymz_irq); | |
| 94 | 93 | DECLARE_WRITE8_MEMBER(coh1002v_bank_w); |
| 95 | 94 | DECLARE_WRITE8_MEMBER(coh1002m_bank_w); |
| 96 | 95 | DECLARE_READ8_MEMBER(cbaj_sound_main_status_r); |
| r243232 | r243233 | |
| 2273 | 2272 | VSync - 60Hz |
| 2274 | 2273 | */ |
| 2275 | 2274 | |
| 2276 | WRITE_LINE_MEMBER(zn_state::coh1001l_ymz_irq) | |
| 2277 | { | |
| 2278 | m_audiocpu->set_input_line(2, state ? ASSERT_LINE : CLEAR_LINE); | |
| 2279 | } | |
| 2280 | ||
| 2281 | 2275 | WRITE16_MEMBER(zn_state::coh1001l_sound_unk_w) |
| 2282 | 2276 | { |
| 2283 | 2277 | // irq ack maybe? |
| r243232 | r243233 | |
| 2326 | 2320 | MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1001l) |
| 2327 | 2321 | |
| 2328 | 2322 | MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) |
| 2329 | MCFG_YMZ280B_IRQ_HANDLER( | |
| 2323 | MCFG_YMZ280B_IRQ_HANDLER(INPUTLINE("audiocpu", 2)) | |
| 2330 | 2324 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) |
| 2331 | 2325 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.35) |
| 2332 | 2326 | MACHINE_CONFIG_END |
| r243232 | r243233 | |
|---|---|---|
| 592 | 592 | DECLARE_MACHINE_START(sc4); |
| 593 | 593 | DECLARE_MACHINE_RESET(sc4); |
| 594 | 594 | |
| 595 | DECLARE_WRITE_LINE_MEMBER(bfm_sc4_irqhandler); | |
| 596 | 595 | |
| 597 | 596 | void bfm_sc4_68307_porta_w(address_space &space, bool dedicated, UINT8 data, UINT8 line_mask); |
| 598 | 597 | DECLARE_WRITE8_MEMBER( bfm_sc4_reel3_w ); |
| r243232 | r243233 | |
|---|---|---|
| 16 | 16 | required_device<m68000_base_device> m_maincpu; |
| 17 | 17 | |
| 18 | 18 | DECLARE_DRIVER_INIT(sc5); |
| 19 | DECLARE_WRITE_LINE_MEMBER(bfm_sc5_ym_irqhandler); | |
| 20 | 19 | DECLARE_READ8_MEMBER( sc5_10202F0_r ); |
| 21 | 20 | DECLARE_WRITE8_MEMBER( sc5_10202F0_w ); |
| 22 | 21 | DECLARE_WRITE16_MEMBER( sc5_duart_w ); |
| r243232 | r243233 | |
|---|---|---|
| 55 | 55 | virtual void video_start(); |
| 56 | 56 | UINT32 screen_update_bishi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 57 | 57 | TIMER_DEVICE_CALLBACK_MEMBER(bishi_scanline); |
| 58 | DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); | |
| 59 | 58 | K056832_CB_MEMBER(tile_callback); |
| 60 | 59 | }; |
| r243232 | r243233 | |
|---|---|---|
| 21 | 21 | m_colorram(*this, "colorram"), |
| 22 | 22 | m_colorram2(*this, "colorram2"), |
| 23 | 23 | m_spriteram(*this, "spriteram") { } |
| 24 | ||
| 24 | ||
| 25 | 25 | /* devices */ |
| 26 | 26 | required_device<cpu_device> m_maincpu; |
| 27 | 27 | required_device<gfxdecode_device> m_gfxdecode; |
| 28 | 28 | required_device<palette_device> m_palette; |
| 29 | 29 | required_device<ay8910_device> m_ay1; |
| 30 | 30 | required_device<ay8910_device> m_ay2; |
| 31 | ||
| 31 | ||
| 32 | 32 | /* memory pointers */ |
| 33 | 33 | required_shared_ptr<UINT8> m_videoram; |
| 34 | 34 | required_shared_ptr<UINT8> m_videoram2; |
| r243232 | r243233 | |
| 45 | 45 | int m_psg_latch; |
| 46 | 46 | int m_last_write; |
| 47 | 47 | int m_colbank; |
| 48 | ||
| 48 | ||
| 49 | 49 | DECLARE_WRITE8_MEMBER(ay8910_latch_w); |
| 50 | 50 | DECLARE_WRITE8_MEMBER(ay8910_control_w); |
| 51 | 51 | DECLARE_WRITE8_MEMBER(videoram_w); |
| r243232 | r243233 | |
| 54 | 54 | DECLARE_WRITE8_MEMBER(colorram2_w); |
| 55 | 55 | DECLARE_WRITE8_MEMBER(paletteram_w); |
| 56 | 56 | DECLARE_WRITE8_MEMBER(colbank_w); |
| 57 | ||
| 57 | ||
| 58 | 58 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 59 | 59 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 60 | ||
| 60 | ||
| 61 | 61 | virtual void machine_start(); |
| 62 | 62 | virtual void machine_reset(); |
| 63 | 63 | virtual void video_start(); |
| 64 | ||
| 64 | ||
| 65 | 65 | DECLARE_PALETTE_INIT(bogeyman); |
| 66 | 66 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 67 | 67 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| r243232 | r243233 | |
|---|---|---|
| 51 | 51 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 52 | 52 | UINT32 screen_update_calomega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 53 | 53 | DECLARE_PALETTE_INIT(calomega); |
| 54 | ||
| 54 | ||
| 55 | 55 | protected: |
| 56 | 56 | virtual void video_start(); |
| 57 | 57 | |
| r243232 | r243233 | |
| 64 | 64 | |
| 65 | 65 | required_shared_ptr<UINT8> m_videoram; |
| 66 | 66 | required_shared_ptr<UINT8> m_colorram; |
| 67 | ||
| 67 | ||
| 68 | 68 | optional_ioport m_in0; |
| 69 | 69 | optional_ioport m_in0_0; |
| 70 | 70 | optional_ioport m_in0_1; |
| r243232 | r243233 | |
| 72 | 72 | optional_ioport m_in0_3; |
| 73 | 73 | optional_ioport m_frq; |
| 74 | 74 | optional_ioport m_sw2; |
| 75 | ||
| 75 | ||
| 76 | 76 | UINT8 m_tx_line; |
| 77 | 77 | int m_s903_mux_data; |
| 78 | 78 | int m_s905_mux_data; |
| r243232 | r243233 | |
|---|---|---|
| 37 | 37 | m_paletteram(*this, "paletteram"), |
| 38 | 38 | m_maincpu(*this, "maincpu"), |
| 39 | 39 | m_audiocpu(*this, "audiocpu"), |
| 40 | m_nmk112(*this, "nmk112"), | |
| 41 | 40 | m_oki(*this, "oki"), |
| 42 | 41 | m_int_timer(*this, "int_timer"), |
| 43 | 42 | m_int_timer_left(*this, "int_timer_left"), |
| r243232 | r243233 | |
| 122 | 121 | /* devices */ |
| 123 | 122 | required_device<cpu_device> m_maincpu; |
| 124 | 123 | optional_device<cpu_device> m_audiocpu; |
| 125 | optional_device<nmk112_device> m_nmk112; | |
| 126 | 124 | optional_device<okim6295_device> m_oki; |
| 127 | 125 | required_device<timer_device> m_int_timer; |
| 128 | 126 | optional_device<timer_device> m_int_timer_left; |
| r243232 | r243233 | |
|---|---|---|
| 24 | 24 | m_paletteram(*this, "palette"), |
| 25 | 25 | m_robocop_shared_ram(*this, "robocop_shared"), |
| 26 | 26 | m_hippodrm_shared_ram(*this, "hippodrm_shared") { } |
| 27 | ||
| 27 | ||
| 28 | 28 | required_device<cpu_device> m_maincpu; |
| 29 | 29 | required_device<cpu_device> m_audiocpu; |
| 30 | 30 | optional_device<cpu_device> m_subcpu; |
| r243232 | r243233 | |
| 77 | 77 | DECLARE_READ16_MEMBER(ffantasybl_242024_r); |
| 78 | 78 | DECLARE_WRITE_LINE_MEMBER(sound_irq); |
| 79 | 79 | DECLARE_WRITE_LINE_MEMBER(sound_irq2); |
| 80 | ||
| 80 | ||
| 81 | 81 | DECLARE_DRIVER_INIT(robocop); |
| 82 | 82 | DECLARE_DRIVER_INIT(hippodrm); |
| 83 | 83 | DECLARE_DRIVER_INIT(hbarrel); |
| r243232 | r243233 | |
| 86 | 86 | DECLARE_DRIVER_INIT(baddudes); |
| 87 | 87 | DECLARE_DRIVER_INIT(midresb); |
| 88 | 88 | DECLARE_DRIVER_INIT(ffantasybl); |
| 89 | ||
| 89 | ||
| 90 | 90 | virtual void machine_start(); |
| 91 | 91 | DECLARE_MACHINE_RESET(slyspy); |
| 92 | 92 | DECLARE_VIDEO_START(dec0); |
| 93 | 93 | DECLARE_VIDEO_START(dec0_nodma); |
| 94 | ||
| 94 | ||
| 95 | 95 | UINT32 screen_update_hbarrel(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 96 | 96 | UINT32 screen_update_baddudes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 97 | 97 | UINT32 screen_update_birdtry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| r243232 | r243233 | |
| 99 | 99 | UINT32 screen_update_hippodrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 100 | 100 | UINT32 screen_update_slyspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 101 | 101 | UINT32 screen_update_midres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 102 | ||
| 102 | ||
| 103 | 103 | void baddudes_i8751_write(int data); |
| 104 | 104 | void birdtry_i8751_write(int data); |
| 105 | 105 | void dec0_i8751_write(int data); |
| r243232 | r243233 | |
| 118 | 118 | UINT8 m_automat_adpcm_byte; |
| 119 | 119 | int m_automat_msm5205_vclk_toggle; |
| 120 | 120 | UINT16 m_automat_scroll_regs[4]; |
| 121 | ||
| 121 | ||
| 122 | 122 | DECLARE_WRITE16_MEMBER(automat_control_w); |
| 123 | 123 | DECLARE_WRITE8_MEMBER(automat_adpcm_w); |
| 124 | 124 | DECLARE_READ16_MEMBER( automat_palette_r ); |
| r243232 | r243233 | |
| 128 | 128 | COMBINE_DATA(&m_automat_scroll_regs[offset]); |
| 129 | 129 | } |
| 130 | 130 | DECLARE_WRITE_LINE_MEMBER(automat_vclk_cb); |
| 131 | ||
| 131 | ||
| 132 | 132 | virtual void machine_start(); |
| 133 | ||
| 133 | ||
| 134 | 134 | UINT32 screen_update_automat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 135 | 135 | UINT32 screen_update_secretab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 136 | 136 | }; |
| r243232 | r243233 | |
|---|---|---|
| 213 | 213 | DECLARE_WRITE8_MEMBER(jantouki_blitter2_rev2_w); |
| 214 | 214 | DECLARE_WRITE8_MEMBER(hanamai_priority_w); |
| 215 | 215 | DECLARE_WRITE8_MEMBER(tenkai_priority_w); |
| 216 | ||
| 216 | ||
| 217 | 217 | DECLARE_DRIVER_INIT(mjelct3); |
| 218 | 218 | DECLARE_DRIVER_INIT(blktouch); |
| 219 | 219 | DECLARE_DRIVER_INIT(mjelct3a); |
| 220 | 220 | DECLARE_DRIVER_INIT(mjreach); |
| 221 | 221 | DECLARE_DRIVER_INIT(maya); |
| 222 | ||
| 222 | ||
| 223 | 223 | UINT32 screen_update_hanamai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 224 | 224 | UINT32 screen_update_hnoridur(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 225 | 225 | UINT32 screen_update_sprtmtch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 226 | 226 | UINT32 screen_update_mjdialq2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 227 | 227 | UINT32 screen_update_jantouki_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 228 | 228 | UINT32 screen_update_jantouki_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 229 | ||
| 229 | ||
| 230 | 230 | INTERRUPT_GEN_MEMBER(sprtmtch_vblank_interrupt); |
| 231 | 231 | INTERRUPT_GEN_MEMBER(jantouki_vblank_interrupt); |
| 232 | 232 | INTERRUPT_GEN_MEMBER(jantouki_sound_vblank_interrupt); |
| 233 | 233 | INTERRUPT_GEN_MEMBER(yarunara_clock_interrupt); |
| 234 | 234 | INTERRUPT_GEN_MEMBER(mjelctrn_vblank_interrupt); |
| 235 | ||
| 235 | ||
| 236 | 236 | TIMER_DEVICE_CALLBACK_MEMBER(neruton_irq_scanline); |
| 237 | 237 | TIMER_DEVICE_CALLBACK_MEMBER(majxtal7_vblank_interrupt); |
| 238 | 238 | TIMER_DEVICE_CALLBACK_MEMBER(tenkai_interrupt); |
| 239 | ||
| 239 | ||
| 240 | 240 | void tenkai_update_rombank(); |
| 241 | 241 | void gekisha_bank_postload(); |
| 242 | ||
| 242 | ||
| 243 | 243 | DECLARE_WRITE_LINE_MEMBER(sprtmtch_sound_callback); |
| 244 | 244 | DECLARE_WRITE_LINE_MEMBER(jantouki_sound_callback); |
| 245 | 245 | DECLARE_WRITE_LINE_MEMBER(adpcm_int); |
| r243232 | r243233 | |
| 268 | 268 | DECLARE_VIDEO_START(mcnpshnt); |
| 269 | 269 | DECLARE_PALETTE_INIT(janyuki); |
| 270 | 270 | DECLARE_VIDEO_START(neruton); |
| 271 | ||
| 271 | ||
| 272 | 272 | inline void blitter_plot_pixel( int layer, int mask, int x, int y, int pen, int wrap, int flags ); |
| 273 | 273 | int blitter_drawgfx( int layer, int mask, const char *gfx, int src, int pen, int x, int y, int wrap, int flags ); |
| 274 | 274 | void dynax_blitter_start( int flags ); |
| r243232 | r243233 | |
|---|---|---|
| 27 | 27 | optional_device<qs1000_device> m_qs1000; |
| 28 | 28 | required_device<screen_device> m_screen; |
| 29 | 29 | required_device<palette_device> m_palette; |
| 30 | ||
| 30 | ||
| 31 | 31 | optional_ioport m_in0; // klondkp doesn't have it |
| 32 | 32 | optional_ioport m_eepromoutport; |
| 33 | 33 | optional_ioport m_penx1port; |
| 34 | 34 | optional_ioport m_peny1port; |
| 35 | 35 | optional_ioport m_penx2port; |
| 36 | 36 | optional_ioport m_peny2port; |
| 37 | ||
| 37 | ||
| 38 | 38 | optional_memory_bank m_sndbank; |
| 39 | ||
| 39 | ||
| 40 | 40 | int m_coin_counter_bit; |
| 41 | 41 | int m_buffer; |
| 42 | 42 | UINT32 *m_vram; |
| 43 | 43 | |
| 44 | 44 | UINT8 m_sound_data; |
| 45 | ||
| 45 | ||
| 46 | 46 | // speedups - see machine/eolithsp.c |
| 47 | 47 | int m_speedup_address; |
| 48 | 48 | int m_speedup_address2; |
| r243232 | r243233 | |
| 66 | 66 | DECLARE_READ8_MEMBER(qs1000_p1_r); |
| 67 | 67 | DECLARE_WRITE8_MEMBER(qs1000_p1_w); |
| 68 | 68 | DECLARE_WRITE8_MEMBER(soundcpu_to_qs1000); |
| 69 | ||
| 69 | ||
| 70 | 70 | DECLARE_DRIVER_INIT(eolith); |
| 71 | 71 | DECLARE_DRIVER_INIT(landbrk); |
| 72 | 72 | DECLARE_DRIVER_INIT(hidctch3); |
| 73 | 73 | DECLARE_DRIVER_INIT(hidctch2); |
| 74 | 74 | DECLARE_DRIVER_INIT(hidnc2k); |
| 75 | 75 | DECLARE_DRIVER_INIT(landbrka); |
| 76 | ||
| 76 | ||
| 77 | 77 | DECLARE_MACHINE_RESET(eolith); |
| 78 | 78 | DECLARE_VIDEO_START(eolith); |
| 79 | ||
| 79 | ||
| 80 | 80 | UINT32 screen_update_eolith(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 81 | ||
| 81 | ||
| 82 | 82 | TIMER_DEVICE_CALLBACK_MEMBER(eolith_speedup); |
| 83 | 83 | }; |
| r243232 | r243233 | |
|---|---|---|
| 57 | 57 | required_device<gfxdecode_device> m_gfxdecode; |
| 58 | 58 | required_device<screen_device> m_screen; |
| 59 | 59 | required_device<palette_device> m_palette; |
| 60 | ||
| 60 | ||
| 61 | 61 | required_shared_ptr<UINT8> m_videoram; |
| 62 | 62 | required_shared_ptr<UINT8> m_sprite1_xpos; |
| 63 | 63 | required_shared_ptr<UINT8> m_sprite1_ypos; |
| r243232 | r243233 | |
| 77 | 77 | bitmap_ind16 m_motion_object_1_vid; |
| 78 | 78 | bitmap_ind16 m_motion_object_2_vid; |
| 79 | 79 | bitmap_ind16 m_motion_object_2_clip; |
| 80 | ||
| 80 | ||
| 81 | 81 | DECLARE_WRITE8_MEMBER(fax_bank_select_w); |
| 82 | 82 | DECLARE_READ8_MEMBER(exidy_interrupt_r); |
| 83 | ||
| 83 | ||
| 84 | 84 | DECLARE_CUSTOM_INPUT_MEMBER(teetert_input_r); |
| 85 | ||
| 85 | ||
| 86 | 86 | DECLARE_DRIVER_INIT(fax); |
| 87 | 87 | DECLARE_DRIVER_INIT(sidetrac); |
| 88 | 88 | DECLARE_DRIVER_INIT(pepper2); |
| r243232 | r243233 | |
| 93 | 93 | DECLARE_DRIVER_INIT(venture); |
| 94 | 94 | DECLARE_DRIVER_INIT(spectar); |
| 95 | 95 | DECLARE_DRIVER_INIT(phantoma); |
| 96 | ||
| 96 | ||
| 97 | 97 | virtual void video_start(); |
| 98 | 98 | DECLARE_MACHINE_START(teetert); |
| 99 | ||
| 99 | ||
| 100 | 100 | UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 101 | ||
| 101 | ||
| 102 | 102 | INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt); |
| 103 | ||
| 103 | ||
| 104 | 104 | void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp); |
| 105 | 105 | inline void latch_condition(int collision); |
| 106 | 106 | inline void set_1_color(int index, int which); |
| r243232 | r243233 | |
|---|---|---|
| 32 | 32 | int m_highcolorflag; |
| 33 | 33 | int m_flipscreen; |
| 34 | 34 | bitmap_rgb32 m_tmpbitmap; |
| 35 | ||
| 35 | ||
| 36 | 36 | DECLARE_WRITE8_MEMBER(hyhoo_blitter_w); |
| 37 | 37 | DECLARE_WRITE8_MEMBER(hyhoo_romsel_w); |
| 38 | ||
| 38 | ||
| 39 | 39 | DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r); |
| 40 | ||
| 40 | ||
| 41 | 41 | virtual void video_start(); |
| 42 | ||
| 42 | ||
| 43 | 43 | UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 44 | 44 | void hyhoo_gfxdraw(); |
| 45 | 45 |
| r243232 | r243233 | |
|---|---|---|
| 13 | 13 | m_scroll_x_high(*this, "scroll_x_high"), |
| 14 | 14 | m_scroll_y_low(*this, "scroll_y_low"), |
| 15 | 15 | m_score_panel_disabled(*this, "score_disable") { } |
| 16 | ||
| 16 | ||
| 17 | 17 | /* devices */ |
| 18 | 18 | required_device<cpu_device> m_maincpu; |
| 19 | 19 | required_device<gfxdecode_device> m_gfxdecode; |
| 20 | 20 | required_device<screen_device> m_screen; |
| 21 | 21 | required_device<palette_device> m_palette; |
| 22 | ||
| 22 | ||
| 23 | 23 | /* memory pointers */ |
| 24 | 24 | required_shared_ptr<UINT8> m_videoram; |
| 25 | 25 | required_shared_ptr<UINT8> m_spriteram; |
| r243232 | r243233 | |
| 31 | 31 | /* video-related */ |
| 32 | 32 | tilemap_t* m_bg_tilemap; |
| 33 | 33 | bitmap_ind16 m_scroll_panel_bitmap; |
| 34 | ||
| 34 | ||
| 35 | 35 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 36 | 36 | DECLARE_WRITE8_MEMBER(scroll_panel_w); |
| 37 | 37 | DECLARE_WRITE8_MEMBER(flipscreen_w); |
| 38 | ||
| 38 | ||
| 39 | 39 | DECLARE_DRIVER_INIT(yard85); |
| 40 | 40 | virtual void video_start(); |
| 41 | 41 | DECLARE_PALETTE_INIT(m58); |
| 42 | ||
| 42 | ||
| 43 | 43 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 44 | 44 | TILEMAP_MAPPER_MEMBER(tilemap_scan_rows); |
| 45 | ||
| 45 | ||
| 46 | 46 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 47 | 47 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 48 | 48 | void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| r243232 | r243233 | |
|---|---|---|
| 54 | 54 | m_discrete(*this, "discrete"), |
| 55 | 55 | #else |
| 56 | 56 | 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"), | |
| 59 | 59 | #endif |
| 60 | 60 | m_spriteram(*this, "spriteram"), |
| 61 | 61 | m_videoram(*this, "videoram"), |
| r243232 | r243233 | |
| 71 | 71 | optional_device<discrete_device> m_discrete; |
| 72 | 72 | #else |
| 73 | 73 | 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; | |
| 76 | 76 | #endif |
| 77 | 77 | |
| 78 | 78 | /* memory pointers */ |
| r243232 | r243233 | |
|---|---|---|
| 224 | 224 | DECLARE_WRITE32_MEMBER(copro_tgp_fifoout_push); |
| 225 | 225 | DECLARE_READ8_MEMBER(virtuacop_lightgun_r); |
| 226 | 226 | DECLARE_READ8_MEMBER(virtuacop_lightgun_offscreen_r); |
| 227 | ||
| 227 | ||
| 228 | 228 | UINT16 crypt_read_callback(UINT32 addr); |
| 229 | 229 | |
| 230 | 230 | bool copro_fifoin_pop(device_t *device, UINT32 *result,UINT32 offset, UINT32 mem_mask); |
| r243232 | r243233 | |
|---|---|---|
| 129 | 129 | |
| 130 | 130 | // (static) configuration helpers |
| 131 | 131 | static void set_type(device_t &device, int type) { downcast<nb1413m3_device &>(device).m_nb1413m3_type = type; } |
| 132 | ||
| 132 | ||
| 133 | 133 | enum |
| 134 | 134 | { |
| 135 | 135 | TIMER_CB |
| r243232 | r243233 | |
| 169 | 169 | virtual void device_start(); |
| 170 | 170 | virtual void device_reset(); |
| 171 | 171 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 172 | ||
| 172 | ||
| 173 | 173 | private: |
| 174 | 174 | |
| 175 | 175 | int m_74ls193_counter; |
| r243232 | r243233 | |
|---|---|---|
| 11 | 11 | m_audiocpu(*this, "audiocpu"), |
| 12 | 12 | m_oki1(*this, "oki1"), |
| 13 | 13 | m_oki2(*this, "oki2"), |
| 14 | m_nmk112(*this, "nmk112"), | |
| 15 | 14 | m_nmk_bgvideoram0(*this, "nmk_bgvideoram0"), |
| 16 | 15 | m_nmk_txvideoram(*this, "nmk_txvideoram"), |
| 17 | 16 | m_mainram(*this, "mainram"), |
| r243232 | r243233 | |
| 34 | 33 | optional_device<cpu_device> m_audiocpu; |
| 35 | 34 | optional_device<okim6295_device> m_oki1; |
| 36 | 35 | optional_device<okim6295_device> m_oki2; |
| 37 | optional_device<nmk112_device> m_nmk112; | |
| 38 | 36 | required_shared_ptr<UINT16> m_nmk_bgvideoram0; |
| 39 | 37 | optional_shared_ptr<UINT16> m_nmk_txvideoram; |
| 40 | 38 | required_shared_ptr<UINT16> m_mainram; |
| r243232 | r243233 | |
| 196 | 194 | void decode_gfx(); |
| 197 | 195 | void decode_tdragonb(); |
| 198 | 196 | void decode_ssmissin(); |
| 199 | DECLARE_WRITE_LINE_MEMBER(ym2203_irqhandler); | |
| 200 | ||
| 201 | 197 | }; |
| r243232 | r243233 | |
|---|---|---|
| 16 | 16 | m_videoram(*this, "videoram"), |
| 17 | 17 | m_paletteram(*this, "paletteram"), |
| 18 | 18 | m_spriteram(*this, "spriteram") { } |
| 19 | ||
| 19 | ||
| 20 | 20 | /* devices */ |
| 21 | 21 | required_device<cpu_device> m_maincpu; |
| 22 | 22 | optional_device<okim6295_device> m_oki2; |
| r243232 | r243233 | |
| 36 | 36 | tilemap_t *m_tilemap_0; |
| 37 | 37 | tilemap_t *m_tilemap_1; |
| 38 | 38 | tilemap_t *m_tilemap_2; |
| 39 | ||
| 39 | ||
| 40 | 40 | bitmap_ind16 m_tmpbitmap; |
| 41 | 41 | UINT8 m_palbank; |
| 42 | 42 | UINT8 m_priority; |
| 43 | 43 | UINT8 m_pixbank; |
| 44 | 44 | int m_sprite_inc; |
| 45 | 45 | int m_irq_count; |
| 46 | ||
| 46 | ||
| 47 | 47 | DECLARE_WRITE8_MEMBER(paradise_rombank_w); |
| 48 | 48 | DECLARE_WRITE8_MEMBER(torus_coin_counter_w); |
| 49 | 49 | DECLARE_WRITE8_MEMBER(paradise_flipscreen_w); |
| r243232 | r243233 | |
| 56 | 56 | DECLARE_WRITE8_MEMBER(paradise_pixmap_w); |
| 57 | 57 | DECLARE_WRITE8_MEMBER(paradise_priority_w); |
| 58 | 58 | DECLARE_WRITE8_MEMBER(paradise_okibank_w); |
| 59 | ||
| 59 | ||
| 60 | 60 | DECLARE_DRIVER_INIT(torus); |
| 61 | 61 | DECLARE_DRIVER_INIT(paradise); |
| 62 | 62 | DECLARE_DRIVER_INIT(tgtball); |
| 63 | ||
| 63 | ||
| 64 | 64 | TILE_GET_INFO_MEMBER(get_tile_info_0); |
| 65 | 65 | TILE_GET_INFO_MEMBER(get_tile_info_1); |
| 66 | 66 | TILE_GET_INFO_MEMBER(get_tile_info_2); |
| 67 | ||
| 67 | ||
| 68 | 68 | virtual void machine_start(); |
| 69 | 69 | virtual void machine_reset(); |
| 70 | 70 | virtual void video_start(); |
| 71 | ||
| 71 | ||
| 72 | 72 | UINT32 screen_update_paradise(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 73 | 73 | UINT32 screen_update_torus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 74 | 74 | UINT32 screen_update_madball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 75 | ||
| 75 | ||
| 76 | 76 | INTERRUPT_GEN_MEMBER(paradise_irq); |
| 77 | ||
| 77 | ||
| 78 | 78 | void update_pix_palbank(); |
| 79 | 79 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 80 | 80 | }; |
| r243232 | r243233 | |
|---|---|---|
| 34 | 34 | int m_palbank; |
| 35 | 35 | UINT8 *m_videoram; |
| 36 | 36 | int m_flipscreen_old; |
| 37 | ||
| 37 | ||
| 38 | 38 | DECLARE_READ8_MEMBER(pastelg_sndrom_r); |
| 39 | 39 | DECLARE_READ8_MEMBER(pastelg_irq_ack_r); |
| 40 | 40 | DECLARE_READ8_MEMBER(threeds_inputport1_r); |
| r243232 | r243233 | |
| 45 | 45 | DECLARE_WRITE8_MEMBER(threeds_output_w); |
| 46 | 46 | DECLARE_READ8_MEMBER(threeds_rom_readback_r); |
| 47 | 47 | DECLARE_WRITE8_MEMBER(pastelg_romsel_w); |
| 48 | ||
| 48 | ||
| 49 | 49 | DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_busyflag_r); |
| 50 | 50 | DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_hackbusyflag_r); |
| 51 | ||
| 51 | ||
| 52 | 52 | virtual void machine_start(); |
| 53 | 53 | virtual void video_start(); |
| 54 | ||
| 54 | ||
| 55 | 55 | DECLARE_PALETTE_INIT(pastelg); |
| 56 | 56 | UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 57 | 57 | int pastelg_blitter_src_addr_r(); |
| r243232 | r243233 | |
| 61 | 61 | protected: |
| 62 | 62 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 63 | 63 | }; |
| 64 |
| r243232 | r243233 | |
|---|---|---|
| 7 | 7 | : driver_device(mconfig, type, tag), |
| 8 | 8 | m_maincpu(*this, "maincpu"), |
| 9 | 9 | m_soundcpu(*this, "soundcpu"), |
| 10 | m_nmk112(*this, "nmk112"), | |
| 11 | 10 | m_vctrl_0(*this, "vctrl_0"), |
| 12 | 11 | m_vram_0(*this, "vram_0"), |
| 13 | 12 | m_vram_1(*this, "vram_1"), |
| r243232 | r243233 | |
| 20 | 19 | |
| 21 | 20 | required_device<cpu_device> m_maincpu; |
| 22 | 21 | optional_device<cpu_device> m_soundcpu; |
| 23 | optional_device<nmk112_device> m_nmk112; | |
| 24 | 22 | required_shared_ptr<UINT16> m_vctrl_0; |
| 25 | 23 | required_shared_ptr<UINT16> m_vram_0; |
| 26 | 24 | required_shared_ptr<UINT16> m_vram_1; |
| r243232 | r243233 | |
|---|---|---|
| 6 | 6 | quizpani_state(const machine_config &mconfig, device_type type, const char *tag) |
| 7 | 7 | : driver_device(mconfig, type, tag), |
| 8 | 8 | m_maincpu(*this, "maincpu"), |
| 9 | m_nmk112(*this, "nmk112"), | |
| 10 | 9 | m_scrollreg(*this, "scrollreg"), |
| 11 | 10 | m_bg_videoram(*this, "bg_videoram"), |
| 12 | 11 | m_txt_videoram(*this, "txt_videoram"), |
| 13 | 12 | m_gfxdecode(*this, "gfxdecode") { } |
| 14 | 13 | |
| 15 | 14 | required_device<cpu_device> m_maincpu; |
| 16 | required_device<nmk112_device> m_nmk112; | |
| 17 | 15 | required_shared_ptr<UINT16> m_scrollreg; |
| 18 | 16 | required_shared_ptr<UINT16> m_bg_videoram; |
| 19 | 17 | required_shared_ptr<UINT16> m_txt_videoram; |
| r243232 | r243233 | |
|---|---|---|
| 36 | 36 | required_device<dac_device> m_dac; |
| 37 | 37 | required_device<gfxdecode_device> m_gfxdecode; |
| 38 | 38 | required_device<palette_device> m_palette; |
| 39 | ||
| 39 | ||
| 40 | 40 | /* memory pointers */ |
| 41 | 41 | required_shared_ptr<UINT8> m_spriteram; |
| 42 | 42 | required_shared_ptr<UINT8> m_fgscroll; |
| r243232 | r243233 | |
| 58 | 58 | // game specific initialization |
| 59 | 59 | int m_is_senjyo; |
| 60 | 60 | int m_scrollhack; |
| 61 | ||
| 61 | ||
| 62 | 62 | UINT8 m_sound_cmd; |
| 63 | 63 | int m_single_volume; |
| 64 | 64 | int m_sound_state; |
| r243232 | r243233 | |
| 67 | 67 | tilemap_t *m_bg1_tilemap; |
| 68 | 68 | tilemap_t *m_bg2_tilemap; |
| 69 | 69 | tilemap_t *m_bg3_tilemap; |
| 70 | ||
| 70 | ||
| 71 | 71 | DECLARE_WRITE8_MEMBER(flip_screen_w); |
| 72 | 72 | DECLARE_WRITE8_MEMBER(paletteram_w); |
| 73 | 73 | DECLARE_WRITE8_MEMBER(starforb_scrolly2); |
| r243232 | r243233 | |
| 82 | 82 | DECLARE_WRITE8_MEMBER(sound_cmd_w); |
| 83 | 83 | DECLARE_WRITE8_MEMBER(irq_ctrl_w); |
| 84 | 84 | DECLARE_READ8_MEMBER(pio_pa_r); |
| 85 | ||
| 85 | ||
| 86 | 86 | DECLARE_DRIVER_INIT(starfora); |
| 87 | 87 | DECLARE_DRIVER_INIT(senjyo); |
| 88 | 88 | DECLARE_DRIVER_INIT(starfore); |
| 89 | 89 | DECLARE_DRIVER_INIT(starforc); |
| 90 | ||
| 90 | ||
| 91 | 91 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 92 | 92 | TILE_GET_INFO_MEMBER(senjyo_bg1_tile_info); |
| 93 | 93 | TILE_GET_INFO_MEMBER(starforc_bg1_tile_info); |
| 94 | 94 | TILE_GET_INFO_MEMBER(get_bg2_tile_info); |
| 95 | 95 | TILE_GET_INFO_MEMBER(get_bg3_tile_info); |
| 96 | ||
| 96 | ||
| 97 | 97 | virtual void machine_start(); |
| 98 | 98 | virtual void machine_reset(); |
| 99 | 99 | virtual void video_start(); |
| r243232 | r243233 | |
|---|---|---|
| 5 | 5 | public: |
| 6 | 6 | silkroad_state(const machine_config &mconfig, device_type type, const char *tag) |
| 7 | 7 | : driver_device(mconfig, type, tag), |
| 8 | m_maincpu(*this, "maincpu"), | |
| 9 | m_oki1(*this, "oki1"), | |
| 10 | m_gfxdecode(*this, "gfxdecode"), | |
| 11 | m_palette(*this, "palette"), | |
| 12 | m_generic_paletteram_32(*this, "paletteram"), | |
| 8 | 13 | m_vidram(*this, "vidram"), |
| 9 | 14 | m_vidram2(*this, "vidram2"), |
| 10 | 15 | m_vidram3(*this, "vidram3"), |
| 11 | 16 | m_sprram(*this, "sprram"), |
| 12 | m_regs(*this, "regs"), | |
| 13 | m_maincpu(*this, "maincpu"), | |
| 14 | m_oki1(*this, "oki1"), | |
| 15 | m_gfxdecode(*this, "gfxdecode"), | |
| 16 | m_palette(*this, "palette"), | |
| 17 | m_generic_paletteram_32(*this, "paletteram") { } | |
| 17 | m_regs(*this, "regs") { } | |
| 18 | 18 | |
| 19 | required_device<cpu_device> m_maincpu; | |
| 20 | required_device<okim6295_device> m_oki1; | |
| 21 | required_device<gfxdecode_device> m_gfxdecode; | |
| 22 | required_device<palette_device> m_palette; | |
| 23 | ||
| 24 | required_shared_ptr<UINT32> m_generic_paletteram_32; | |
| 19 | 25 | required_shared_ptr<UINT32> m_vidram; |
| 20 | 26 | required_shared_ptr<UINT32> m_vidram2; |
| 21 | 27 | required_shared_ptr<UINT32> m_vidram3; |
| 22 | 28 | required_shared_ptr<UINT32> m_sprram; |
| 23 | 29 | required_shared_ptr<UINT32> m_regs; |
| 30 | ||
| 24 | 31 | tilemap_t *m_fg_tilemap; |
| 25 | 32 | tilemap_t *m_fg2_tilemap; |
| 26 | 33 | tilemap_t *m_fg3_tilemap; |
| 34 | ||
| 27 | 35 | DECLARE_WRITE32_MEMBER(paletteram32_xRRRRRGGGGGBBBBB_dword_w); |
| 28 | 36 | DECLARE_WRITE32_MEMBER(silk_coin_counter_w); |
| 29 | 37 | DECLARE_WRITE32_MEMBER(silkroad_fgram_w); |
| 30 | 38 | DECLARE_WRITE32_MEMBER(silkroad_fgram2_w); |
| 31 | 39 | DECLARE_WRITE32_MEMBER(silkroad_fgram3_w); |
| 32 | 40 | DECLARE_WRITE32_MEMBER(silk_6295_bank_w); |
| 41 | ||
| 33 | 42 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 34 | 43 | TILE_GET_INFO_MEMBER(get_fg2_tile_info); |
| 35 | 44 | TILE_GET_INFO_MEMBER(get_fg3_tile_info); |
| 45 | ||
| 36 | 46 | virtual void video_start(); |
| 47 | ||
| 37 | 48 | UINT32 screen_update_silkroad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 38 | 49 | void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 39 | required_device<cpu_device> m_maincpu; | |
| 40 | required_device<okim6295_device> m_oki1; | |
| 41 | required_device<gfxdecode_device> m_gfxdecode; | |
| 42 | required_device<palette_device> m_palette; | |
| 43 | required_shared_ptr<UINT32> m_generic_paletteram_32; | |
| 44 | 50 | }; |
| r243232 | r243233 | |
|---|---|---|
| 19 | 19 | required_device<deco_bac06_device> m_tilegen1; |
| 20 | 20 | required_device<deco_mxc06_device> m_spritegen; |
| 21 | 21 | required_device<gfxdecode_device> m_gfxdecode; |
| 22 | ||
| 22 | ||
| 23 | 23 | required_shared_ptr<UINT16> m_spriteram; |
| 24 | 24 | required_shared_ptr<UINT16> m_pf1_data; |
| 25 | 25 | |
| 26 | 26 | tilemap_t *m_pf1_tilemap; |
| 27 | ||
| 27 | ||
| 28 | 28 | DECLARE_WRITE16_MEMBER(stadhero_control_w); |
| 29 | 29 | DECLARE_WRITE16_MEMBER(stadhero_pf1_data_w); |
| 30 | ||
| 30 | ||
| 31 | 31 | virtual void video_start(); |
| 32 | ||
| 32 | ||
| 33 | 33 | TILE_GET_INFO_MEMBER(get_pf1_tile_info); |
| 34 | 34 | UINT32 screen_update_stadhero(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 35 | 35 | }; |
| r243232 | r243233 | |
|---|---|---|
| 28 | 28 | required_device<msm5205_device> m_msm; |
| 29 | 29 | required_device<gfxdecode_device> m_gfxdecode; |
| 30 | 30 | required_device<palette_device> m_palette; |
| 31 | ||
| 31 | ||
| 32 | 32 | optional_shared_ptr<UINT8> m_text_char_ram; |
| 33 | 33 | optional_shared_ptr<UINT8> m_text_attr_ram; |
| 34 | 34 | optional_shared_ptr<UINT8> m_tx_vram; |
| r243232 | r243233 | |
|---|---|---|
| 36 | 36 | required_shared_ptr<UINT16> m_mhigh_scrollram; |
| 37 | 37 | required_shared_ptr<UINT16> m_vidattrram; |
| 38 | 38 | required_shared_ptr<UINT16> m_spriteram; |
| 39 | ||
| 39 | ||
| 40 | 40 | tilemap_t *m_bg_tilemap; |
| 41 | 41 | tilemap_t *m_mlow_tilemap; |
| 42 | 42 | tilemap_t *m_mhigh_tilemap; |
| 43 | 43 | tilemap_t *m_tx_tilemap; |
| 44 | 44 | |
| 45 | 45 | int m_sprxoffs; |
| 46 | ||
| 46 | ||
| 47 | 47 | DECLARE_WRITE16_MEMBER(stlforce_bg_videoram_w); |
| 48 | 48 | DECLARE_WRITE16_MEMBER(stlforce_mlow_videoram_w); |
| 49 | 49 | DECLARE_WRITE16_MEMBER(stlforce_mhigh_videoram_w); |
| 50 | 50 | DECLARE_WRITE16_MEMBER(stlforce_tx_videoram_w); |
| 51 | 51 | DECLARE_WRITE16_MEMBER(eeprom_w); |
| 52 | 52 | DECLARE_WRITE16_MEMBER(oki_bank_w); |
| 53 | ||
| 53 | ||
| 54 | 54 | DECLARE_DRIVER_INIT(twinbrat); |
| 55 | 55 | DECLARE_DRIVER_INIT(stlforce); |
| 56 | ||
| 56 | ||
| 57 | 57 | TILE_GET_INFO_MEMBER(get_stlforce_bg_tile_info); |
| 58 | 58 | TILE_GET_INFO_MEMBER(get_stlforce_mlow_tile_info); |
| 59 | 59 | TILE_GET_INFO_MEMBER(get_stlforce_mhigh_tile_info); |
| 60 | 60 | TILE_GET_INFO_MEMBER(get_stlforce_tx_tile_info); |
| 61 | ||
| 61 | ||
| 62 | 62 | virtual void video_start(); |
| 63 | 63 | UINT32 screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 64 | 64 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| r243232 | r243233 | |
|---|---|---|
| 15 | 15 | required_device<cpu_device> m_subcpu; |
| 16 | 16 | required_device<gfxdecode_device> m_gfxdecode; |
| 17 | 17 | required_device<palette_device> m_palette; |
| 18 | ||
| 18 | ||
| 19 | 19 | required_shared_ptr<UINT8> m_videoram; |
| 20 | 20 | required_shared_ptr<UINT8> m_xscroll; |
| 21 | 21 | required_shared_ptr<UINT8> m_spriteram; |
| r243232 | r243233 | |
| 23 | 23 | UINT8 m_scrl_ctrl; |
| 24 | 24 | tilemap_t *m_bg_tilemap; |
| 25 | 25 | UINT8 m_irq_source; |
| 26 | ||
| 26 | ||
| 27 | 27 | TIMER_DEVICE_CALLBACK_MEMBER(strnskil_irq); |
| 28 | 28 | |
| 29 | 29 | DECLARE_READ8_MEMBER(strnskil_d800_r); |
| r243232 | r243233 | |
| 32 | 32 | DECLARE_WRITE8_MEMBER(protection_w); |
| 33 | 33 | DECLARE_WRITE8_MEMBER(strnskil_videoram_w); |
| 34 | 34 | DECLARE_WRITE8_MEMBER(strnskil_scrl_ctrl_w); |
| 35 | ||
| 35 | ||
| 36 | 36 | DECLARE_DRIVER_INIT(banbam); |
| 37 | 37 | DECLARE_DRIVER_INIT(pettanp); |
| 38 | ||
| 38 | ||
| 39 | 39 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 40 | ||
| 41 | virtual void machine_start(); | |
| 40 | ||
| 41 | virtual void machine_start(); | |
| 42 | 42 | virtual void video_start(); |
| 43 | 43 | DECLARE_PALETTE_INIT(strnskil); |
| 44 | 44 | UINT32 screen_update_strnskil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| r243232 | r243233 | |
|---|---|---|
| 153 | 153 | void truxton2_postload(); |
| 154 | 154 | void create_tx_tilemap(int dx = 0, int dx_flipped = 0); |
| 155 | 155 | void toaplan2_vblank_irq(int irq_line); |
| 156 | DECLARE_WRITE_LINE_MEMBER(bbakraid_irqhandler); | |
| 157 | 156 | |
| 158 | 157 | UINT8 m_pwrkick_hopper; |
| 159 | 158 | DECLARE_CUSTOM_INPUT_MEMBER(pwrkick_hopper_status_r); |
| r243232 | r243233 | |
|---|---|---|
| 107 | 107 | m_objram(*this, "objram"), |
| 108 | 108 | m_rcram(*this, "rcram"), |
| 109 | 109 | m_z80_ram(*this, "z80_ram"), |
| 110 | m_char_tiles(*this, "char_tiles"), | |
| 111 | m_obj_tiles(*this, "obj_tiles"), | |
| 112 | m_road_rom(*this, "road"), | |
| 113 | m_obj_map(*this, "obj_map"), | |
| 114 | m_obj_luts(*this, "obj_luts"), | |
| 115 | m_proms(*this, "proms"), | |
| 110 | 116 | m_screen(*this, "screen") { } |
| 111 | 117 | |
| 112 | 118 | required_device<cpu_device> m_maincpu; |
| r243232 | r243233 | |
| 117 | 123 | required_shared_ptr<UINT16> m_objram; |
| 118 | 124 | required_shared_ptr<UINT16> m_rcram; |
| 119 | 125 | required_shared_ptr<UINT8> m_z80_ram; |
| 126 | ||
| 127 | required_region_ptr<UINT8> m_char_tiles; | |
| 128 | required_region_ptr<UINT8> m_obj_tiles; | |
| 129 | required_region_ptr<UINT8> m_road_rom; | |
| 130 | required_region_ptr<UINT8> m_obj_map; | |
| 131 | required_region_ptr<UINT8> m_obj_luts; | |
| 132 | required_region_ptr<UINT8> m_proms; | |
| 133 | ||
| 120 | 134 | required_device<screen_device> m_screen; |
| 121 | 135 | |
| 122 | 136 | emu_timer *m_interrupt_timer; |
| r243232 | r243233 | |
|---|---|---|
| 44 | 44 | DECLARE_WRITE16_MEMBER(vaportra_priority_w); |
| 45 | 45 | DECLARE_WRITE16_MEMBER(vaportra_palette_24bit_rg_w); |
| 46 | 46 | DECLARE_WRITE16_MEMBER(vaportra_palette_24bit_b_w); |
| 47 | ||
| 47 | ||
| 48 | 48 | DECLARE_DRIVER_INIT(vaportra); |
| 49 | 49 | virtual void machine_start(); |
| 50 | 50 | virtual void machine_reset(); |
| 51 | ||
| 51 | ||
| 52 | 52 | UINT32 screen_update_vaportra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 53 | 53 | void update_24bitcol( int offset ); |
| 54 | ||
| 54 | ||
| 55 | 55 | DECO16IC_BANK_CB_MEMBER(bank_callback); |
| 56 | 56 | }; |
| r243232 | r243233 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | required_device<cpu_device> m_maincpu; |
| 11 | 11 | required_device<gfxdecode_device> m_gfxdecode; |
| 12 | ||
| 12 | ||
| 13 | 13 | required_shared_ptr<UINT8> m_vidram; |
| 14 | ||
| 14 | ||
| 15 | 15 | tilemap_t *m_tilemap; |
| 16 | 16 | |
| 17 | 17 | int m_e0_data; |
| 18 | 18 | int m_credits; |
| 19 | 19 | int m_coins; |
| 20 | 20 | int m_prev_coin; |
| 21 | ||
| 21 | ||
| 22 | 22 | DECLARE_WRITE8_MEMBER(irqack_w); |
| 23 | 23 | DECLARE_READ8_MEMBER(io_r); |
| 24 | 24 | DECLARE_WRITE8_MEMBER(io_w); |
| 25 | 25 | DECLARE_WRITE8_MEMBER(vidram_w); |
| 26 | ||
| 26 | ||
| 27 | 27 | virtual void machine_start(); |
| 28 | 28 | virtual void video_start(); |
| 29 | 29 | TILE_GET_INFO_MEMBER(get_tile_info); |
| 30 | 30 | DECLARE_PALETTE_INIT(xyonix); |
| 31 | 31 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 32 | ||
| 32 | ||
| 33 | 33 | void handle_coins(int coin); |
| 34 | 34 | }; |
| r243232 | r243233 | |
|---|---|---|
| 151 | 151 | <bezel name="text2" element="P4"><bounds left="100" right="180" top="90" bottom="102" /></bezel> |
| 152 | 152 | <bezel name="text1" element="P5"><bounds left="100" right="180" top="150" bottom="162" /></bezel> |
| 153 | 153 | <bezel name="text0" element="P6"><bounds left="100" right="180" top="210" bottom="222" /></bezel> |
| 154 | ||
| 154 | ||
| 155 | 155 | <screen index="0"> |
| 156 | 156 | <bounds x="320" y="0" width="320" height="240" /> |
| 157 | 157 | </screen> |
| 158 | ||
| 158 | </view> | |
| 159 | 159 | </mamelayout> |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | /* Sega Compression (and possibly encryption) device |
| 2 | 2 | |
| 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) | |
| 5 | 5 | |
| 6 | ||
| 6 | Package Type: TQFP100 | |
| 7 | 7 | |
| 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. | |
| 11 | 11 | |
| 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?) | |
| 15 | 15 | |
| 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. | |
| 19 | 19 | |
| 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 | |
| 23 | 23 | |
| 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 | |
| 31 | 31 | |
| 32 | 32 | */ |
| 33 | 33 | |
| r243232 | r243233 | |
| 95 | 95 | |
| 96 | 96 | UINT32 sega_315_5838_comp_device::genericdecathlt_prot_r(UINT32 mem_mask, int channel) |
| 97 | 97 | { |
| 98 | // UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base(); | |
| 99 | // UINT32 retvalue = 0xffff; | |
| 98 | // UINT32 *fake0 = (UINT32*)memregion( ":fake0" )->base(); | |
| 99 | // UINT32 retvalue = 0xffff; | |
| 100 | 100 | |
| 101 | 101 | switch (m_channel[channel].m_srcoffset) |
| 102 | 102 | { |
| r243232 | r243233 | |
| 177 | 177 | |
| 178 | 178 | void sega_315_5838_comp_device::set_prot_addr(UINT32 data, UINT32 mem_mask, int channel) |
| 179 | 179 | { |
| 180 | // | |
| 180 | // printf("set_prot_addr\n"); | |
| 181 | 181 | COMBINE_DATA(&m_channel[channel].m_srcoffset); |
| 182 | 182 | |
| 183 | 183 | //if (m_decathlt_part==0) logerror("%d, last read count was %06x\n",channel, m_channel[channel].m_decathlt_lastcount*4); |
| r243232 | r243233 | |
| 361 | 361 | 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)); |
| 362 | 362 | 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) |
| 363 | 363 | 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 | // | |
| 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 | |
| 365 | 365 | |
| 366 | } | |
| No newline at end of file | ||
| 366 | } |
| r243232 | r243233 | |
|---|---|---|
| 82 | 82 | { |
| 83 | 83 | if (done_compression == 1) |
| 84 | 84 | enc_start(); |
| 85 | ||
| 86 | 85 | |
| 87 | 86 | |
| 87 | ||
| 88 | 88 | line_fill(); |
| 89 | 89 | } |
| 90 | 90 | base = line_buffer + line_buffer_pos; |
| r243232 | r243233 | |
| 176 | 176 | |
| 177 | 177 | void key2label(uint32_t key) |
| 178 | 178 | { |
| 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); | |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | Given the use of the BCD-encoded security module labels, it's expected that at least other 6 additional bits be present in the |
| r243232 | r243233 | |
| 196 | 196 | |
| 197 | 197 | In the second Feistel Network, every key bit seem to be used at most once (the various uses of current bit #9 are fictitious, as |
| 198 | 198 | that bit really represent various bits in the real key; see comments on the use of the labels above). Given that, it seems probable |
| 199 | that the real key is 64 bits long, exactly as in the related CPS-2 scheme, and the designers tried to cover all 96 input bits with | |
| 199 | that the real key is 64 bits long, exactly as in the related CPS-2 scheme, and the designers tried to cover all 96 input bits with | |
| 200 | 200 | the bits provening from the game key, the sequence key and the result from the first feistel network (64+16+16=96). In the first |
| 201 | 201 | Feistel Network, as only 80 bits are available, some bits would be used twice (as can be partially seen in the current implementation). |
| 202 | 202 | The fact that only 29 bits out of the expected 64 have been observed till now would be due to the generation of the key by composing |
| r243232 | r243233 | |
| 453 | 453 | |
| 454 | 454 | { |
| 455 | 455 | { |
| 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, | |
| 457 | 457 | // unused? |
| 458 | 458 | 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, |
| 459 | 459 | }, |
| r243232 | r243233 | |
| 511 | 511 | |
| 512 | 512 | const int sega_315_5881_crypt_device::fn1_game_key_scheduling[FN1GK][2] = { |
| 513 | 513 | {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}, | |
| 515 | 515 | {11,6}, {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15}, {18,23}, |
| 516 | 516 | {18,43}, {19,82}, {20,81}, {21,32}, {22,5}, {23,66}, {24,13}, {24,45}, |
| 517 | 517 | {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25} |
| r243232 | r243233 | |
| 680 | 680 | |
| 681 | 681 | prot_cur_address ++; |
| 682 | 682 | |
| 683 | // | |
| 683 | // printf("get_decrypted_16 %04x\n", res); | |
| 684 | 684 | |
| 685 | 685 | return res; |
| 686 | 686 | } |
| r243232 | r243233 | |
| 691 | 691 | block_pos = 0; |
| 692 | 692 | done_compression = 0; |
| 693 | 693 | buffer_pos = BUFFER_SIZE; |
| 694 | ||
| 694 | ||
| 695 | 695 | 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?) |
| 696 | 696 | { |
| 697 | // | |
| 697 | // printf("buffer_bit2 is %d\n", buffer_bit2); | |
| 698 | 698 | dec_header = (buffer2a & 0x0003) << 16; |
| 699 | 699 | } |
| 700 | 700 | else |
| r243232 | r243233 | |
| 710 | 710 | // etc. after each block a new header must be read, it looks like compressed and uncompressed blocks |
| 711 | 711 | // can be mixed like this, I don't know if the length is src length of decompressed length. |
| 712 | 712 | // 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. | |
| 714 | 714 | |
| 715 | 715 | block_numlines = ((dec_header & 0x000000ff) >> 0) + 1; |
| 716 | 716 | int blocky = ((dec_header & 0x0001ff00) >> 8) + 1; |
| r243232 | r243233 | |
| 824 | 824 | |
| 825 | 825 | int sega_315_5881_crypt_device::get_compressed_bit() |
| 826 | 826 | { |
| 827 | // if(buffer_pos == BUFFER_SIZE) | |
| 828 | // enc_fill(); | |
| 827 | // if(buffer_pos == BUFFER_SIZE) | |
| 828 | // enc_fill(); | |
| 829 | 829 | |
| 830 | 830 | if (buffer_bit2 == 15) |
| 831 | 831 | { |
| r243232 | r243233 | |
| 833 | 833 | buffer2a = get_decrypted_16(); |
| 834 | 834 | buffer2[0] = buffer2a; |
| 835 | 835 | buffer2[1] = buffer2a >> 8; |
| 836 | // | |
| 836 | // block_pos+=2; | |
| 837 | 837 | buffer_pos = 0; |
| 838 | 838 | |
| 839 | 839 | } |
| r243232 | r243233 | |
| 842 | 842 | buffer_bit2++; |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | // | |
| 845 | // if (buffer_bit ==7) printf("using byte %02x\n", buffer2[(buffer_pos&1) ^ 1]); | |
| 846 | 846 | |
| 847 | 847 | int res = (buffer2[(buffer_pos&1)^1] >> buffer_bit) & 1; |
| 848 | 848 | buffer_bit--; |
| r243232 | r243233 | |
|---|---|---|
| 364 | 364 | RAM[0x1af] = 0x60; /* RTS prot area */ |
| 365 | 365 | RAM[0x1db] = 0x60; /* RTS prot area */ |
| 366 | 366 | RAM[0x21a] = 0x60; /* RTS prot area */ |
| 367 | ||
| 367 | ||
| 368 | 368 | save_item(NAME(m_hippodrm_msb)); |
| 369 | 369 | save_item(NAME(m_hippodrm_lsb)); |
| 370 | 370 | } |
| r243232 | r243233 | |
| 377 | 377 | /* Slyspy sound cpu has some protection */ |
| 378 | 378 | RAM[0xf2d] = 0xea; |
| 379 | 379 | RAM[0xf2e] = 0xea; |
| 380 | ||
| 380 | ||
| 381 | 381 | save_item(NAME(m_slyspy_state)); |
| 382 | 382 | } |
| 383 | 383 |
| r243232 | r243233 | |
|---|---|---|
| 33 | 33 | AM_RANGE(0x00, 0x07) AM_READWRITE(gpio_r, gpio_w) |
| 34 | 34 | AM_RANGE(0x08, 0x08) AM_READWRITE(gpiodir_r, gpiodir_w) |
| 35 | 35 | AM_RANGE(0x0f, 0x0f) AM_READWRITE(adc_r, adc_w) |
| 36 | AM_RANGE(0x10, 0x10) AM_READWRITE(jvs_r, jvs_w) | |
| 36 | AM_RANGE(0x10, 0x10) AM_READWRITE(jvs_r, jvs_w) // ports 1x and 2x is standard UARTs, TODO handle it properly | |
| 37 | 37 | AM_RANGE(0x12, 0x12) AM_WRITE(jvs_dest_w) |
| 38 | AM_RANGE(0x13, 0x13) AM_WRITE(jvs_lcr_w) | |
| 38 | 39 | AM_RANGE(0x15, 0x15) AM_READ(jvs_status_r) |
| 39 | 40 | AM_RANGE(0x30, 0x30) AM_READWRITE(irq_enable_r, irq_enable_w) |
| 40 | 41 | AM_RANGE(0x50, 0x50) AM_READWRITE(maple_irqlevel_r, maple_irqlevel_w) |
| r243232 | r243233 | |
| 319 | 320 | |
| 320 | 321 | READ8_MEMBER(mie_device::jvs_r) |
| 321 | 322 | { |
| 323 | if (jvs_lcr & 0x80) | |
| 324 | return 0; | |
| 325 | ||
| 322 | 326 | const UINT8 *buf; |
| 323 | 327 | UINT32 size; |
| 324 | 328 | jvs->get_encoded_reply(buf, size); |
| r243232 | r243233 | |
| 329 | 333 | |
| 330 | 334 | WRITE8_MEMBER(mie_device::jvs_w) |
| 331 | 335 | { |
| 332 | // Hack until the ports are better understood | |
| 333 | if(jvs_dest == 2) | |
| 334 | jvs->push(data); | |
| 336 | if (jvs_lcr & 0x80) | |
| 337 | return; | |
| 338 | ||
| 339 | jvs->push(data); | |
| 335 | 340 | } |
| 336 | 341 | |
| 337 | 342 | WRITE8_MEMBER(mie_device::jvs_dest_w) |
| r243232 | r243233 | |
| 359 | 364 | jvs_control = data; |
| 360 | 365 | } |
| 361 | 366 | |
| 367 | WRITE8_MEMBER(mie_device::jvs_lcr_w) | |
| 368 | { | |
| 369 | jvs_lcr = data; | |
| 370 | } | |
| 371 | ||
| 362 | 372 | READ8_MEMBER(mie_device::jvs_sense_r) |
| 363 | 373 | { |
| 364 | 374 | return 0x8c | (jvs->get_address_set_line() ? 2 : 0) | (jvs->get_presence_line() ? 0 : 1); |
| r243232 | r243233 | |
|---|---|---|
| 61 | 61 | DECLARE_READ8_MEMBER(jvs_status_r); |
| 62 | 62 | DECLARE_WRITE8_MEMBER(jvs_control_w); |
| 63 | 63 | DECLARE_READ8_MEMBER(jvs_sense_r); |
| 64 | DECLARE_WRITE8_MEMBER(jvs_lcr_w); | |
| 64 | 65 | |
| 65 | 66 | DECLARE_READ8_MEMBER(read_ff); |
| 66 | 67 | DECLARE_READ8_MEMBER(read_00); |
| r243232 | r243233 | |
| 106 | 107 | UINT8 gpiodir, gpio_val[8]; |
| 107 | 108 | UINT8 irq_enable, irq_pending, maple_irqlevel; |
| 108 | 109 | UINT8 jvs_control, jvs_dest; |
| 110 | UINT8 jvs_lcr; | |
| 109 | 111 | |
| 110 | 112 | void raise_irq(int level); |
| 111 | 113 | void recalc_irq(); |
| r243232 | r243233 | |
|---|---|---|
| 63 | 63 | ( ( ( src ^ A ) >> 1 ) & 0x08 ) | |
| 64 | 64 | ( ~( ( src >> 6 ) ^ A ) & 0x01 ); |
| 65 | 65 | } |
| 66 | ||
| 66 | ||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | DRIVER_INIT_MEMBER(stfight_state,stfight) |
| r243232 | r243233 | |
|---|---|---|
| 39 | 39 | UINT16 res2 = m_cryptdevice->do_decrypt(base); |
| 40 | 40 | res = ((res & 0xff00) >> 8) | ((res & 0x00ff) << 8); |
| 41 | 41 | res2 = ((res2 & 0xff00) >> 8) | ((res2 & 0x00ff) << 8); |
| 42 | ||
| 43 | return res2 | (res << 16); | |
| 42 | ||
| 43 | return res2 | (res << 16); | |
| 44 | 44 | } |
| 45 | 45 | return m_a_bus[offset]; |
| 46 | 46 | } |
| r243232 | r243233 | |
|---|---|---|
| 209 | 209 | warofbug // (c) 1981 Armenia |
| 210 | 210 | warofbugu // (c) 1981 Armenia |
| 211 | 211 | warofbugg // German Version |
| 212 | spactrai | |
| 212 | spactrai // | |
| 213 | 213 | redufo // (c) Artic |
| 214 | 214 | redufob // bootleg |
| 215 | 215 | exodus // Subelectro - bootleg? |
| r243232 | r243233 | |
| 2679 | 2679 | snowbrosd // MIN16-02 (c) 1990 Toaplan + Dooyong license |
| 2680 | 2680 | wintbob // bootleg |
| 2681 | 2681 | snowbroswb // |
| 2682 | toto | |
| 2682 | toto // | |
| 2683 | 2683 | // modified snowbros 'clone' hardware |
| 2684 | 2684 | honeydol // (c) 1995 Barko Corp |
| 2685 | 2685 | twinadv // (c) 1995 Barko Corp |
| r243232 | r243233 | |
| 3414 | 3414 | ddsomjr1 // 06/02/1996 (c) 1996 (Japan) |
| 3415 | 3415 | ddsomj // 19/06/1996 (c) 1996 (Japan) |
| 3416 | 3416 | ddsoma // 19/06/1996 (c) 1996 (Asia) |
| 3417 | ddsomar1 | |
| 3417 | ddsomar1 // 08/02/1996 (c) 1996 (Asia) | |
| 3418 | 3418 | ddsomh // 23/02/1996 (c) 1996 (Hispanic) |
| 3419 | 3419 | ddsomb // 23/02/1996 (c) 1996 (Brazil) |
| 3420 | 3420 | sfa2 // 06/03/1996 (c) 1996 (Euro) |
| r243232 | r243233 | |
| 5381 | 5381 | sprtjam // 2000.11.13 Sports Jam |
| 5382 | 5382 | pjustic // 2000.12 Moero Justice Gakuen / Project Justice |
| 5383 | 5383 | samba2k // 2000.12 Samba de Amigo Ver.2000 |
| 5384 | shaktam | |
| 5384 | shaktam // 2000.12.28 Shakatto Tambourine (Rev B) | |
| 5385 | 5385 | // 2000.?? Boat Race Ocean Heats |
| 5386 | 5386 | csmash // 2000.?? Cosmic Smash |
| 5387 | 5387 | csmasho // 2000.?? Cosmic Smash (original) |
| r243232 | r243233 | |
| 6710 | 6710 | popn1 // GX803 (c) 1998 (Asia) |
| 6711 | 6711 | //popn1j // GX803 (c) 1998 (Japan) |
| 6712 | 6712 | popn2 // GX831 (c) 1998 (Japan) |
| 6713 | popn3 | |
| 6713 | popn3 // GX980 (c) 1999 (Japan) | |
| 6714 | 6714 | //popnstex // GX970 (c) 1999 (Japan) |
| 6715 | 6715 | |
| 6716 | 6716 | // Firebeat games |
| r243232 | r243233 | |
| 6964 | 6964 | quantum1 // 136016 (c) 1982 // made by Gencomp |
| 6965 | 6965 | quantump // 136016 (c) 1982 // made by Gencomp |
| 6966 | 6966 | bwidow // 136017 (c) 1982 |
| 6967 | bwidowp | |
| 6967 | bwidowp // (proto) (c) 1982 | |
| 6968 | 6968 | starwars // 136021 (c) 1983 |
| 6969 | 6969 | starwars1 // 136021 (c) 1983 |
| 6970 | 6970 | starwarso // 136021 (c) 1983 |
| r243232 | r243233 | |
|---|---|---|
| 33 | 33 | VIDEO_START_MEMBER(eolith_state,eolith) |
| 34 | 34 | { |
| 35 | 35 | 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); | |
| 37 | 37 | save_item(NAME(m_buffer)); |
| 38 | 38 | } |
| 39 | 39 |
| r243232 | r243233 | |
|---|---|---|
| 175 | 175 | AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(gp9001_fg_tmap_w) AM_SHARE("vram_fg") |
| 176 | 176 | AM_RANGE(0x2000, 0x2fff) AM_RAM_WRITE(gp9001_top_tmap_w) AM_SHARE("vram_top") |
| 177 | 177 | AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("spriteram") AM_MIRROR(0x0800) |
| 178 | // | |
| 178 | // AM_RANGE(0x3800, 0x3fff) AM_RAM // sprite mirror? | |
| 179 | 179 | ADDRESS_MAP_END |
| 180 | 180 | |
| 181 | 181 |
| r243232 | r243233 | |
|---|---|---|
| 283 | 283 | int height = m_screen->height(); |
| 284 | 284 | |
| 285 | 285 | m_videoram = auto_alloc_array_clear(machine(), UINT8, width * height); |
| 286 | ||
| 286 | ||
| 287 | 287 | save_item(NAME(m_blitter_desty)); |
| 288 | 288 | save_item(NAME(m_blitter_sizex)); |
| 289 | 289 | save_item(NAME(m_blitter_sizey)); |
| r243232 | r243233 | |
|---|---|---|
| 230 | 230 | int xx2 = x2 >> TAITOAIR_FRAC_SHIFT; |
| 231 | 231 | int grad_col; |
| 232 | 232 | int base_color; |
| 233 | ||
| 233 | ||
| 234 | 234 | if (xx1 <= cliprect.max_x || xx2 >= cliprect.min_x) |
| 235 | 235 | { |
| 236 | 236 | if (xx1 < cliprect.min_x) |
| 237 | 237 | xx1 = cliprect.min_x; |
| 238 | 238 | if (xx2 > cliprect.max_x) |
| 239 | 239 | xx2 = cliprect.max_x; |
| 240 | ||
| 240 | ||
| 241 | 241 | if(color & 0x40) |
| 242 | 242 | { |
| 243 | 243 | /* Non-terrain elements are colored with this. */ |
| r243232 | r243233 | |
|---|---|---|
| 430 | 430 | helper[0] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT); |
| 431 | 431 | helper[1] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT); |
| 432 | 432 | helper[2] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT); |
| 433 | ||
| 433 | ||
| 434 | 434 | register_save_state(); |
| 435 | 435 | } |
| 436 | 436 |
| r243232 | r243233 | |
|---|---|---|
| 199 | 199 | bitmap_ind16 *helper[3]; |
| 200 | 200 | |
| 201 | 201 | UINT16 screen_height; |
| 202 | ||
| 202 | ||
| 203 | 203 | void register_save_state(); |
| 204 | 204 | }; |
| 205 | 205 |
| r243232 | r243233 | |
|---|---|---|
| 113 | 113 | |
| 114 | 114 | PALETTE_INIT_MEMBER(tx1_state,tx1) |
| 115 | 115 | { |
| 116 | const UINT8 *color_prom = m | |
| 116 | const UINT8 *const color_prom = &m_proms[0]; | |
| 117 | 117 | int i; |
| 118 | 118 | |
| 119 | 119 | static const res_net_info tx1_net_info = |
| r243232 | r243233 | |
| 233 | 233 | UINT16 *tx1_vram = m_vram; |
| 234 | 234 | INT32 x, y; |
| 235 | 235 | UINT32 scroll_x; |
| 236 | UINT8 *chars, *gfx2; | |
| 237 | 236 | |
| 238 | 237 | /* 2bpp characters */ |
| 239 | chars = memregion("char_tiles")->base(); | |
| 240 | gfx2 = chars + 0x4000; | |
| 238 | const UINT8 *const chars = &m_char_tiles[0]; | |
| 239 | const UINT8 *const gfx2 = &m_char_tiles[0x4000]; | |
| 241 | 240 | |
| 242 | 241 | /* X scroll value is the last word in char RAM */ |
| 243 | 242 | scroll_x = tx1_vram[0xfff] & 0x3ff; |
| r243232 | r243233 | |
| 414 | 413 | UINT8 pix[2][4][3]; |
| 415 | 414 | |
| 416 | 415 | /* Road slice map ROMs */ |
| 417 | const UINT8 *const gfx3 = memregion("gfx3")->base(); | |
| 418 | const UINT8 *const rom_a = gfx3; | |
| 419 | const UINT8 *const rom_b = gfx3 + 0x2000; | |
| 420 | const UINT8 *const rom_c = gfx3 + 0x4000; | |
| 416 | const UINT8 *const rom_a = &m_road_rom[0]; | |
| 417 | const UINT8 *const rom_b = &m_road_rom[0x2000]; | |
| 418 | const UINT8 *const rom_c = &m_road_rom[0x4000]; | |
| 421 | 419 | |
| 422 | 420 | /* Pixel data */ |
| 423 | const UINT8 *const proms = memregion("proms")->base(); | |
| 424 | const UINT8 *const prom_a = proms + 0x1100; | |
| 425 | const UINT8 *const prom_b = proms + 0x1300; | |
| 426 | const UINT8 *const prom_c = proms + 0x1500; | |
| 427 | const UINT8 *const vprom = proms + 0x1700; | |
| 421 | const UINT8 *const prom_a = &m_proms[0x1100]; | |
| 422 | const UINT8 *const prom_b = &m_proms[0x1300]; | |
| 423 | const UINT8 *const prom_c = &m_proms[0x1500]; | |
| 424 | const UINT8 *const vprom = &m_proms[0x1700]; | |
| 428 | 425 | |
| 429 | 426 | rva9_8 = (tx1_vregs.flags & 3) << 8; |
| 430 | 427 | rva7 = !BIT(tx1_vregs.flags, TX1_RDFLAG_RVA7) << 7; |
| r243232 | r243233 | |
| 855 | 852 | UINT32 offs; |
| 856 | 853 | |
| 857 | 854 | /* The many lookup table ROMs */ |
| 858 | const UINT8 *const ic48 = memregion("user3")->base(); | |
| 859 | const UINT8 *const ic281 = ic48 + 0x2000; | |
| 855 | const UINT8 *const ic48 = &m_obj_luts[0]; | |
| 856 | const UINT8 *const ic281 = &m_obj_luts[0x2000]; | |
| 860 | 857 | |
| 861 | const UINT8 *const proms = memregion("proms")->base(); | |
| 862 | const UINT8 *const ic190 = proms + 0xc00; | |
| 863 | const UINT8 *const ic162 = proms + 0xe00; | |
| 864 | const UINT8 *const ic25 = proms + 0x1000; | |
| 858 | const UINT8 *const ic190 = &m_proms[0xc00]; | |
| 859 | const UINT8 *const ic162 = &m_proms[0xe00]; | |
| 860 | const UINT8 *const ic25 = &m_proms[0x1000]; | |
| 865 | 861 | |
| 866 | const UINT8 *const ic106 = memregion("obj_map")->base(); | |
| 867 | const UINT8 *const ic73 = ic106 + 0x4000; | |
| 862 | const UINT8 *const ic106 = &m_obj_map[0]; | |
| 863 | const UINT8 *const ic73 = &m_obj_map[0x4000]; | |
| 868 | 864 | |
| 869 | const UINT8 *const pixdata_rgn = m | |
| 865 | const UINT8 *const pixdata_rgn = &m_obj_tiles[0]; | |
| 870 | 866 | |
| 871 | 867 | for (offs = 0x0; offs <= 0x300; offs += 8) |
| 872 | 868 | { |
| r243232 | r243233 | |
| 995 | 991 | dataend |= ic106_data & 0x40; |
| 996 | 992 | |
| 997 | 993 | /* Retrieve data for an 8x8 tile */ |
| 998 | ic73_data = ic73[rom_addr2]; | |
| 994 | ic73_data = ic73[rom_addr2 & 0x3fff]; | |
| 999 | 995 | |
| 1000 | 996 | /* This is the data from the LUT pair */ |
| 1001 | 997 | lut_data = (ic106_data << 8) | ic73_data; |
| r243232 | r243233 | |
| 1130 | 1126 | void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) |
| 1131 | 1127 | { |
| 1132 | 1128 | int x, y; |
| 1133 | UINT8 *chr_pal = m | |
| 1129 | UINT8 *chr_pal = &m_proms[0x900]; | |
| 1134 | 1130 | |
| 1135 | 1131 | int x_offset = screen * 256; |
| 1136 | 1132 | |
| r243232 | r243233 | |
| 1256 | 1252 | |
| 1257 | 1253 | PALETTE_INIT_MEMBER(tx1_state,buggyboy) |
| 1258 | 1254 | { |
| 1259 | const UINT8 *color_prom = m | |
| 1255 | const UINT8 *const color_prom = &m_proms[0]; | |
| 1260 | 1256 | int i; |
| 1261 | 1257 | |
| 1262 | 1258 | for (i = 0; i < 0x100; i++) |
| r243232 | r243233 | |
| 1301 | 1297 | UINT16 *buggyboy_vram = m_vram; |
| 1302 | 1298 | INT32 x, y; |
| 1303 | 1299 | UINT32 scroll_x, scroll_y; |
| 1304 | UINT8 *chars, *gfx2; | |
| 1305 | 1300 | UINT32 total_width; |
| 1306 | 1301 | UINT32 x_mask; |
| 1307 | 1302 | |
| 1308 | 1303 | /* 2bpp characters */ |
| 1309 | chars = memregion("char_tiles")->base(); | |
| 1310 | gfx2 = memregion("char_tiles")->base() + 0x4000; | |
| 1304 | const UINT8 *const chars = &m_char_tiles[0]; | |
| 1305 | const UINT8 *const gfx2 = &m_char_tiles[0x4000]; | |
| 1311 | 1306 | |
| 1312 | 1307 | /* X/Y scroll values are the last word in char RAM */ |
| 1313 | 1308 | if (wide) |
| r243232 | r243233 | |
| 1449 | 1444 | UINT8 d1 = 0; |
| 1450 | 1445 | |
| 1451 | 1446 | /* ROM/PROM lookup tables */ |
| 1452 | const UINT8 *rom = memregion("road")->base(); | |
| 1453 | const UINT8 *prom0 = rom + 0x4000; | |
| 1454 | const UINT8 *prom1 = rom + 0x4200; | |
| 1455 | const UINT8 *prom2 = rom + 0x4400; | |
| 1447 | const UINT8 *const rom = &m_road_rom[0]; | |
| 1448 | const UINT8 *const prom0 = &m_road_rom[0x4000]; | |
| 1449 | const UINT8 *const prom1 = &m_road_rom[0x4200]; | |
| 1450 | const UINT8 *const prom2 = &m_road_rom[0x4400]; | |
| 1456 | 1451 | |
| 1457 | 1452 | /* Latch road reverse bit */ |
| 1458 | 1453 | *_rorev = !( (rom_en && rom_flip) || (!rom_en && (ls161 & 0x4000)) ); |
| r243232 | r243233 | |
| 1543 | 1538 | UINT32 rva20_6; |
| 1544 | 1539 | |
| 1545 | 1540 | /* ROM/PROM lookup tables */ |
| 1546 | const UINT8 *rcols = (UINT8*)(memregion("proms")->base() + 0x1500); | |
| 1547 | const UINT8 *vprom = memregion("road")->base() + 0x4600; | |
| 1541 | const UINT8 *const rcols = &m_proms[0x1500]; | |
| 1542 | const UINT8 *const vprom = &m_road_rom[0x4600]; | |
| 1548 | 1543 | |
| 1549 | 1544 | /* Extract constant values */ |
| 1550 | 1545 | tcmd = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6); |
| r243232 | r243233 | |
| 2170 | 2165 | UINT32 rva20_6; |
| 2171 | 2166 | |
| 2172 | 2167 | /* ROM/PROM lookup tables */ |
| 2173 | const UINT8 *rcols = (UINT8*)(memregion("proms")->base() + 0x1500); | |
| 2174 | const UINT8 *vprom = memregion("road")->base() + 0x4600; | |
| 2168 | const UINT8 *const rcols = &m_proms[0x1500]; | |
| 2169 | const UINT8 *const vprom = &m_road_rom[0x4600]; | |
| 2175 | 2170 | |
| 2176 | 2171 | /* Extract constant values */ |
| 2177 | 2172 | tcmd = ((vregs.scol & 0xc000) >> 12) | ((vregs.scol & 0x00c0) >> 6); |
| r243232 | r243233 | |
| 2577 | 2572 | UINT32 x_stride; |
| 2578 | 2573 | |
| 2579 | 2574 | /* The many lookup table ROMs */ |
| 2580 | const UINT8 *const bug13 = (UINT8*)memregion("obj_luts")->base(); | |
| 2581 | const UINT8 *const bug18s = bug13 + 0x2000; | |
| 2582 | const UINT8 *const bb8 = (UINT8*)memregion("proms")->base() + 0x1600; | |
| 2575 | const UINT8 *const bug13 = &m_obj_luts[0]; | |
| 2576 | const UINT8 *const bug18s = &m_obj_luts[0x2000]; | |
| 2577 | const UINT8 *const bb8 = &m_proms[0x1600]; | |
| 2583 | 2578 | |
| 2584 | const UINT8 *const bug16s = (UINT8*)memregion("obj_map")->base(); | |
| 2585 | const UINT8 *const bug17s = bug16s + 0x8000; | |
| 2579 | const UINT8 *const bug16s = &m_obj_map[0]; | |
| 2580 | const UINT8 *const bug17s = &m_obj_map[0x8000]; | |
| 2586 | 2581 | |
| 2587 | const UINT8 *const bb9o = (UINT8*)memregion("proms")->base() + 0x500; | |
| 2588 | const UINT8 *const bb9e = bb9o + 0x800; | |
| 2582 | const UINT8 *const bb9o = &m_proms[0x500]; | |
| 2583 | const UINT8 *const bb9e = &m_proms[0xd00]; | |
| 2589 | 2584 | |
| 2590 | const UINT8 *const pixdata_rgn = | |
| 2585 | const UINT8 *const pixdata_rgn = &m_obj_tiles[0]; | |
| 2591 | 2586 | |
| 2592 | 2587 | if (wide) |
| 2593 | 2588 | { |
| r243232 | r243233 | |
| 2927 | 2922 | |
| 2928 | 2923 | void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) |
| 2929 | 2924 | { |
| 2930 | UINT8 *chr_pal = m | |
| 2925 | UINT8 *chr_pal = &m_proms[0x400]; | |
| 2931 | 2926 | UINT32 bmp_stride; |
| 2932 | 2927 | UINT32 x_offset; |
| 2933 | 2928 | UINT32 y; |
| r243232 | r243233 | |
|---|---|---|
| 316 | 316 | |
| 317 | 317 | /* Banks may have changed, reset the cpu so it uses the correct reset vector */ |
| 318 | 318 | m_maincpu->reset(); |
| 319 | ||
| 319 | ||
| 320 | 320 | save_item(NAME(m_current_screen_height)); |
| 321 | 321 | } |
| 322 | 322 |
| r243232 | r243233 | |
|---|---|---|
| 59 | 59 | |
| 60 | 60 | MC6845_ON_UPDATE_ADDR_CHANGED(banctec_state::crtc_addr) |
| 61 | 61 | { |
| 62 | ||
| 62 | /* What is this function meant to do ? */ | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /****************************** |
| r243232 | r243233 | |
| 103 | 103 | |
| 104 | 104 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", banctec) |
| 105 | 105 | MCFG_PALETTE_ADD("palette", 2) |
| 106 | // | |
| 106 | // MCFG_PALETTE_INIT_OWNER(banctec_state, banctec) | |
| 107 | 107 | |
| 108 | 108 | MCFG_MC6845_ADD("crtc", R6545_1, "screen", XTAL_20MHz) /* (?) */ |
| 109 | 109 | MCFG_MC6845_SHOW_BORDER_AREA(false) |
| r243232 | r243233 | |
|---|---|---|
| 1 | // license: MAME | |
| 2 | // copyright-holders: Angelo Salese | |
| 1 | 3 | /*************************************************************************** |
| 2 | 4 | |
| 3 | commodore c65 home computer | |
| 4 | PeT mess@utanet.at | |
| 5 | C=65 / C=64DX (c) 1991 Commodore | |
| 5 | 6 | |
| 6 | documention | |
| 7 | www.funet.fi | |
| 7 | Attempt at rewriting the driver ... | |
| 8 | 8 | |
| 9 | ***************************************************************************/ | |
| 9 | TODO: | |
| 10 | - Dies as soon as it enters into DOS ROM (bp 0x9d1a, it never returns due of a bad stack pointer read); | |
| 10 | 11 | |
| 11 | /* | |
| 12 | Note: | |
| 13 | - VIC-4567 will be eventually be added via compile switch, once that I | |
| 14 | get the hang of the system (and checking where the old code fails | |
| 15 | eventually) | |
| 12 | 16 | |
| 13 | 2008 - Driver Updates | |
| 14 | --------------------- | |
| 17 | ***************************************************************************/ | |
| 15 | 18 | |
| 16 | (most of the informations are taken from http://www.zimmers.net/cbmpics/ ) | |
| 17 | 19 | |
| 20 | #include "emu.h" | |
| 21 | #include "cpu/m6502/m4510.h" | |
| 18 | 22 | |
| 19 | ||
| 23 | #define MAIN_CLOCK XTAL_3_5MHz | |
| 20 | 24 | |
| 21 | * Commodore 65 (1989) | |
| 25 | class c65_state : public driver_device | |
| 26 | { | |
| 27 | public: | |
| 28 | c65_state(const machine_config &mconfig, device_type type, const char *tag) | |
| 29 | : driver_device(mconfig, type, tag), | |
| 30 | m_maincpu(*this, "maincpu"), | |
| 31 | m_screen(*this, "screen"), | |
| 32 | m_palette(*this, "palette"), | |
| 33 | m_workram(*this, "wram"), | |
| 34 | m_palred(*this, "redpal"), | |
| 35 | m_palgreen(*this, "greenpal"), | |
| 36 | m_palblue(*this, "bluepal"), | |
| 37 | m_dmalist(*this, "dmalist"), | |
| 38 | m_cram(*this, "cram"), | |
| 39 | m_gfxdecode(*this, "gfxdecode") | |
| 40 | { } | |
| 22 | 41 | |
| 23 | Also known as C64 DX at early stages of the project. It was cancelled | |
| 24 | around 1990-1991. Only few units survive (they were sold after Commodore | |
| 25 | liquidation in 1994). | |
| 42 | // devices | |
| 43 | required_device<m4510_device> m_maincpu; | |
| 44 | required_device<screen_device> m_screen; | |
| 45 | required_device<palette_device> m_palette; | |
| 46 | required_shared_ptr<UINT8> m_workram; | |
| 47 | required_shared_ptr<UINT8> m_palred; | |
| 48 | required_shared_ptr<UINT8> m_palgreen; | |
| 49 | required_shared_ptr<UINT8> m_palblue; | |
| 50 | required_shared_ptr<UINT8> m_dmalist; | |
| 51 | required_shared_ptr<UINT8> m_cram; | |
| 52 | required_device<gfxdecode_device> m_gfxdecode; | |
| 26 | 53 | |
| 27 | CPU: CSG 4510 (3.54 MHz) | |
| 28 | RAM: 128 kilobytes, expandable to 8 megabytes | |
| 29 | ROM: 128 kilobytes | |
| 30 | Video: CSG 4569 "VIC-III" (6 Video modes; Resolutions from 320x200 to | |
| 31 | 1280x400; 80 columns text; Palette of 4096 colors) | |
| 32 | Sound: CSG 8580 "SID" x2 (6 voice stereo synthesizer/digital sound | |
| 33 | capabilities) | |
| 34 | Ports: CSG 4510 (2 Joystick/Mouse ports; CBM Serial port; CBM 'USER' | |
| 35 | port; CBM Monitor port; Power and reset switches; C65 bus drive | |
| 36 | port; RGBI video port; 2 RCA audio ports; RAM expansion port; C65 | |
| 37 | expansion port) | |
| 38 | Keyboard: Full-sized 77 key QWERTY (12 programmable function keys; | |
| 39 | 4 direction cursor-pad) | |
| 40 | Additional Hardware: Built in 3.5" DD disk drive (1581 compatible) | |
| 41 | Miscellaneous: Partially implemented Commodore 64 emulation | |
| 54 | DECLARE_READ8_MEMBER(vic4567_dummy_r); | |
| 55 | DECLARE_WRITE8_MEMBER(vic4567_dummy_w); | |
| 56 | DECLARE_WRITE8_MEMBER(PalRed_w); | |
| 57 | DECLARE_WRITE8_MEMBER(PalGreen_w); | |
| 58 | DECLARE_WRITE8_MEMBER(PalBlue_w); | |
| 59 | DECLARE_WRITE8_MEMBER(DMAgic_w); | |
| 60 | DECLARE_READ8_MEMBER(CIASelect_r); | |
| 61 | DECLARE_WRITE8_MEMBER(CIASelect_w); | |
| 62 | ||
| 63 | DECLARE_READ8_MEMBER(dummy_r); | |
| 64 | ||
| 65 | // screen updates | |
| 66 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 67 | DECLARE_PALETTE_INIT(c65); | |
| 68 | DECLARE_DRIVER_INIT(c65); | |
| 69 | DECLARE_DRIVER_INIT(c65pal); | |
| 70 | ||
| 71 | INTERRUPT_GEN_MEMBER(vic3_vblank_irq); | |
| 72 | protected: | |
| 73 | // driver_device overrides | |
| 74 | virtual void machine_start(); | |
| 75 | virtual void machine_reset(); | |
| 42 | 76 | |
| 43 | [Notes] | |
| 77 | virtual void video_start(); | |
| 78 | private: | |
| 79 | UINT8 m_VIC2_IRQPend, m_VIC2_IRQMask; | |
| 80 | UINT8 m_VIC3_ControlA,m_VIC3_ControlB; | |
| 81 | void PalEntryFlush(UINT8 offset); | |
| 82 | void DMAgicExecute(address_space &space,UINT32 address); | |
| 83 | }; | |
| 44 | 84 | |
| 45 | The datasette port was removed here. C65 supports an additional "dumb" | |
| 46 | drive externally. It also features, in addition to the standard CBM | |
| 47 | bus serial (available in all modes), a Fast and a Burst serial bus | |
| 48 | (both available in C65 mode only) | |
| 49 | ||
| 50 | */ | |
| 51 | ||
| 52 | ||
| 53 | #include "emu.h" | |
| 54 | #include "cpu/m6502/m4510.h" | |
| 55 | #include "machine/mos6526.h" | |
| 56 | #include "machine/cbm_snqk.h" | |
| 57 | #include "includes/c65.h" | |
| 58 | #include "bus/cbmiec/cbmiec.h" | |
| 59 | #include "machine/ram.h" | |
| 60 | ||
| 61 | static void cbm_c65_quick_sethiaddress( address_space &space, UINT16 hiaddress ) | |
| 85 | void c65_state::video_start() | |
| 62 | 86 | { |
| 63 | space.write_byte(0x82, hiaddress & 0xff); | |
| 64 | space.write_byte(0x83, hiaddress >> 8); | |
| 65 | 87 | } |
| 66 | 88 | |
| 67 | ||
| 89 | UINT32 c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) | |
| 68 | 90 | { |
| 69 | return general_cbm_loadsnap(image, file_type, quickload_size, m_maincpu->space(AS_PROGRAM), 0, cbm_c65_quick_sethiaddress); | |
| 70 | } | |
| 91 | int y,x; | |
| 92 | gfx_element *gfx = m_gfxdecode->gfx(0); | |
| 71 | 93 | |
| 72 | /************************************* | |
| 73 | * | |
| 74 | * Main CPU memory handlers | |
| 75 | * | |
| 76 | *************************************/ | |
| 94 | for(y=0;y<30;y++) | |
| 95 | { | |
| 96 | for(x=0;x<40;x++) | |
| 97 | { | |
| 98 | UINT8 tile = m_workram[x+y*40+0x800]; | |
| 99 | gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); | |
| 100 | } | |
| 101 | } | |
| 77 | 102 | |
| 78 | static ADDRESS_MAP_START( c65_mem , AS_PROGRAM, 8, c65_state ) | |
| 79 | AM_RANGE(0x00000, 0x07fff) AM_RAMBANK("bank11") | |
| 80 | AM_RANGE(0x08000, 0x09fff) AM_READ_BANK("bank1") AM_WRITE_BANK("bank12") | |
| 81 | AM_RANGE(0x0a000, 0x0bfff) AM_READ_BANK("bank2") AM_WRITE_BANK("bank13") | |
| 82 | AM_RANGE(0x0c000, 0x0cfff) AM_READ_BANK("bank3") AM_WRITE_BANK("bank14") | |
| 83 | AM_RANGE(0x0d000, 0x0d7ff) AM_READ_BANK("bank4") AM_WRITE_BANK("bank5") | |
| 84 | AM_RANGE(0x0d800, 0x0dbff) AM_READ_BANK("bank6") AM_WRITE_BANK("bank7") | |
| 85 | AM_RANGE(0x0dc00, 0x0dfff) AM_READ_BANK("bank8") AM_WRITE_BANK("bank9") | |
| 86 | AM_RANGE(0x0e000, 0x0ffff) AM_READ_BANK("bank10") AM_WRITE_BANK("bank15") | |
| 87 | AM_RANGE(0x10000, 0x1f7ff) AM_RAM | |
| 88 | AM_RANGE(0x1f800, 0x1ffff) AM_RAM AM_SHARE("colorram") | |
| 103 | return 0; | |
| 104 | } | |
| 89 | 105 | |
| 90 | AM_RANGE(0x20000, 0x23fff) AM_ROM /* &c65_dos, maps to 0x8000 */ | |
| 91 | AM_RANGE(0x24000, 0x28fff) AM_ROM /* reserved */ | |
| 92 | AM_RANGE(0x29000, 0x29fff) AM_ROM AM_SHARE("c65_chargen") | |
| 93 | AM_RANGE(0x2a000, 0x2bfff) AM_ROM AM_SHARE("basic") | |
| 94 | AM_RANGE(0x2c000, 0x2cfff) AM_ROM AM_SHARE("interface") | |
| 95 | AM_RANGE(0x2d000, 0x2dfff) AM_ROM AM_SHARE("chargen") | |
| 96 | AM_RANGE(0x2e000, 0x2ffff) AM_ROM AM_SHARE("kernal") | |
| 106 | READ8_MEMBER(c65_state::vic4567_dummy_r) | |
| 107 | { | |
| 108 | UINT8 res; | |
| 97 | 109 | |
| 98 | AM_RANGE(0x30000, 0x31fff) AM_ROM /*&c65_monitor, monitor maps to 0x6000 */ | |
| 99 | AM_RANGE(0x32000, 0x37fff) AM_ROM /*&c65_basic, */ | |
| 100 | AM_RANGE(0x38000, 0x3bfff) AM_ROM /*&c65_graphics, */ | |
| 101 | AM_RANGE(0x3c000, 0x3dfff) AM_ROM /* reserved */ | |
| 102 | AM_RANGE(0x3e000, 0x3ffff) AM_ROM /* &c65_kernal, */ | |
| 110 | res=0xff; | |
| 111 | switch(offset) | |
| 112 | { | |
| 113 | case 0x11: | |
| 114 | res = (m_screen->vpos() & 0x100) >> 1; | |
| 115 | return res; | |
| 116 | case 0x12: | |
| 117 | res = (m_screen->vpos() & 0xff); | |
| 118 | return res; | |
| 119 | case 0x19: | |
| 120 | return m_VIC2_IRQPend; | |
| 121 | case 0x30: | |
| 122 | return m_VIC3_ControlA; | |
| 123 | case 0x31: | |
| 124 | return m_VIC3_ControlB; | |
| 125 | } | |
| 126 | ||
| 127 | if(!space.debugger_access()) | |
| 128 | printf("%02x\n",offset); // TODO: PC | |
| 129 | return res; | |
| 130 | } | |
| 103 | 131 | |
| 104 | AM_RANGE(0x40000, 0x7ffff) AM_NOP | |
| 105 | /* 8 megabyte full address space! */ | |
| 106 | ADDRESS_MAP_END | |
| 107 | ||
| 108 | ||
| 109 | /************************************* | |
| 110 | * | |
| 111 | * Input Ports | |
| 112 | * | |
| 113 | *************************************/ | |
| 114 | ||
| 115 | static INPUT_PORTS_START( c65 ) | |
| 116 | PORT_START( "ROW0" ) | |
| 117 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Down Up") PORT_CODE(KEYCODE_RALT) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CHAR(UCHAR_MAMEKEY(UP)) | |
| 118 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F5)) | |
| 119 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F3)) | |
| 120 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) | |
| 121 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F7)) | |
| 122 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Crsr Right Left") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) | |
| 123 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) | |
| 124 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("INST DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) | |
| 125 | ||
| 126 | PORT_START( "ROW1" ) | |
| 127 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) | |
| 128 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') | |
| 129 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') | |
| 130 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') | |
| 131 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') | |
| 132 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') | |
| 133 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') | |
| 134 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') | |
| 135 | ||
| 136 | PORT_START( "ROW2" ) | |
| 137 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') | |
| 138 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') | |
| 139 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') | |
| 140 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') | |
| 141 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') | |
| 142 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') | |
| 143 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') | |
| 144 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') | |
| 145 | ||
| 146 | PORT_START( "ROW3" ) | |
| 147 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') | |
| 148 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') | |
| 149 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') | |
| 150 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') | |
| 151 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') | |
| 152 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') | |
| 153 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') | |
| 154 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') | |
| 155 | ||
| 156 | PORT_START( "ROW4" ) | |
| 157 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') | |
| 158 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') | |
| 159 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') | |
| 160 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') | |
| 161 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') | |
| 162 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') | |
| 163 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') | |
| 164 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') | |
| 165 | ||
| 166 | PORT_START( "ROW5" ) | |
| 167 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') | |
| 168 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('@') | |
| 169 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') | |
| 170 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') | |
| 171 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') | |
| 172 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') | |
| 173 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') | |
| 174 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') | |
| 175 | ||
| 176 | PORT_START( "ROW6" ) | |
| 177 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') | |
| 178 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91 Pi") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x2191) PORT_CHAR(0x03C0) | |
| 179 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') | |
| 180 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) | |
| 181 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CLR HOME") PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(HOME)) | |
| 182 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') | |
| 183 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') | |
| 184 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xA3') | |
| 185 | ||
| 186 | PORT_START( "ROW7" ) | |
| 187 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUN STOP") PORT_CODE(KEYCODE_HOME) | |
| 188 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') | |
| 189 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CBM") PORT_CODE(KEYCODE_LALT) | |
| 190 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') | |
| 191 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') | |
| 192 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_SHIFT_2) | |
| 193 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x90") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(0x2190) | |
| 194 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') | |
| 195 | PORT_START("FUNCT") | |
| 196 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) | |
| 197 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13 F14") PORT_CODE(KEYCODE_F11) | |
| 198 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11 F12") PORT_CODE(KEYCODE_F10) | |
| 199 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9 F10") PORT_CODE(KEYCODE_F9) | |
| 200 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F12) | |
| 201 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F2) /* non blocking */ | |
| 202 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) | |
| 203 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NO SCRL") PORT_CODE(KEYCODE_F4) | |
| 204 | ||
| 205 | PORT_START( "SPECIAL" ) /* special keys */ | |
| 206 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR) | |
| 207 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) | |
| 208 | PORT_CONFNAME( 0x20, 0x00, "(C65) Caps Lock (switch)") PORT_CODE(KEYCODE_F3) | |
| 209 | PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) | |
| 210 | PORT_CONFSETTING( 0x20, DEF_STR( On ) ) | |
| 211 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 212 | ||
| 213 | PORT_START("CTRLSEL") /* Controller selection */ | |
| 214 | PORT_CONFNAME( 0x07, 0x00, "Gameport A" ) | |
| 215 | PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) ) | |
| 216 | PORT_CONFSETTING( 0x01, "Paddles 1 & 2" ) | |
| 217 | PORT_CONFSETTING( 0x02, "Mouse 1351" ) | |
| 218 | PORT_CONFSETTING( 0x03, "Mouse (Non Proportional) 1350" ) | |
| 219 | PORT_CONFSETTING( 0x04, "Lightpen" ) | |
| 220 | // PORT_CONFSETTING( 0x05, "Koala Pad" ) | |
| 221 | PORT_CONFSETTING( 0x06, "Lightgun" ) | |
| 222 | PORT_CONFSETTING( 0x07, "No Device Connected" ) | |
| 223 | PORT_CONFNAME( 0x70, 0x00, "Gameport B" ) | |
| 224 | PORT_CONFSETTING( 0x00, DEF_STR( Joystick ) ) | |
| 225 | PORT_CONFSETTING( 0x10, "Paddles 3 & 4" ) | |
| 226 | // PORT_CONFSETTING( 0x20, "Mouse 1351" ) | |
| 227 | // PORT_CONFSETTING( 0x30, "Mouse (Non Proportional) 1350" ) | |
| 228 | PORT_CONFSETTING( 0x70, "No Device Connected" ) | |
| 229 | PORT_CONFNAME( 0x80, 0x00, "Swap Gameport A and B") PORT_CODE(KEYCODE_F1) PORT_TOGGLE | |
| 230 | PORT_CONFSETTING( 0x00, DEF_STR( No ) ) | |
| 231 | PORT_CONFSETTING( 0x80, DEF_STR( Yes ) ) | |
| 232 | ||
| 233 | PORT_START("JOY1_1B") | |
| 234 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) | |
| 235 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) | |
| 236 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) | |
| 237 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) | |
| 238 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x00) | |
| 239 | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 240 | ||
| 241 | PORT_START("JOY2_1B") | |
| 242 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) | |
| 243 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) | |
| 244 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) | |
| 245 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) | |
| 246 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x00) | |
| 247 | PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 248 | ||
| 249 | /* Mouse Commodore 1350 was basically working as a Joystick */ | |
| 250 | PORT_START("JOY1_2B") | |
| 251 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Up") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) | |
| 252 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Down") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) | |
| 253 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Left") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) | |
| 254 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Right") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) | |
| 255 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 1") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) | |
| 256 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 2") PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x03) | |
| 257 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 258 | ||
| 259 | /* Still to verify how many mices you were able to plug into a c64 */ | |
| 260 | /* Only one, for now */ | |
| 261 | PORT_START("JOY2_2B") | |
| 262 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 263 | /* PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) | |
| 264 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) | |
| 265 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) | |
| 266 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) | |
| 267 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) | |
| 268 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_PGUP) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x30) | |
| 269 | PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) | |
| 270 | */ | |
| 271 | PORT_START("PADDLE1") | |
| 272 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) PORT_PLAYER(1) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) | |
| 273 | ||
| 274 | PORT_START("PADDLE2") | |
| 275 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_DOWN) PORT_CODE_INC(KEYCODE_UP) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) PORT_PLAYER(2) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) | |
| 276 | ||
| 277 | PORT_START("PADDLE3") | |
| 278 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_HOME) PORT_CODE_INC(KEYCODE_PGUP) PORT_PLAYER(3) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) | |
| 279 | ||
| 280 | PORT_START("PADDLE4") | |
| 281 | PORT_BIT( 0xff, 128, IPT_PADDLE) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0,255) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_END) PORT_CODE_INC(KEYCODE_PGDN) PORT_PLAYER(4) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) | |
| 282 | ||
| 283 | PORT_START("TRACKX") | |
| 284 | PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) | |
| 285 | ||
| 286 | PORT_START("TRACKY") | |
| 287 | PORT_BIT( 0x7e, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_REVERSE PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) | |
| 288 | ||
| 289 | PORT_START("LIGHTX") | |
| 290 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_NAME("Lightpen X Axis") PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) | |
| 291 | ||
| 292 | PORT_START("LIGHTY") | |
| 293 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y) PORT_NAME("Lightpen Y Axis") PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) | |
| 294 | ||
| 295 | PORT_START("OTHER") | |
| 296 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Paddle 1 Button") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) | |
| 297 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Paddle 2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x01) | |
| 298 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Paddle 3 Button") PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) | |
| 299 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Paddle 4 Button") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0xf0, EQUALS, 0x10) | |
| 300 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Lightpen Signal") PORT_CODE(KEYCODE_LCONTROL) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x04) | |
| 301 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button Left") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02) | |
| 302 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button Right") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON2) PORT_CONDITION("CTRLSEL", 0x0f, EQUALS, 0x02)INPUT_PORTS_END | |
| 303 | ||
| 304 | ||
| 305 | static INPUT_PORTS_START( c65ger ) | |
| 306 | PORT_INCLUDE( c65 ) | |
| 307 | ||
| 308 | PORT_MODIFY( "ROW1" ) | |
| 309 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z { Y }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') | |
| 310 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') | |
| 311 | ||
| 312 | PORT_MODIFY( "ROW3" ) | |
| 313 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Y { Z }") PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') | |
| 314 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 ' { 7 / }") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'') | |
| 315 | ||
| 316 | PORT_MODIFY( "ROW4" ) | |
| 317 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 { = }") PORT_CODE(KEYCODE_0) PORT_CHAR('0') | |
| 318 | ||
| 319 | PORT_MODIFY( "ROW5" ) | |
| 320 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", < { ; }") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') | |
| 321 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Paragraph \xE2\x86\x91 { \xc3\xbc }") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(0x00A7) PORT_CHAR(0x2191) | |
| 322 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": [ { \xc3\xa4 }") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('[') | |
| 323 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". > { : }") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') | |
| 324 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- { ' ` }") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') | |
| 325 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("+ { \xc3\x9f ? }") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('+') | |
| 326 | ||
| 327 | PORT_MODIFY( "ROW6" ) | |
| 328 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ? { - _ }") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') | |
| 329 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Sum Pi { ] \\ }") PORT_CODE(KEYCODE_DEL) PORT_CHAR(0x03A3) PORT_CHAR(0x03C0) | |
| 330 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("= { # ' }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('=') | |
| 331 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; ] { \xc3\xb6 }") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR(']') | |
| 332 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("* ` { + * }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('*') PORT_CHAR('`') | |
| 333 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ { [ \xE2\x86\x91 }") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR('\xa3') | |
| 334 | ||
| 335 | PORT_MODIFY( "ROW7" ) | |
| 336 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("_ { < > }") PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') | |
| 337 | ||
| 338 | PORT_MODIFY("SPECIAL") /* special keys */ | |
| 339 | PORT_DIPNAME( 0x20, 0x00, "(C65) DIN ASC (switch)") PORT_CODE(KEYCODE_F3) | |
| 340 | PORT_DIPSETTING( 0x00, "ASC" ) | |
| 341 | PORT_DIPSETTING( 0x20, "DIN" ) | |
| 342 | INPUT_PORTS_END | |
| 343 | ||
| 344 | ||
| 345 | ||
| 346 | /************************************* | |
| 347 | * | |
| 348 | * Sound definitions | |
| 349 | * | |
| 350 | *************************************/ | |
| 351 | ||
| 352 | int c65_state::c64_paddle_read( device_t *device, address_space &space, int which ) | |
| 132 | WRITE8_MEMBER(c65_state::vic4567_dummy_w) | |
| 353 | 133 | { |
| 354 | int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp; | |
| 355 | UINT8 cia0porta = machine().device<mos6526_device>("cia_0")->pa_r(space, 0); | |
| 356 | int controller1 = ioport("CTRLSEL")->read() & 0x07; | |
| 357 | int controller2 = ioport("CTRLSEL")->read() & 0x70; | |
| 358 | /* Notice that only a single input is defined for Mouse & Lightpen in both ports */ | |
| 359 | switch (controller1) | |
| 134 | switch(offset) | |
| 360 | 135 | { |
| 361 | case 0x01: | |
| 362 | if (which) | |
| 363 | pot2 = ioport("PADDLE2")->read(); | |
| 364 | else | |
| 365 | pot1 = ioport("PADDLE1")->read(); | |
| 136 | case 0x19: | |
| 137 | m_VIC2_IRQPend = data & 0x8f; | |
| 366 | 138 | break; |
| 367 | ||
| 368 | case 0x02: | |
| 369 | if (which) | |
| 370 | pot2 = ioport("TRACKY")->read(); | |
| 371 | else | |
| 372 | pot1 = ioport("TRACKX")->read(); | |
| 139 | case 0x1a: | |
| 140 | m_VIC2_IRQMask = data & 0xf; | |
| 373 | 141 | break; |
| 374 | ||
| 375 | case 0x03: | |
| 376 | if (which && (ioport("JOY1_2B")->read() & 0x20)) /* Joy1 Button 2 */ | |
| 377 | pot1 = 0x00; | |
| 142 | /* KEY register, handles vic-iii and vic-ii modes via two consecutive writes | |
| 143 | 0xa5 -> 0x96 vic-iii mode | |
| 144 | any other write vic-ii mode | |
| 145 | */ | |
| 146 | //case 0x2f: break; | |
| 147 | case 0x30: | |
| 148 | if((data & 0xfe) != 0x64) | |
| 149 | printf("CONTROL A %02x\n",data); | |
| 150 | m_VIC3_ControlA = data; | |
| 378 | 151 | break; |
| 379 | ||
| 380 | case 0x04: | |
| 381 | if (which) | |
| 382 | pot2 = ioport("LIGHTY")->read(); | |
| 383 | else | |
| 384 | pot1 = ioport("LIGHTX")->read(); | |
| 152 | case 0x31: | |
| 153 | printf("CONTROL B %02x\n",data); | |
| 154 | m_VIC3_ControlB = data; | |
| 385 | 155 | break; |
| 386 | ||
| 387 | case 0x06: | |
| 388 | if (which && (ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */ | |
| 389 | pot2 = 0x00; | |
| 390 | break; | |
| 391 | ||
| 392 | case 0x00: | |
| 393 | case 0x07: | |
| 394 | break; | |
| 395 | ||
| 396 | 156 | default: |
| 397 | logerror("Invalid Controller Setting %d\n", controller1); | |
| 157 | if(!space.debugger_access()) | |
| 158 | printf("%02x %02x\n",offset,data); | |
| 398 | 159 | break; |
| 399 | 160 | } |
| 400 | 161 | |
| 401 | switch (controller2) | |
| 402 | { | |
| 403 | case 0x10: | |
| 404 | if (which) | |
| 405 | pot4 = ioport("PADDLE4")->read(); | |
| 406 | else | |
| 407 | pot3 = ioport("PADDLE3")->read(); | |
| 408 | break; | |
| 162 | } | |
| 409 | 163 | |
| 410 | case 0x20: | |
| 411 | if (which) | |
| 412 | pot4 = ioport("TRACKY")->read(); | |
| 413 | else | |
| 414 | pot3 = ioport("TRACKX")->read(); | |
| 415 | break; | |
| 164 | void c65_state::PalEntryFlush(UINT8 offset) | |
| 165 | { | |
| 166 | m_palette->set_pen_color(offset, pal4bit(m_palred[offset]), pal4bit(m_palgreen[offset]), pal4bit(m_palblue[offset])); | |
| 167 | } | |
| 416 | 168 | |
| 417 | case 0x30: | |
| 418 | if (which && (ioport("JOY2_2B")->read() & 0x20)) /* Joy2 Button 2 */ | |
| 419 | pot4 = 0x00; | |
| 420 | break; | |
| 169 | WRITE8_MEMBER(c65_state::PalRed_w) | |
| 170 | { | |
| 171 | m_palred[offset] = data; | |
| 172 | PalEntryFlush(offset); | |
| 173 | } | |
| 421 | 174 | |
| 422 | case 0x40: | |
| 423 | if (which) | |
| 424 | pot4 = ioport("LIGHTY")->read(); | |
| 425 | else | |
| 426 | pot3 = ioport("LIGHTX")->read(); | |
| 427 | break; | |
| 175 | WRITE8_MEMBER(c65_state::PalGreen_w) | |
| 176 | { | |
| 177 | m_palblue[offset] = data; | |
| 178 | PalEntryFlush(offset); | |
| 179 | } | |
| 428 | 180 | |
| 429 | case 0x60: | |
| 430 | if (which && (ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */ | |
| 431 | pot4 = 0x00; | |
| 432 | break; | |
| 181 | WRITE8_MEMBER(c65_state::PalBlue_w) | |
| 182 | { | |
| 183 | m_palgreen[offset] = data; | |
| 184 | PalEntryFlush(offset); | |
| 185 | } | |
| 433 | 186 | |
| 434 | case 0x00: | |
| 435 | case 0x70: | |
| 436 | break; | |
| 437 | ||
| 438 | default: | |
| 439 | logerror("Invalid Controller Setting %d\n", controller1); | |
| 440 | break; | |
| 441 | } | |
| 442 | ||
| 443 | if (ioport("CTRLSEL")->read() & 0x80) /* Swap */ | |
| 187 | void c65_state::DMAgicExecute(address_space &space,UINT32 address) | |
| 188 | { | |
| 189 | UINT8 cmd;// = space.read_byte(address++); | |
| 190 | UINT16 length; //= space.read_byte(address++); | |
| 191 | UINT32 src, dst; | |
| 192 | static const char *const dma_cmd_string[] = | |
| 444 | 193 | { |
| 445 | temp = pot1; pot1 = pot3; pot3 = temp; | |
| 446 | temp = pot2; pot2 = pot4; pot4 = temp; | |
| 447 | } | |
| 194 | "COPY", // 0 | |
| 195 | "MIX", | |
| 196 | "SWAP", | |
| 197 | "FILL" | |
| 198 | }; | |
| 199 | cmd = space.read_byte(address++); | |
| 200 | length = space.read_byte(address++); | |
| 201 | length|=(space.read_byte(address++)<<8); | |
| 202 | src = space.read_byte(address++); | |
| 203 | src|=(space.read_byte(address++)<<8); | |
| 204 | src|=(space.read_byte(address++)<<16); | |
| 205 | dst = space.read_byte(address++); | |
| 206 | dst|=(space.read_byte(address++)<<8); | |
| 207 | dst|=(space.read_byte(address++)<<16); | |
| 448 | 208 | |
| 449 | switch | |
| 209 | switch(cmd & 3) | |
| 450 | 210 | { |
| 451 | case 0x40: | |
| 452 | return which ? pot2 : pot1; | |
| 211 | case 0: // copy - TODO: untested | |
| 212 | { | |
| 213 | if(length != 1) | |
| 214 | printf("DMAgic %s %02x -> %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src,dst,length,cmd & 4 ? "yes" : "no"); | |
| 215 | UINT32 SourceIndex; | |
| 216 | UINT32 DestIndex; | |
| 217 | UINT16 SizeIndex; | |
| 218 | SourceIndex = src & 0xfffff; | |
| 219 | DestIndex = dst & 0xfffff; | |
| 220 | SizeIndex = length; | |
| 221 | do | |
| 222 | { | |
| 223 | space.write_byte(DestIndex++,space.read_byte(SourceIndex++)); | |
| 224 | SizeIndex--; | |
| 225 | }while(SizeIndex != 0); | |
| 453 | 226 | |
| 454 | case 0x80: | |
| 455 | return which ? pot4 : pot3; | |
| 227 | return; | |
| 228 | } | |
| 229 | case 3: // fill | |
| 230 | { | |
| 231 | /* TODO: upper bits of source */ | |
| 232 | printf("DMAgic %s %02x -> %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src & 0xff,dst,length,cmd & 4 ? "yes" : "no"); | |
| 233 | UINT8 FillValue; | |
| 234 | UINT32 DestIndex; | |
| 235 | UINT16 SizeIndex; | |
| 236 | FillValue = src & 0xff; | |
| 237 | DestIndex = dst & 0xfffff; | |
| 238 | SizeIndex = length; | |
| 239 | do | |
| 240 | { | |
| 241 | space.write_byte(DestIndex++,FillValue); | |
| 242 | SizeIndex--; | |
| 243 | }while(SizeIndex != 0); | |
| 244 | } | |
| 245 | return; | |
| 246 | } | |
| 247 | printf("DMAgic %s %08x %08x %04x (CHAIN=%s)\n",dma_cmd_string[cmd & 3],src,dst,length,cmd & 4 ? "yes" : "no"); | |
| 248 | } | |
| 456 | 249 | |
| 457 | case 0xc0: | |
| 458 | return which ? pot2 : pot1; | |
| 459 | 250 | |
| 460 | default: | |
| 461 | return 0; | |
| 462 | } | |
| 251 | WRITE8_MEMBER(c65_state::DMAgic_w) | |
| 252 | { | |
| 253 | m_dmalist[offset] = data; | |
| 254 | if(offset == 0) | |
| 255 | DMAgicExecute(space,(m_dmalist[0])|(m_dmalist[1]<<8)|(m_dmalist[2]<<16)); | |
| 463 | 256 | } |
| 464 | 257 | |
| 465 | READ8_MEMBER( | |
| 258 | READ8_MEMBER(c65_state::CIASelect_r) | |
| 466 | 259 | { |
| 467 | return c64_paddle_read(m_sid_r, space, 0); | |
| 260 | if(m_VIC3_ControlA & 1) | |
| 261 | return m_cram[offset]; | |
| 262 | else | |
| 263 | { | |
| 264 | // CIA | |
| 265 | } | |
| 266 | ||
| 267 | return 0; | |
| 468 | 268 | } |
| 469 | 269 | |
| 470 | RE | |
| 270 | WRITE8_MEMBER(c65_state::CIASelect_w) | |
| 471 | 271 | { |
| 472 | return c64_paddle_read(m_sid_r, space, 1); | |
| 272 | if(m_VIC3_ControlA & 1) | |
| 273 | m_cram[offset] = data; | |
| 274 | else | |
| 275 | { | |
| 276 | // CIA | |
| 277 | } | |
| 278 | ||
| 473 | 279 | } |
| 474 | 280 | |
| 475 | ||
| 476 | /************************************* | |
| 477 | * | |
| 478 | * VIC III interfaces | |
| 479 | * | |
| 480 | *************************************/ | |
| 481 | ||
| 482 | UINT32 c65_state::screen_update_c65(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) | |
| 281 | READ8_MEMBER(c65_state::dummy_r) | |
| 483 | 282 | { |
| 484 | m_vic->video_update(bitmap, cliprect); | |
| 485 | 283 | return 0; |
| 486 | 284 | } |
| 487 | 285 | |
| 488 | READ8_MEMBER(c65_state::c65_lightpen_x_cb) | |
| 286 | static ADDRESS_MAP_START( c65_map, AS_PROGRAM, 8, c65_state ) | |
| 287 | AM_RANGE(0x00000, 0x07fff) AM_RAM AM_SHARE("wram") // TODO: bank | |
| 288 | AM_RANGE(0x0c800, 0x0cfff) AM_ROM AM_REGION("maincpu", 0xc800) | |
| 289 | AM_RANGE(0x0d000, 0x0d07f) AM_READWRITE(vic4567_dummy_r,vic4567_dummy_w) // 0x0d000, 0x0d07f VIC-4567 | |
| 290 | AM_RANGE(0x0d080, 0x0d081) AM_READ(dummy_r) // 0x0d080, 0x0d09f FDC | |
| 291 | // 0x0d0a0, 0x0d0ff Ram Expansion Control (REC) | |
| 292 | AM_RANGE(0x0d100, 0x0d1ff) AM_RAM_WRITE(PalRed_w) AM_SHARE("redpal")// 0x0d100, 0x0d1ff Red Palette | |
| 293 | AM_RANGE(0x0d200, 0x0d2ff) AM_RAM_WRITE(PalGreen_w) AM_SHARE("greenpal") // 0x0d200, 0x0d2ff Green Palette | |
| 294 | AM_RANGE(0x0d300, 0x0d3ff) AM_RAM_WRITE(PalBlue_w) AM_SHARE("bluepal") // 0x0d300, 0x0d3ff Blue Palette | |
| 295 | // 0x0d400, 0x0d4*f Right SID | |
| 296 | // 0x0d440, 0x0d4*f Left SID | |
| 297 | // 0x0d600, 0x0d6** UART | |
| 298 | AM_RANGE(0x0d700, 0x0d702) AM_WRITE(DMAgic_w) AM_SHARE("dmalist") // 0x0d700, 0x0d7** DMAgic | |
| 299 | //AM_RANGE(0x0d703, 0x0d703) AM_READ(DMAgic_r) | |
| 300 | // 0x0d800, 0x0d8** Color matrix | |
| 301 | AM_RANGE(0x0dc00, 0x0dfff) AM_READWRITE(CIASelect_r,CIASelect_w) AM_SHARE("cram") | |
| 302 | // 0x0dc00, 0x0dc** CIA-1 | |
| 303 | // 0x0dd00, 0x0dd** CIA-2 | |
| 304 | // 0x0de00, 0x0de** Ext I/O Select 1 | |
| 305 | // 0x0df00, 0x0df** Ext I/O Select 2 (RAM window?) | |
| 306 | AM_RANGE(0x0e000, 0x0ffff) AM_ROM AM_REGION("maincpu",0x0e000) | |
| 307 | AM_RANGE(0x10000, 0x1f7ff) AM_RAM | |
| 308 | AM_RANGE(0x1f800, 0x1ffff) AM_RAM // VRAM attributes | |
| 309 | AM_RANGE(0x20000, 0x3ffff) AM_ROM AM_REGION("maincpu",0) | |
| 310 | ADDRESS_MAP_END | |
| 311 | ||
| 312 | ||
| 313 | ||
| 314 | static INPUT_PORTS_START( c65 ) | |
| 315 | /* dummy active high structure */ | |
| 316 | PORT_START("SYSA") | |
| 317 | PORT_DIPNAME( 0x01, 0x00, "SYSA" ) | |
| 318 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 319 | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) | |
| 320 | PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) | |
| 321 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 322 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) | |
| 323 | PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) | |
| 324 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 325 | PORT_DIPSETTING( 0x04, DEF_STR( On ) ) | |
| 326 | PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) | |
| 327 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 328 | PORT_DIPSETTING( 0x08, DEF_STR( On ) ) | |
| 329 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) | |
| 330 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 331 | PORT_DIPSETTING( 0x10, DEF_STR( On ) ) | |
| 332 | PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) | |
| 333 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 334 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) | |
| 335 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) | |
| 336 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 337 | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) | |
| 338 | PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) | |
| 339 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) | |
| 340 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) | |
| 341 | ||
| 342 | /* dummy active low structure */ | |
| 343 | PORT_START("DSWA") | |
| 344 | PORT_DIPNAME( 0x01, 0x01, "DSWA" ) | |
| 345 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) | |
| 346 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 347 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) | |
| 348 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) | |
| 349 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 350 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) | |
| 351 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) | |
| 352 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 353 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) | |
| 354 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) | |
| 355 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 356 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) | |
| 357 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) | |
| 358 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 359 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) | |
| 360 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) | |
| 361 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 362 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) | |
| 363 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 364 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 365 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) | |
| 366 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) | |
| 367 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 368 | INPUT_PORTS_END | |
| 369 | ||
| 370 | ||
| 371 | void c65_state::machine_start() | |
| 489 | 372 | { |
| 490 | return ioport("LIGHTX")->read() & ~0x01; | |
| 491 | 373 | } |
| 492 | 374 | |
| 493 | ||
| 375 | void c65_state::machine_reset() | |
| 494 | 376 | { |
| 495 | return ioport("LIGHTY")->read() & ~0x01; | |
| 496 | 377 | } |
| 497 | 378 | |
| 498 | READ8_MEMBER(c65_state::c65_lightpen_button_cb) | |
| 379 | ||
| 380 | PALETTE_INIT_MEMBER(c65_state, c65) | |
| 499 | 381 | { |
| 500 | | |
| 382 | // TODO: initial state? | |
| 501 | 383 | } |
| 502 | 384 | |
| 503 | ||
| 385 | static const gfx_layout charlayout = | |
| 504 | 386 | { |
| 505 | return m_memory[offset]; | |
| 506 | } | |
| 387 | 8,8, | |
| 388 | 0x1000/8, | |
| 389 | 1, | |
| 390 | { RGN_FRAC(0,1) }, | |
| 391 | { 0, 1, 2, 3, 4, 5, 6, 7 }, | |
| 392 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, | |
| 393 | 8*8 | |
| 394 | }; | |
| 507 | 395 | |
| 508 | INTERRUPT_GEN_MEMBER(c65_state::vic3_raster_irq) | |
| 396 | static GFXDECODE_START( c65 ) | |
| 397 | GFXDECODE_ENTRY( "maincpu", 0xd000, charlayout, 0, 1 ) // another identical copy is at 0x9000 | |
| 398 | GFXDECODE_END | |
| 399 | ||
| 400 | INTERRUPT_GEN_MEMBER(c65_state::vic3_vblank_irq) | |
| 509 | 401 | { |
| 510 | m_vic->raster_interrupt_gen(); | |
| 402 | //if(m_VIC2_IRQMask & 1) | |
| 403 | // m_maincpu->set_input_line(M4510_IRQ_LINE,HOLD_LINE); | |
| 511 | 404 | } |
| 512 | 405 | |
| 513 | /************************************* | |
| 514 | * | |
| 515 | * Machine driver | |
| 516 | * | |
| 517 | *************************************/ | |
| 518 | ||
| 519 | 406 | static MACHINE_CONFIG_START( c65, c65_state ) |
| 407 | ||
| 520 | 408 | /* basic machine hardware */ |
| 521 | MCFG_CPU_ADD("maincpu", M4510, 3500000) /* or VIC6567_CLOCK, */ | |
| 522 | MCFG_CPU_PROGRAM_MAP(c65_mem) | |
| 523 | MCFG_CPU_VBLANK_INT_DRIVER("screen", c65_state, c65_frame_interrupt) | |
| 524 | MCFG_CPU_PERIODIC_INT_DRIVER(c65_state, vic3_raster_irq, VIC6567_HRETRACERATE) | |
| 409 | MCFG_CPU_ADD("maincpu",M4510,MAIN_CLOCK) | |
| 410 | MCFG_CPU_PROGRAM_MAP(c65_map) | |
| 411 | MCFG_CPU_VBLANK_INT_DRIVER("screen",c65_state,vic3_vblank_irq) | |
| 525 | 412 | |
| 526 | MCFG_MACHINE_START_OVERRIDE(c65_state, c65 ) | |
| 527 | ||
| 528 | 413 | /* video hardware */ |
| 529 | 414 | MCFG_SCREEN_ADD("screen", RASTER) |
| 530 | MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) | |
| 531 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ | |
| 532 | MCFG_SCREEN_SIZE(525 * 2, 520 * 2) | |
| 533 | MCFG_SCREEN_VISIBLE_AREA(VIC6567_STARTVISIBLECOLUMNS ,(VIC6567_STARTVISIBLECOLUMNS + VIC6567_VISIBLECOLUMNS - 1) * 2, VIC6567_STARTVISIBLELINES, VIC6567_STARTVISIBLELINES + VIC6567_VISIBLELINES - 1) | |
| 534 | MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update_c65) | |
| 535 | MCFG_SCREEN_PALETTE("vic3:palette") | |
| 415 | // MCFG_SCREEN_REFRESH_RATE(60) | |
| 416 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) | |
| 417 | MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update) | |
| 418 | // MCFG_SCREEN_SIZE(32*8, 32*8) | |
| 419 | // MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) | |
| 420 | MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, 910, 0, 320, 525, 0, 240) // mods needed | |
| 421 | MCFG_SCREEN_PALETTE("palette") | |
| 536 | 422 | |
| 537 | MCFG_DEVICE_ADD("vic3", VIC3, 0) | |
| 538 | MCFG_VIC3_CPU("maincpu") | |
| 539 | MCFG_VIC3_TYPE(VIC4567_NTSC) | |
| 540 | MCFG_VIC3_LIGHTPEN_X_CB(READ8(c65_state, c65_lightpen_x_cb)) | |
| 541 | MCFG_VIC3_LIGHTPEN_Y_CB(READ8(c65_state, c65_lightpen_y_cb)) | |
| 542 | MCFG_VIC3_LIGHTPEN_BUTTON_CB(READ8(c65_state, c65_lightpen_button_cb)) | |
| 543 | MCFG_VIC3_DMA_READ_CB(READ8(c65_state, c65_dma_read)) | |
| 544 | MCFG_VIC3_DMA_READ_COLOR_CB(READ8(c65_state, c65_dma_read_color)) | |
| 545 | MCFG_VIC3_INTERRUPT_CB(WRITELINE(c65_state, c65_vic_interrupt)) | |
| 546 | MCFG_VIC3_PORT_CHANGED_CB(WRITE8(c65_state, c65_bankswitch_interface)) | |
| 547 | MCFG_VIC3_C64_MEM_R_CB(READ8(c65_state, c65_c64_mem_r)) | |
| 423 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", c65) | |
| 548 | 424 | |
| 549 | /* sound hardware */ | |
| 550 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") | |
| 551 | MCFG_SOUND_ADD("sid_r", MOS8580, 985248) | |
| 552 | MCFG_MOS6581_POTX_CALLBACK(READ8(c65_state, sid_potx_r)) | |
| 553 | MCFG_MOS6581_POTY_CALLBACK(READ8(c65_state, sid_poty_r)) | |
| 554 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) | |
| 555 | MCFG_SOUND_ADD("sid_l", MOS8580, 985248) | |
| 556 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) | |
| 425 | MCFG_PALETTE_ADD("palette", 0x100) | |
| 426 | MCFG_PALETTE_INIT_OWNER(c65_state, c65) | |
| 557 | 427 | |
| 558 | /* quickload */ | |
| 559 | MCFG_QUICKLOAD_ADD("quickload", c65_state, cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) | |
| 560 | ||
| 561 | /* cia */ | |
| 562 | MCFG_DEVICE_ADD("cia_0", MOS6526, 3500000) | |
| 563 | MCFG_MOS6526_TOD(60) | |
| 564 | MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia0_interrupt)) | |
| 565 | MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia0_port_a_r)) | |
| 566 | MCFG_MOS6526_PB_INPUT_CALLBACK(READ8(c65_state, c65_cia0_port_b_r)) | |
| 567 | MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia0_port_b_w)) | |
| 568 | ||
| 569 | MCFG_DEVICE_ADD("cia_1", MOS6526, 3500000) | |
| 570 | MCFG_MOS6526_TOD(60) | |
| 571 | MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(c65_state, c65_cia1_interrupt)) | |
| 572 | MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(c65_state, c65_cia1_port_a_r)) | |
| 573 | MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(c65_state, c65_cia1_port_a_w)) | |
| 574 | ||
| 575 | /* floppy from serial bus */ | |
| 576 | MCFG_CBM_IEC_ADD(NULL) | |
| 577 | ||
| 578 | /* internal ram */ | |
| 579 | MCFG_RAM_ADD(RAM_TAG) | |
| 580 | MCFG_RAM_DEFAULT_SIZE("128K") | |
| 581 | MCFG_RAM_EXTRA_OPTIONS("640K,4224K") | |
| 582 | MACHINE_CONFIG_END | |
| 583 | ||
| 584 | static MACHINE_CONFIG_DERIVED( c65pal, c65 ) | |
| 585 | MCFG_SCREEN_MODIFY("screen") | |
| 586 | MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) | |
| 587 | MCFG_SCREEN_SIZE(625 * 2, 520 * 2) | |
| 588 | MCFG_SCREEN_VISIBLE_AREA(VIC6569_STARTVISIBLECOLUMNS, (VIC6569_STARTVISIBLECOLUMNS + VIC6569_VISIBLECOLUMNS - 1) * 2, VIC6569_STARTVISIBLELINES, VIC6569_STARTVISIBLELINES + VIC6569_VISIBLELINES - 1) | |
| 589 | MCFG_SCREEN_PALETTE("vic3:palette") | |
| 590 | ||
| 591 | MCFG_DEVICE_MODIFY("vic3") | |
| 592 | MCFG_VIC3_TYPE(VIC4567_PAL) | |
| 593 | ||
| 594 | 428 | /* sound hardware */ |
| 595 | MCFG_SOUND_REPLACE("sid_r", MOS8580, 1022727) | |
| 596 | MCFG_MOS6581_POTX_CALLBACK(READ8(c65_state, sid_potx_r)) | |
| 597 | MCFG_MOS6581_POTY_CALLBACK(READ8(c65_state, sid_poty_r)) | |
| 598 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) | |
| 599 | MCFG_SOUND_REPLACE("sid_l", MOS8580, 1022727) | |
| 600 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) | |
| 601 | ||
| 602 | /* cia */ | |
| 603 | MCFG_DEVICE_MODIFY("cia_0") | |
| 604 | MCFG_MOS6526_TOD(50) | |
| 605 | ||
| 606 | MCFG_DEVICE_MODIFY("cia_1") | |
| 607 | MCFG_MOS6526_TOD(50) | |
| 429 | MCFG_SPEAKER_STANDARD_MONO("mono") | |
| 430 | // MCFG_SOUND_ADD("aysnd", AY8910, MAIN_CLOCK/4) | |
| 431 | // MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) | |
| 608 | 432 | MACHINE_CONFIG_END |
| 609 | 433 | |
| 610 | 434 | |
| 611 | /************************************* | |
| 612 | * | |
| 613 | * ROM definition(s) | |
| 614 | * | |
| 615 | *************************************/ | |
| 435 | /*************************************************************************** | |
| 616 | 436 | |
| 437 | Game driver(s) | |
| 617 | 438 | |
| 439 | ***************************************************************************/ | |
| 440 | ||
| 618 | 441 | ROM_START( c65 ) |
| 619 | ROM_REGION( 0x | |
| 442 | ROM_REGION( 0x20000, "maincpu", 0 ) | |
| 620 | 443 | ROM_SYSTEM_BIOS( 0, "910111", "V0.9.910111" ) |
| 621 | ROMX_LOAD( "910111.bin", 0x | |
| 444 | ROMX_LOAD( "910111.bin", 0x0000, 0x20000, CRC(c5d8d32e) SHA1(71c05f098eff29d306b0170e2c1cdeadb1a5f206), ROM_BIOS(1) ) | |
| 622 | 445 | ROM_SYSTEM_BIOS( 1, "910523", "V0.9.910523" ) |
| 623 | ROMX_LOAD( "910523.bin", 0x | |
| 446 | ROMX_LOAD( "910523.bin", 0x0000, 0x20000, CRC(e8235dd4) SHA1(e453a8e7e5b95de65a70952e9d48012191e1b3e7), ROM_BIOS(2) ) | |
| 624 | 447 | ROM_SYSTEM_BIOS( 2, "910626", "V0.9.910626" ) |
| 625 | ROMX_LOAD( "910626.bin", 0x | |
| 448 | ROMX_LOAD( "910626.bin", 0x0000, 0x20000, CRC(12527742) SHA1(07c185b3bc58410183422f7ac13a37ddd330881b), ROM_BIOS(3) ) | |
| 626 | 449 | ROM_SYSTEM_BIOS( 3, "910828", "V0.9.910828" ) |
| 627 | ROMX_LOAD( "910828.bin", 0x | |
| 450 | ROMX_LOAD( "910828.bin", 0x0000, 0x20000, CRC(3ee40b06) SHA1(b63d970727a2b8da72a0a8e234f3c30a20cbcb26), ROM_BIOS(4) ) | |
| 628 | 451 | ROM_SYSTEM_BIOS( 4, "911001", "V0.9.911001" ) |
| 629 | ROMX_LOAD( "911001.bin", 0x | |
| 452 | ROMX_LOAD( "911001.bin", 0x0000, 0x20000, CRC(0888b50f) SHA1(129b9a2611edaebaa028ac3e3f444927c8b1fc5d), ROM_BIOS(5) ) | |
| 630 | 453 | ROM_END |
| 631 | 454 | |
| 632 | 455 | ROM_START( c64dx ) |
| 633 | ROM_REGION( 0x400000, "maincpu", 0 ) | |
| 634 | ROM_LOAD( "910429.bin", 0x20000, 0x20000, CRC(b025805c) SHA1(c3b05665684f74adbe33052a2d10170a1063ee7d) ) | |
| 456 | ROM_REGION( 0x20000, "maincpu", 0 ) | |
| 457 | ROM_LOAD( "910429.bin", 0x0000, 0x20000, CRC(b025805c) SHA1(c3b05665684f74adbe33052a2d10170a1063ee7d) ) | |
| 635 | 458 | ROM_END |
| 636 | 459 | |
| 637 | /*************************************************************************** | |
| 460 | DRIVER_INIT_MEMBER(c65_state,c65) | |
| 461 | { | |
| 462 | // m_dma.version = 2; | |
| 463 | // c65_common_driver_init(); | |
| 464 | } | |
| 638 | 465 | |
| 639 | Game driver(s) | |
| 466 | DRIVER_INIT_MEMBER(c65_state,c65pal) | |
| 467 | { | |
| 468 | // m_dma.version = 1; | |
| 469 | // c65_common_driver_init(); | |
| 470 | // m_pal = 1; | |
| 471 | } | |
| 640 | 472 | |
| 641 | ***************************************************************************/ | |
| 642 | ||
| 643 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ | |
| 644 | ||
| 645 | COMP( 1991, c65, 0, 0, c65, c65, c65_state, c65, "Commodore Business Machines", "Commodore 65 Development System (Prototype, NTSC)", GAME_NOT_WORKING ) | |
| 646 | COMP( 1991, c64dx, c65, 0, c65pal, c65ger, c65_state, c65pal, "Commodore Business Machines", "Commodore 64DX Development System (Prototype, PAL, German)", GAME_NOT_WORKING ) | |
| 473 | COMP( 1991, c65, 0, 0, c65, c65, c65_state, c65, "Commodore Business Machines", "Commodore 65 Development System (Prototype, NTSC)", GAME_NOT_WORKING ) | |
| 474 | COMP( 1991, c64dx, c65, 0, c65, c65, c65_state, c65pal, "Commodore Business Machines", "Commodore 64DX Development System (Prototype, PAL, German)", GAME_NOT_WORKING ) |
| r243232 | r243233 | |
|---|---|---|
| 223 | 223 | Pins: |
| 224 | 224 | 1: GND through 220k resistor r78 |
| 225 | 225 | 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 | |
| 227 | 227 | |
| 228 | 228 | J5: locking-tab-type "CONN HEADER VERT 4POS .100 TIN" connector for supplying power |
| 229 | 229 | through a small cable with a berg connector at the other end, to the floppy drive |
| r243232 | r243233 | |
| 240 | 240 | /HICE is !a15 |
| 241 | 241 | /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 |
| 242 | 242 | /ROM_OE' goes to the two EPROMS |
| 243 | ||
| 243 | DECODE_18 is DECODE_E pal pin 18 | |
| 244 | 244 | pin 1 (GND) is in the lower left and the pins count low-high then to the right |
| 245 | 245 | (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 ) |
| 246 | 246 | (GND /IPL1 DECODE_18 /RESET gnd a16 vcc a12 a7 a6 a5 a4 a3 a2 a1 a0 d0 d1 d2 gnd) |
| r243232 | r243233 | |
| 369 | 369 | // pin 13 (PB3) : |
| 370 | 370 | // pin 14 (PB4) : |
| 371 | 371 | // pin 15 (PB5) : |
| 372 | // pin 16 (PB6) : | |
| 372 | // pin 16 (PB6) : | |
| 373 | 373 | // 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) | |
| 376 | 376 | // pin 21 (/IRQ) : out to 68008 /IPL1 pin 41 |
| 377 | 377 | // pin 22 (R/W) : in from 68008 R/W pin 30 |
| 378 | 378 | // pin 23 (/CS2) : in from DECODE E pin 18 |
| r243232 | r243233 | |
| 384 | 384 | // pin 39 (CA2) is through inductor L11 and resistor r128 to peripheral connector pin 35 <end minus 26> |
| 385 | 385 | // pin 40 (CA1) is through inductor L30 and resistor r138 to peripheral connector pin 53 <end minus 8> |
| 386 | 386 | |
| 387 | // 6522 @ u35 | |
| 387 | // 6522 @ u35 | |
| 388 | 388 | // pin 2 (PA0) : |
| 389 | 389 | // pin 3 (PA1) : |
| 390 | 390 | // pin 4 (PA2) : |
| r243232 | r243233 | |
| 421 | 421 | // pin 4 (Y2) : out to 6522 @u35 pin 11 |
| 422 | 422 | // pin 5 (A2) : in from 4N37 @ u48 pin 5 (output side emitter pin) (tied via R189 to gnd) <ring indicator?> |
| 423 | 423 | // 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) : | |
| 427 | 427 | // pin 11 (B4) : in from 68008 A15 |
| 428 | 428 | // pin 12 (A4) : in from 68008 A15 |
| 429 | 429 | // pin 13 (Y4) : out to EPROM @ U31 /CE |
| r243232 | r243233 | |
| 1743 | 1743 | * ||||\-------------Q? ? |
| 1744 | 1744 | * |||\--------------Q? ? |
| 1745 | 1745 | * ||\---------------Q> output to decode pal pin 2 |
| 1746 | * |\----------------->? output? to ram multiplexer 'A' pins | |
| 1746 | * |\----------------->? output? to ram multiplexer 'A' pins | |
| 1747 | 1747 | * \------------------< ? |
| 1748 | 1748 | */ |
| 1749 | 1749 | ROM_LOAD( "timing_b.ampal16r4a.u9.jed", 0x0000, 0xb08, CRC(643e6e83) SHA1(7db167883f9d6cf385ce496d08976dc16fc3e2c3)) |
| r243232 | r243233 | |
|---|---|---|
| 20 | 20 | : driver_device(mconfig, type, tag) |
| 21 | 21 | , m_maincpu(*this, "maincpu") |
| 22 | 22 | , m_cart(*this, "cartslot") |
| 23 | #ifdef USE_GFX | |
| 23 | #ifdef USE_GFX | |
| 24 | 24 | , m_gfxdecode(*this, "gfxdecode") |
| 25 | 25 | #endif |
| 26 | 26 | , m_io_joy(*this, "JOY") |
| r243232 | r243233 | |
| 53 | 53 | |
| 54 | 54 | struct |
| 55 | 55 | { |
| 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 | |
| 60 | 60 | 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; | |
| 64 | 64 | bool y_increment; |
| 65 | 65 | } video; |
| 66 | 66 | |
| 67 | 67 | struct { |
| 68 | | |
| 68 | bool set; | |
| 69 | 69 | int bit_shifter; |
| 70 | 70 | UINT8 cartridge_byte; |
| 71 | 71 | UINT16 address; // in reality something more like short local cartridge address offset |
| 72 | 72 | bool unprotected; |
| 73 | 73 | bool failed; |
| 74 | ||
| 74 | ||
| 75 | 75 | } card_protection; |
| 76 | 76 | |
| 77 | 77 | required_device<cpu_device> m_maincpu; |
| r243232 | r243233 | |
| 84 | 84 | required_shared_ptr<UINT8> m_bios; |
| 85 | 85 | emu_timer *timer1; |
| 86 | 86 | emu_timer *timer2; |
| 87 | UINT8 bank_multi; | |
| 87 | UINT8 bank_multi; | |
| 88 | 88 | UINT8 *m_cart_ptr; |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | 91 | WRITE8_MEMBER( gamate_state::gamate_cart_protection_w ) |
| 92 | 92 | { |
| 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 | ||
| 95 | 95 | switch (offset) { |
| 96 | 96 | case 0: |
| 97 | 97 | card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0); |
| r243232 | r243233 | |
| 105 | 105 | } |
| 106 | 106 | READ8_MEMBER( gamate_state::gamate_cart_protection_r ) |
| 107 | 107 | { |
| 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 { | |
| 113 | 112 | card_protection.bit_shifter++; |
| 114 | 113 | if (card_protection.bit_shifter==8) { |
| 115 | 114 | card_protection.bit_shifter=0; |
| r243232 | r243233 | |
| 118 | 117 | } |
| 119 | 118 | ret=(card_protection.cartridge_byte&0x80)?2:0; |
| 120 | 119 | if (card_protection.bit_shifter==7 && !card_protection.failed) { // now protection chip on cartridge activates cartridge chip select on cpu accesses |
| 121 | // | |
| 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 | |
| 122 | 121 | } |
| 123 | 122 | 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; | |
| 127 | 126 | } |
| 128 | 127 | |
| 129 | 128 | READ8_MEMBER( gamate_state::protection_r ) { return card_protection.set? 3: 1; } // bits 0 and 1 checked |
| 130 | 129 | |
| 131 | 130 | WRITE8_MEMBER( gamate_state::protection_reset ) |
| 132 | 131 | { |
| 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; | |
| 139 | 138 | } |
| 140 | 139 | |
| 141 | 140 | READ8_MEMBER( gamate_state::newer_protection_set ) |
| 142 | 141 | { |
| 143 | card_protection.set=true; | |
| 144 | return 0; | |
| 142 | card_protection.set=true; | |
| 143 | return 0; | |
| 145 | 144 | } |
| 146 | 145 | |
| 147 | 146 | |
| 148 | 147 | WRITE8_MEMBER( gamate_state::gamate_video_w ) |
| 149 | 148 | { |
| 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 | |
| 153 | 152 | video.y_increment=data&0x40; |
| 154 | 153 | break; |
| 155 | 154 | case 2: video.bitmap.xpos=data;break; // at least 7 bits |
| 156 | 155 | 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++; | |
| 169 | 168 | else video.x++; |
| 170 | ||
| 169 | } | |
| 171 | 170 | } |
| 172 | 171 | |
| 173 | 172 | WRITE8_MEMBER( gamate_state::cart_bankswitchmulti_w ) |
| 174 | 173 | { |
| 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); | |
| 177 | 176 | } |
| 178 | 177 | |
| 179 | 178 | WRITE8_MEMBER( gamate_state::cart_bankswitch_w ) |
| r243232 | r243233 | |
| 184 | 183 | READ8_MEMBER( gamate_state::gamate_video_r ) |
| 185 | 184 | { |
| 186 | 185 | 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; | |
| 199 | 198 | } |
| 200 | 199 | |
| 201 | 200 | WRITE8_MEMBER( gamate_state::gamate_audio_w ) |
| 202 | 201 | { |
| 203 | ||
| 202 | logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data); | |
| 204 | 203 | } |
| 205 | 204 | |
| 206 | 205 | READ8_MEMBER( gamate_state::gamate_audio_r ) |
| 207 | 206 | { |
| 208 | ||
| 207 | logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset); | |
| 209 | 208 | return 0; |
| 210 | 209 | } |
| 211 | 210 | |
| 212 | 211 | |
| 213 | 212 | READ8_MEMBER( gamate_state::gamate_pad_r ) |
| 214 | 213 | { |
| 215 | UINT8 data=m_io_joy->read(); | |
| 216 | return data; | |
| 214 | UINT8 data=m_io_joy->read(); | |
| 215 | return data; | |
| 217 | 216 | } |
| 218 | 217 | |
| 219 | 218 | static 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) | |
| 227 | 226 | |
| 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") | |
| 230 | 229 | |
| 231 | 230 | AM_RANGE(0x6000, 0x6000) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w) |
| 232 | 231 | AM_RANGE(0x8000, 0x8000) AM_WRITE(cart_bankswitchmulti_w) |
| 233 | 232 | AM_RANGE(0xc000, 0xc000) AM_WRITE(cart_bankswitch_w) |
| 234 | 233 | |
| 235 | ||
| 234 | AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios") | |
| 236 | 235 | ADDRESS_MAP_END |
| 237 | 236 | |
| 238 | 237 | |
| r243232 | r243233 | |
| 251 | 250 | #ifdef USE_GFX |
| 252 | 251 | static const struct gfx_layout gamate_charlayout = |
| 253 | 252 | { |
| 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 */ | |
| 264 | 263 | }; |
| 265 | 264 | |
| 266 | 265 | static GFXDECODE_START( gamate ) |
| 267 | ||
| 266 | GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 ) | |
| 268 | 267 | GFXDECODE_END |
| 269 | 268 | #endif |
| 270 | 269 | |
| 271 | 270 | /* palette in red, green, blue tribles */ |
| 272 | 271 | static const unsigned char gamate_colors[4][3] = |
| 273 | 272 | { |
| 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 } | |
| 278 | 277 | }; |
| 279 | 278 | |
| 280 | 279 | PALETTE_INIT_MEMBER(gamate_state, gamate) |
| r243232 | r243233 | |
| 299 | 298 | |
| 300 | 299 | UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 301 | 300 | { |
| 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]; | |
| 307 | 306 | #ifdef USE_GFX |
| 308 | ||
| 307 | m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1&0xf)|((d2&0xf)<<4), 0,0,0,x+4,y); | |
| 309 | 308 | m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, (d1>>4)|(d2&0xf0),0,0,0,x,y); |
| 310 | 309 | #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; | |
| 317 | 316 | } |
| 318 | 317 | |
| 319 | 318 | DRIVER_INIT_MEMBER(gamate_state,gamate) |
| r243232 | r243233 | |
| 322 | 321 | #ifdef USE_GFX |
| 323 | 322 | UINT8 *gfx=memregion("gfx1")->base(); |
| 324 | 323 | for (int i=0; i<256; i++) gfx[i]=i; |
| 325 | #endif | |
| 324 | #endif | |
| 326 | 325 | timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this)); |
| 327 | 326 | timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this)); |
| 328 | 327 | } |
| r243232 | r243233 | |
| 332 | 331 | { |
| 333 | 332 | m_cart_ptr = memregion("maincpu")->base() + 0x6000; |
| 334 | 333 | if (m_cart->exists()) { |
| 335 | // | |
| 334 | // m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r)); | |
| 336 | 335 | m_cart_ptr = m_cart->get_rom_base(); |
| 337 | 336 | membank("bankmulti")->set_base(m_cart->get_rom_base()+1); |
| 338 | 337 | membank("bank")->set_base(m_cart->get_rom_base()+0x4000); // bankswitched games in reality no offset |
| 339 | 338 | } |
| 340 | // | |
| 339 | // m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // default bios: $47 protection readback | |
| 341 | 340 | card_protection.set=false; |
| 342 | 341 | bank_multi=0; |
| 343 | 342 | card_protection.unprotected=false; |
| r243232 | r243233 | |
| 390 | 389 | |
| 391 | 390 | #ifdef USE_GFX |
| 392 | 391 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate ) |
| 393 | #endif | |
| 392 | #endif | |
| 394 | 393 | MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors)) |
| 395 | 394 | MCFG_PALETTE_INIT_OWNER(gamate_state, gamate) |
| 396 | 395 | MCFG_DEFAULT_LAYOUT(layout_lcd) |
| r243232 | r243233 | |
| 408 | 407 | ROMX_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297), ROM_BIOS(1) ) |
| 409 | 408 | ROM_SYSTEM_BIOS(1, "newer", "NEWER") |
| 410 | 409 | 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 | |
| 412 | 411 | ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF) |
| 413 | #endif | |
| 412 | #endif | |
| 414 | 413 | ROM_END |
| 415 | 414 | |
| 416 | 415 | |
| 417 | 416 | /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ |
| 418 | 417 | CONS( 19??, gamate, 0, 0, gamate, gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NO_SOUND) |
| 419 | ||
| 420 |
| r243232 | r243233 | |
|---|---|---|
| 19 | 19 | MC68000 @ 10 MHz |
| 20 | 20 | MC68A45 CRTC |
| 21 | 21 | Z0765A08PSC floppy controller (NEC765 type) |
| 22 | ||
| 22 | TMS9914A GPIB bus interface | |
| 23 | 23 | SCN2661 DUART/timer |
| 24 | 24 | |
| 25 | 25 | 16500b: |
| r243232 | r243233 | |
| 50 | 50 | #include "video/mc6845.h" |
| 51 | 51 | #include "machine/mc68681.h" |
| 52 | 52 | |
| 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" | |
| 57 | 57 | |
| 58 | 58 | class hp16500_state : public driver_device |
| 59 | 59 | { |
| r243232 | r243233 | |
|---|---|---|
| 1 | 1 | // license:BSD-3-Clause |
| 2 | 2 | // copyright-holders:R. Belmont |
| 3 | 3 | /*************************************************************************** |
| 4 | ||
| 4 | ||
| 5 | 5 | hp9k3xx.c: preliminary driver for HP9000 300 Series (aka HP9000/3xx) |
| 6 | 6 | |
| 7 | 7 | Currently supporting: |
| r243232 | r243233 | |
| 16 | 16 | MC68881 FPU |
| 17 | 17 | |
| 18 | 18 | 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 | |
| 22 | 22 | |
| 23 | 23 | 340: |
| 24 | 24 | MC68030 CPU @ 16.67 MHz w/built-in MMU |
| 25 | ||
| 25 | MC68881 FPU | |
| 26 | 26 | |
| 27 | 27 | 380: |
| 28 | 28 | MC68040 CPU @ 25 MHz w/built-in MMU and FPU |
| 29 | 29 | |
| 30 | 30 | 382: |
| 31 | 31 | MC68040 CPU @ 25? MHz w/built-in MMU and FPU |
| 32 | ||
| 32 | Built-in VGA compatible video | |
| 33 | 33 | |
| 34 | 34 | All models have an MC6840 PIT on IRQ6 clocked at 250 kHz. |
| 35 | 35 | |
| r243232 | r243233 | |
| 132 | 132 | |
| 133 | 133 | // shared mappings for all 9000/3xx systems |
| 134 | 134 | static ADDRESS_MAP_START(hp9k3xx_common, AS_PROGRAM, 32, hp9k3xx_state) |
| 135 | AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP | |
| 135 | AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP // writes to 1fffc are the LED | |
| 136 | 136 | |
| 137 | AM_RANGE(0x00500000, 0x0050000f) AM_RAM | |
| 137 | AM_RANGE(0x00500000, 0x0050000f) AM_RAM // this is sufficient to pass the DMA test for now | |
| 138 | 138 | |
| 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 | |
| 142 | 142 | AM_RANGE(0x005f8000, 0x005f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff00ff) |
| 143 | 143 | ADDRESS_MAP_END |
| 144 | 144 | |
| 145 | 145 | // 9000/310 - has onboard video that the graphics card used in other 3xxes conflicts with |
| 146 | 146 | static ADDRESS_MAP_START(hp9k310_map, AS_PROGRAM, 16, hp9k3xx_state) |
| 147 | AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP | |
| 147 | AM_RANGE(0x000000, 0x01ffff) AM_ROM AM_REGION("maincpu",0) AM_WRITENOP // writes to 1fffc are the LED | |
| 148 | 148 | |
| 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 | |
| 152 | 152 | |
| 153 | 153 | AM_RANGE(0x5f8000, 0x5f800f) AM_DEVREADWRITE8(PTM6840_TAG, ptm6840_device, read, write, 0x00ff) |
| 154 | 154 | |
| 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 | |
| 157 | 157 | |
| 158 | 158 | AM_RANGE(0x700000, 0x7fffff) AM_READWRITE(buserror16_r, buserror16_w) |
| 159 | 159 | AM_RANGE(0x800000, 0xffffff) AM_RAM |
| r243232 | r243233 | |
| 161 | 161 | |
| 162 | 162 | // 9000/320 |
| 163 | 163 | static 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 | |
| 166 | 166 | |
| 167 | 167 | AM_RANGE(0xffe00000, 0xffefffff) AM_READWRITE(buserror_r, buserror_w) |
| 168 | 168 | AM_RANGE(0xfff00000, 0xffffffff) AM_RAM |
| r243232 | r243233 | |
| 172 | 172 | |
| 173 | 173 | // 9000/330 and 9000/340 |
| 174 | 174 | static 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 | |
| 177 | 177 | |
| 178 | 178 | AM_RANGE(0xffb00000, 0xffbfffff) AM_READWRITE(buserror_r, buserror_w) |
| 179 | 179 | AM_RANGE(0xffc00000, 0xffffffff) AM_RAM |
| r243232 | r243233 | |
| 183 | 183 | |
| 184 | 184 | // 9000/370 - 8 MB RAM standard |
| 185 | 185 | static 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 | |
| 188 | 188 | |
| 189 | 189 | AM_RANGE(0xff700000, 0xff7fffff) AM_READWRITE(buserror_r, buserror_w) |
| 190 | 190 | AM_RANGE(0xff800000, 0xffffffff) AM_RAM |
| r243232 | r243233 | |
| 292 | 292 | MCFG_CPU_PROGRAM_MAP(hp9k310_map) |
| 293 | 293 | |
| 294 | 294 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 295 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 295 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 296 | 296 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 297 | 297 | |
| 298 | 298 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 308 | 308 | MCFG_CPU_PROGRAM_MAP(hp9k320_map) |
| 309 | 309 | |
| 310 | 310 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 311 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 311 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 312 | 312 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 313 | 313 | |
| 314 | 314 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 324 | 324 | MCFG_CPU_PROGRAM_MAP(hp9k330_map) |
| 325 | 325 | |
| 326 | 326 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 327 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 327 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 328 | 328 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 329 | 329 | |
| 330 | 330 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 340 | 340 | MCFG_CPU_PROGRAM_MAP(hp9k330_map) |
| 341 | 341 | |
| 342 | 342 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 343 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 343 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 344 | 344 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 345 | 345 | |
| 346 | 346 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 356 | 356 | MCFG_CPU_PROGRAM_MAP(hp9k370_map) |
| 357 | 357 | |
| 358 | 358 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 359 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 359 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 360 | 360 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 361 | 361 | |
| 362 | 362 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 368 | 368 | |
| 369 | 369 | static MACHINE_CONFIG_START( hp9k380, hp9k3xx_state ) |
| 370 | 370 | /* basic machine hardware */ |
| 371 | MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) | |
| 371 | MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz? 33? | |
| 372 | 372 | MCFG_CPU_PROGRAM_MAP(hp9k330_map) |
| 373 | 373 | |
| 374 | 374 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 375 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 375 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 376 | 376 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 377 | 377 | |
| 378 | 378 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 384 | 384 | |
| 385 | 385 | static MACHINE_CONFIG_START( hp9k382, hp9k3xx_state ) |
| 386 | 386 | /* basic machine hardware */ |
| 387 | MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) | |
| 387 | MCFG_CPU_ADD(MAINCPU_TAG, M68040, 25000000) // 25 MHz? 33? | |
| 388 | 388 | MCFG_CPU_PROGRAM_MAP(hp9k382_map) |
| 389 | 389 | |
| 390 | 390 | MCFG_DEVICE_ADD(PTM6840_TAG, PTM6840, 0) |
| 391 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) | |
| 391 | MCFG_PTM6840_INTERNAL_CLOCK(250000.0f) // from oscillator module next to the 6840 | |
| 392 | 392 | MCFG_PTM6840_EXTERNAL_CLOCKS(250000.0f, 250000.0f, 250000.0f) |
| 393 | 393 | |
| 394 | 394 | MCFG_SCREEN_ADD( "screen", RASTER) |
| r243232 | r243233 | |
| 400 | 400 | |
| 401 | 401 | ROM_START( hp9k310 ) |
| 402 | 402 | 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) ) | |
| 405 | 405 | |
| 406 | 406 | 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) ) | |
| 409 | 409 | |
| 410 | 410 | ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE ) |
| 411 | 411 | ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) |
| r243232 | r243233 | |
| 413 | 413 | |
| 414 | 414 | ROM_START( hp9k320 ) |
| 415 | 415 | 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) ) | |
| 420 | 420 | |
| 421 | 421 | ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) |
| 422 | 422 | ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) |
| r243232 | r243233 | |
| 424 | 424 | |
| 425 | 425 | ROM_START( hp9k330 ) |
| 426 | 426 | 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) ) | |
| 429 | 429 | |
| 430 | 430 | ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) |
| 431 | 431 | ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) |
| r243232 | r243233 | |
| 433 | 433 | |
| 434 | 434 | ROM_START( hp9k340 ) |
| 435 | 435 | 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) ) | |
| 438 | 438 | |
| 439 | 439 | ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT ) |
| 440 | 440 | ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) |
| r243232 | r243233 | |
|---|---|---|
| 214 | 214 | { |
| 215 | 215 | m_ciram = auto_alloc_array(machine(), UINT8, 0x800); |
| 216 | 216 | setup_disk(m_disk); |
| 217 | ||
| 217 | ||
| 218 | 218 | // register saves |
| 219 | 219 | save_item(NAME(m_last_frame_flip)); |
| 220 | 220 | save_pointer(NAME(m_ciram), 0x800); |
| r243232 | r243233 | |
|---|---|---|
| 406 | 406 | |
| 407 | 407 | // X-bus module select |
| 408 | 408 | // 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 | |
| 410 | 410 | // this register (bits 0-7 are ignored) |
| 411 | 411 | // TODO: make expansion modules slot devices |
| 412 | 412 | WRITE16_MEMBER(ngen_state::xbus_w) |
| r243232 | r243233 | |
| 435 | 435 | READ16_MEMBER(ngen_state::xbus_r) |
| 436 | 436 | { |
| 437 | 437 | UINT16 ret = 0xffff; |
| 438 | ||
| 438 | ||
| 439 | 439 | switch(m_xbus_current) |
| 440 | 440 | { |
| 441 | 441 | case 0x00: |
| r243232 | r243233 | |
| 647 | 647 | |
| 648 | 648 | READ8_MEMBER(ngen_state::dma_3_dack_r) |
| 649 | 649 | { |
| 650 | UINT16 ret = 0xffff; | |
| 651 | ||
| 650 | UINT16 ret = 0xffff; | |
| 651 | ||
| 652 | 652 | if((m_hdc_control & 0x04) && m_disk_rom) |
| 653 | 653 | { |
| 654 | 654 | ret = m_disk_rom->base()[m_disk_rom_ptr++] << 8; |
| r243232 | r243233 | |
| 659 | 659 | //m_dmac->dreq3_w(0); |
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | m_dma_high_byte = ret & 0xff00; | |
| 662 | m_dma_high_byte = ret & 0xff00; | |
| 663 | 663 | return ret; |
| 664 | 664 | } |
| 665 | 665 | |
| r243232 | r243233 | |
| 737 | 737 | |
| 738 | 738 | static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state ) |
| 739 | 739 | AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w) |
| 740 | ||
| 740 | ||
| 741 | 741 | // 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) | |
| 747 | 747 | // 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 | ||
| 750 | 750 | ADDRESS_MAP_END |
| 751 | 751 | |
| 752 | 752 | static ADDRESS_MAP_START( ngen386_mem, AS_PROGRAM, 32, ngen_state ) |
| r243232 | r243233 | |
| 851 | 851 | |
| 852 | 852 | // keyboard UART (patent says i8251 is used for keyboard communications, it is located on the video board) |
| 853 | 853 | MCFG_DEVICE_ADD("videouart", I8251, 0) // main clock unknown, Rx/Tx clocks are 19.53kHz |
| 854 | // | |
| 854 | // MCFG_I8251_TXEMPTY_HANDLER(DEVWRITELINE("pic",pic8259_device,ir4_w)) | |
| 855 | 855 | MCFG_I8251_TXD_HANDLER(DEVWRITELINE("keyboard", rs232_port_device, write_txd)) |
| 856 | 856 | MCFG_RS232_PORT_ADD("keyboard", keyboard, "ngen") |
| 857 | 857 | MCFG_RS232_RXD_HANDLER(DEVWRITELINE("videouart", i8251_device, write_rxd)) |
| r243232 | r243233 | |
| 865 | 865 | MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w)) |
| 866 | 866 | MCFG_WD_FDC_FORCE_READY |
| 867 | 867 | MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0) |
| 868 | MCFG_PIT8253_CLK0(XTAL_20MHz / 20) | |
| 868 | MCFG_PIT8253_CLK0(XTAL_20MHz / 20) | |
| 869 | 869 | MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w)) // clocked on FDC data register access |
| 870 | 870 | MCFG_PIT8253_CLK1(XTAL_20MHz / 20) |
| 871 | 871 | MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w)) // 1MHz |
| 872 | 872 | 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)) | |
| 874 | 874 | // TODO: WD1010 HDC (not implemented), use WD2010 for now |
| 875 | 875 | MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4) |
| 876 | 876 | MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r)) |
| r243232 | r243233 | |
|---|---|---|
| 681 | 681 | astring region_tag; |
| 682 | 682 | m_maincpu_rom = memregion("maincpu"); |
| 683 | 683 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 684 | if (!m_cart_rom) | |
| 684 | if (!m_cart_rom) // this should never happen, since we make carts mandatory! | |
| 685 | 685 | m_cart_rom = memregion("maincpu"); |
| 686 | 686 | |
| 687 | 687 | membank("bank27")->set_base(m_cart_rom->base()); |
| r243232 | r243233 | |
|---|---|---|
| 4 | 4 | |
| 5 | 5 | Parker Brothers Split Second |
| 6 | 6 | * TMS1400NLL MP7314-N2 (die labeled MP7314) |
| 7 | ||
| 7 | ||
| 8 | 8 | This is an electronic handheld reflex gaming device, it's straightforward |
| 9 | 9 | to use. The included mini-games are: |
| 10 | 10 | 1, 2, 3: Mad Maze* |
| r243232 | r243233 | |
| 12 | 12 | 6: Auto Cross |
| 13 | 13 | 7: Stomp |
| 14 | 14 | 8: Speedball |
| 15 | ||
| 15 | ||
| 16 | 16 | *: higher number indicates higher difficulty |
| 17 | 17 | |
| 18 | 18 | |
| r243232 | r243233 | |
| 167 | 167 | { |
| 168 | 168 | // R8: speaker out |
| 169 | 169 | m_speaker->level_w(data >> 8 & 1); |
| 170 | ||
| 170 | ||
| 171 | 171 | // R9,R10: input mux |
| 172 | 172 | // R0-R7: led columns |
| 173 | 173 | m_r = data; |
| r243232 | r243233 | |
|---|---|---|
| 693 | 693 | COMP( 1980, snspella, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (US set 2)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) |
| 694 | 694 | COMP( 1978, snspelluk, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (UK set 1)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) |
| 695 | 695 | COMP( 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 |
| 696 | COMP( 1979, snspelljp, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) | |
| 696 | COMP( 1979, snspelljp, snspell, 0, snspell, snspell, tispeak_state, snspell, "Texas Instruments", "Speak & Spell (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND ) | |
| 697 | 697 | COMP( 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 |
| 698 | 698 | |
| 699 | 699 | COMP( 1980, snmath, 0, 0, snmath, snmath, driver_device, 0, "Texas Instruments", "Speak & Math (US prototype)", GAME_IMPERFECT_SOUND ) // also US set 1 |
| r243232 | r243233 | |
|---|---|---|
| 1 | /***************************************************************************** | |
| 2 | * | |
| 3 | * includes/c65.h | |
| 4 | * | |
| 5 | ****************************************************************************/ | |
| 6 | 1 | |
| 7 | #ifndef C65_H_ | |
| 8 | #define C65_H_ | |
| 9 | ||
| 10 | #include "machine/mos6526.h" | |
| 11 | #include "bus/cbmiec/cbmiec.h" | |
| 12 | #include "imagedev/snapquik.h" | |
| 13 | #include "machine/ram.h" | |
| 14 | #include "sound/mos6581.h" | |
| 15 | #include "video/vic4567.h" | |
| 16 | ||
| 17 | #define C64_MAX_ROMBANK 64 // .crt files contain multiple 'CHIPs', i.e. rom banks (of variable size) with headers. Known carts have at most 64 'CHIPs'. | |
| 18 | ||
| 19 | struct C64_ROM { | |
| 20 | int addr, size, index, start; | |
| 21 | }; | |
| 22 | ||
| 23 | struct c64_cart_t { | |
| 24 | C64_ROM bank[C64_MAX_ROMBANK]; | |
| 25 | INT8 game; | |
| 26 | INT8 exrom; | |
| 27 | UINT8 mapper; | |
| 28 | UINT8 n_banks; | |
| 29 | }; | |
| 30 | ||
| 31 | struct dma_t | |
| 32 | { | |
| 33 | int version; | |
| 34 | UINT8 data[4]; | |
| 35 | }; | |
| 36 | ||
| 37 | struct fdc_t | |
| 38 | { | |
| 39 | int state; | |
| 40 | ||
| 41 | UINT8 reg[0x0f]; | |
| 42 | ||
| 43 | UINT8 buffer[0x200]; | |
| 44 | int cpu_pos; | |
| 45 | int fdc_pos; | |
| 46 | ||
| 47 | UINT16 status; | |
| 48 | ||
| 49 | attotime time; | |
| 50 | int head,track,sector; | |
| 51 | }; | |
| 52 | ||
| 53 | struct expansion_ram_t | |
| 54 | { | |
| 55 | UINT8 reg; | |
| 56 | }; | |
| 57 | ||
| 58 | class c65_state : public driver_device | |
| 59 | { | |
| 60 | public: | |
| 61 | c65_state(const machine_config &mconfig, device_type type, const char *tag) | |
| 62 | : driver_device(mconfig, type, tag), | |
| 63 | m_cia0(*this, "cia_0"), | |
| 64 | m_cia1(*this, "cia_1"), | |
| 65 | m_sid_r(*this, "sid_r"), | |
| 66 | m_vic(*this, "vic3"), | |
| 67 | m_iec(*this, CBM_IEC_TAG), | |
| 68 | m_colorram(*this, "colorram"), | |
| 69 | m_basic(*this, "basic"), | |
| 70 | m_chargen(*this, "chargen"), | |
| 71 | m_kernal(*this, "kernal"), | |
| 72 | m_c65_chargen(*this, "c65_chargen"), | |
| 73 | m_interface(*this, "interface"), | |
| 74 | m_roml_writable(0), | |
| 75 | m_maincpu(*this, "maincpu"), | |
| 76 | m_ram(*this, RAM_TAG) { } | |
| 77 | ||
| 78 | required_device<mos6526_device> m_cia0; | |
| 79 | required_device<mos6526_device> m_cia1; | |
| 80 | required_device<mos6581_device> m_sid_r; | |
| 81 | required_device<vic3_device> m_vic; | |
| 82 | optional_device<cbm_iec_device> m_iec; | |
| 83 | ||
| 84 | required_shared_ptr<UINT8> m_colorram; | |
| 85 | required_shared_ptr<UINT8> m_basic; | |
| 86 | required_shared_ptr<UINT8> m_chargen; | |
| 87 | required_shared_ptr<UINT8> m_kernal; | |
| 88 | required_shared_ptr<UINT8> m_c65_chargen; | |
| 89 | required_shared_ptr<UINT8> m_interface; | |
| 90 | int m_old_level; | |
| 91 | int m_old_data; | |
| 92 | int m_old_exrom; | |
| 93 | int m_old_game; | |
| 94 | UINT8 m_vicirq; | |
| 95 | emu_timer *m_datasette_timer; | |
| 96 | emu_timer *m_cartridge_timer; | |
| 97 | UINT8 *m_memory; | |
| 98 | int m_pal; | |
| 99 | int m_tape_on; | |
| 100 | UINT8 *m_c64_roml; | |
| 101 | UINT8 *m_c64_romh; | |
| 102 | UINT8 *m_vicaddr; | |
| 103 | UINT8 *m_c128_vicaddr; | |
| 104 | UINT8 m_game; | |
| 105 | UINT8 m_exrom; | |
| 106 | UINT8 *m_io_mirror; | |
| 107 | UINT8 m_port_data; | |
| 108 | UINT8 *m_roml; | |
| 109 | UINT8 *m_romh; | |
| 110 | int m_roml_writable; | |
| 111 | int m_ultimax; | |
| 112 | int m_cia1_on; | |
| 113 | int m_io_enabled; | |
| 114 | int m_is_sx64; | |
| 115 | UINT8 *m_io_ram_w_ptr; | |
| 116 | UINT8 *m_io_ram_r_ptr; | |
| 117 | c64_cart_t m_cart; | |
| 118 | int m_nmilevel; int m_charset_select; | |
| 119 | int m_c64mode; | |
| 120 | UINT8 m_6511_port; | |
| 121 | UINT8 m_keyline; | |
| 122 | int m_old_value; | |
| 123 | dma_t m_dma; | |
| 124 | int m_dump_dma; | |
| 125 | fdc_t m_fdc; | |
| 126 | expansion_ram_t m_expansion_ram; | |
| 127 | int m_io_on; | |
| 128 | int m_io_dc00_on; | |
| 129 | int m_cia0_irq, m_cia1_irq; | |
| 130 | DECLARE_DRIVER_INIT(c65); | |
| 131 | DECLARE_DRIVER_INIT(c65pal); | |
| 132 | ||
| 133 | DECLARE_READ8_MEMBER( c64_lightpen_x_cb ); | |
| 134 | DECLARE_READ8_MEMBER( c64_lightpen_y_cb ); | |
| 135 | DECLARE_READ8_MEMBER( c64_lightpen_button_cb ); | |
| 136 | DECLARE_READ8_MEMBER( c64_dma_read ); | |
| 137 | DECLARE_READ8_MEMBER( c64_dma_read_ultimax ); | |
| 138 | DECLARE_READ8_MEMBER( c64_dma_read_color ); | |
| 139 | DECLARE_WRITE_LINE_MEMBER( c64_vic_interrupt ); | |
| 140 | DECLARE_READ8_MEMBER( c64_rdy_cb ); | |
| 141 | DECLARE_READ8_MEMBER( sid_potx_r ); | |
| 142 | DECLARE_READ8_MEMBER( sid_poty_r ); | |
| 143 | DECLARE_MACHINE_START(c65); | |
| 144 | UINT32 screen_update_c65(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
| 145 | INTERRUPT_GEN_MEMBER(vic3_raster_irq); | |
| 146 | INTERRUPT_GEN_MEMBER(c65_frame_interrupt); | |
| 147 | DECLARE_READ8_MEMBER(c65_cia0_port_a_r); | |
| 148 | DECLARE_READ8_MEMBER(c65_cia0_port_b_r); | |
| 149 | DECLARE_WRITE8_MEMBER(c65_cia0_port_b_w); | |
| 150 | DECLARE_READ8_MEMBER(c65_cia1_port_a_r); | |
| 151 | DECLARE_WRITE8_MEMBER(c65_cia1_port_a_w); | |
| 152 | DECLARE_WRITE_LINE_MEMBER(c65_cia1_interrupt); | |
| 153 | void c64_legacy_driver_init(); | |
| 154 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER( c64_cart ); | |
| 155 | DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( c64_cart ); | |
| 156 | DECLARE_WRITE_LINE_MEMBER(c65_cia0_interrupt); | |
| 157 | DECLARE_READ8_MEMBER(c65_lightpen_x_cb); | |
| 158 | DECLARE_READ8_MEMBER(c65_lightpen_y_cb); | |
| 159 | DECLARE_READ8_MEMBER(c65_lightpen_button_cb); | |
| 160 | DECLARE_READ8_MEMBER(c65_c64_mem_r); | |
| 161 | DECLARE_READ8_MEMBER(c65_dma_read); | |
| 162 | DECLARE_READ8_MEMBER(c65_dma_read_color); | |
| 163 | DECLARE_WRITE_LINE_MEMBER(c65_vic_interrupt); | |
| 164 | DECLARE_WRITE8_MEMBER(c65_bankswitch_interface); | |
| 165 | DECLARE_READ8_MEMBER( c65_read_mem ); | |
| 166 | DECLARE_WRITE8_MEMBER( c65_write_mem ); | |
| 167 | DECLARE_READ8_MEMBER( c65_ram_expansion_r ); | |
| 168 | DECLARE_WRITE8_MEMBER( c65_ram_expansion_w ); | |
| 169 | DECLARE_WRITE8_MEMBER( c65_write_io ); | |
| 170 | DECLARE_WRITE8_MEMBER( c65_write_io_dc00 ); | |
| 171 | DECLARE_READ8_MEMBER( c65_read_io ); | |
| 172 | DECLARE_READ8_MEMBER( c65_read_io_dc00 ); | |
| 173 | DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c65 ); | |
| 174 | ||
| 175 | int c64_paddle_read( device_t *device, address_space &space, int which ); | |
| 176 | void c65_nmi( ); | |
| 177 | void c65_irq( int level ); | |
| 178 | void c65_dma_port_w( int offset, int value ); | |
| 179 | int c65_dma_port_r( int offset ); | |
| 180 | void c65_6511_port_w( int offset, int value ); | |
| 181 | int c65_6511_port_r( int offset ); | |
| 182 | void c65_fdc_state(void); | |
| 183 | void c65_fdc_w( int offset, int data ); | |
| 184 | int c65_fdc_r( int offset ); | |
| 185 | void c65_bankswitch( ); | |
| 186 | void c65_colorram_write( int offset, int value ); | |
| 187 | void c65_common_driver_init( ); | |
| 188 | ||
| 189 | required_device<cpu_device> m_maincpu; | |
| 190 | required_device<ram_device> m_ram; | |
| 191 | }; | |
| 192 | ||
| 193 | MACHINE_CONFIG_EXTERN( c64_cartslot ); | |
| 194 | ||
| 195 | #endif /* C65_H_ */ |
| r243232 | r243233 | |
|---|---|---|
| 291 | 291 | INT32 m_adb_linestate; |
| 292 | 292 | bool m_adb_srqflag; |
| 293 | 293 | #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; | |
| 297 | 297 | |
| 298 | 298 | // Portable/PB100 Power Manager IC comms (chapter 4, "Guide to the Macintosh Family Hardware", second edition) |
| 299 | 299 | 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; |
| r243232 | r243233 | |
|---|---|---|
| 3034 | 3034 | |
| 3035 | 3035 | astring region_tag; |
| 3036 | 3036 | m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 3037 | if (!m_region_cart) | |
| 3037 | if (!m_region_cart) // this should never happen, since we make carts mandatory! | |
| 3038 | 3038 | m_region_cart = memregion("maincpu"); |
| 3039 | 3039 | } |
| 3040 | 3040 | |
| r243232 | r243233 | |
| 3078 | 3078 | |
| 3079 | 3079 | astring region_tag; |
| 3080 | 3080 | m_region_cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG)); |
| 3081 | if (!m_region_cart) | |
| 3081 | if (!m_region_cart) // this should never happen, since we make carts mandatory! | |
| 3082 | 3082 | m_region_cart = memregion("maincpu"); |
| 3083 | 3083 | } |
| 3084 | 3084 |
| r243232 | r243233 | |
|---|---|---|
| 1 | /*************************************************************************** | |
| 2 | commodore c65 home computer | |
| 3 | peter.trauner@jk.uni-linz.ac.at | |
| 4 | documention | |
| 5 | www.funet.fi | |
| 6 | ***************************************************************************/ | |
| 7 | ||
| 8 | #include "emu.h" | |
| 9 | ||
| 10 | #include "includes/c65.h" | |
| 11 | #include "cpu/m6502/m4510.h" | |
| 12 | #include "sound/mos6581.h" | |
| 13 | #include "machine/mos6526.h" | |
| 14 | #include "bus/cbmiec/cbmiec.h" | |
| 15 | #include "machine/ram.h" | |
| 16 | #include "video/vic4567.h" | |
| 17 | #include "imagedev/cassette.h" | |
| 18 | #include "crsshair.h" | |
| 19 | #include "formats/cbm_tap.h" | |
| 20 | ||
| 21 | #define VERBOSE_LEVEL 0 | |
| 22 | #define DBG_LOG( MACHINE, N, M, A ) \ | |
| 23 | do { \ | |
| 24 | if(VERBOSE_LEVEL >= N) \ | |
| 25 | { \ | |
| 26 | if( M ) \ | |
| 27 | logerror("%11.6f: %-24s", MACHINE.time().as_double(), (char*) M ); \ | |
| 28 | logerror A; \ | |
| 29 | } \ | |
| 30 | } while (0) | |
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | /*********************************************** | |
| 35 | ||
| 36 | Input Reading - Common Components | |
| 37 | ||
| 38 | ***********************************************/ | |
| 39 | ||
| 40 | /* These are needed by c64, c65 and c128, each machine has also additional specific | |
| 41 | components in its INTERRUPT_GEN */ | |
| 42 | ||
| 43 | /* keyboard lines */ | |
| 44 | UINT8 c64_keyline[10]; | |
| 45 | ||
| 46 | void cbm_common_init(void) | |
| 47 | { | |
| 48 | int i; | |
| 49 | ||
| 50 | for (i = 0; i < ARRAY_LENGTH(c64_keyline); i++) | |
| 51 | c64_keyline[i] = 0xff; | |
| 52 | } | |
| 53 | ||
| 54 | static TIMER_CALLBACK( lightpen_tick ) | |
| 55 | { | |
| 56 | if (((machine.root_device().ioport("CTRLSEL")->read() & 0x07) == 0x04) || ((machine.root_device().ioport("CTRLSEL")->read() & 0x07) == 0x06)) | |
| 57 | { | |
| 58 | /* enable lightpen crosshair */ | |
| 59 | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); | |
| 60 | } | |
| 61 | else | |
| 62 | { | |
| 63 | /* disable lightpen crosshair */ | |
| 64 | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| 68 | void cbm_common_interrupt( device_t *device ) | |
| 69 | { | |
| 70 | int value, i; | |
| 71 | int controller1 = device->machine().root_device().ioport("CTRLSEL")->read() & 0x07; | |
| 72 | int controller2 = device->machine().root_device().ioport("CTRLSEL")->read() & 0x70; | |
| 73 | static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; | |
| 74 | ||
| 75 | /* Lines 0-7 : common keyboard */ | |
| 76 | for (i = 0; i < 8; i++) | |
| 77 | { | |
| 78 | value = 0xff; | |
| 79 | value &= ~device->machine().root_device().ioport(c64ports[i])->read(); | |
| 80 | ||
| 81 | /* Shift Lock is mapped on Left Shift */ | |
| 82 | if ((i == 1) && (device->machine().root_device().ioport("SPECIAL")->read() & 0x40)) | |
| 83 | value &= ~0x80; | |
| 84 | ||
| 85 | c64_keyline[i] = value; | |
| 86 | } | |
| 87 | ||
| 88 | ||
| 89 | value = 0xff; | |
| 90 | switch(controller1) | |
| 91 | { | |
| 92 | case 0x00: | |
| 93 | value &= ~device->machine().root_device().ioport("JOY1_1B")->read(); /* Joy1 Directions + Button 1 */ | |
| 94 | break; | |
| 95 | ||
| 96 | case 0x01: | |
| 97 | if (device->machine().root_device().ioport("OTHER")->read() & 0x40) /* Paddle2 Button */ | |
| 98 | value &= ~0x08; | |
| 99 | if (device->machine().root_device().ioport("OTHER")->read() & 0x80) /* Paddle1 Button */ | |
| 100 | value &= ~0x04; | |
| 101 | break; | |
| 102 | ||
| 103 | case 0x02: | |
| 104 | if (device->machine().root_device().ioport("OTHER")->read() & 0x02) /* Mouse Button Left */ | |
| 105 | value &= ~0x10; | |
| 106 | if (device->machine().root_device().ioport("OTHER")->read() & 0x01) /* Mouse Button Right */ | |
| 107 | value &= ~0x01; | |
| 108 | break; | |
| 109 | ||
| 110 | case 0x03: | |
| 111 | value &= ~(device->machine().root_device().ioport("JOY1_2B")->read() & 0x1f); /* Joy1 Directions + Button 1 */ | |
| 112 | break; | |
| 113 | ||
| 114 | case 0x04: | |
| 115 | /* was there any input on the lightpen? where is it mapped? */ | |
| 116 | // if (device->machine().root_device().ioport("OTHER")->read() & 0x04) /* Lightpen Signal */ | |
| 117 | // value &= ?? ; | |
| 118 | break; | |
| 119 | ||
| 120 | case 0x07: | |
| 121 | break; | |
| 122 | ||
| 123 | default: | |
| 124 | logerror("Invalid Controller 1 Setting %d\n", controller1); | |
| 125 | break; | |
| 126 | } | |
| 127 | ||
| 128 | c64_keyline[8] = value; | |
| 129 | ||
| 130 | ||
| 131 | value = 0xff; | |
| 132 | switch(controller2) | |
| 133 | { | |
| 134 | case 0x00: | |
| 135 | value &= ~device->machine().root_device().ioport("JOY2_1B")->read(); /* Joy2 Directions + Button 1 */ | |
| 136 | break; | |
| 137 | ||
| 138 | case 0x10: | |
| 139 | if (device->machine().root_device().ioport("OTHER")->read() & 0x10) /* Paddle4 Button */ | |
| 140 | value &= ~0x08; | |
| 141 | if (device->machine().root_device().ioport("OTHER")->read() & 0x20) /* Paddle3 Button */ | |
| 142 | value &= ~0x04; | |
| 143 | break; | |
| 144 | ||
| 145 | case 0x20: | |
| 146 | if (device->machine().root_device().ioport("OTHER")->read() & 0x02) /* Mouse Button Left */ | |
| 147 | value &= ~0x10; | |
| 148 | if (device->machine().root_device().ioport("OTHER")->read() & 0x01) /* Mouse Button Right */ | |
| 149 | value &= ~0x01; | |
| 150 | break; | |
| 151 | ||
| 152 | case 0x30: | |
| 153 | value &= ~(device->machine().root_device().ioport("JOY2_2B")->read() & 0x1f); /* Joy2 Directions + Button 1 */ | |
| 154 | break; | |
| 155 | ||
| 156 | case 0x40: | |
| 157 | /* was there any input on the lightpen? where is it mapped? */ | |
| 158 | // if (device->machine().root_device().ioport("OTHER")->read() & 0x04) /* Lightpen Signal */ | |
| 159 | // value &= ?? ; | |
| 160 | break; | |
| 161 | ||
| 162 | case 0x70: | |
| 163 | break; | |
| 164 | ||
| 165 | default: | |
| 166 | logerror("Invalid Controller 2 Setting %d\n", controller2); | |
| 167 | break; | |
| 168 | } | |
| 169 | ||
| 170 | c64_keyline[9] = value; | |
| 171 | ||
| 172 | // vic2_frame_interrupt does nothing so this is not necessary | |
| 173 | // vic2_frame_interrupt (device); | |
| 174 | ||
| 175 | /* check if lightpen has been chosen as input: if so, enable crosshair */ | |
| 176 | device->machine().scheduler().timer_set(attotime::zero, FUNC(lightpen_tick)); | |
| 177 | ||
| 178 | set_led_status (device->machine(), 1, device->machine().root_device().ioport("SPECIAL")->read() & 0x40 ? 1 : 0); /* Shift Lock */ | |
| 179 | set_led_status (device->machine(), 0, device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ? 1 : 0); /* Joystick Swap */ | |
| 180 | } | |
| 181 | ||
| 182 | ||
| 183 | /*********************************************** | |
| 184 | ||
| 185 | CIA Common Handlers | |
| 186 | ||
| 187 | ***********************************************/ | |
| 188 | ||
| 189 | /* These are shared by c64, c65 and c128. c65 and c128 also have additional specific | |
| 190 | components (to select/read additional keyboard lines) */ | |
| 191 | ||
| 192 | /* | |
| 193 | * CIA 0 - Port A | |
| 194 | * bits 7-0 keyboard line select | |
| 195 | * bits 7,6: paddle select( 01 port a, 10 port b) | |
| 196 | * bit 4: joystick a fire button | |
| 197 | * bits 3,2: Paddles port a fire button | |
| 198 | * bits 3-0: joystick a direction | |
| 199 | * | |
| 200 | * CIA 0 - Port B | |
| 201 | * bits 7-0: keyboard raw values | |
| 202 | * bit 4: joystick b fire button, lightpen select | |
| 203 | * bits 3,2: paddle b fire buttons (left,right) | |
| 204 | * bits 3-0: joystick b direction | |
| 205 | * | |
| 206 | * flag cassette read input, serial request in | |
| 207 | * irq to irq connected | |
| 208 | */ | |
| 209 | ||
| 210 | UINT8 cbm_common_cia0_port_a_r( device_t *device, UINT8 output_b ) | |
| 211 | { | |
| 212 | UINT8 value = 0xff; | |
| 213 | ||
| 214 | if (!(output_b & 0x80)) | |
| 215 | { | |
| 216 | UINT8 t = 0xff; | |
| 217 | if (!(c64_keyline[7] & 0x80)) t &= ~0x80; | |
| 218 | if (!(c64_keyline[6] & 0x80)) t &= ~0x40; | |
| 219 | if (!(c64_keyline[5] & 0x80)) t &= ~0x20; | |
| 220 | if (!(c64_keyline[4] & 0x80)) t &= ~0x10; | |
| 221 | if (!(c64_keyline[3] & 0x80)) t &= ~0x08; | |
| 222 | if (!(c64_keyline[2] & 0x80)) t &= ~0x04; | |
| 223 | if (!(c64_keyline[1] & 0x80)) t &= ~0x02; | |
| 224 | if (!(c64_keyline[0] & 0x80)) t &= ~0x01; | |
| 225 | value &= t; | |
| 226 | } | |
| 227 | ||
| 228 | if (!(output_b & 0x40)) | |
| 229 | { | |
| 230 | UINT8 t = 0xff; | |
| 231 | if (!(c64_keyline[7] & 0x40)) t &= ~0x80; | |
| 232 | if (!(c64_keyline[6] & 0x40)) t &= ~0x40; | |
| 233 | if (!(c64_keyline[5] & 0x40)) t &= ~0x20; | |
| 234 | if (!(c64_keyline[4] & 0x40)) t &= ~0x10; | |
| 235 | if (!(c64_keyline[3] & 0x40)) t &= ~0x08; | |
| 236 | if (!(c64_keyline[2] & 0x40)) t &= ~0x04; | |
| 237 | if (!(c64_keyline[1] & 0x40)) t &= ~0x02; | |
| 238 | if (!(c64_keyline[0] & 0x40)) t &= ~0x01; | |
| 239 | value &= t; | |
| 240 | } | |
| 241 | ||
| 242 | if (!(output_b & 0x20)) | |
| 243 | { | |
| 244 | UINT8 t = 0xff; | |
| 245 | if (!(c64_keyline[7] & 0x20)) t &= ~0x80; | |
| 246 | if (!(c64_keyline[6] & 0x20)) t &= ~0x40; | |
| 247 | if (!(c64_keyline[5] & 0x20)) t &= ~0x20; | |
| 248 | if (!(c64_keyline[4] & 0x20)) t &= ~0x10; | |
| 249 | if (!(c64_keyline[3] & 0x20)) t &= ~0x08; | |
| 250 | if (!(c64_keyline[2] & 0x20)) t &= ~0x04; | |
| 251 | if (!(c64_keyline[1] & 0x20)) t &= ~0x02; | |
| 252 | if (!(c64_keyline[0] & 0x20)) t &= ~0x01; | |
| 253 | value &= t; | |
| 254 | } | |
| 255 | ||
| 256 | if (!(output_b & 0x10)) | |
| 257 | { | |
| 258 | UINT8 t = 0xff; | |
| 259 | if (!(c64_keyline[7] & 0x10)) t &= ~0x80; | |
| 260 | if (!(c64_keyline[6] & 0x10)) t &= ~0x40; | |
| 261 | if (!(c64_keyline[5] & 0x10)) t &= ~0x20; | |
| 262 | if (!(c64_keyline[4] & 0x10)) t &= ~0x10; | |
| 263 | if (!(c64_keyline[3] & 0x10)) t &= ~0x08; | |
| 264 | if (!(c64_keyline[2] & 0x10)) t &= ~0x04; | |
| 265 | if (!(c64_keyline[1] & 0x10)) t &= ~0x02; | |
| 266 | if (!(c64_keyline[0] & 0x10)) t &= ~0x01; | |
| 267 | value &= t; | |
| 268 | } | |
| 269 | ||
| 270 | if (!(output_b & 0x08)) | |
| 271 | { | |
| 272 | UINT8 t = 0xff; | |
| 273 | if (!(c64_keyline[7] & 0x08)) t &= ~0x80; | |
| 274 | if (!(c64_keyline[6] & 0x08)) t &= ~0x40; | |
| 275 | if (!(c64_keyline[5] & 0x08)) t &= ~0x20; | |
| 276 | if (!(c64_keyline[4] & 0x08)) t &= ~0x10; | |
| 277 | if (!(c64_keyline[3] & 0x08)) t &= ~0x08; | |
| 278 | if (!(c64_keyline[2] & 0x08)) t &= ~0x04; | |
| 279 | if (!(c64_keyline[1] & 0x08)) t &= ~0x02; | |
| 280 | if (!(c64_keyline[0] & 0x08)) t &= ~0x01; | |
| 281 | value &= t; | |
| 282 | } | |
| 283 | ||
| 284 | if (!(output_b & 0x04)) | |
| 285 | { | |
| 286 | UINT8 t = 0xff; | |
| 287 | if (!(c64_keyline[7] & 0x04)) t &= ~0x80; | |
| 288 | if (!(c64_keyline[6] & 0x04)) t &= ~0x40; | |
| 289 | if (!(c64_keyline[5] & 0x04)) t &= ~0x20; | |
| 290 | if (!(c64_keyline[4] & 0x04)) t &= ~0x10; | |
| 291 | if (!(c64_keyline[3] & 0x04)) t &= ~0x08; | |
| 292 | if (!(c64_keyline[2] & 0x04)) t &= ~0x04; | |
| 293 | if (!(c64_keyline[1] & 0x04)) t &= ~0x02; | |
| 294 | if (!(c64_keyline[0] & 0x04)) t &= ~0x01; | |
| 295 | value &= t; | |
| 296 | } | |
| 297 | ||
| 298 | if (!(output_b & 0x02)) | |
| 299 | { | |
| 300 | UINT8 t = 0xff; | |
| 301 | if (!(c64_keyline[7] & 0x02)) t &= ~0x80; | |
| 302 | if (!(c64_keyline[6] & 0x02)) t &= ~0x40; | |
| 303 | if (!(c64_keyline[5] & 0x02)) t &= ~0x20; | |
| 304 | if (!(c64_keyline[4] & 0x02)) t &= ~0x10; | |
| 305 | if (!(c64_keyline[3] & 0x02)) t &= ~0x08; | |
| 306 | if (!(c64_keyline[2] & 0x02)) t &= ~0x04; | |
| 307 | if (!(c64_keyline[1] & 0x02)) t &= ~0x02; | |
| 308 | if (!(c64_keyline[0] & 0x02)) t &= ~0x01; | |
| 309 | value &= t; | |
| 310 | } | |
| 311 | ||
| 312 | if (!(output_b & 0x01)) | |
| 313 | { | |
| 314 | UINT8 t = 0xff; | |
| 315 | if (!(c64_keyline[7] & 0x01)) t &= ~0x80; | |
| 316 | if (!(c64_keyline[6] & 0x01)) t &= ~0x40; | |
| 317 | if (!(c64_keyline[5] & 0x01)) t &= ~0x20; | |
| 318 | if (!(c64_keyline[4] & 0x01)) t &= ~0x10; | |
| 319 | if (!(c64_keyline[3] & 0x01)) t &= ~0x08; | |
| 320 | if (!(c64_keyline[2] & 0x01)) t &= ~0x04; | |
| 321 | if (!(c64_keyline[1] & 0x01)) t &= ~0x02; | |
| 322 | if (!(c64_keyline[0] & 0x01)) t &= ~0x01; | |
| 323 | value &= t; | |
| 324 | } | |
| 325 | ||
| 326 | if ( device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ) | |
| 327 | value &= c64_keyline[8]; | |
| 328 | else | |
| 329 | value &= c64_keyline[9]; | |
| 330 | ||
| 331 | return value; | |
| 332 | } | |
| 333 | ||
| 334 | UINT8 cbm_common_cia0_port_b_r( device_t *device, UINT8 output_a ) | |
| 335 | { | |
| 336 | UINT8 value = 0xff; | |
| 337 | ||
| 338 | if (!(output_a & 0x80)) value &= c64_keyline[7]; | |
| 339 | if (!(output_a & 0x40)) value &= c64_keyline[6]; | |
| 340 | if (!(output_a & 0x20)) value &= c64_keyline[5]; | |
| 341 | if (!(output_a & 0x10)) value &= c64_keyline[4]; | |
| 342 | if (!(output_a & 0x08)) value &= c64_keyline[3]; | |
| 343 | if (!(output_a & 0x04)) value &= c64_keyline[2]; | |
| 344 | if (!(output_a & 0x02)) value &= c64_keyline[1]; | |
| 345 | if (!(output_a & 0x01)) value &= c64_keyline[0]; | |
| 346 | ||
| 347 | if ( device->machine().root_device().ioport("CTRLSEL")->read() & 0x80 ) | |
| 348 | value &= c64_keyline[9]; | |
| 349 | else | |
| 350 | value &= c64_keyline[8]; | |
| 351 | ||
| 352 | return value; | |
| 353 | } | |
| 354 | ||
| 355 | ||
| 356 | /*********************************************** | |
| 357 | ||
| 358 | CBM Cartridges | |
| 359 | ||
| 360 | ***********************************************/ | |
| 361 | ||
| 362 | ||
| 363 | /* All the cartridge specific code has been moved | |
| 364 | to machine/ drivers. Once more informations | |
| 365 | surface about the cart expansions for systems | |
| 366 | in c65.c, c128.c, cbmb.c and pet.c, the shared | |
| 367 | code could be refactored to have here the | |
| 368 | common functions */ | |
| 369 | ||
| 370 | ||
| 371 | ||
| 372 | /*********************************************** | |
| 373 | ||
| 374 | CBM Datasette Tapes | |
| 375 | ||
| 376 | ***********************************************/ | |
| 377 | ||
| 378 | #if 0 | |
| 379 | const cassette_interface cbm_cassette_interface = | |
| 380 | { | |
| 381 | cbm_cassette_formats, | |
| 382 | NULL, | |
| 383 | (cassette_state) (CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED), | |
| 384 | NULL | |
| 385 | }; | |
| 386 | #endif | |
| 387 | ||
| 388 | ||
| 389 | /*UINT8 *c65_basic; */ | |
| 390 | /*UINT8 *c65_kernal; */ | |
| 391 | /*UINT8 *c65_dos; */ | |
| 392 | /*UINT8 *c65_monitor; */ | |
| 393 | /*UINT8 *c65_graphics; */ | |
| 394 | ||
| 395 | ||
| 396 | void c65_state::c65_nmi( ) | |
| 397 | { | |
| 398 | if (m_nmilevel != (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq) /* KEY_RESTORE */ | |
| 399 | { | |
| 400 | m_maincpu->set_input_line(INPUT_LINE_NMI, (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq); | |
| 401 | ||
| 402 | m_nmilevel = (ioport("SPECIAL")->read() & 0x80) || m_cia1_irq; | |
| 403 | } | |
| 404 | } | |
| 405 | ||
| 406 | ||
| 407 | /*********************************************** | |
| 408 | ||
| 409 | CIA Interfaces | |
| 410 | ||
| 411 | ***********************************************/ | |
| 412 | ||
| 413 | /* | |
| 414 | * CIA 0 - Port A keyboard line select | |
| 415 | * CIA 0 - Port B keyboard line read | |
| 416 | * | |
| 417 | * flag cassette read input, serial request in | |
| 418 | * irq to irq connected | |
| 419 | * | |
| 420 | * see machine/cbm.c | |
| 421 | */ | |
| 422 | ||
| 423 | READ8_MEMBER(c65_state::c65_cia0_port_a_r) | |
| 424 | { | |
| 425 | UINT8 cia0portb = m_cia0->pb_r(space, 0); | |
| 426 | ||
| 427 | return cbm_common_cia0_port_a_r(m_cia0, cia0portb); | |
| 428 | } | |
| 429 | ||
| 430 | READ8_MEMBER(c65_state::c65_cia0_port_b_r) | |
| 431 | { | |
| 432 | UINT8 value = 0xff; | |
| 433 | UINT8 cia0porta = m_cia0->pa_r(space, 0); | |
| 434 | ||
| 435 | value &= cbm_common_cia0_port_b_r(m_cia0, cia0porta); | |
| 436 | ||
| 437 | if (!(m_6511_port & 0x02)) | |
| 438 | value &= m_keyline; | |
| 439 | ||
| 440 | return value; | |
| 441 | } | |
| 442 | ||
| 443 | WRITE8_MEMBER(c65_state::c65_cia0_port_b_w) | |
| 444 | { | |
| 445 | // was there lightpen support in c65 video chip? | |
| 446 | // vic3_device *vic3 = machine().device<vic3_device>("vic3"); | |
| 447 | // vic3->lightpen_write(data & 0x10); | |
| 448 | } | |
| 449 | ||
| 450 | void c65_state::c65_irq( int level ) | |
| 451 | { | |
| 452 | if (level != m_old_level) | |
| 453 | { | |
| 454 | DBG_LOG(machine(), 3, "mos4510", ("irq %s\n", level ? "start" : "end")); | |
| 455 | m_maincpu->set_input_line(M4510_IRQ_LINE, level); | |
| 456 | m_old_level = level; | |
| 457 | } | |
| 458 | } | |
| 459 | ||
| 460 | /* is this correct for c65 as well as c64? */ | |
| 461 | WRITE_LINE_MEMBER(c65_state::c65_cia0_interrupt) | |
| 462 | { | |
| 463 | m_cia0_irq = state; | |
| 464 | c65_irq(state || m_vicirq); | |
| 465 | } | |
| 466 | ||
| 467 | /* is this correct for c65 as well as c64? */ | |
| 468 | WRITE_LINE_MEMBER(c65_state::c65_vic_interrupt) | |
| 469 | { | |
| 470 | #if 1 | |
| 471 | if (state != m_vicirq) | |
| 472 | { | |
| 473 | c65_irq (state || m_cia0_irq); | |
| 474 | m_vicirq = state; | |
| 475 | } | |
| 476 | #endif | |
| 477 | } | |
| 478 | ||
| 479 | /* | |
| 480 | * CIA 1 - Port A | |
| 481 | * bit 7 serial bus data input | |
| 482 | * bit 6 serial bus clock input | |
| 483 | * bit 5 serial bus data output | |
| 484 | * bit 4 serial bus clock output | |
| 485 | * bit 3 serial bus atn output | |
| 486 | * bit 2 rs232 data output | |
| 487 | * bits 1-0 vic-chip system memory bank select | |
| 488 | * | |
| 489 | * CIA 1 - Port B | |
| 490 | * bit 7 user rs232 data set ready | |
| 491 | * bit 6 user rs232 clear to send | |
| 492 | * bit 5 user | |
| 493 | * bit 4 user rs232 carrier detect | |
| 494 | * bit 3 user rs232 ring indicator | |
| 495 | * bit 2 user rs232 data terminal ready | |
| 496 | * bit 1 user rs232 request to send | |
| 497 | * bit 0 user rs232 received data | |
| 498 | * | |
| 499 | * flag restore key or rs232 received data input | |
| 500 | * irq to nmi connected ? | |
| 501 | */ | |
| 502 | READ8_MEMBER(c65_state::c65_cia1_port_a_r) | |
| 503 | { | |
| 504 | UINT8 value = 0xff; | |
| 505 | ||
| 506 | if (!m_iec->clk_r()) | |
| 507 | value &= ~0x40; | |
| 508 | ||
| 509 | if (!m_iec->data_r()) | |
| 510 | value &= ~0x80; | |
| 511 | ||
| 512 | return value; | |
| 513 | } | |
| 514 | ||
| 515 | WRITE8_MEMBER(c65_state::c65_cia1_port_a_w) | |
| 516 | { | |
| 517 | static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000}; | |
| 518 | ||
| 519 | m_iec->atn_w(!BIT(data, 3)); | |
| 520 | m_iec->clk_w(!BIT(data, 4)); | |
| 521 | m_iec->data_w(!BIT(data, 5)); | |
| 522 | ||
| 523 | m_vicaddr = m_memory + helper[data & 0x03]; | |
| 524 | } | |
| 525 | ||
| 526 | WRITE_LINE_MEMBER(c65_state::c65_cia1_interrupt) | |
| 527 | { | |
| 528 | m_cia1_irq = state; | |
| 529 | c65_nmi(); | |
| 530 | } | |
| 531 | ||
| 532 | /*********************************************** | |
| 533 | ||
| 534 | Memory Handlers | |
| 535 | ||
| 536 | ***********************************************/ | |
| 537 | ||
| 538 | /* processor has only 1 mega address space !? */ | |
| 539 | /* and system 8 megabyte */ | |
| 540 | /* dma controller and bankswitch hardware ?*/ | |
| 541 | READ8_MEMBER( c65_state::c65_read_mem ) | |
| 542 | { | |
| 543 | UINT8 result; | |
| 544 | if (offset <= 0x0ffff) | |
| 545 | result = m_memory[offset]; | |
| 546 | else | |
| 547 | result = space.read_byte(offset); | |
| 548 | return result; | |
| 549 | } | |
| 550 | ||
| 551 | WRITE8_MEMBER( c65_state::c65_write_mem ) | |
| 552 | { | |
| 553 | if (offset <= 0x0ffff) | |
| 554 | m_memory[offset] = data; | |
| 555 | else | |
| 556 | space.write_byte(offset, data); | |
| 557 | } | |
| 558 | ||
| 559 | /* dma chip at 0xd700 | |
| 560 | used: | |
| 561 | writing banknumber to offset 2 | |
| 562 | writing hibyte to offset 1 | |
| 563 | writing lobyte to offset 0 | |
| 564 | cpu holded, dma transfer(data at address) executed, cpu activated | |
| 565 | ||
| 566 | command data: | |
| 567 | 0 command (0 copy, 3 fill) | |
| 568 | 1,2 length | |
| 569 | 3,4,5 source | |
| 570 | 6,7,8 dest | |
| 571 | 9 subcommand | |
| 572 | 10 mod | |
| 573 | ||
| 574 | version 1: | |
| 575 | seldom copy (overlapping) from 0x402002 to 0x402008 | |
| 576 | (making place for new line in basic area) | |
| 577 | for whats this bit 0x400000, or is this really the address? | |
| 578 | maybe means add counter to address for access, | |
| 579 | so allowing up or down copies, and reordering copies | |
| 580 | ||
| 581 | version 2: | |
| 582 | cmd 0x30 used for this | |
| 583 | */ | |
| 584 | void c65_state::c65_dma_port_w( int offset, int value ) | |
| 585 | { | |
| 586 | PAIR pair, src, dst, len; | |
| 587 | UINT8 cmd, fill; | |
| 588 | int i; | |
| 589 | address_space &space = m_maincpu->space(AS_PROGRAM); | |
| 590 | ||
| 591 | switch (offset & 3) | |
| 592 | { | |
| 593 | case 2: | |
| 594 | case 1: | |
| 595 | m_dma.data[offset & 3] = value; | |
| 596 | break; | |
| 597 | case 0: | |
| 598 | pair.b.h3 = 0; | |
| 599 | pair.b.h2 = m_dma.data[2]; | |
| 600 | pair.b.h = m_dma.data[1]; | |
| 601 | pair.b.l = m_dma.data[0]=value; | |
| 602 | cmd = c65_read_mem(space, pair.d++); | |
| 603 | len.w.h = 0; | |
| 604 | len.b.l = c65_read_mem(space, pair.d++); | |
| 605 | len.b.h = c65_read_mem(space, pair.d++); | |
| 606 | src.b.h3 = 0; | |
| 607 | fill = src.b.l = c65_read_mem(space, pair.d++); | |
| 608 | src.b.h = c65_read_mem(space, pair.d++); | |
| 609 | src.b.h2 = c65_read_mem(space, pair.d++); | |
| 610 | dst.b.h3 = 0; | |
| 611 | dst.b.l = c65_read_mem(space, pair.d++); | |
| 612 | dst.b.h = c65_read_mem(space, pair.d++); | |
| 613 | dst.b.h2 = c65_read_mem(space, pair.d++); | |
| 614 | ||
| 615 | switch (cmd) | |
| 616 | { | |
| 617 | case 0: | |
| 618 | if (src.d == 0x3ffff) m_dump_dma = 1; | |
| 619 | if (m_dump_dma) | |
| 620 | DBG_LOG(space.machine(), 1,"dma copy job", | |
| 621 | ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", | |
| 622 | len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), | |
| 623 | c65_read_mem(space, pair.d + 1) ) ); | |
| 624 | if ((m_dma.version == 1) | |
| 625 | && ( (src.d&0x400000) || (dst.d & 0x400000))) | |
| 626 | { | |
| 627 | if (!(src.d & 0x400000)) | |
| 628 | { | |
| 629 | dst.d &= ~0x400000; | |
| 630 | for (i = 0; i < len.w.l; i++) | |
| 631 | c65_write_mem(space, dst.d--, c65_read_mem(space, src.d++)); | |
| 632 | } | |
| 633 | else if (!(dst.d & 0x400000)) | |
| 634 | { | |
| 635 | src.d &= ~0x400000; | |
| 636 | for (i = 0; i < len.w.l; i++) | |
| 637 | c65_write_mem(space, dst.d++, c65_read_mem(space, src.d--)); | |
| 638 | } | |
| 639 | else | |
| 640 | { | |
| 641 | src.d &= ~0x400000; | |
| 642 | dst.d &= ~0x400000; | |
| 643 | for (i = 0; i < len.w.l; i++) | |
| 644 | c65_write_mem(space, --dst.d, c65_read_mem(space, --src.d)); | |
| 645 | } | |
| 646 | } | |
| 647 | else | |
| 648 | { | |
| 649 | for (i = 0; i < len.w.l; i++) | |
| 650 | c65_write_mem(space, dst.d++, c65_read_mem(space, src.d++)); | |
| 651 | } | |
| 652 | break; | |
| 653 | case 3: | |
| 654 | DBG_LOG(space.machine(), 3,"dma fill job", | |
| 655 | ("len:%.4x value:%.2x dst:%.6x sub:%.2x modrm:%.2x\n", | |
| 656 | len.w.l, fill, dst.d, c65_read_mem(space, pair.d), | |
| 657 | c65_read_mem(space, pair.d + 1))); | |
| 658 | for (i = 0; i < len.w.l; i++) | |
| 659 | c65_write_mem(space, dst.d++, fill); | |
| 660 | break; | |
| 661 | case 0x30: | |
| 662 | DBG_LOG(space.machine(), 1,"dma copy down", | |
| 663 | ("len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", | |
| 664 | len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), | |
| 665 | c65_read_mem(space, pair.d + 1) ) ); | |
| 666 | for (i = 0; i < len.w.l; i++) | |
| 667 | c65_write_mem(space, dst.d--,c65_read_mem(space, src.d--)); | |
| 668 | break; | |
| 669 | default: | |
| 670 | DBG_LOG(space.machine(), 1,"dma job", | |
| 671 | ("cmd:%.2x len:%.4x src:%.6x dst:%.6x sub:%.2x modrm:%.2x\n", | |
| 672 | cmd,len.w.l, src.d, dst.d, c65_read_mem(space, pair.d), | |
| 673 | c65_read_mem(space, pair.d + 1))); | |
| 674 | } | |
| 675 | break; | |
| 676 | default: | |
| 677 | DBG_LOG(space.machine(), 1, "dma chip write", ("%.3x %.2x\n", offset, value)); | |
| 678 | break; | |
| 679 | } | |
| 680 | } | |
| 681 | ||
| 682 | int c65_state::c65_dma_port_r( int offset ) | |
| 683 | { | |
| 684 | /* offset 3 bit 7 in progress ? */ | |
| 685 | DBG_LOG(machine(), 2, "dma chip read", ("%.3x\n", offset)); | |
| 686 | return 0x7f; | |
| 687 | } | |
| 688 | ||
| 689 | void c65_state::c65_6511_port_w( int offset, int value ) | |
| 690 | { | |
| 691 | if (offset == 7) | |
| 692 | { | |
| 693 | m_6511_port = value; | |
| 694 | } | |
| 695 | DBG_LOG(machine(), 2, "r6511 write", ("%.2x %.2x\n", offset, value)); | |
| 696 | } | |
| 697 | ||
| 698 | int c65_state::c65_6511_port_r( int offset ) | |
| 699 | { | |
| 700 | int data = 0xff; | |
| 701 | ||
| 702 | if (offset == 7) | |
| 703 | { | |
| 704 | if (ioport("SPECIAL")->read() & 0x20) | |
| 705 | data &= ~1; | |
| 706 | } | |
| 707 | DBG_LOG(machine(), 2, "r6511 read", ("%.2x\n", offset)); | |
| 708 | ||
| 709 | return data; | |
| 710 | } | |
| 711 | ||
| 712 | /* one docu states custom 4191 disk controller | |
| 713 | (for 2 1MB MFM disk drives, 1 internal, the other extern (optional) 1565 | |
| 714 | with integrated 512 byte buffer | |
| 715 | ||
| 716 | 0->0 reset ? | |
| 717 | ||
| 718 | 0->1, 0->0, wait until 2 positiv, 1->0 ??? | |
| 719 | ||
| 720 | 0->0, 0 not 0 means no drive ???, other system entries | |
| 721 | ||
| 722 | ||
| 723 | reg 0 write/read | |
| 724 | 0,1 written | |
| 725 | bit 1 set | |
| 726 | bit 2 set | |
| 727 | bit 3 set | |
| 728 | bit 4 set | |
| 729 | ||
| 730 | ||
| 731 | reg 0 read | |
| 732 | bit 0 | |
| 733 | bit 1 | |
| 734 | bit 2 | |
| 735 | 0..2 ->$1d4 | |
| 736 | ||
| 737 | reg 1 write | |
| 738 | $01 written | |
| 739 | $18 written | |
| 740 | $46 written | |
| 741 | $80 written | |
| 742 | $a1 written | |
| 743 | $01 written, dec | |
| 744 | $10 written | |
| 745 | ||
| 746 | reg 2 read/write?(lsr) | |
| 747 | bit 2 | |
| 748 | bit 4 | |
| 749 | bit 5 busy waiting until zero, then reading reg 7 | |
| 750 | bit 6 operation not activ flag!? or set overflow pin used | |
| 751 | bit 7 busy flag? | |
| 752 | ||
| 753 | reg 3 read/write?(rcr) | |
| 754 | bit 1 | |
| 755 | bit 3 | |
| 756 | bit 7 busy flag? | |
| 757 | ||
| 758 | reg 4 | |
| 759 | track?? | |
| 760 | 0 written | |
| 761 | read -> $1d2 | |
| 762 | cmp #$50 | |
| 763 | bcs | |
| 764 | ||
| 765 | ||
| 766 | reg 5 | |
| 767 | sector ?? | |
| 768 | 1 written | |
| 769 | read -> $1d3 | |
| 770 | cmp #$b bcc | |
| 771 | ||
| 772 | ||
| 773 | reg 6 | |
| 774 | head ?? | |
| 775 | 0 written | |
| 776 | read -> $1d1 | |
| 777 | cmp #2 bcc | |
| 778 | ||
| 779 | reg 7 read | |
| 780 | #4e written | |
| 781 | 12 times 0, a1 a1 a1 fe written | |
| 782 | ||
| 783 | reg 8 read | |
| 784 | #ff written | |
| 785 | 16 times #ff written | |
| 786 | ||
| 787 | reg 9 | |
| 788 | #60 written | |
| 789 | ||
| 790 | might use the set overflow input | |
| 791 | ||
| 792 | $21a6c 9a6c format | |
| 793 | $21c97 9c97 write operation | |
| 794 | $21ca0 9ca0 get byte? | |
| 795 | $21cab 9cab read reg 7 | |
| 796 | $21caf 9caf write reg 7 | |
| 797 | $21cb3 | |
| 798 | */ | |
| 799 | ||
| 800 | #define FDC_LOST 4 | |
| 801 | #define FDC_CRC 8 | |
| 802 | #define FDC_RNF 0x10 | |
| 803 | #define FDC_BUSY 0x80 | |
| 804 | #define FDC_IRQ 0x200 | |
| 805 | ||
| 806 | #define FDC_CMD_MOTOR_SPIN_UP 0x10 | |
| 807 | ||
| 808 | #if 0 | |
| 809 | void c65_state::c65_fdc_state(void) | |
| 810 | { | |
| 811 | switch (m_fdc.state) | |
| 812 | { | |
| 813 | case FDC_CMD_MOTOR_SPIN_UP: | |
| 814 | if (machine().time() - m_fdc.time) | |
| 815 | { | |
| 816 | m_fdc.state = 0; | |
| 817 | m_fdc.status &= ~FDC_BUSY; | |
| 818 | } | |
| 819 | break; | |
| 820 | } | |
| 821 | } | |
| 822 | #endif | |
| 823 | ||
| 824 | void c65_state::c65_fdc_w( int offset, int data ) | |
| 825 | { | |
| 826 | DBG_LOG(machine(), 1, "fdc write", ("%.5x %.2x %.2x\n", machine().device("maincpu")->safe_pc(), offset, data)); | |
| 827 | switch (offset & 0xf) | |
| 828 | { | |
| 829 | case 0: | |
| 830 | m_fdc.reg[0] = data; | |
| 831 | break; | |
| 832 | case 1: | |
| 833 | m_fdc.reg[1] = data; | |
| 834 | switch (data & 0xf9) | |
| 835 | { | |
| 836 | case 0x20: // wait for motor spin up | |
| 837 | m_fdc.status &= ~(FDC_IRQ|FDC_LOST|FDC_CRC|FDC_RNF); | |
| 838 | m_fdc.status |= FDC_BUSY; | |
| 839 | m_fdc.time = machine().time(); | |
| 840 | m_fdc.state = FDC_CMD_MOTOR_SPIN_UP; | |
| 841 | break; | |
| 842 | case 0: // cancel | |
| 843 | m_fdc.status &= ~(FDC_BUSY); | |
| 844 | m_fdc.state = 0; | |
| 845 | break; | |
| 846 | case 0x80: // buffered write | |
| 847 | case 0x40: // buffered read | |
| 848 | case 0x81: // unbuffered write | |
| 849 | case 0x41: // unbuffered read | |
| 850 | case 0x30:case 0x31: // step | |
| 851 | break; | |
| 852 | } | |
| 853 | break; | |
| 854 | case 2: case 3: // read only | |
| 855 | break; | |
| 856 | case 4: | |
| 857 | m_fdc.reg[offset & 0xf] = data; | |
| 858 | m_fdc.track = data; | |
| 859 | break; | |
| 860 | case 5: | |
| 861 | m_fdc.reg[offset & 0xf] = data; | |
| 862 | m_fdc.sector = data; | |
| 863 | break; | |
| 864 | case 6: | |
| 865 | m_fdc.reg[offset & 0xf] = data; | |
| 866 | m_fdc.head = data; | |
| 867 | break; | |
| 868 | case 7: | |
| 869 | m_fdc.buffer[m_fdc.cpu_pos++] = data; | |
| 870 | break; | |
| 871 | default: | |
| 872 | m_fdc.reg[offset & 0xf] = data; | |
| 873 | break; | |
| 874 | } | |
| 875 | } | |
| 876 | ||
| 877 | int c65_state::c65_fdc_r( int offset ) | |
| 878 | { | |
| 879 | UINT8 data = 0; | |
| 880 | switch (offset & 0xf) | |
| 881 | { | |
| 882 | case 0: | |
| 883 | data = m_fdc.reg[0]; | |
| 884 | break; | |
| 885 | case 1: | |
| 886 | data = m_fdc.reg[1]; | |
| 887 | break; | |
| 888 | case 2: | |
| 889 | data = m_fdc.status; | |
| 890 | break; | |
| 891 | case 3: | |
| 892 | data = m_fdc.status >> 8; | |
| 893 | break; | |
| 894 | case 4: | |
| 895 | data = m_fdc.track; | |
| 896 | break; | |
| 897 | case 5: | |
| 898 | data = m_fdc.sector; | |
| 899 | break; | |
| 900 | case 6: | |
| 901 | data = m_fdc.head; | |
| 902 | break; | |
| 903 | case 7: | |
| 904 | data = m_fdc.buffer[m_fdc.cpu_pos++]; | |
| 905 | break; | |
| 906 | default: | |
| 907 | data = m_fdc.reg[offset & 0xf]; | |
| 908 | break; | |
| 909 | } | |
| 910 | DBG_LOG(machine(), 1, "fdc read", ("%.5x %.2x %.2x\n", machine().device("maincpu")->safe_pc(), offset, data)); | |
| 911 | return data; | |
| 912 | } | |
| 913 | ||
| 914 | /* version 1 ramcheck | |
| 915 | write 0:0 | |
| 916 | read write read write 80000,90000,f0000 | |
| 917 | write 0:8 | |
| 918 | read write read write 80000,90000,f0000 | |
| 919 | ||
| 920 | version 2 ramcheck??? | |
| 921 | read 0: | |
| 922 | write 0:0 | |
| 923 | read 0: | |
| 924 | first read and second read bit 0x80 set --> nothing | |
| 925 | write 0:0 | |
| 926 | read 0 | |
| 927 | write 0:ff | |
| 928 | */ | |
| 929 | ||
| 930 | READ8_MEMBER( c65_state::c65_ram_expansion_r ) | |
| 931 | { | |
| 932 | UINT8 data = 0xff; | |
| 933 | if (m_ram->size() > (128 * 1024)) | |
| 934 | data = m_expansion_ram.reg; | |
| 935 | return data; | |
| 936 | } | |
| 937 | ||
| 938 | WRITE8_MEMBER( c65_state::c65_ram_expansion_w ) | |
| 939 | { | |
| 940 | offs_t expansion_ram_begin; | |
| 941 | offs_t expansion_ram_end; | |
| 942 | ||
| 943 | if (m_ram->size() > (128 * 1024)) | |
| 944 | { | |
| 945 | m_expansion_ram.reg = data; | |
| 946 | ||
| 947 | expansion_ram_begin = 0x80000; | |
| 948 | expansion_ram_end = 0x80000 + (m_ram->size() - 128*1024) - 1; | |
| 949 | ||
| 950 | if (data == 0x00) { | |
| 951 | space.install_readwrite_bank(expansion_ram_begin, expansion_ram_end,"bank16"); | |
| 952 | membank("bank16")->set_base(m_ram->pointer() + 128*1024); | |
| 953 | } else { | |
| 954 | space.nop_readwrite(expansion_ram_begin, expansion_ram_end); | |
| 955 | } | |
| 956 | } | |
| 957 | } | |
| 958 | ||
| 959 | WRITE8_MEMBER( c65_state::c65_write_io ) | |
| 960 | { | |
| 961 | mos6581_device *sid_0 = machine().device<mos6581_device>("sid_r"); | |
| 962 | mos6581_device *sid_1 = machine().device<mos6581_device>("sid_l"); | |
| 963 | vic3_device *vic3 = machine().device<vic3_device>("vic3"); | |
| 964 | ||
| 965 | switch (offset & 0xf00) | |
| 966 | { | |
| 967 | case 0x000: | |
| 968 | if (offset < 0x80) | |
| 969 | vic3->port_w(space, offset & 0x7f, data); | |
| 970 | else if (offset < 0xa0) | |
| 971 | c65_fdc_w(offset & 0x1f, data); | |
| 972 | else | |
| 973 | { | |
| 974 | c65_ram_expansion_w(space, offset & 0x1f, data, mem_mask); | |
| 975 | /*ram expansion crtl optional */ | |
| 976 | } | |
| 977 | break; | |
| 978 | case 0x100: | |
| 979 | case 0x200: | |
| 980 | case 0x300: | |
| 981 | vic3->palette_w(space, offset - 0x100, data); | |
| 982 | break; | |
| 983 | case 0x400: | |
| 984 | if (offset<0x420) /* maybe 0x20 */ | |
| 985 | sid_0->write(space, offset & 0x3f, data); | |
| 986 | else if (offset<0x440) | |
| 987 | sid_1->write(space, offset & 0x3f, data); | |
| 988 | else | |
| 989 | DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset, data)); | |
| 990 | break; | |
| 991 | case 0x500: | |
| 992 | DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset, data)); | |
| 993 | break; | |
| 994 | case 0x600: | |
| 995 | c65_6511_port_w(offset & 0xff,data); | |
| 996 | break; | |
| 997 | case 0x700: | |
| 998 | c65_dma_port_w(offset & 0xff, data); | |
| 999 | break; | |
| 1000 | } | |
| 1001 | } | |
| 1002 | ||
| 1003 | WRITE8_MEMBER( c65_state::c65_write_io_dc00 ) | |
| 1004 | { | |
| 1005 | switch (offset & 0xf00) | |
| 1006 | { | |
| 1007 | case 0x000: | |
| 1008 | m_cia0->write(space, offset, data); | |
| 1009 | break; | |
| 1010 | case 0x100: | |
| 1011 | m_cia1->write(space, offset, data); | |
| 1012 | break; | |
| 1013 | case 0x200: | |
| 1014 | case 0x300: | |
| 1015 | DBG_LOG(machine(), 1, "io write", ("%.3x %.2x\n", offset+0xc00, data)); | |
| 1016 | break; | |
| 1017 | } | |
| 1018 | } | |
| 1019 | ||
| 1020 | READ8_MEMBER( c65_state::c65_read_io ) | |
| 1021 | { | |
| 1022 | mos6581_device *sid_0 = machine().device<mos6581_device>("sid_r"); | |
| 1023 | mos6581_device *sid_1 = machine().device<mos6581_device>("sid_l"); | |
| 1024 | vic3_device *vic3 = machine().device<vic3_device>("vic3"); | |
| 1025 | ||
| 1026 | switch (offset & 0xf00) | |
| 1027 | { | |
| 1028 | case 0x000: | |
| 1029 | if (offset < 0x80) | |
| 1030 | return vic3->port_r(space, offset & 0x7f); | |
| 1031 | if (offset < 0xa0) | |
| 1032 | return c65_fdc_r(offset & 0x1f); | |
| 1033 | else | |
| 1034 | { | |
| 1035 | return c65_ram_expansion_r(space, offset & 0x1f, mem_mask); | |
| 1036 | /*return; ram expansion crtl optional */ | |
| 1037 | } | |
| 1038 | case 0x100: | |
| 1039 | case 0x200: | |
| 1040 | case 0x300: | |
| 1041 | /* read only !? */ | |
| 1042 | DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); | |
| 1043 | break; | |
| 1044 | case 0x400: | |
| 1045 | if (offset < 0x420) | |
| 1046 | return sid_0->read(space, offset & 0x3f); | |
| 1047 | if (offset < 0x440) | |
| 1048 | return sid_1->read(space, offset & 0x3f); | |
| 1049 | DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); | |
| 1050 | break; | |
| 1051 | case 0x500: | |
| 1052 | DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset)); | |
| 1053 | break; | |
| 1054 | case 0x600: | |
| 1055 | return c65_6511_port_r(offset&0xff); | |
| 1056 | case 0x700: | |
| 1057 | return c65_dma_port_r(offset&0xff); | |
| 1058 | } | |
| 1059 | return 0xff; | |
| 1060 | } | |
| 1061 | ||
| 1062 | READ8_MEMBER( c65_state::c65_read_io_dc00 ) | |
| 1063 | { | |
| 1064 | switch (offset & 0x300) | |
| 1065 | { | |
| 1066 | case 0x000: | |
| 1067 | return m_cia0->read(space, offset); | |
| 1068 | case 0x100: | |
| 1069 | return m_cia1->read(space, offset); | |
| 1070 | case 0x200: | |
| 1071 | case 0x300: | |
| 1072 | DBG_LOG(machine(), 1, "io read", ("%.3x\n", offset+0xc00)); | |
| 1073 | break; | |
| 1074 | } | |
| 1075 | return 0xff; | |
| 1076 | } | |
| 1077 | ||
| 1078 | ||
| 1079 | /* | |
| 1080 | d02f: | |
| 1081 | init a5 96 written (seems to be switch to c65 or vic3 mode) | |
| 1082 | go64 0 written | |
| 1083 | */ | |
| 1084 | ||
| 1085 | /* bit 1 external sync enable (genlock) | |
| 1086 | bit 2 palette enable | |
| 1087 | bit 6 vic3 c65 character set */ | |
| 1088 | WRITE8_MEMBER(c65_state::c65_bankswitch_interface) | |
| 1089 | { | |
| 1090 | DBG_LOG(machine(), 2, "c65 bankswitch", ("%.2x\n",data)); | |
| 1091 | ||
| 1092 | if (m_io_on) | |
| 1093 | { | |
| 1094 | if (data & 1) | |
| 1095 | { | |
| 1096 | membank("bank8")->set_base(m_colorram + 0x400); | |
| 1097 | membank("bank9")->set_base(m_colorram + 0x400); | |
| 1098 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8"); | |
| 1099 | m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9"); | |
| 1100 | } | |
| 1101 | else | |
| 1102 | { | |
| 1103 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x0dc00, 0x0dfff, read8_delegate(FUNC(c65_state::c65_read_io_dc00),this)); | |
| 1104 | m_maincpu->space(AS_PROGRAM).install_write_handler(0x0dc00, 0x0dfff, write8_delegate(FUNC(c65_state::c65_write_io_dc00),this)); | |
| 1105 | } | |
| 1106 | } | |
| 1107 | ||
| 1108 | m_io_dc00_on = !(data & 1); | |
| 1109 | #if 0 | |
| 1110 | /* cartridge roms !?*/ | |
| 1111 | if (data & 0x08) | |
| 1112 | membank("bank1")->set_base(m_roml); | |
| 1113 | else | |
| 1114 | membank("bank1")->set_base(m_memory + 0x8000); | |
| 1115 | ||
| 1116 | if (data & 0x10) | |
| 1117 | membank("bank2")->set_base(m_basic); | |
| 1118 | else | |
| 1119 | membank("bank2")->set_base(m_memory + 0xa000); | |
| 1120 | #endif | |
| 1121 | if ((m_old_value^data) & 0x20) | |
| 1122 | { | |
| 1123 | /* bankswitching faulty when doing actual page */ | |
| 1124 | if (data & 0x20) | |
| 1125 | membank("bank3")->set_base(m_basic); | |
| 1126 | else | |
| 1127 | membank("bank3")->set_base(m_memory + 0xc000); | |
| 1128 | } | |
| 1129 | m_charset_select = data & 0x40; | |
| 1130 | #if 0 | |
| 1131 | /* cartridge roms !?*/ | |
| 1132 | if (data & 0x80) | |
| 1133 | membank("bank8")->set_base(m_kernal); | |
| 1134 | else | |
| 1135 | membank("bank6")->set_base(m_memory + 0xe000); | |
| 1136 | #endif | |
| 1137 | m_old_value = data; | |
| 1138 | } | |
| 1139 | ||
| 1140 | void c65_state::c65_bankswitch( ) | |
| 1141 | { | |
| 1142 | int data, loram, hiram, charen; | |
| 1143 | ||
| 1144 | data = 0x00; // machine().device<m4510_device>("maincpu")->get_port(); | |
| 1145 | if (data == m_old_data) | |
| 1146 | return; | |
| 1147 | ||
| 1148 | DBG_LOG(machine(), 1, "bankswitch", ("%d\n", data & 7)); | |
| 1149 | loram = (data & 1) ? 1 : 0; | |
| 1150 | hiram = (data & 2) ? 1 : 0; | |
| 1151 | charen = (data & 4) ? 1 : 0; | |
| 1152 | ||
| 1153 | if ((!m_game && m_exrom) || (loram && hiram && !m_exrom)) | |
| 1154 | membank("bank1")->set_base(m_roml); | |
| 1155 | else | |
| 1156 | membank("bank1")->set_base(m_memory + 0x8000); | |
| 1157 | ||
| 1158 | if ((!m_game && m_exrom && hiram) || (!m_exrom)) | |
| 1159 | membank("bank2")->set_base(m_romh); | |
| 1160 | else if (loram && hiram) | |
| 1161 | membank("bank2")->set_base(m_basic); | |
| 1162 | else | |
| 1163 | membank("bank2")->set_base(m_memory + 0xa000); | |
| 1164 | ||
| 1165 | if ((!m_game && m_exrom) || (charen && (loram || hiram))) | |
| 1166 | { | |
| 1167 | m_io_on = 1; | |
| 1168 | membank("bank6")->set_base(m_colorram); | |
| 1169 | membank("bank7")->set_base(m_colorram); | |
| 1170 | ||
| 1171 | if (m_io_dc00_on) | |
| 1172 | { | |
| 1173 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x0dc00, 0x0dfff, read8_delegate(FUNC(c65_state::c65_read_io_dc00),this)); | |
| 1174 | m_maincpu->space(AS_PROGRAM).install_write_handler(0x0dc00, 0x0dfff, write8_delegate(FUNC(c65_state::c65_write_io_dc00),this)); | |
| 1175 | } | |
| 1176 | else | |
| 1177 | { | |
| 1178 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8"); | |
| 1179 | m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9"); | |
| 1180 | membank("bank8")->set_base(m_colorram + 0x400); | |
| 1181 | membank("bank9")->set_base(m_colorram + 0x400); | |
| 1182 | } | |
| 1183 | m_maincpu->space(AS_PROGRAM).install_read_handler(0x0d000, 0x0d7ff, read8_delegate(FUNC(c65_state::c65_read_io),this)); | |
| 1184 | m_maincpu->space(AS_PROGRAM).install_write_handler(0x0d000, 0x0d7ff, write8_delegate(FUNC(c65_state::c65_write_io),this)); | |
| 1185 | } | |
| 1186 | else | |
| 1187 | { | |
| 1188 | m_io_on = 0; | |
| 1189 | membank("bank5")->set_base(m_memory + 0xd000); | |
| 1190 | membank("bank7")->set_base(m_memory + 0xd800); | |
| 1191 | membank("bank9")->set_base(m_memory + 0xdc00); | |
| 1192 | if (!charen && (loram || hiram)) | |
| 1193 | { | |
| 1194 | membank("bank4")->set_base(m_chargen); | |
| 1195 | membank("bank6")->set_base(m_chargen + 0x800); | |
| 1196 | membank("bank8")->set_base(m_chargen + 0xc00); | |
| 1197 | } | |
| 1198 | else | |
| 1199 | { | |
| 1200 | membank("bank4")->set_base(m_memory + 0xd000); | |
| 1201 | membank("bank6")->set_base(m_memory + 0xd800); | |
| 1202 | membank("bank8")->set_base(m_memory + 0xdc00); | |
| 1203 | } | |
| 1204 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x0d000, 0x0d7ff, "bank4"); | |
| 1205 | m_maincpu->space(AS_PROGRAM).install_write_bank(0x0d000, 0x0d7ff, "bank5"); | |
| 1206 | } | |
| 1207 | ||
| 1208 | if (!m_game && m_exrom) | |
| 1209 | { | |
| 1210 | membank("bank10")->set_base(m_romh); | |
| 1211 | } | |
| 1212 | else | |
| 1213 | { | |
| 1214 | if (hiram) | |
| 1215 | { | |
| 1216 | membank("bank10")->set_base(m_kernal); | |
| 1217 | } | |
| 1218 | else | |
| 1219 | { | |
| 1220 | membank("bank10")->set_base(m_memory + 0xe000); | |
| 1221 | } | |
| 1222 | } | |
| 1223 | m_old_data = data; | |
| 1224 | } | |
| 1225 | ||
| 1226 | #ifdef UNUSED_FUNCTION | |
| 1227 | void c65_state::c65_colorram_write( int offset, int value ) | |
| 1228 | { | |
| 1229 | m_colorram[offset & 0x7ff] = value | 0xf0; | |
| 1230 | } | |
| 1231 | #endif | |
| 1232 | ||
| 1233 | /* | |
| 1234 | * only 14 address lines | |
| 1235 | * a15 and a14 portlines | |
| 1236 | * 0x1000-0x1fff, 0x9000-0x9fff char rom | |
| 1237 | */ | |
| 1238 | READ8_MEMBER(c65_state::c65_dma_read) | |
| 1239 | { | |
| 1240 | if (!m_game && m_exrom) | |
| 1241 | { | |
| 1242 | if (offset < 0x3000) | |
| 1243 | return m_memory[offset]; | |
| 1244 | return m_romh[offset & 0x1fff]; | |
| 1245 | } | |
| 1246 | if ((m_vicaddr == m_memory) || (m_vicaddr == m_memory + 0x8000)) | |
| 1247 | { | |
| 1248 | if (offset < 0x1000) | |
| 1249 | return m_vicaddr[offset & 0x3fff]; | |
| 1250 | if (offset < 0x2000) { | |
| 1251 | if (m_charset_select) | |
| 1252 | return m_chargen[offset & 0xfff]; | |
| 1253 | else | |
| 1254 | return m_chargen[offset & 0xfff]; | |
| 1255 | } | |
| 1256 | return m_vicaddr[offset & 0x3fff]; | |
| 1257 | } | |
| 1258 | return m_vicaddr[offset & 0x3fff]; | |
| 1259 | } | |
| 1260 | ||
| 1261 | READ8_MEMBER(c65_state::c65_dma_read_color) | |
| 1262 | { | |
| 1263 | if (m_c64mode) | |
| 1264 | return m_colorram[offset & 0x3ff] & 0xf; | |
| 1265 | return m_colorram[offset & 0x7ff]; | |
| 1266 | } | |
| 1267 | ||
| 1268 | void c65_state::c65_common_driver_init( ) | |
| 1269 | { | |
| 1270 | m_memory = auto_alloc_array_clear(machine(), UINT8, 0x10000); | |
| 1271 | membank("bank11")->set_base(m_memory + 0x00000); | |
| 1272 | membank("bank12")->set_base(m_memory + 0x08000); | |
| 1273 | membank("bank13")->set_base(m_memory + 0x0a000); | |
| 1274 | membank("bank14")->set_base(m_memory + 0x0c000); | |
| 1275 | membank("bank15")->set_base(m_memory + 0x0e000); | |
| 1276 | ||
| 1277 | cbm_common_init(); | |
| 1278 | m_keyline = 0xff; | |
| 1279 | ||
| 1280 | m_pal = 0; | |
| 1281 | m_charset_select = 0; | |
| 1282 | m_6511_port = 0xff; | |
| 1283 | m_vicirq = 0; | |
| 1284 | m_old_data = -1; | |
| 1285 | ||
| 1286 | /* C65 had no datasette port */ | |
| 1287 | m_tape_on = 0; | |
| 1288 | m_game = 1; | |
| 1289 | m_exrom = 1; | |
| 1290 | ||
| 1291 | /*memset(m_memory + 0x40000, 0, 0x800000 - 0x40000); */ | |
| 1292 | } | |
| 1293 | ||
| 1294 | DRIVER_INIT_MEMBER(c65_state,c65) | |
| 1295 | { | |
| 1296 | m_dma.version = 2; | |
| 1297 | c65_common_driver_init(); | |
| 1298 | } | |
| 1299 | ||
| 1300 | DRIVER_INIT_MEMBER(c65_state,c65pal) | |
| 1301 | { | |
| 1302 | m_dma.version = 1; | |
| 1303 | c65_common_driver_init(); | |
| 1304 | m_pal = 1; | |
| 1305 | } | |
| 1306 | ||
| 1307 | MACHINE_START_MEMBER(c65_state,c65) | |
| 1308 | { | |
| 1309 | /* clear upper memory */ | |
| 1310 | memset(m_ram->pointer() + 128*1024, 0xff, m_ram->size() - 128*1024); | |
| 1311 | ||
| 1312 | //removed cbm_drive_0_config (SERIAL, 10); | |
| 1313 | //removed cbm_drive_1_config (SERIAL, 11); | |
| 1314 | m_vicaddr = m_memory; | |
| 1315 | ||
| 1316 | m_c64mode = 0; | |
| 1317 | ||
| 1318 | c65_bankswitch_interface(m_maincpu->space(AS_PROGRAM),0,0xff); | |
| 1319 | c65_bankswitch(); | |
| 1320 | } | |
| 1321 | ||
| 1322 | ||
| 1323 | INTERRUPT_GEN_MEMBER(c65_state::c65_frame_interrupt) | |
| 1324 | { | |
| 1325 | int value; | |
| 1326 | ||
| 1327 | c65_nmi(); | |
| 1328 | ||
| 1329 | /* common keys input ports */ | |
| 1330 | cbm_common_interrupt(&device); | |
| 1331 | ||
| 1332 | /* c65 specific: function keys input ports */ | |
| 1333 | value = 0xff; | |
| 1334 | ||
| 1335 | value &= ~ioport("FUNCT")->read(); | |
| 1336 | m_keyline = value; | |
| 1337 | } |
| r243232 | r243233 | |
|---|---|---|
| 427 | 427 | { |
| 428 | 428 | if(m_adb_keybuf_start == m_adb_keybuf_end) |
| 429 | 429 | { |
| 430 | // | |
| 430 | // printf("%s: buffer empty\n", __func__); | |
| 431 | 431 | m_adb_buffer[0] = 0xff; |
| 432 | 432 | m_adb_buffer[1] = 0xff; |
| 433 | 433 | } |
| r243232 | r243233 | |
|---|---|---|
| 139 | 139 | // bit 0 to controller port |
| 140 | 140 | ret |= m_ctrl1->read_bit0(); |
| 141 | 141 | |
| 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 | |
| 143 | 143 | // too, so in principle some homebrew hardware modification could use the same |
| 144 | 144 | // connection with P1 controller too) |
| 145 | 145 | ret |= m_ctrl1->read_exp(0); |
| r243232 | r243233 | |
| 160 | 160 | // bit 0 to controller port |
| 161 | 161 | ret |= m_ctrl2->read_bit0(); |
| 162 | 162 | |
| 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 | |
| 164 | 164 | // too, so in principle some homebrew hardware modification could use the same |
| 165 | 165 | // connection with P1 controller too) |
| 166 | 166 | ret |= m_ctrl1->read_exp(1); |
| r243232 | r243233 | |
| 193 | 193 | { |
| 194 | 194 | // get the pixel at the gun position |
| 195 | 195 | UINT32 pix = m_ppu->get_pixel(x, y); |
| 196 | ||
| 196 | ||
| 197 | 197 | // get the color base from the ppu |
| 198 | 198 | UINT32 color_base = m_ppu->get_colorbase(); |
| 199 | ||
| 199 | ||
| 200 | 200 | // check if the cursor is over a bright pixel |
| 201 | 201 | if ((pix == color_base + 0x20) || (pix == color_base + 0x30) || |
| 202 | 202 | (pix == color_base + 0x33) || (pix == color_base + 0x34)) |
| r243232 | r243233 | |
|---|---|---|
| 1088 | 1088 | $(MESS_DRIVERS)/c128.o \ |
| 1089 | 1089 | $(MESS_DRIVERS)/c64.o \ |
| 1090 | 1090 | $(MESS_DRIVERS)/c64dtv.o \ |
| 1091 | $(MESS_DRIVERS)/c65.o | |
| 1091 | $(MESS_DRIVERS)/c65.o \ | |
| 1092 | 1092 | $(MESS_DRIVERS)/c900.o \ |
| 1093 | 1093 | $(MESS_DRIVERS)/cbm2.o \ |
| 1094 | 1094 | $(MESS_DRIVERS)/clcd.o \ |
| r243232 | r243233 | |
|---|---|---|
| 20 | 20 | { |
| 21 | 21 | public: |
| 22 | 22 | |
| 23 | ||
| 23 | virtual ~debug_module() { } | |
| 24 | 24 | |
| 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; | |
| 28 | 28 | }; |
| 29 | 29 | |
| 30 | 30 |
| r243232 | r243233 | |
|---|---|---|
| 27 | 27 | class debug_internal : public osd_module, public debug_module |
| 28 | 28 | { |
| 29 | 29 | public: |
| 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 | } | |
| 35 | 35 | |
| 36 | ||
| 36 | virtual ~debug_internal() { } | |
| 37 | 37 | |
| 38 | virtual int init() { return 0;} | |
| 39 | virtual void exit(); | |
| 38 | virtual int init() { return 0;} | |
| 39 | virtual void exit(); | |
| 40 | 40 | |
| 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(); | |
| 44 | 44 | |
| 45 | 45 | private: |
| 46 | ||
| 46 | running_machine *m_machine; | |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 |
| r243232 | r243233 | |
|---|---|---|
| 37 | 37 | class debug_qt : public osd_module, public debug_module |
| 38 | 38 | { |
| 39 | 39 | public: |
| 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 | } | |
| 45 | 45 | |
| 46 | ||
| 46 | virtual ~debug_qt() { } | |
| 47 | 47 | |
| 48 | virtual int init() { return 0;} | |
| 49 | virtual void exit() { } | |
| 48 | virtual int init() { return 0;} | |
| 49 | virtual void exit() { } | |
| 50 | 50 | |
| 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(); | |
| 54 | 54 | |
| 55 | 55 | private: |
| 56 | ||
| 56 | running_machine *m_machine; | |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | //============================================================ |
| r243232 | r243233 | |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | #else /* SDLMAME_UNIX */ |
| 360 | ||
| 360 | MODULE_NOT_SUPPORTED(debug_qt, OSD_DEBUG_PROVIDER, "qt") | |
| 361 | 361 | #endif |
| 362 | 362 | |
| 363 | 363 | MODULE_DEFINITION(DEBUG_QT, debug_qt) |
| r243232 | r243233 | |
|---|---|---|
| 44 | 44 | class debugger_windows : public osd_module, public debug_module |
| 45 | 45 | { |
| 46 | 46 | public: |
| 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 | } | |
| 52 | 52 | |
| 53 | ||
| 53 | virtual ~debugger_windows() { } | |
| 54 | 54 | |
| 55 | virtual int init() { return 0;} | |
| 56 | virtual void exit(); | |
| 55 | virtual int init() { return 0;} | |
| 56 | virtual void exit(); | |
| 57 | 57 | |
| 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(); | |
| 61 | 61 | |
| 62 | 62 | private: |
| 63 | ||
| 63 | running_machine *m_machine; | |
| 64 | 64 | }; |
| 65 | 65 | //============================================================ |
| 66 | 66 | // PARAMETERS |
| r243232 | r243233 | |
| 3094 | 3094 | smart_show_window(info->wnd, show); |
| 3095 | 3095 | } |
| 3096 | 3096 | #else /* not windows */ |
| 3097 | ||
| 3097 | MODULE_NOT_SUPPORTED(debugger_windows, OSD_DEBUG_PROVIDER, "windows") | |
| 3098 | 3098 | #endif |
| 3099 | 3099 | |
| 3100 | 3100 | MODULE_DEFINITION(DEBUG_WINDOWS, debugger_windows) |
| r243232 | r243233 | |
|---|---|---|
| 12 | 12 | class debug_none : public osd_module, public debug_module |
| 13 | 13 | { |
| 14 | 14 | public: |
| 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 | } | |
| 20 | 20 | |
| 21 | ||
| 21 | virtual ~debug_none() { } | |
| 22 | 22 | |
| 23 | virtual int init() { return 0;} | |
| 24 | virtual void exit() { } | |
| 23 | virtual int init() { return 0;} | |
| 24 | virtual void exit() { } | |
| 25 | 25 | |
| 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(); | |
| 29 | 29 | |
| 30 | 30 | private: |
| 31 | ||
| 31 | running_machine *m_machine; | |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | void debug_none::init_debugger(running_machine &machine) |
| 35 | 35 | { |
| 36 | ||
| 36 | m_machine = &machine; | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | void debug_none::wait_for_debugger(device_t &device, bool firststop) |
| r243232 | r243233 | |
|---|---|---|
| 18 | 18 | class font_module |
| 19 | 19 | { |
| 20 | 20 | public: |
| 21 | virtual ~font_module() { } | |
| 22 | virtual osd_font *font_alloc() = 0; | |
| 21 | virtual ~font_module() { } | |
| 22 | virtual osd_font *font_alloc() = 0; | |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 |
| r243232 | r243233 | |
|---|---|---|
| 14 | 14 | class osd_font_none : public osd_font |
| 15 | 15 | { |
| 16 | 16 | public: |
| 17 | ||
| 17 | virtual ~osd_font_none() {}; | |
| 18 | 18 | |
| 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); | |
| 22 | 22 | private: |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | bool osd_font_none::open(const char *font_path, const char *_name, int &height) |
| 26 | 26 | { |
| 27 | ||
| 27 | return false; | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | //------------------------------------------------- |
| r243232 | r243233 | |
| 46 | 46 | |
| 47 | 47 | bool osd_font_none::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 48 | 48 | { |
| 49 | ||
| 49 | return false; | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | class font_none : public osd_module, public font_module |
| 53 | 53 | { |
| 54 | 54 | public: |
| 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 | } | |
| 59 | 59 | |
| 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 | } | |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | 66 | MODULE_DEFINITION(FONT_NONE, font_none) |
| 67 |
| r243232 | r243233 | |
|---|---|---|
| 26 | 26 | class osd_font_osx : public osd_font |
| 27 | 27 | { |
| 28 | 28 | public: |
| 29 | ||
| 29 | virtual ~osd_font_osx() {}; | |
| 30 | 30 | |
| 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); | |
| 34 | 34 | private: |
| 35 | ||
| 35 | CTFontRef m_font; | |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | 38 | bool osd_font_osx::open(const char *font_path, const char *_name, int &height) |
| 39 | 39 | { |
| 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; | |
| 44 | 44 | |
| 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); | |
| 48 | 48 | #if 0 |
| 49 | if (name == "default") | |
| 50 | { | |
| 51 | name = "LucidaGrande"; | |
| 52 | } | |
| 49 | if (name == "default") | |
| 50 | { | |
| 51 | name = "LucidaGrande"; | |
| 52 | } | |
| 53 | 53 | #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; | |
| 58 | 58 | |
| 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 ); | |
| 63 | 63 | |
| 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 ); | |
| 67 | 67 | |
| 68 | CFRelease( font_descriptor ); | |
| 69 | } | |
| 70 | } | |
| 68 | CFRelease( font_descriptor ); | |
| 69 | } | |
| 70 | } | |
| 71 | 71 | |
| 72 | ||
| 72 | CFRelease( font_name ); | |
| 73 | 73 | |
| 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 | } | |
| 79 | 79 | |
| 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 ); | |
| 85 | 85 | |
| 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); | |
| 91 | 91 | |
| 92 | m_font = ct_font; | |
| 93 | return true; | |
| 92 | m_font = ct_font; | |
| 93 | return true; | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | //------------------------------------------------- |
| r243232 | r243233 | |
| 100 | 100 | |
| 101 | 101 | void osd_font_osx::close() |
| 102 | 102 | { |
| 103 | if( m_font != NULL ) | |
| 104 | { | |
| 105 | CFRelease( m_font ); | |
| 106 | } | |
| 103 | if( m_font != NULL ) | |
| 104 | { | |
| 105 | CFRelease( m_font ); | |
| 106 | } | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | //------------------------------------------------- |
| r243232 | r243233 | |
| 116 | 116 | |
| 117 | 117 | bool osd_font_osx::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 118 | 118 | { |
| 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; | |
| 125 | 125 | |
| 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 | } | |
| 140 | 140 | |
| 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; | |
| 145 | 145 | |
| 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; | |
| 148 | 148 | |
| 149 | ||
| 149 | bitmap_height = ceilf( (CTFontGetAscent(ct_font) + CTFontGetDescent(ct_font) + CTFontGetLeading(ct_font)) * EXTRA_HEIGHT); | |
| 150 | 150 | |
| 151 | xoffs = yoffs = 0; | |
| 152 | width = bitmap_width; | |
| 151 | xoffs = yoffs = 0; | |
| 152 | width = bitmap_width; | |
| 153 | 153 | |
| 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; | |
| 157 | 157 | |
| 158 | color_space = CGColorSpaceCreateDeviceRGB(); | |
| 159 | bits_per_component = 8; | |
| 158 | color_space = CGColorSpaceCreateDeviceRGB(); | |
| 159 | bits_per_component = 8; | |
| 160 | 160 | |
| 161 | ||
| 161 | bitmap.allocate(bitmap_width, bitmap_height); | |
| 162 | 162 | |
| 163 | ||
| 163 | context_ref = CGBitmapContextCreate( bitmap.raw_pixptr(0), bitmap_width, bitmap_height, bits_per_component, bitmap.rowpixels()*4, color_space, bitmap_info ); | |
| 164 | 164 | |
| 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 | } | |
| 177 | 177 | |
| 178 | CGColorSpaceRelease( color_space ); | |
| 179 | } | |
| 178 | CGColorSpaceRelease( color_space ); | |
| 179 | } | |
| 180 | 180 | |
| 181 | ||
| 181 | return bitmap.valid(); | |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | class font_osx : public osd_module, public font_module |
| 186 | 186 | { |
| 187 | 187 | public: |
| 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 | } | |
| 192 | 192 | |
| 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 | } | |
| 197 | 197 | |
| 198 | 198 | }; |
| 199 | 199 | #else /* SDLMAME_UNIX */ |
| 200 | ||
| 200 | MODULE_NOT_SUPPORTED(font_osx, OSD_FONT_PROVIDER, "osx") | |
| 201 | 201 | #endif |
| 202 | 202 | |
| 203 | 203 | MODULE_DEFINITION(FONT_OSX, font_osx) |
| r243232 | r243233 | |
|---|---|---|
| 32 | 32 | class osd_font_sdl : public osd_font |
| 33 | 33 | { |
| 34 | 34 | public: |
| 35 | ||
| 35 | virtual ~osd_font_sdl() {}; | |
| 36 | 36 | |
| 37 | virtual bool open(const char *font_path, const char *name, int &height); | |
| 38 | virtual void close(); | |
| 39 | virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); | |
| 37 | virtual bool open(const char *font_path, const char *name, int &height); | |
| 38 | virtual void close(); | |
| 39 | virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); | |
| 40 | 40 | private: |
| 41 | 41 | #ifndef SDLMAME_HAIKU |
| 42 | ||
| 42 | TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles); | |
| 43 | 43 | #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; | |
| 47 | 47 | }; |
| 48 | 48 | |
| 49 | 49 | bool osd_font_sdl::open(const char *font_path, const char *_name, int &height) |
| 50 | 50 | { |
| 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; | |
| 54 | 54 | |
| 55 | // accept qualifiers from the name | |
| 56 | astring name(_name); | |
| 55 | // accept qualifiers from the name | |
| 56 | astring name(_name); | |
| 57 | 57 | |
| 58 | if (name == "default") | |
| 59 | { | |
| 60 | name = "Liberation Sans"; | |
| 61 | } | |
| 58 | if (name == "default") | |
| 59 | { | |
| 60 | name = "Liberation Sans"; | |
| 61 | } | |
| 62 | 62 | |
| 63 | bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0); | |
| 64 | bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0); | |
| 65 | bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0); | |
| 66 | bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0); | |
| 63 | bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0); | |
| 64 | bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0); | |
| 65 | bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0); | |
| 66 | bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0); | |
| 67 | 67 | |
| 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); | |
| 70 | 70 | |
| 71 | ||
| 71 | // if no success, try the font path | |
| 72 | 72 | |
| 73 | if (!font) | |
| 74 | { | |
| 75 | osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH); | |
| 76 | //emu_file file(options().font_path(), OPEN_FLAG_READ); | |
| 77 | emu_file file(font_path, OPEN_FLAG_READ); | |
| 78 | if (file.open(name) == FILERR_NONE) | |
| 79 | { | |
| 80 | astring full_name = file.fullpath(); | |
| 81 | font = TTF_OpenFont_Magic(full_name, POINT_SIZE); | |
| 82 | if (font) | |
| 83 | osd_printf_verbose("Found font %s\n", full_name.cstr()); | |
| 84 | } | |
| 85 | } | |
| 73 | if (!font) | |
| 74 | { | |
| 75 | osd_printf_verbose("Searching font %s in -%s\n", name.cstr(), OPTION_FONTPATH); | |
| 76 | //emu_file file(options().font_path(), OPEN_FLAG_READ); | |
| 77 | emu_file file(font_path, OPEN_FLAG_READ); | |
| 78 | if (file.open(name) == FILERR_NONE) | |
| 79 | { | |
| 80 | astring full_name = file.fullpath(); | |
| 81 | font = TTF_OpenFont_Magic(full_name, POINT_SIZE); | |
| 82 | if (font) | |
| 83 | osd_printf_verbose("Found font %s\n", full_name.cstr()); | |
| 84 | } | |
| 85 | } | |
| 86 | 86 | |
| 87 | ||
| 87 | // if that didn't work, crank up the FontConfig database | |
| 88 | 88 | #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 | } | |
| 93 | 93 | #endif |
| 94 | 94 | |
| 95 | if (!font) | |
| 96 | { | |
| 97 | if (!BDF_Check_Magic(name)) | |
| 98 | { | |
| 99 | osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr()); | |
| 100 | } | |
| 101 | return NULL; | |
| 102 | } | |
| 95 | if (!font) | |
| 96 | { | |
| 97 | if (!BDF_Check_Magic(name)) | |
| 98 | { | |
| 99 | osd_printf_verbose("font %s is not TrueType or BDF, using MAME default\n", name.cstr()); | |
| 100 | } | |
| 101 | return NULL; | |
| 102 | } | |
| 103 | 103 | |
| 104 | // apply styles | |
| 105 | if (!bakedstyles) | |
| 106 | { | |
| 107 | style |= bold ? TTF_STYLE_BOLD : 0; | |
| 108 | style |= italic ? TTF_STYLE_ITALIC : 0; | |
| 109 | } | |
| 110 | style |= underline ? TTF_STYLE_UNDERLINE : 0; | |
| 111 | // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH | |
| 104 | // apply styles | |
| 105 | if (!bakedstyles) | |
| 106 | { | |
| 107 | style |= bold ? TTF_STYLE_BOLD : 0; | |
| 108 | style |= italic ? TTF_STYLE_ITALIC : 0; | |
| 109 | } | |
| 110 | style |= underline ? TTF_STYLE_UNDERLINE : 0; | |
| 111 | // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH | |
| 112 | 112 | #if SDL_VERSIONNUM(TTF_MAJOR_VERSION, TTF_MINOR_VERSION, TTF_PATCHLEVEL) > SDL_VERSIONNUM(2,0,9) |
| 113 | ||
| 113 | style |= strike ? TTF_STYLE_STRIKETHROUGH : 0; | |
| 114 | 114 | #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"); | |
| 117 | 117 | #endif // PATCHLEVEL |
| 118 | ||
| 118 | TTF_SetFontStyle(font, style); | |
| 119 | 119 | |
| 120 | ||
| 120 | height = TTF_FontLineSkip(font); | |
| 121 | 121 | |
| 122 | m_font = font; | |
| 123 | return true; | |
| 122 | m_font = font; | |
| 123 | return true; | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | //------------------------------------------------- |
| r243232 | r243233 | |
| 130 | 130 | |
| 131 | 131 | void osd_font_sdl::close() |
| 132 | 132 | { |
| 133 | ||
| 133 | TTF_CloseFont(this->m_font); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | //------------------------------------------------- |
| r243232 | r243233 | |
| 143 | 143 | |
| 144 | 144 | bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 145 | 145 | { |
| 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]; | |
| 150 | 150 | |
| 151 | ||
| 151 | ttffont = m_font; | |
| 152 | 152 | |
| 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); | |
| 156 | 156 | |
| 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); | |
| 162 | 162 | |
| 163 | // copy the rendered character image into it | |
| 164 | for (int y = 0; y < bitmap.height(); y++) | |
| 165 | { | |
| 166 | UINT32 *dstrow = &bitmap.pix32(y); | |
| 167 | UINT8 *srcrow = (UINT8 *)drawsurf->pixels; | |
| 163 | // copy the rendered character image into it | |
| 164 | for (int y = 0; y < bitmap.height(); y++) | |
| 165 | { | |
| 166 | UINT32 *dstrow = &bitmap.pix32(y); | |
| 167 | UINT8 *srcrow = (UINT8 *)drawsurf->pixels; | |
| 168 | 168 | |
| 169 | ||
| 169 | srcrow += (y * drawsurf->pitch); | |
| 170 | 170 | |
| 171 | for (int x = 0; x < drawsurf->w; x++) | |
| 172 | { | |
| 173 | dstrow[x] = srcrow[x] ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); | |
| 174 | } | |
| 175 | } | |
| 171 | for (int x = 0; x < drawsurf->w; x++) | |
| 172 | { | |
| 173 | dstrow[x] = srcrow[x] ? rgb_t(0xff,0xff,0xff,0xff) : rgb_t(0x00,0xff,0xff,0xff); | |
| 174 | } | |
| 175 | } | |
| 176 | 176 | |
| 177 | // what are these? | |
| 178 | xoffs = yoffs = 0; | |
| 179 | width = drawsurf->w; | |
| 177 | // what are these? | |
| 178 | xoffs = yoffs = 0; | |
| 179 | width = drawsurf->w; | |
| 180 | 180 | |
| 181 | SDL_FreeSurface(drawsurf); | |
| 182 | } | |
| 181 | SDL_FreeSurface(drawsurf); | |
| 182 | } | |
| 183 | 183 | |
| 184 | ||
| 184 | return bitmap.valid(); | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize) |
| 188 | 188 | { |
| 189 | emu_file file(OPEN_FLAG_READ); | |
| 190 | if (file.open(name) == FILERR_NONE) | |
| 191 | { | |
| 192 | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; | |
| 193 | unsigned char magic[5] = { 0x00, 0x01, 0x00, 0x00, 0x00 }; | |
| 194 | file.read(buffer,5); | |
| 195 | if (memcmp(buffer, magic, 5)) | |
| 196 | return NULL; | |
| 197 | } | |
| 198 | return TTF_OpenFont(name.cstr(), POINT_SIZE); | |
| 189 | emu_file file(OPEN_FLAG_READ); | |
| 190 | if (file.open(name) == FILERR_NONE) | |
| 191 | { | |
| 192 | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; | |
| 193 | unsigned char magic[5] = { 0x00, 0x01, 0x00, 0x00, 0x00 }; | |
| 194 | file.read(buffer,5); | |
| 195 | if (memcmp(buffer, magic, 5)) | |
| 196 | return NULL; | |
| 197 | } | |
| 198 | return TTF_OpenFont(name.cstr(), POINT_SIZE); | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | bool osd_font_sdl::BDF_Check_Magic(astring name) |
| 202 | 202 | { |
| 203 | emu_file file(OPEN_FLAG_READ); | |
| 204 | if (file.open(name) == FILERR_NONE) | |
| 205 | { | |
| 206 | unsigned char buffer[9]; | |
| 207 | unsigned char magic[9] = { 'S', 'T', 'A', 'R', 'T', 'F', 'O', 'N', 'T' }; | |
| 208 | file.read(buffer, 9); | |
| 209 | file.close(); | |
| 210 | if (!memcmp(buffer, magic, 9)) | |
| 211 | return true; | |
| 212 | } | |
| 203 | emu_file file(OPEN_FLAG_READ); | |
| 204 | if (file.open(name) == FILERR_NONE) | |
| 205 | { | |
| 206 | unsigned char buffer[9]; | |
| 207 | unsigned char magic[9] = { 'S', 'T', 'A', 'R', 'T', 'F', 'O', 'N', 'T' }; | |
| 208 | file.read(buffer, 9); | |
| 209 | file.close(); | |
| 210 | if (!memcmp(buffer, magic, 9)) | |
| 211 | return true; | |
| 212 | } | |
| 213 | 213 | |
| 214 | ||
| 214 | return false; | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | #ifndef SDLMAME_HAIKU |
| 218 | 218 | TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles) |
| 219 | 219 | { |
| 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; | |
| 226 | 226 | |
| 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()); | |
| 231 | 231 | |
| 232 | // try and get a font with the requested styles baked-in | |
| 233 | if (bold) | |
| 234 | { | |
| 235 | if (italic) | |
| 236 | { | |
| 237 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold Italic"); | |
| 238 | } | |
| 239 | else | |
| 240 | { | |
| 241 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold"); | |
| 242 | } | |
| 243 | } | |
| 244 | else if (italic) | |
| 245 | { | |
| 246 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Italic"); | |
| 247 | } | |
| 248 | else | |
| 249 | { | |
| 250 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); | |
| 251 | } | |
| 232 | // try and get a font with the requested styles baked-in | |
| 233 | if (bold) | |
| 234 | { | |
| 235 | if (italic) | |
| 236 | { | |
| 237 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold Italic"); | |
| 238 | } | |
| 239 | else | |
| 240 | { | |
| 241 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Bold"); | |
| 242 | } | |
| 243 | } | |
| 244 | else if (italic) | |
| 245 | { | |
| 246 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Italic"); | |
| 247 | } | |
| 248 | else | |
| 249 | { | |
| 250 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); | |
| 251 | } | |
| 252 | 252 | |
| 253 | ||
| 253 | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); | |
| 254 | 254 | |
| 255 | FcObjectSetAdd(os, FC_FILE); | |
| 256 | fontset = FcFontList(config, pat, os); | |
| 255 | FcObjectSetAdd(os, FC_FILE); | |
| 256 | fontset = FcFontList(config, pat, os); | |
| 257 | 257 | |
| 258 | for (int i = 0; i < fontset->nfont; i++) | |
| 259 | { | |
| 260 | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) | |
| 261 | { | |
| 262 | continue; | |
| 263 | } | |
| 258 | for (int i = 0; i < fontset->nfont; i++) | |
| 259 | { | |
| 260 | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) | |
| 261 | { | |
| 262 | continue; | |
| 263 | } | |
| 264 | 264 | |
| 265 | if (val.type != FcTypeString) | |
| 266 | { | |
| 267 | continue; | |
| 268 | } | |
| 265 | if (val.type != FcTypeString) | |
| 266 | { | |
| 267 | continue; | |
| 268 | } | |
| 269 | 269 | |
| 270 | osd_printf_verbose("Matching font: %s\n", val.u.s); | |
| 271 | { | |
| 272 | astring match_name((const char*)val.u.s); | |
| 273 | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); | |
| 274 | } | |
| 270 | osd_printf_verbose("Matching font: %s\n", val.u.s); | |
| 271 | { | |
| 272 | astring match_name((const char*)val.u.s); | |
| 273 | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); | |
| 274 | } | |
| 275 | 275 | |
| 276 | if (font) | |
| 277 | { | |
| 278 | bakedstyles = true; | |
| 279 | break; | |
| 280 | } | |
| 281 | } | |
| 276 | if (font) | |
| 277 | { | |
| 278 | bakedstyles = true; | |
| 279 | break; | |
| 280 | } | |
| 281 | } | |
| 282 | 282 | |
| 283 | // didn't get a font above? try again with no baked-in styles | |
| 284 | if (!font) | |
| 285 | { | |
| 286 | FcPatternDestroy(pat); | |
| 287 | FcFontSetDestroy(fontset); | |
| 283 | // didn't get a font above? try again with no baked-in styles | |
| 284 | if (!font) | |
| 285 | { | |
| 286 | FcPatternDestroy(pat); | |
| 287 | FcFontSetDestroy(fontset); | |
| 288 | 288 | |
| 289 | pat = FcPatternCreate(); | |
| 290 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); | |
| 291 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); | |
| 292 | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); | |
| 293 | fontset = FcFontList(config, pat, os); | |
| 289 | pat = FcPatternCreate(); | |
| 290 | FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *)name.cstr()); | |
| 291 | FcPatternAddString(pat, FC_STYLE, (const FcChar8 *)"Regular"); | |
| 292 | FcPatternAddString(pat, FC_FONTFORMAT, (const FcChar8 *)"TrueType"); | |
| 293 | fontset = FcFontList(config, pat, os); | |
| 294 | 294 | |
| 295 | for (int i = 0; i < fontset->nfont; i++) | |
| 296 | { | |
| 297 | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) | |
| 298 | { | |
| 299 | continue; | |
| 300 | } | |
| 295 | for (int i = 0; i < fontset->nfont; i++) | |
| 296 | { | |
| 297 | if (FcPatternGet(fontset->fonts[i], FC_FILE, 0, &val) != FcResultMatch) | |
| 298 | { | |
| 299 | continue; | |
| 300 | } | |
| 301 | 301 | |
| 302 | if (val.type != FcTypeString) | |
| 303 | { | |
| 304 | continue; | |
| 305 | } | |
| 302 | if (val.type != FcTypeString) | |
| 303 | { | |
| 304 | continue; | |
| 305 | } | |
| 306 | 306 | |
| 307 | osd_printf_verbose("Matching unstyled font: %s\n", val.u.s); | |
| 308 | { | |
| 309 | astring match_name((const char*)val.u.s); | |
| 310 | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); | |
| 311 | } | |
| 307 | osd_printf_verbose("Matching unstyled font: %s\n", val.u.s); | |
| 308 | { | |
| 309 | astring match_name((const char*)val.u.s); | |
| 310 | font = TTF_OpenFont_Magic(match_name, POINT_SIZE); | |
| 311 | } | |
| 312 | 312 | |
| 313 | if (font) | |
| 314 | { | |
| 315 | break; | |
| 316 | } | |
| 317 | } | |
| 318 | } | |
| 313 | if (font) | |
| 314 | { | |
| 315 | break; | |
| 316 | } | |
| 317 | } | |
| 318 | } | |
| 319 | 319 | |
| 320 | FcPatternDestroy(pat); | |
| 321 | FcObjectSetDestroy(os); | |
| 322 | FcFontSetDestroy(fontset); | |
| 323 | return font; | |
| 320 | FcPatternDestroy(pat); | |
| 321 | FcObjectSetDestroy(os); | |
| 322 | FcFontSetDestroy(fontset); | |
| 323 | return font; | |
| 324 | 324 | } |
| 325 | 325 | #endif |
| 326 | 326 | |
| r243232 | r243233 | |
| 328 | 328 | class font_sdl : public osd_module, public font_module |
| 329 | 329 | { |
| 330 | 330 | public: |
| 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 | } | |
| 335 | 335 | |
| 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 | } | |
| 340 | 340 | |
| 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 | } | |
| 350 | 350 | |
| 351 | virtual void exit() | |
| 352 | { | |
| 353 | TTF_Quit(); | |
| 354 | } | |
| 351 | virtual void exit() | |
| 352 | { | |
| 353 | TTF_Quit(); | |
| 354 | } | |
| 355 | 355 | }; |
| 356 | 356 | #else /* SDLMAME_UNIX */ |
| 357 | ||
| 357 | MODULE_NOT_SUPPORTED(font_sdl, OSD_FONT_PROVIDER, "sdl") | |
| 358 | 358 | #endif |
| 359 | 359 | |
| 360 | 360 | MODULE_DEFINITION(FONT_SDL, font_sdl) |
| 361 | ||
| 362 |
| r243232 | r243233 | |
|---|---|---|
| 34 | 34 | class osd_font_windows : public osd_font |
| 35 | 35 | { |
| 36 | 36 | public: |
| 37 | ||
| 37 | virtual ~osd_font_windows() {}; | |
| 38 | 38 | |
| 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); | |
| 42 | 42 | private: |
| 43 | ||
| 43 | HGDIOBJ m_font; | |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | 46 | bool osd_font_windows::open(const char *font_path, const char *_name, int &height) |
| 47 | 47 | { |
| 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); | |
| 53 | 53 | |
| 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; | |
| 69 | 69 | |
| 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); | |
| 75 | 75 | |
| 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; | |
| 81 | 81 | |
| 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); | |
| 89 | 89 | |
| 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); | |
| 94 | 94 | |
| 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; | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | //------------------------------------------------- |
| r243232 | r243233 | |
| 109 | 109 | |
| 110 | 110 | void osd_font_windows::close() |
| 111 | 111 | { |
| 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); | |
| 115 | 115 | |
| 116 | 116 | } |
| 117 | 117 | |
| r243232 | r243233 | |
| 125 | 125 | |
| 126 | 126 | bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 127 | 127 | { |
| 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); | |
| 131 | 131 | |
| 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); | |
| 135 | 135 | |
| 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; | |
| 145 | 145 | |
| 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; | |
| 149 | 149 | |
| 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; | |
| 168 | 168 | |
| 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); | |
| 173 | 173 | |
| 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); | |
| 177 | 177 | |
| 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); | |
| 183 | 183 | |
| 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; | |
| 188 | 188 | |
| 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 | } | |
| 209 | 209 | |
| 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 | } | |
| 230 | 230 | |
| 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); | |
| 235 | 235 | |
| 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 | } | |
| 247 | 247 | |
| 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 | } | |
| 252 | 252 | |
| 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(); | |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | class font_win : public osd_module, public font_module |
| 262 | 262 | { |
| 263 | 263 | public: |
| 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 | } | |
| 268 | 268 | |
| 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 | } | |
| 273 | 273 | |
| 274 | 274 | }; |
| 275 | 275 | #else /* SDLMAME_UNIX */ |
| 276 | ||
| 276 | MODULE_NOT_SUPPORTED(font_win, OSD_FONT_PROVIDER, "win") | |
| 277 | 277 | #endif |
| 278 | 278 | |
| 279 | 279 | MODULE_DEFINITION(FONT_WINDOWS, font_win) |
| r243232 | r243233 | |
|---|---|---|
| 34 | 34 | |
| 35 | 35 | const char *osd_getenv(const char *name) |
| 36 | 36 | { |
| 37 | ||
| 37 | return getenv(name); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | //============================================================ |
| r243232 | r243233 | |
| 43 | 43 | |
| 44 | 44 | int osd_setenv(const char *name, const char *value, int overwrite) |
| 45 | 45 | { |
| 46 | ||
| 46 | return setenv(name, value, overwrite); | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | //============================================================ |
| r243232 | r243233 | |
| 52 | 52 | |
| 53 | 53 | void osd_process_kill(void) |
| 54 | 54 | { |
| 55 | ||
| 55 | kill(getpid(), SIGKILL); | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | //============================================================ |
| r243232 | r243233 | |
| 61 | 61 | |
| 62 | 62 | int osd_get_num_processors(void) |
| 63 | 63 | { |
| 64 | ||
| 64 | int processors = 1; | |
| 65 | 65 | |
| 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; | |
| 70 | 70 | |
| 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); | |
| 78 | 78 | |
| 79 | ||
| 79 | return processors; | |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | //============================================================ |
| r243232 | r243233 | |
| 86 | 86 | void *osd_malloc(size_t size) |
| 87 | 87 | { |
| 88 | 88 | #ifndef MALLOC_DEBUG |
| 89 | ||
| 89 | return malloc(size); | |
| 90 | 90 | #else |
| 91 | 91 | #error "MALLOC_DEBUG not yet supported" |
| 92 | 92 | #endif |
| r243232 | r243233 | |
| 100 | 100 | void *osd_malloc_array(size_t size) |
| 101 | 101 | { |
| 102 | 102 | #ifndef MALLOC_DEBUG |
| 103 | ||
| 103 | return malloc(size); | |
| 104 | 104 | #else |
| 105 | 105 | #error "MALLOC_DEBUG not yet supported" |
| 106 | 106 | #endif |
| r243232 | r243233 | |
| 114 | 114 | void osd_free(void *ptr) |
| 115 | 115 | { |
| 116 | 116 | #ifndef MALLOC_DEBUG |
| 117 | ||
| 117 | free(ptr); | |
| 118 | 118 | #else |
| 119 | 119 | #error "MALLOC_DEBUG not yet supported" |
| 120 | 120 | #endif |
| r243232 | r243233 | |
| 131 | 131 | void *osd_alloc_executable(size_t size) |
| 132 | 132 | { |
| 133 | 133 | #if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX) |
| 134 | ||
| 134 | return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); | |
| 135 | 135 | #elif defined(SDLMAME_UNIX) |
| 136 | ||
| 136 | return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0); | |
| 137 | 137 | #endif |
| 138 | 138 | } |
| 139 | 139 | |
| r243232 | r243233 | |
| 146 | 146 | void osd_free_executable(void *ptr, size_t size) |
| 147 | 147 | { |
| 148 | 148 | #ifdef SDLMAME_SOLARIS |
| 149 | ||
| 149 | munmap((char *)ptr, size); | |
| 150 | 150 | #else |
| 151 | ||
| 151 | munmap(ptr, size); | |
| 152 | 152 | #endif |
| 153 | 153 | } |
| 154 | 154 | |
| r243232 | r243233 | |
| 158 | 158 | |
| 159 | 159 | void osd_break_into_debugger(const char *message) |
| 160 | 160 | { |
| 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 | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | |
| r243232 | r243233 | |
| 191 | 191 | |
| 192 | 192 | static osd_ticks_t init_cycle_counter(void) |
| 193 | 193 | { |
| 194 | osd_ticks_t start, end; | |
| 195 | osd_ticks_t a, b; | |
| 194 | osd_ticks_t start, end; | |
| 195 | osd_ticks_t a, b; | |
| 196 | 196 | |
| 197 | cycle_counter = mach_cycle_counter; | |
| 198 | ticks_counter = mach_cycle_counter; | |
| 197 | cycle_counter = mach_cycle_counter; | |
| 198 | ticks_counter = mach_cycle_counter; | |
| 199 | 199 | |
| 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); | |
| 206 | 206 | |
| 207 | // get the starting cycle count | |
| 208 | start = (*cycle_counter)(); | |
| 207 | // get the starting cycle count | |
| 208 | start = (*cycle_counter)(); | |
| 209 | 209 | |
| 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); | |
| 215 | 215 | |
| 216 | // get the ending cycle count | |
| 217 | end = (*cycle_counter)(); | |
| 216 | // get the ending cycle count | |
| 217 | end = (*cycle_counter)(); | |
| 218 | 218 | |
| 219 | // compute ticks_per_sec | |
| 220 | ticks_per_second = (end - start) * 4; | |
| 219 | // compute ticks_per_sec | |
| 220 | ticks_per_second = (end - start) * 4; | |
| 221 | 221 | |
| 222 | // return the current cycle count | |
| 223 | return (*cycle_counter)(); | |
| 222 | // return the current cycle count | |
| 223 | return (*cycle_counter)(); | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | //============================================================ |
| r243232 | r243233 | |
| 232 | 232 | //============================================================ |
| 233 | 233 | static osd_ticks_t mach_cycle_counter(void) |
| 234 | 234 | { |
| 235 | ||
| 235 | return mach_absolute_time(); | |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | //============================================================ |
| r243232 | r243233 | |
| 241 | 241 | |
| 242 | 242 | osd_ticks_t osd_ticks(void) |
| 243 | 243 | { |
| 244 | ||
| 244 | return (*cycle_counter)(); | |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
| r243232 | r243233 | |
| 251 | 251 | |
| 252 | 252 | osd_ticks_t osd_ticks_per_second(void) |
| 253 | 253 | { |
| 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; | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
| r243232 | r243233 | |
| 267 | 267 | |
| 268 | 268 | void osd_sleep(osd_ticks_t duration) |
| 269 | 269 | { |
| 270 | ||
| 270 | UINT32 msec; | |
| 271 | 271 | |
| 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(); | |
| 275 | 275 | |
| 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); | |
| 278 | 278 | |
| 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 | } | |
| 286 | 286 | } |
| r243232 | r243233 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | const char *osd_getenv(const char *name) |
| 33 | 33 | { |
| 34 | ||
| 34 | return getenv(name); | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | //============================================================ |
| r243232 | r243233 | |
| 40 | 40 | |
| 41 | 41 | int osd_setenv(const char *name, const char *value, int overwrite) |
| 42 | 42 | { |
| 43 | ||
| 43 | return setenv(name, value, overwrite); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | //============================================================ |
| r243232 | r243233 | |
| 49 | 49 | |
| 50 | 50 | void osd_process_kill(void) |
| 51 | 51 | { |
| 52 | ||
| 52 | fprintf(stderr,"osd_process_kill missing in OS/2 build\n"); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //============================================================ |
| r243232 | r243233 | |
| 58 | 58 | |
| 59 | 59 | int osd_get_num_processors(void) |
| 60 | 60 | { |
| 61 | ||
| 61 | ULONG numprocs = 1; | |
| 62 | 62 | |
| 63 | ||
| 63 | DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &numprocs, sizeof(numprocs)); | |
| 64 | 64 | |
| 65 | ||
| 65 | return numprocs; | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | //============================================================ |
| r243232 | r243233 | |
| 72 | 72 | void *osd_malloc(size_t size) |
| 73 | 73 | { |
| 74 | 74 | #ifndef MALLOC_DEBUG |
| 75 | ||
| 75 | return malloc(size); | |
| 76 | 76 | #else |
| 77 | 77 | #error "MALLOC_DEBUG not yet supported" |
| 78 | 78 | #endif |
| r243232 | r243233 | |
| 86 | 86 | void *osd_malloc_array(size_t size) |
| 87 | 87 | { |
| 88 | 88 | #ifndef MALLOC_DEBUG |
| 89 | ||
| 89 | return malloc(size); | |
| 90 | 90 | #else |
| 91 | 91 | #error "MALLOC_DEBUG not yet supported" |
| 92 | 92 | #endif |
| r243232 | r243233 | |
| 100 | 100 | void osd_free(void *ptr) |
| 101 | 101 | { |
| 102 | 102 | #ifndef MALLOC_DEBUG |
| 103 | ||
| 103 | free(ptr); | |
| 104 | 104 | #else |
| 105 | 105 | #error "MALLOC_DEBUG not yet supported" |
| 106 | 106 | #endif |
| r243232 | r243233 | |
| 116 | 116 | |
| 117 | 117 | void *osd_alloc_executable(size_t size) |
| 118 | 118 | { |
| 119 | ||
| 119 | void *p; | |
| 120 | 120 | |
| 121 | DosAllocMem( &p, size, fALLOC ); | |
| 122 | return p; | |
| 121 | DosAllocMem( &p, size, fALLOC ); | |
| 122 | return p; | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | //============================================================ |
| r243232 | r243233 | |
| 130 | 130 | |
| 131 | 131 | void osd_free_executable(void *ptr, size_t size) |
| 132 | 132 | { |
| 133 | ||
| 133 | DosFreeMem( ptr ); | |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | //============================================================ |
| r243232 | r243233 | |
| 139 | 139 | |
| 140 | 140 | void osd_break_into_debugger(const char *message) |
| 141 | 141 | { |
| 142 | ||
| 142 | printf("Ignoring MAME exception: %s\n", message); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | //============================================================ |
| r243232 | r243233 | |
| 167 | 167 | |
| 168 | 168 | static osd_ticks_t init_cycle_counter(void) |
| 169 | 169 | { |
| 170 | osd_ticks_t start, end; | |
| 171 | osd_ticks_t a, b; | |
| 170 | osd_ticks_t start, end; | |
| 171 | osd_ticks_t a, b; | |
| 172 | 172 | |
| 173 | ULONG frequency; | |
| 174 | PTIB ptib; | |
| 175 | ULONG ulClass; | |
| 176 | ULONG ulDelta; | |
| 173 | ULONG frequency; | |
| 174 | PTIB ptib; | |
| 175 | ULONG ulClass; | |
| 176 | ULONG ulDelta; | |
| 177 | 177 | |
| 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 ); | |
| 181 | 181 | |
| 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; | |
| 187 | 187 | |
| 188 | ||
| 188 | ticks_per_second = frequency; | |
| 189 | 189 | |
| 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 | } | |
| 198 | 198 | |
| 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 ); | |
| 201 | 201 | |
| 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); | |
| 208 | 208 | |
| 209 | // get the starting cycle count | |
| 210 | start = (*cycle_counter)(); | |
| 209 | // get the starting cycle count | |
| 210 | start = (*cycle_counter)(); | |
| 211 | 211 | |
| 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); | |
| 217 | 217 | |
| 218 | // get the ending cycle count | |
| 219 | end = (*cycle_counter)(); | |
| 218 | // get the ending cycle count | |
| 219 | end = (*cycle_counter)(); | |
| 220 | 220 | |
| 221 | // compute ticks_per_sec | |
| 222 | ticks_per_second = (end - start) * 4; | |
| 221 | // compute ticks_per_sec | |
| 222 | ticks_per_second = (end - start) * 4; | |
| 223 | 223 | |
| 224 | // restore our priority | |
| 225 | DosSetPriority( PRTYS_THREAD, ulClass, ulDelta, 0 ); | |
| 224 | // restore our priority | |
| 225 | DosSetPriority( PRTYS_THREAD, ulClass, ulDelta, 0 ); | |
| 226 | 226 | |
| 227 | // return the current cycle count | |
| 228 | return (*cycle_counter)(); | |
| 227 | // return the current cycle count | |
| 228 | return (*cycle_counter)(); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | //============================================================ |
| r243232 | r243233 | |
| 234 | 234 | |
| 235 | 235 | static osd_ticks_t performance_cycle_counter(void) |
| 236 | 236 | { |
| 237 | ||
| 237 | QWORD qwTime; | |
| 238 | 238 | |
| 239 | DosTmrQueryTime( &qwTime ); | |
| 240 | return (osd_ticks_t)qwTime.ulLo; | |
| 239 | DosTmrQueryTime( &qwTime ); | |
| 240 | return (osd_ticks_t)qwTime.ulLo; | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | //============================================================ |
| r243232 | r243233 | |
| 246 | 246 | |
| 247 | 247 | osd_ticks_t osd_ticks(void) |
| 248 | 248 | { |
| 249 | ||
| 249 | return (*cycle_counter)(); | |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
| r243232 | r243233 | |
| 256 | 256 | |
| 257 | 257 | osd_ticks_t osd_ticks_per_second(void) |
| 258 | 258 | { |
| 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; | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | |
| r243232 | r243233 | |
| 271 | 271 | |
| 272 | 272 | void osd_sleep(osd_ticks_t duration) |
| 273 | 273 | { |
| 274 | ||
| 274 | UINT32 msec; | |
| 275 | 275 | |
| 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(); | |
| 279 | 279 | |
| 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); | |
| 282 | 282 | |
| 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 | } | |
| 290 | 290 | } |
| 291 |
| r243232 | r243233 | |
|---|---|---|
| 30 | 30 | |
| 31 | 31 | const char *osd_getenv(const char *name) |
| 32 | 32 | { |
| 33 | ||
| 33 | return getenv(name); | |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | //============================================================ |
| r243232 | r243233 | |
| 39 | 39 | |
| 40 | 40 | int osd_setenv(const char *name, const char *value, int overwrite) |
| 41 | 41 | { |
| 42 | ||
| 42 | return setenv(name, value, overwrite); | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | //============================================================ |
| r243232 | r243233 | |
| 48 | 48 | |
| 49 | 49 | void osd_process_kill(void) |
| 50 | 50 | { |
| 51 | ||
| 51 | kill(getpid(), SIGKILL); | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | //============================================================ |
| r243232 | r243233 | |
| 57 | 57 | |
| 58 | 58 | int osd_get_num_processors(void) |
| 59 | 59 | { |
| 60 | ||
| 60 | int processors = 1; | |
| 61 | 61 | |
| 62 | 62 | #if defined(_SC_NPROCESSORS_ONLN) |
| 63 | ||
| 63 | processors = sysconf(_SC_NPROCESSORS_ONLN); | |
| 64 | 64 | #endif |
| 65 | ||
| 65 | return processors; | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | //============================================================ |
| r243232 | r243233 | |
| 72 | 72 | void *osd_malloc(size_t size) |
| 73 | 73 | { |
| 74 | 74 | #ifndef MALLOC_DEBUG |
| 75 | ||
| 75 | return malloc(size); | |
| 76 | 76 | #else |
| 77 | 77 | #error "MALLOC_DEBUG not yet supported" |
| 78 | 78 | #endif |
| r243232 | r243233 | |
| 86 | 86 | void *osd_malloc_array(size_t size) |
| 87 | 87 | { |
| 88 | 88 | #ifndef MALLOC_DEBUG |
| 89 | ||
| 89 | return malloc(size); | |
| 90 | 90 | #else |
| 91 | 91 | #error "MALLOC_DEBUG not yet supported" |
| 92 | 92 | #endif |
| r243232 | r243233 | |
| 100 | 100 | void osd_free(void *ptr) |
| 101 | 101 | { |
| 102 | 102 | #ifndef MALLOC_DEBUG |
| 103 | ||
| 103 | free(ptr); | |
| 104 | 104 | #else |
| 105 | 105 | #error "MALLOC_DEBUG not yet supported" |
| 106 | 106 | #endif |
| r243232 | r243233 | |
| 116 | 116 | void *osd_alloc_executable(size_t size) |
| 117 | 117 | { |
| 118 | 118 | #if defined(SDLMAME_BSD) || defined(SDLMAME_MACOSX) |
| 119 | ||
| 119 | return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); | |
| 120 | 120 | #elif defined(SDLMAME_UNIX) |
| 121 | ||
| 121 | return (void *)mmap(0, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, 0, 0); | |
| 122 | 122 | #endif |
| 123 | 123 | } |
| 124 | 124 | |
| r243232 | r243233 | |
| 131 | 131 | void osd_free_executable(void *ptr, size_t size) |
| 132 | 132 | { |
| 133 | 133 | #ifdef SDLMAME_SOLARIS |
| 134 | ||
| 134 | munmap((char *)ptr, size); | |
| 135 | 135 | #else |
| 136 | ||
| 136 | munmap(ptr, size); | |
| 137 | 137 | #endif |
| 138 | 138 | } |
| 139 | 139 | |
| r243232 | r243233 | |
| 143 | 143 | |
| 144 | 144 | void osd_break_into_debugger(const char *message) |
| 145 | 145 | { |
| 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 | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| r243232 | r243233 | |
| 160 | 160 | osd_ticks_t osd_ticks(void) |
| 161 | 161 | { |
| 162 | 162 | #ifdef SDLMAME_EMSCRIPTEN |
| 163 | ||
| 163 | return (osd_ticks_t)(emscripten_get_now() * 1000.0); | |
| 164 | 164 | #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; | |
| 167 | 167 | |
| 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; | |
| 172 | 172 | #endif |
| 173 | 173 | } |
| 174 | 174 | |
| r243232 | r243233 | |
| 179 | 179 | |
| 180 | 180 | osd_ticks_t osd_ticks_per_second(void) |
| 181 | 181 | { |
| 182 | ||
| 182 | return (osd_ticks_t) 1000000; | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | //============================================================ |
| r243232 | r243233 | |
| 188 | 188 | |
| 189 | 189 | void osd_sleep(osd_ticks_t duration) |
| 190 | 190 | { |
| 191 | ||
| 191 | UINT32 msec; | |
| 192 | 192 | |
| 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()); | |
| 195 | 195 | |
| 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 | } | |
| 203 | 203 | } |
| r243232 | r243233 | |
|---|---|---|
| 53 | 53 | |
| 54 | 54 | const char *osd_getenv(const char *name) |
| 55 | 55 | { |
| 56 | ||
| 56 | return getenv(name); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
| r243232 | r243233 | |
| 63 | 63 | |
| 64 | 64 | int osd_setenv(const char *name, const char *value, int overwrite) |
| 65 | 65 | { |
| 66 | char *buf; | |
| 67 | int result; | |
| 66 | char *buf; | |
| 67 | int result; | |
| 68 | 68 | |
| 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); | |
| 77 | 77 | |
| 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 | */ | |
| 81 | 81 | |
| 82 | ||
| 82 | return result; | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | //============================================================ |
| r243232 | r243233 | |
| 88 | 88 | |
| 89 | 89 | void osd_process_kill(void) |
| 90 | 90 | { |
| 91 | ||
| 91 | TerminateProcess(GetCurrentProcess(), -1); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | //============================================================ |
| r243232 | r243233 | |
| 97 | 97 | |
| 98 | 98 | int osd_get_num_processors(void) |
| 99 | 99 | { |
| 100 | ||
| 100 | SYSTEM_INFO info; | |
| 101 | 101 | |
| 102 | // otherwise, fetch the info from the system | |
| 103 | GetSystemInfo(&info); | |
| 102 | // otherwise, fetch the info from the system | |
| 103 | GetSystemInfo(&info); | |
| 104 | 104 | |
| 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); | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | //============================================================ |
| r243232 | r243233 | |
| 113 | 113 | void *osd_malloc(size_t size) |
| 114 | 114 | { |
| 115 | 115 | #ifndef MALLOC_DEBUG |
| 116 | ||
| 116 | return HeapAlloc(GetProcessHeap(), 0, size); | |
| 117 | 117 | #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); | |
| 120 | 120 | |
| 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); | |
| 123 | 123 | |
| 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); | |
| 127 | 127 | #endif |
| 128 | 128 | } |
| 129 | 129 | |
| r243232 | r243233 | |
| 135 | 135 | void *osd_malloc_array(size_t size) |
| 136 | 136 | { |
| 137 | 137 | #ifndef MALLOC_DEBUG |
| 138 | ||
| 138 | return HeapAlloc(GetProcessHeap(), 0, size); | |
| 139 | 139 | #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); | |
| 142 | 142 | |
| 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; | |
| 145 | 145 | |
| 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; | |
| 150 | 150 | |
| 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; | |
| 155 | 155 | |
| 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); | |
| 158 | 158 | |
| 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); | |
| 162 | 162 | #endif |
| 163 | 163 | } |
| 164 | 164 | |
| r243232 | r243233 | |
| 170 | 170 | void osd_free(void *ptr) |
| 171 | 171 | { |
| 172 | 172 | #ifndef MALLOC_DEBUG |
| 173 | ||
| 173 | HeapFree(GetProcessHeap(), 0, ptr); | |
| 174 | 174 | #else |
| 175 | ||
| 175 | size_t size = reinterpret_cast<size_t *>(ptr)[-1]; | |
| 176 | 176 | |
| 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)); | |
| 180 | 180 | |
| 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 | } | |
| 187 | 187 | #endif |
| 188 | 188 | } |
| 189 | 189 | |
| r243232 | r243233 | |
| 197 | 197 | |
| 198 | 198 | void *osd_alloc_executable(size_t size) |
| 199 | 199 | { |
| 200 | ||
| 200 | return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| r243232 | r243233 | |
| 209 | 209 | |
| 210 | 210 | void osd_free_executable(void *ptr, size_t size) |
| 211 | 211 | { |
| 212 | ||
| 212 | VirtualFree(ptr, 0, MEM_RELEASE); | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
| r243232 | r243233 | |
| 220 | 220 | void osd_break_into_debugger(const char *message) |
| 221 | 221 | { |
| 222 | 222 | #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)(); | |
| 230 | 230 | #else |
| 231 | if (IsDebuggerPresent()) | |
| 232 | { | |
| 233 | OutputDebugStringA(message); | |
| 234 | DebugBreak(); | |
| 235 | } | |
| 231 | if (IsDebuggerPresent()) | |
| 232 | { | |
| 233 | OutputDebugStringA(message); | |
| 234 | DebugBreak(); | |
| 235 | } | |
| 236 | 236 | #endif |
| 237 | 237 | } |
| 238 | 238 | |
| r243232 | r243233 | |
| 252 | 252 | |
| 253 | 253 | osd_ticks_t osd_ticks(void) |
| 254 | 254 | { |
| 255 | ||
| 255 | LARGE_INTEGER performance_count; | |
| 256 | 256 | |
| 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; | |
| 260 | 260 | |
| 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 | } | |
| 270 | 270 | |
| 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 | } | |
| 275 | 275 | |
| 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; | |
| 282 | 282 | |
| 283 | // call ourselves to get the first value | |
| 284 | return osd_ticks(); | |
| 283 | // call ourselves to get the first value | |
| 284 | return osd_ticks(); | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | |
| r243232 | r243233 | |
| 291 | 291 | |
| 292 | 292 | osd_ticks_t osd_ticks_per_second(void) |
| 293 | 293 | { |
| 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; | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | //============================================================ |
| r243232 | r243233 | |
| 302 | 302 | |
| 303 | 303 | void osd_sleep(osd_ticks_t duration) |
| 304 | 304 | { |
| 305 | ||
| 305 | DWORD msec; | |
| 306 | 306 | |
| 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(); | |
| 310 | 310 | |
| 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); | |
| 313 | 313 | |
| 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); | |
| 319 | 319 | |
| 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; | |
| 322 | 322 | |
| 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 | } | |
| 329 | 329 | } |
| r243232 | r243233 | |
|---|---|---|
| 17 | 17 | |
| 18 | 18 | const options_entry osd_options::s_option_entries[] = |
| 19 | 19 | { |
| 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: " }, | |
| 22 | 22 | |
| 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" }, | |
| 26 | 26 | |
| 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" }, | |
| 31 | 31 | |
| 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" }, | |
| 39 | 39 | // 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" }, | |
| 48 | 48 | |
| 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" }, | |
| 55 | 55 | |
| 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" }, | |
| 60 | 60 | |
| 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" }, | |
| 65 | 65 | |
| 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" }, | |
| 70 | 70 | |
| 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" }, | |
| 75 | 75 | |
| 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" }, | |
| 79 | 79 | |
| 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)" }, | |
| 84 | 84 | |
| 85 | // End of list | |
| 86 | { NULL } | |
| 85 | // End of list | |
| 86 | { NULL } | |
| 87 | 87 | }; |
| 88 | 88 | |
| 89 | 89 | osd_options::osd_options() |
| 90 | 90 | : cli_options() |
| 91 | 91 | { |
| 92 | ||
| 92 | add_entries(osd_options::s_option_entries); | |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | 95 | |
| r243232 | r243233 | |
| 99 | 99 | |
| 100 | 100 | osd_common_t::osd_common_t(osd_options &options) |
| 101 | 101 | : 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) | |
| 105 | 105 | |
| 106 | 106 | { |
| 107 | 107 | } |
| r243232 | r243233 | |
| 110 | 110 | |
| 111 | 111 | void osd_common_t::register_options() |
| 112 | 112 | { |
| 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); | |
| 113 | 117 | |
| 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); | |
| 118 | 122 | |
| 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 | ||
| 124 | 123 | #ifdef SDLMAME_MACOSX |
| 125 | ||
| 124 | REGISTER_MODULE(m_mod_man, DEBUG_OSX); | |
| 126 | 125 | #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); | |
| 131 | 130 | |
| 132 | ||
| 131 | // after initialization we know which modules are supported | |
| 133 | 132 | |
| 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); | |
| 141 | 140 | |
| 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); | |
| 147 | 146 | |
| 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); | |
| 154 | 153 | |
| 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); | |
| 159 | 158 | } |
| 160 | 159 | |
| 161 | 160 | void osd_common_t::update_option(const char * key, dynamic_array<const char *> &values) |
| r243232 | r243233 | |
| 305 | 304 | // It provides an array of stereo samples in L-R order which should be |
| 306 | 305 | // output at the configured sample_rate. |
| 307 | 306 | // |
| 308 | ||
| 307 | m_sound->update_audio_stream(m_machine->video().throttled(), buffer,samples_this_frame); | |
| 309 | 308 | } |
| 310 | 309 | |
| 311 | 310 | |
| r243232 | r243233 | |
| 322 | 321 | // while (attenuation++ < 0) |
| 323 | 322 | // volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB |
| 324 | 323 | // |
| 325 | if (m_sound != NULL) | |
| 326 | m_sound->set_mastervolume(attenuation); | |
| 324 | if (m_sound != NULL) | |
| 325 | m_sound->set_mastervolume(attenuation); | |
| 327 | 326 | } |
| 328 | 327 | |
| 329 | 328 | |
| r243232 | r243233 | |
| 398 | 397 | |
| 399 | 398 | bool osd_common_t::execute_command(const char *command) |
| 400 | 399 | { |
| 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 | } | |
| 413 | 412 | |
| 414 | ||
| 413 | return false; | |
| 415 | 414 | |
| 416 | 415 | } |
| 417 | 416 | |
| r243232 | r243233 | |
| 437 | 436 | #endif |
| 438 | 437 | midi_init(); |
| 439 | 438 | |
| 440 | ||
| 439 | m_font_module = select_module_options<font_module *>(options(), OSD_FONT_PROVIDER); | |
| 441 | 440 | |
| 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(); | |
| 445 | 444 | |
| 446 | ||
| 445 | m_debugger = select_module_options<debug_module *>(options(), OSD_DEBUG_PROVIDER); | |
| 447 | 446 | |
| 448 | ||
| 447 | m_mod_man.init(); | |
| 449 | 448 | |
| 450 | 449 | } |
| 451 | 450 | |
| r243232 | r243233 | |
| 524 | 523 | |
| 525 | 524 | void osd_common_t::osd_exit() |
| 526 | 525 | { |
| 527 | ||
| 526 | m_mod_man.exit(); | |
| 528 | 527 | |
| 529 | ||
| 528 | exit_subsystems(); | |
| 530 | 529 | } |
| 531 | 530 | |
| 532 | 531 | void osd_common_t::video_options_add(const char *name, void *type) |
| r243232 | r243233 | |
| 537 | 536 | |
| 538 | 537 | bool osd_common_t::midi_init() |
| 539 | 538 | { |
| 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(); | |
| 542 | 541 | } |
| 543 | 542 | |
| 544 | 543 | void osd_common_t::midi_exit() |
| 545 | 544 | { |
| 546 | ||
| 545 | osd_midi_exit(); | |
| 547 | 546 | } |
| 548 | ||
| 549 |
| r243232 | r243233 | |
|---|---|---|
| 62 | 62 | class osd_options : public cli_options |
| 63 | 63 | { |
| 64 | 64 | public: |
| 65 | // construction/destruction | |
| 66 | osd_options(); | |
| 65 | // construction/destruction | |
| 66 | osd_options(); | |
| 67 | 67 | |
| 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); } | |
| 71 | 71 | |
| 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); } | |
| 76 | 76 | |
| 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); } | |
| 86 | 86 | |
| 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)); } | |
| 96 | 96 | |
| 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); } | |
| 99 | 99 | |
| 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); } | |
| 103 | 103 | |
| 104 | 104 | private: |
| 105 | ||
| 105 | static const options_entry s_option_entries[]; | |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | 108 | // ======================> osd_interface |
| r243232 | r243233 | |
| 142 | 142 | // video overridables |
| 143 | 143 | virtual void *get_slider_list(); |
| 144 | 144 | |
| 145 | // command option overrides | |
| 146 | virtual bool execute_command(const char *command); | |
| 145 | // command option overrides | |
| 146 | virtual bool execute_command(const char *command); | |
| 147 | 147 | |
| 148 | ||
| 148 | osd_font *font_alloc() { return m_font_module->font_alloc(); } | |
| 149 | 149 | |
| 150 | 150 | // FIXME: everything below seems to be osd specific and not part of |
| 151 | 151 | // this INTERFACE but part of the osd IMPLEMENTATION |
| 152 | 152 | |
| 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; } | |
| 155 | 155 | |
| 156 | 156 | |
| 157 | ||
| 157 | virtual void debugger_update(); | |
| 158 | 158 | |
| 159 | ||
| 159 | virtual void init_subsystems(); | |
| 160 | 160 | |
| 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(); | |
| 164 | 164 | |
| 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(); | |
| 169 | 169 | |
| 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(); | |
| 177 | 177 | |
| 178 | ||
| 178 | virtual void osd_exit(); | |
| 179 | 179 | |
| 180 | ||
| 180 | virtual void video_options_add(const char *name, void *type); | |
| 181 | 181 | |
| 182 | ||
| 182 | osd_options &options() { return m_options; } | |
| 183 | 183 | |
| 184 | 184 | protected: |
| 185 | virtual bool input_init(); | |
| 186 | virtual void input_pause(); | |
| 185 | virtual bool input_init(); | |
| 186 | virtual void input_pause(); | |
| 187 | 187 | |
| 188 | 188 | private: |
| 189 | 189 | // internal state |
| 190 | 190 | running_machine * m_machine; |
| 191 | 191 | osd_options& m_options; |
| 192 | 192 | |
| 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; | |
| 195 | 195 | |
| 196 | 196 | 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 | } | |
| 210 | 210 | |
| 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 | } | |
| 216 | 216 | |
| 217 | 217 | protected: |
| 218 | 218 | sound_module* m_sound; |
| r243232 | r243233 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | struct osd_midi_device |
| 12 | 12 | { |
| 13 | ||
| 13 | int dummy; | |
| 14 | 14 | }; |
| 15 | 15 | |
| 16 | 16 | bool osd_midi_init() |
| 17 | 17 | { |
| 18 | ||
| 18 | return true; | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | void osd_midi_exit() |
| r243232 | r243233 | |
| 24 | 24 | |
| 25 | 25 | void osd_list_midi_devices(void) |
| 26 | 26 | { |
| 27 | ||
| 27 | osd_printf_warning("\nMIDI is not supported in this build\n"); | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | osd_midi_device *osd_open_midi_input(const char *devname) |
| 31 | 31 | { |
| 32 | ||
| 32 | return NULL; | |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | osd_midi_device *osd_open_midi_output(const char *devname) |
| 36 | 36 | { |
| 37 | ||
| 37 | return NULL; | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | void osd_close_midi_channel(osd_midi_device *dev) |
| r243232 | r243233 | |
| 43 | 43 | |
| 44 | 44 | bool osd_poll_midi_channel(osd_midi_device *dev) |
| 45 | 45 | { |
| 46 | ||
| 46 | return false; | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut) |
| 50 | 50 | { |
| 51 | ||
| 51 | return 0; | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | void osd_write_midi_channel(osd_midi_device *dev, UINT8 data) |
| r243232 | r243233 | |
|---|---|---|
| 16 | 16 | |
| 17 | 17 | struct osd_midi_device |
| 18 | 18 | { |
| 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; | |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | 27 | bool osd_midi_init() |
| 28 | 28 | { |
| 29 | Pm_Initialize(); | |
| 30 | return true; | |
| 29 | Pm_Initialize(); | |
| 30 | return true; | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | void osd_midi_exit() |
| 34 | 34 | { |
| 35 | ||
| 35 | Pm_Terminate(); | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | void osd_list_midi_devices(void) |
| 39 | 39 | { |
| 40 | int num_devs = Pm_CountDevices(); | |
| 41 | const PmDeviceInfo *pmInfo; | |
| 40 | int num_devs = Pm_CountDevices(); | |
| 41 | const PmDeviceInfo *pmInfo; | |
| 42 | 42 | |
| 43 | ||
| 43 | printf("\n"); | |
| 44 | 44 | |
| 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 | } | |
| 50 | 50 | |
| 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); | |
| 55 | 55 | |
| 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 | } | |
| 61 | 61 | |
| 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); | |
| 66 | 66 | |
| 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 | } | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | osd_midi_device *osd_open_midi_input(const char *devname) |
| 75 | 75 | { |
| 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; | |
| 81 | 81 | |
| 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); | |
| 91 | 91 | |
| 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 | } | |
| 102 | 102 | |
| 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 | } | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | osd_midi_device *osd_open_midi_output(const char *devname) |
| 125 | 125 | { |
| 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; | |
| 131 | 131 | |
| 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); | |
| 141 | 141 | |
| 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 | } | |
| 152 | 152 | |
| 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; | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | void osd_close_midi_channel(osd_midi_device *dev) |
| 176 | 176 | { |
| 177 | Pm_Close(dev->pmStream); | |
| 178 | osd_free(dev); | |
| 177 | Pm_Close(dev->pmStream); | |
| 178 | osd_free(dev); | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | bool osd_poll_midi_channel(osd_midi_device *dev) |
| 182 | 182 | { |
| 183 | ||
| 183 | PmError chk = Pm_Poll(dev->pmStream); | |
| 184 | 184 | |
| 185 | ||
| 185 | return (chk == pmGotData) ? true : false; | |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | int osd_read_midi_channel(osd_midi_device *dev, UINT8 *pOut) |
| 189 | 189 | { |
| 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; | |
| 192 | 192 | |
| 193 | if (msgsRead <= 0) | |
| 194 | { | |
| 195 | return 0; | |
| 196 | } | |
| 193 | if (msgsRead <= 0) | |
| 194 | { | |
| 195 | return 0; | |
| 196 | } | |
| 197 | 197 | |
| 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); | |
| 201 | 201 | |
| 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; | |
| 249 | 249 | |
| 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 | } | |
| 263 | 263 | |
| 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; | |
| 269 | 269 | |
| 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; | |
| 277 | 277 | |
| 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; | |
| 282 | 282 | |
| 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 | } | |
| 292 | 292 | |
| 293 | ||
| 293 | return bytesOut; | |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | void osd_write_midi_channel(osd_midi_device *dev, UINT8 data) |
| 297 | 297 | { |
| 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 | |
| 301 | 301 | |
| 302 | 302 | // printf("write: %02x (%d)\n", data, dev->xmit_cnt); |
| 303 | 303 | |
| 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 | } | |
| 310 | 310 | |
| 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 | } | |
| 316 | 316 | |
| 317 | // handle sysex | |
| 318 | if (dev->last_status == MIDI_SYSEX) | |
| 319 | { | |
| 317 | // handle sysex | |
| 318 | if (dev->last_status == MIDI_SYSEX) | |
| 319 | { | |
| 320 | 320 | // printf("sysex: %02x (%d)\n", data, dev->xmit_cnt); |
| 321 | 321 | |
| 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 | { | |
| 325 | 325 | // 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 | } | |
| 330 | 330 | |
| 331 | ||
| 331 | dev->xmit_in[dev->xmit_cnt++] = data; | |
| 332 | 332 | |
| 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; | |
| 340 | 340 | |
| 341 | 341 | // printf("SysEx packet: %08x\n", ev.message); |
| 342 | 342 | |
| 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 | } | |
| 349 | 349 | |
| 350 | return; | |
| 351 | } | |
| 350 | return; | |
| 351 | } | |
| 352 | 352 | |
| 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 | } | |
| 358 | 358 | |
| 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; | |
| 363 | 363 | // 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; | |
| 368 | 368 | // printf("\tNRS: [%d] = %02x\n", dev->xmit_cnt-1, data); |
| 369 | ||
| 369 | } | |
| 370 | 370 | |
| 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 | { | |
| 373 | 373 | // printf("Start SysEx!\n"); |
| 374 | dev->last_status = MIDI_SYSEX; | |
| 375 | return; | |
| 376 | } | |
| 374 | dev->last_status = MIDI_SYSEX; | |
| 375 | return; | |
| 376 | } | |
| 377 | 377 | |
| 378 | ||
| 378 | // are we there yet? | |
| 379 | 379 | // 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; | |
| 386 | 386 | |
| 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; | |
| 392 | 392 | |
| 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; | |
| 396 | 396 | |
| 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; | |
| 401 | 401 | |
| 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; | |
| 407 | 407 | |
| 408 | default: | |
| 409 | bytes_needed = 3; | |
| 410 | break; | |
| 411 | } | |
| 408 | default: | |
| 409 | bytes_needed = 3; | |
| 410 | break; | |
| 411 | } | |
| 412 | 412 | |
| 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 | } | |
| 419 | 419 | |
| 420 | 420 | } |
| r243232 | r243233 | |
|---|---|---|
| 7 | 7 | |
| 8 | 8 | osd_module_manager::osd_module_manager() |
| 9 | 9 | { |
| 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 | } | |
| 15 | 15 | } |
| 16 | 16 | osd_module_manager::~osd_module_manager() |
| 17 | 17 | { |
| 18 | for (int i = 0; m_modules[i] != NULL; i++) | |
| 19 | { | |
| 20 | m_modules[i]->~osd_module(); | |
| 21 | osd_free(m_modules[i]); | |
| 22 | } | |
| 18 | for (int i = 0; m_modules[i] != NULL; i++) | |
| 19 | { | |
| 20 | m_modules[i]->~osd_module(); | |
| 21 | osd_free(m_modules[i]); | |
| 22 | } | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | void osd_module_manager::register_module(const module_type &mod_type) |
| 26 | 26 | { |
| 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()); | |
| 31 | 31 | |
| 32 | int i; | |
| 33 | for (i = 0; m_modules[i] != NULL; i++) | |
| 34 | ; | |
| 35 | m_modules[i] = module; | |
| 36 | } | |
| 37 | else | |
| 38 | { | |
| 39 | osd_printf_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 | } | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | bool osd_module_manager::type_has_name(const char *type, const char *name) |
| 46 | 46 | { |
| 47 | ||
| 47 | return (get_module_index(type, name) >= 0); | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | osd_module *osd_module_manager::get_module_generic(const char *type, const char *name) |
| 51 | 51 | { |
| 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; | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | osd_module *osd_module_manager::select_module(const char *type, const char *name) |
| 60 | 60 | { |
| 61 | ||
| 61 | osd_module *m = get_module_generic(type, name); | |
| 62 | 62 | |
| 63 | // FIXME: check if already exists! | |
| 64 | int i; | |
| 65 | for (i = 0; m_selected[i] != NULL; i++) | |
| 66 | ; | |
| 67 | m_selected[i] = m; | |
| 68 | return m; | |
| 63 | // FIXME: check if already exists! | |
| 64 | int i; | |
| 65 | for (i = 0; m_selected[i] != NULL; i++) | |
| 66 | ; | |
| 67 | m_selected[i] = m; | |
| 68 | return m; | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | void osd_module_manager::init() |
| 72 | 72 | { |
| 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 | } | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | void osd_module_manager::exit() |
| 80 | 80 | { |
| 81 | // Find count | |
| 82 | int cnt; | |
| 83 | for (cnt = 0; m_selected[cnt] != NULL; cnt++) | |
| 84 | ; | |
| 85 | for (int i = cnt - 1; i >= 0; i--) | |
| 86 | { | |
| 87 | m_selected[i]->exit(); | |
| 88 | m_selected[i] = NULL; | |
| 89 | } | |
| 81 | // Find count | |
| 82 | int cnt; | |
| 83 | for (cnt = 0; m_selected[cnt] != NULL; cnt++) | |
| 84 | ; | |
| 85 | for (int i = cnt - 1; i >= 0; i--) | |
| 86 | { | |
| 87 | m_selected[i]->exit(); | |
| 88 | m_selected[i] = NULL; | |
| 89 | } | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | int osd_module_manager::get_module_index(const char *type, const char *name) |
| 93 | 93 | { |
| 94 | for (int i = 0; m_modules[i] != NULL; i++) | |
| 95 | { | |
| 96 | if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0))) | |
| 97 | return i; | |
| 98 | } | |
| 99 | return -1; | |
| 94 | for (int i = 0; m_modules[i] != NULL; i++) | |
| 95 | { | |
| 96 | if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0))) | |
| 97 | return i; | |
| 98 | } | |
| 99 | return -1; | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) |
| 103 | 103 | { |
| 104 | *num = 0; | |
| 105 | for (int i = 0; m_modules[i] != NULL; i++) | |
| 106 | { | |
| 107 | if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max)) | |
| 108 | { | |
| 109 | names[*num] = m_modules[i]->name(); | |
| 110 | *num = *num + 1; | |
| 111 | } | |
| 104 | *num = 0; | |
| 105 | for (int i = 0; m_modules[i] != NULL; i++) | |
| 106 | { | |
| 107 | if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max)) | |
| 108 | { | |
| 109 | names[*num] = m_modules[i]->name(); | |
| 110 | *num = *num + 1; | |
| 111 | } | |
| 112 | 112 | |
| 113 | ||
| 113 | } | |
| 114 | 114 | } |
| 115 | ||
| 116 |
| r243232 | r243233 | |
|---|---|---|
| 26 | 26 | { |
| 27 | 27 | public: |
| 28 | 28 | |
| 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() { } | |
| 33 | 33 | |
| 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; } | |
| 36 | 36 | |
| 37 | ||
| 37 | virtual bool probe() const { return true; } | |
| 38 | 38 | |
| 39 | virtual int init() { return 0; } | |
| 40 | virtual void exit() { } | |
| 39 | virtual int init() { return 0; } | |
| 40 | virtual void exit() { } | |
| 41 | 41 | |
| 42 | 42 | private: |
| 43 | astring m_name; | |
| 44 | astring m_type; | |
| 43 | astring m_name; | |
| 44 | astring m_type; | |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | 47 | // a module_type is simply a pointer to its alloc function |
| r243232 | r243233 | |
| 51 | 51 | template<class _ModuleClass> |
| 52 | 52 | osd_module *module_creator() |
| 53 | 53 | { |
| 54 | void *p = osd_malloc(sizeof(_ModuleClass)); | |
| 55 | return new(p) _ModuleClass; | |
| 54 | void *p = osd_malloc(sizeof(_ModuleClass)); | |
| 55 | return new(p) _ModuleClass; | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | class osd_module_manager |
| 59 | 59 | { |
| 60 | 60 | public: |
| 61 | 61 | |
| 62 | ||
| 62 | static const int MAX_MODULES = 32; | |
| 63 | 63 | |
| 64 | osd_module_manager(); | |
| 65 | ~osd_module_manager(); | |
| 64 | osd_module_manager(); | |
| 65 | ~osd_module_manager(); | |
| 66 | 66 | |
| 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); | |
| 69 | 69 | |
| 70 | ||
| 70 | osd_module *get_module_generic(const char *type, const char *name); | |
| 71 | 71 | |
| 72 | template<class C> | |
| 73 | C select_module(const char *type, const char *name = "") | |
| 74 | { | |
| 75 | return dynamic_cast<C>(select_module(type, name)); | |
| 76 | } | |
| 72 | template<class C> | |
| 73 | C select_module(const char *type, const char *name = "") | |
| 74 | { | |
| 75 | return dynamic_cast<C>(select_module(type, name)); | |
| 76 | } | |
| 77 | 77 | |
| 78 | ||
| 78 | osd_module *select_module(const char *type, const char *name = ""); | |
| 79 | 79 | |
| 80 | ||
| 80 | void get_module_names(const char *type, const int max, int *num, const char *names[]); | |
| 81 | 81 | |
| 82 | ||
| 82 | void init(); | |
| 83 | 83 | |
| 84 | ||
| 84 | void exit(); | |
| 85 | 85 | |
| 86 | 86 | private: |
| 87 | ||
| 87 | int get_module_index(const char *type, const char *name); | |
| 88 | 88 | |
| 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]; | |
| 91 | 91 | }; |
| 92 | 92 | |
| 93 | 93 | #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 >; | |
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | #define MODULE_NOT_SUPPORTED(_mod, _type, _name) \ |
| 99 | class _mod : public osd_module { \ | |
| 100 | public: \ | |
| 101 | _mod () \ | |
| 102 | : osd_module(_type, _name) {} \ | |
| 103 | bool probe() const { return false; } \ | |
| 104 | }; | |
| 99 | class _mod : public osd_module { \ | |
| 100 | public: \ | |
| 101 | _mod () \ | |
| 102 | : osd_module(_type, _name) {} \ | |
| 103 | bool probe() const { return false; } \ | |
| 104 | }; | |
| 105 | 105 | |
| 106 | 106 | #endif /* __OSDMODULE_H__ */ |
| r243232 | r243233 | |
|---|---|---|
| 51 | 51 | { |
| 52 | 52 | public: |
| 53 | 53 | |
| 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() { } | |
| 59 | 59 | |
| 60 | virtual int init(); | |
| 61 | virtual void exit(); | |
| 60 | virtual int init(); | |
| 61 | virtual void exit(); | |
| 62 | 62 | |
| 63 | ||
| 63 | // sound_module | |
| 64 | 64 | |
| 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); | |
| 67 | 67 | |
| 68 | 68 | private: |
| 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); | |
| 74 | 74 | |
| 75 | 75 | }; |
| 76 | 76 | |
| r243232 | r243233 | |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | #else /* SDLMAME_UNIX */ |
| 451 | ||
| 451 | MODULE_NOT_SUPPORTED(sound_direct_sound, OSD_SOUND_PROVIDER, "dsound") | |
| 452 | 452 | #endif |
| 453 | 453 | |
| 454 | 454 | MODULE_DEFINITION(SOUND_DSOUND, sound_direct_sound) |
| r243232 | r243233 | |
|---|---|---|
| 19 | 19 | { |
| 20 | 20 | public: |
| 21 | 21 | |
| 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() { } | |
| 27 | 27 | |
| 28 | virtual int init(); | |
| 29 | virtual void exit(); | |
| 28 | virtual int init(); | |
| 29 | virtual void exit(); | |
| 30 | 30 | |
| 31 | ||
| 31 | // sound_module | |
| 32 | 32 | |
| 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 | } | |
| 47 | 47 | |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | #else /* SDLMAME_UNIX */ |
| 51 | ||
| 51 | MODULE_NOT_SUPPORTED(sound_js, OSD_SOUND_PROVIDER, "js") | |
| 52 | 52 | #endif |
| 53 | 53 | |
| 54 | 54 | MODULE_DEFINITION(SOUND_JS, sound_js) |
| r243232 | r243233 | |
|---|---|---|
| 14 | 14 | class sound_none : public osd_module, public sound_module |
| 15 | 15 | { |
| 16 | 16 | public: |
| 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() { } | |
| 22 | 22 | |
| 23 | virtual int init() { return 0; } | |
| 24 | virtual void exit() { } | |
| 23 | virtual int init() { return 0; } | |
| 24 | virtual void exit() { } | |
| 25 | 25 | |
| 26 | ||
| 26 | // sound_module | |
| 27 | 27 | |
| 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) { } | |
| 30 | 30 | |
| 31 | 31 | }; |
| 32 | 32 |
| r243232 | r243233 | |
|---|---|---|
| 12 | 12 | #include "sound_module.h" |
| 13 | 13 | #include "modules/osdmodule.h" |
| 14 | 14 | |
| 15 | #if (!defined( | |
| 15 | #if (!defined(OSD_WINDOWS)) | |
| 16 | 16 | |
| 17 | 17 | // standard sdl header |
| 18 | 18 | #include "../../sdl/sdlinc.h" |
| r243232 | r243233 | |
| 43 | 43 | { |
| 44 | 44 | public: |
| 45 | 45 | |
| 46 | ||
| 46 | friend void sdl_callback(void *userdata, Uint8 *stream, int len); | |
| 47 | 47 | |
| 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; | |
| 50 | 50 | |
| 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() { } | |
| 60 | 60 | |
| 61 | virtual int init(); | |
| 62 | virtual void exit(); | |
| 61 | virtual int init(); | |
| 62 | virtual void exit(); | |
| 63 | 63 | |
| 64 | ||
| 64 | // sound_module | |
| 65 | 65 | |
| 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); | |
| 68 | 68 | |
| 69 | 69 | private: |
| 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); | |
| 76 | 76 | |
| 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; | |
| 81 | 81 | |
| 82 | ||
| 82 | int buf_locked; | |
| 83 | 83 | |
| 84 | INT8 *stream_buffer; | |
| 85 | volatile INT32 stream_playpos; | |
| 84 | INT8 *stream_buffer; | |
| 85 | volatile INT32 stream_playpos; | |
| 86 | 86 | |
| 87 | UINT32 stream_buffer_size; | |
| 88 | UINT32 stream_buffer_in; | |
| 87 | UINT32 stream_buffer_size; | |
| 88 | UINT32 stream_buffer_in; | |
| 89 | 89 | |
| 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; | |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | }; |
| r243232 | r243233 | |
| 354 | 354 | //============================================================ |
| 355 | 355 | static void sdl_callback(void *userdata, Uint8 *stream, int len) |
| 356 | 356 | { |
| 357 | ||
| 357 | sound_sdl *thiz = (sound_sdl *) userdata; | |
| 358 | 358 | int len1, len2, sb_in; |
| 359 | 359 | |
| 360 | 360 | sb_in = thiz->stream_buffer_in; |
| r243232 | r243233 | |
| 379 | 379 | len2 = 0; |
| 380 | 380 | } |
| 381 | 381 | |
| 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 | } | |
| 389 | 389 | |
| 390 | 390 | |
| 391 | 391 | // move the play cursor |
| 392 | ||
| 392 | thiz->stream_playpos += len1 + len2; | |
| 393 | 393 | if (thiz->stream_playpos >= thiz->stream_buffer_size) |
| 394 | 394 | { |
| 395 | | |
| 395 | thiz->stream_playpos -= thiz->stream_buffer_size; | |
| 396 | 396 | thiz->stream_loop = 0; |
| 397 | 397 | |
| 398 | 398 | if (LOG_SOUND) |
| r243232 | r243233 | |
| 416 | 416 | SDL_AudioSpec aspec, obtained; |
| 417 | 417 | char audio_driver[16] = ""; |
| 418 | 418 | |
| 419 | if (LOG_SOUND) | |
| 420 | sound_log = fopen(SDLMAME_SOUND_LOG, "w"); | |
| 419 | if (LOG_SOUND) | |
| 420 | sound_log = fopen(SDLMAME_SOUND_LOG, "w"); | |
| 421 | 421 | |
| 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 | } | |
| 429 | 429 | |
| 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); | |
| 437 | 437 | |
| 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; | |
| 441 | 441 | |
| 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; | |
| 449 | 449 | |
| 450 | if (SDL_OpenAudio(&aspec, &obtained) < 0) | |
| 451 | goto cant_start_audio; | |
| 450 | if (SDL_OpenAudio(&aspec, &obtained) < 0) | |
| 451 | goto cant_start_audio; | |
| 452 | 452 | |
| 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); | |
| 455 | 455 | |
| 456 | ||
| 456 | sdl_xfer_samples = obtained.samples; | |
| 457 | 457 | |
| 458 | ||
| 458 | audio_latency = m_audio_latency; | |
| 459 | 459 | |
| 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 | } | |
| 469 | 469 | |
| 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; | |
| 475 | 475 | |
| 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; | |
| 479 | 479 | |
| 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; | |
| 484 | 484 | |
| 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()); | |
| 489 | 489 | |
| 490 | return -1; | |
| 491 | } | |
| 490 | return -1; | |
| 491 | } | |
| 492 | 492 | |
| 493 | ||
| 493 | return 0; | |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
| r243232 | r243233 | |
| 501 | 501 | |
| 502 | 502 | void sound_sdl::exit() |
| 503 | 503 | { |
| 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; | |
| 507 | 507 | |
| 508 | ||
| 508 | osd_printf_verbose("sdl_kill: closing audio\n"); | |
| 509 | 509 | SDL_CloseAudio(); |
| 510 | 510 | |
| 511 | 511 | SDL_QuitSubSystem(SDL_INIT_AUDIO); |
| 512 | 512 | |
| 513 | // kill the buffers | |
| 514 | sdl_destroy_buffers(); | |
| 513 | // kill the buffers | |
| 514 | sdl_destroy_buffers(); | |
| 515 | 515 | |
| 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); | |
| 519 | 519 | |
| 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 | } | |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | |
| r243232 | r243233 | |
| 555 | 555 | |
| 556 | 556 | |
| 557 | 557 | #else /* SDLMAME_UNIX */ |
| 558 | ||
| 558 | MODULE_NOT_SUPPORTED(sound_sdl, OSD_SOUND_PROVIDER, "sdl") | |
| 559 | 559 | #endif |
| 560 | 560 | |
| 561 | 561 | MODULE_DEFINITION(SOUND_SDL, sound_sdl) |
| r243232 | r243233 | |
|---|---|---|
| 18 | 18 | class sound_module |
| 19 | 19 | { |
| 20 | 20 | public: |
| 21 | ||
| 21 | sound_module() : m_sample_rate(0), m_audio_latency(1) { } | |
| 22 | 22 | |
| 23 | ||
| 23 | virtual ~sound_module() { } | |
| 24 | 24 | |
| 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; | |
| 27 | 27 | |
| 28 | ||
| 28 | int sample_rate() { return m_sample_rate; } | |
| 29 | 29 | |
| 30 | int m_sample_rate; | |
| 31 | int m_audio_latency; | |
| 30 | int m_sample_rate; | |
| 31 | int m_audio_latency; | |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | #endif /* FONT_MODULE_H_ */ |
| r243232 | r243233 | |
|---|---|---|
| 160 | 160 | void osd_thread_wait_free(osd_thread *thread) |
| 161 | 161 | { |
| 162 | 162 | } |
| 163 |
| r243232 | r243233 | |
|---|---|---|
| 411 | 411 | { |
| 412 | 412 | if (timeout == OSD_EVENT_WAIT_INFINITE) |
| 413 | 413 | timeout = osd_ticks_per_second() * (osd_ticks_t)10000; |
| 414 | ||
| 414 | ||
| 415 | 415 | pthread_mutex_lock(&event->mutex); |
| 416 | 416 | if (!timeout) |
| 417 | 417 | { |
| r243232 | r243233 | |
| 531 | 531 | pthread_join(thread->thread, NULL); |
| 532 | 532 | free(thread); |
| 533 | 533 | } |
| 534 |
| r243232 | r243233 | |
|---|---|---|
| 388 | 388 | { |
| 389 | 389 | ULONG rc; |
| 390 | 390 | ULONG timeout_param; |
| 391 | ||
| 391 | ||
| 392 | 392 | if (timeout == OSD_EVENT_WAIT_INFINITE) |
| 393 | 393 | timeout_param = SEM_INDEFINITE_WAIT; |
| 394 | 394 | else |
| r243232 | r243233 | |
|---|---|---|
| 326 | 326 | thread->callback = callback; |
| 327 | 327 | thread->param = cbparam; |
| 328 | 328 | #ifdef SDLMAME_SDL2 |
| 329 | ||
| 329 | thread->thread = SDL_CreateThread(worker_thread_entry, "Thread", thread); | |
| 330 | 330 | #else |
| 331 | ||
| 331 | thread->thread = SDL_CreateThread(worker_thread_entry, thread); | |
| 332 | 332 | #endif |
| 333 | 333 | if ( thread->thread == NULL ) |
| 334 | 334 | { |
| r243232 | r243233 | |
| 366 | 366 | SDL_WaitThread(thread->thread, &status); |
| 367 | 367 | free(thread); |
| 368 | 368 | } |
| 369 |
| r243232 | r243233 | |
|---|---|---|
| 246 | 246 | { |
| 247 | 247 | if (timeout == OSD_EVENT_WAIT_INFINITE) |
| 248 | 248 | timeout = osd_ticks_per_second() * (osd_ticks_t)10000; |
| 249 | ||
| 249 | ||
| 250 | 250 | pthread_mutex_lock(&event->mutex); |
| 251 | 251 | if (!timeout) |
| 252 | 252 | { |
| r243232 | r243233 | |
| 389 | 389 | pthread_join(thread->thread, NULL); |
| 390 | 390 | free(thread); |
| 391 | 391 | } |
| 392 |
| r243232 | r243233 | |
|---|---|---|
| 244 | 244 | timeout_param = INFINITE; |
| 245 | 245 | else |
| 246 | 246 | timeout_param = timeout * 1000 / osd_ticks_per_second(); |
| 247 | ||
| 247 | ||
| 248 | 248 | int ret = WaitForSingleObject((HANDLE) event, timeout_param); |
| 249 | 249 | return (ret == WAIT_OBJECT_0); |
| 250 | 250 | } |
| r243232 | r243233 | |
|---|---|---|
| 70 | 70 | template<typename _PtrType> |
| 71 | 71 | static void spin_while(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout, const int invert = 0) |
| 72 | 72 | { |
| 73 | ||
| 73 | osd_ticks_t stopspin = osd_ticks() + timeout; | |
| 74 | 74 | |
| 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); | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | template<typename _PtrType> |
| 86 | 86 | static void spin_while_not(const volatile _PtrType * volatile ptr, const _PtrType val, const osd_ticks_t timeout) |
| 87 | 87 | { |
| 88 | ||
| 88 | spin_while(ptr, val, timeout, 1); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
| r243232 | r243233 | |
| 553 | 553 | if (item->event == NULL) |
| 554 | 554 | { |
| 555 | 555 | // TODO: do we need to measure the spin time here as well? and how can we do it? |
| 556 | ||
| 556 | spin_while(&item->done, 0, timeout); | |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | // otherwise, block on the event until done |
| r243232 | r243233 | |
|---|---|---|
| 54 | 54 | output_delegate osd_set_output_channel(output_channel channel, output_delegate callback) |
| 55 | 55 | { |
| 56 | 56 | if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull()) |
| 57 | { | |
| 58 | throw std::exception(); | |
| 59 | } | |
| 57 | { | |
| 58 | throw std::exception(); | |
| 59 | } | |
| 60 | 60 | |
| 61 | 61 | /* return the originals if requested */ |
| 62 | 62 | output_delegate prevcb = output_cb[channel]; |
| r243232 | r243233 | |
| 166 | 166 | va_end(argptr); |
| 167 | 167 | } |
| 168 | 168 | #endif |
| 169 |
| r243232 | r243233 | |
|---|---|---|
| 32 | 32 | class osd_font |
| 33 | 33 | { |
| 34 | 34 | public: |
| 35 | ||
| 35 | virtual ~osd_font() {} | |
| 36 | 36 | |
| 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; | |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | 42 | // ======================> osd_interface |
| r243232 | r243233 | |
|---|---|---|
| 81 | 81 | // can't support clipboards generically |
| 82 | 82 | return NULL; |
| 83 | 83 | } |
| 84 |
| r243232 | r243233 | |
|---|---|---|
| 114 | 114 | |
| 115 | 115 | #define TEXCOPY_M( _name, _src_type, _dest_type, _op, _len_div) \ |
| 116 | 116 | INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo *texsource) { \ |
| 117 | ||
| 117 | ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ | |
| 118 | 118 | int x, y; \ |
| 119 | 119 | /* loop over Y */ \ |
| 120 | 120 | for (y = 0; y < texsource->height; y++) { \ |
| r243232 | r243233 | |
| 134 | 134 | |
| 135 | 135 | #define TEXROT( _name, _src_type, _dest_type, _op) \ |
| 136 | 136 | INLINE void texcopy_rot_##_name (const texture_info *texture, const render_texinfo *texsource) { \ |
| 137 | ||
| 137 | ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ | |
| 138 | 138 | int x, y; \ |
| 139 | 139 | const quad_setup_data *setup = &texture->m_setup; \ |
| 140 | 140 | int dudx = setup->dudx; \ |
| r243232 | r243233 | |
|---|---|---|
| 48 | 48 | |
| 49 | 49 | static inline bool is_opaque(const float &a) |
| 50 | 50 | { |
| 51 | ||
| 51 | return (a >= 1.0f); | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | static inline bool is_transparent(const float &a) |
| 55 | 55 | { |
| 56 | ||
| 56 | return (a < 0.0001f); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | //============================================================ |
| r243232 | r243233 | |
| 63 | 63 | |
| 64 | 64 | struct quad_setup_data |
| 65 | 65 | { |
| 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); | |
| 71 | 71 | |
| 72 | 72 | INT32 dudx, dvdx, dudy, dvdy; |
| 73 | 73 | INT32 startu, startv; |
| r243232 | r243233 | |
| 105 | 105 | /* texture_info holds information about a texture */ |
| 106 | 106 | class texture_info |
| 107 | 107 | { |
| 108 | ||
| 108 | friend class simple_list<texture_info>; | |
| 109 | 109 | public: |
| 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(); | |
| 112 | 112 | |
| 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); | |
| 116 | 116 | |
| 117 | ||
| 117 | copy_info_t *compute_size_type(); | |
| 118 | 118 | |
| 119 | 119 | void *m_pixels; // pixels for the texture |
| 120 | 120 | int m_pitch; |
| r243232 | r243233 | |
| 125 | 125 | osd_ticks_t m_last_access; |
| 126 | 126 | |
| 127 | 127 | int raw_width() const { return m_texinfo.width; } |
| 128 | ||
| 128 | int raw_height() const { return m_texinfo.height; } | |
| 129 | 129 | |
| 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; } | |
| 133 | 133 | |
| 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 | } | |
| 140 | 140 | |
| 141 | 141 | private: |
| 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 | |
| 147 | 147 | |
| 148 | SDL_Texture * m_texture_id; | |
| 149 | int m_is_rotated; | |
| 148 | SDL_Texture * m_texture_id; | |
| 149 | int m_is_rotated; | |
| 150 | 150 | |
| 151 | int m_format; // texture format | |
| 152 | SDL_BlendMode m_sdl_blendmode; | |
| 151 | int m_format; // texture format | |
| 152 | SDL_BlendMode m_sdl_blendmode; | |
| 153 | 153 | |
| 154 | ||
| 154 | texture_info * m_next; // next texture in the list | |
| 155 | 155 | }; |
| 156 | 156 | |
| 157 | 157 | /* sdl_info is the information about SDL for the current screen */ |
| 158 | 158 | struct sdl_info |
| 159 | 159 | { |
| 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 | {} | |
| 166 | 166 | |
| 167 | ||
| 167 | void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); | |
| 168 | 168 | |
| 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); | |
| 171 | 171 | |
| 172 | 172 | INT32 m_blittimer; |
| 173 | 173 | |
| r243232 | r243233 | |
| 389 | 389 | target_rect.w = round_nearest(prim->bounds.x1 - prim->bounds.x0); |
| 390 | 390 | target_rect.h = round_nearest(prim->bounds.y1 - prim->bounds.y0); |
| 391 | 391 | |
| 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); | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | void sdl_info::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y) |
| 398 | 398 | { |
| 399 | ||
| 399 | SDL_Rect target_rect; | |
| 400 | 400 | |
| 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); | |
| 405 | 405 | |
| 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(); | |
| 412 | 412 | |
| 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); | |
| 427 | 427 | |
| 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 | } | |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | static int RendererSupportsFormat(SDL_Renderer *renderer, Uint32 format, Uint32 access, const char *sformat) |
| r243232 | r243233 | |
| 518 | 518 | else |
| 519 | 519 | osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>"); |
| 520 | 520 | |
| 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 | } | |
| 533 | 533 | |
| 534 | 534 | return 0; |
| 535 | 535 | } |
| r243232 | r243233 | |
| 604 | 604 | { |
| 605 | 605 | SDL_DisplayMode mode; |
| 606 | 606 | //SDL_GetCurrentDisplayMode(window->monitor()->handle, &mode); |
| 607 | ||
| 607 | SDL_GetWindowDisplayMode(window->sdl_window, &mode); | |
| 608 | 608 | sdl->m_original_mode = mode; |
| 609 | 609 | mode.w = width; |
| 610 | 610 | mode.h = height; |
| r243232 | r243233 | |
| 630 | 630 | osd_printf_warning("Ignoring depth %d\n", window->depth); |
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | ||
| 633 | SDL_SetWindowDisplayMode(window->sdl_window, &mode); // Try to set mode | |
| 634 | 634 | #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); | |
| 640 | 640 | #endif |
| 641 | 641 | } |
| 642 | 642 | else |
| r243232 | r243233 | |
| 736 | 736 | SDL_GetWindowSize(window->sdl_window, &window->width, &window->height); |
| 737 | 737 | sdl->m_resize_pending = 0; |
| 738 | 738 | SDL_RenderSetViewport(sdl->m_renderer, NULL); |
| 739 | | |
| 739 | //sdlvideo_monitor_refresh(window->monitor()); | |
| 740 | 740 | |
| 741 | 741 | } |
| 742 | 742 | |
| r243232 | r243233 | |
| 855 | 855 | |
| 856 | 856 | drawsdl2_destroy_all_textures(window); |
| 857 | 857 | |
| 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 | } | |
| 864 | 864 | |
| 865 | ||
| 865 | SDL_DestroyWindow(window->sdl_window); | |
| 866 | 866 | |
| 867 | 867 | global_free(sdl); |
| 868 | 868 | window->dxdata = NULL; |
| r243232 | r243233 | |
| 889 | 889 | { |
| 890 | 890 | if (RendererSupportsFormat(m_renderer, bi->dst_fmt, m_sdl_access, bi->dstname)) |
| 891 | 891 | { |
| 892 | | |
| 892 | int perf = bi->perf; | |
| 893 | 893 | if (perf == 0) |
| 894 | 894 | return bi; |
| 895 | 895 | else if (perf > (maxperf * 102) / 100) |
| r243232 | r243233 | |
| 920 | 920 | |
| 921 | 921 | bool texture_info::matches(const render_primitive &prim, const quad_setup_data &setup) |
| 922 | 922 | { |
| 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; | |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | //============================================================ |
| r243232 | r243233 | |
| 937 | 937 | |
| 938 | 938 | texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags) |
| 939 | 939 | { |
| 940 | ||
| 941 | 940 | // fill in the core data |
| 942 | ||
| 941 | m_renderer = renderer; | |
| 943 | 942 | m_hash = texture_compute_hash(texsource, flags); |
| 944 | 943 | m_flags = flags; |
| 945 | 944 | m_texinfo = texsource; |
| r243232 | r243233 | |
| 997 | 996 | |
| 998 | 997 | if (m_sdl_access == SDL_TEXTUREACCESS_STATIC) |
| 999 | 998 | { |
| 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; | |
| 1004 | 1003 | } |
| 1005 | 1004 | m_last_access = osd_ticks(); |
| 1006 | 1005 | |
| r243232 | r243233 | |
| 1008 | 1007 | |
| 1009 | 1008 | texture_info::~texture_info() |
| 1010 | 1009 | { |
| 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); | |
| 1014 | 1013 | } |
| 1015 | 1014 | |
| 1016 | 1015 | //============================================================ |
| r243232 | r243233 | |
| 1082 | 1081 | |
| 1083 | 1082 | #if 0 |
| 1084 | 1083 | 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); | |
| 1088 | 1087 | /* compute start and delta U,V coordinates now */ |
| 1089 | 1088 | #endif |
| 1090 | 1089 | |
| r243232 | r243233 | |
| 1162 | 1161 | if (texture == NULL && prim.texture.base != NULL) |
| 1163 | 1162 | { |
| 1164 | 1163 | texture = global_alloc(texture_info(m_renderer, prim.texture, setup, prim.flags)); |
| 1165 | | |
| 1164 | /* add us to the texture list */ | |
| 1166 | 1165 | m_texlist.prepend(*texture); |
| 1167 | 1166 | |
| 1168 | 1167 | } |
| r243232 | r243233 | |
| 1191 | 1190 | if(window->primlist) |
| 1192 | 1191 | { |
| 1193 | 1192 | window->primlist->acquire_lock(); |
| 1194 | sdl->m_texlist.reset(); | |
| 1195 | window->primlist->release_lock(); | |
| 1193 | sdl->m_texlist.reset(); | |
| 1194 | window->primlist->release_lock(); | |
| 1196 | 1195 | } |
| 1197 | 1196 | else |
| 1198 | ||
| 1197 | sdl->m_texlist.reset(); | |
| 1199 | 1198 | } |
| r243232 | r243233 | |
|---|---|---|
| 161 | 161 | /* texture_info holds information about a texture */ |
| 162 | 162 | struct texture_info |
| 163 | 163 | { |
| 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 | } | |
| 182 | 182 | |
| 183 | 183 | HashT hash; // hash value for the texture (must be >= pointer size) |
| 184 | 184 | UINT32 flags; // rendering flags |
| r243232 | r243233 | |
| 217 | 217 | /* sdl_info is the information about SDL for the current screen */ |
| 218 | 218 | struct sdl_info |
| 219 | 219 | { |
| 220 | sdl_info() | |
| 221 | : blittimer(0), extra_flags(0), | |
| 220 | sdl_info() | |
| 221 | : blittimer(0), extra_flags(0), | |
| 222 | 222 | #if (SDLMAME_SDL2) |
| 223 | ||
| 223 | gl_context_id(0), | |
| 224 | 224 | #else |
| 225 | ||
| 225 | sdlsurf(NULL), | |
| 226 | 226 | #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 | } | |
| 249 | 249 | |
| 250 | 250 | INT32 blittimer; |
| 251 | 251 | UINT32 extra_flags; |
| r243232 | r243233 | |
| 3079 | 3079 | sdl->texhash[i] = NULL; |
| 3080 | 3080 | if (texture != NULL) |
| 3081 | 3081 | { |
| 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 | } | |
| 3087 | 3087 | |
| 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 | } | |
| 3093 | 3093 | |
| 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 | } | |
| 3100 | 3100 | |
| 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 | } | |
| 3107 | 3107 | |
| 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); | |
| 3116 | 3116 | } |
| 3117 | 3117 | i++; |
| 3118 | 3118 | } |
| r243232 | r243233 | |
|---|---|---|
| 1986 | 1986 | else |
| 1987 | 1987 | { |
| 1988 | 1988 | #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()) | |
| 1993 | 1993 | #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 | } | |
| 1999 | 1999 | } |
| 2000 | 2000 | focus_window = window; |
| 2001 | 2001 | break; |
| r243232 | r243233 | |
|---|---|---|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
| 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 | } | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | void deinit_pcap() |
| r243232 | r243233 | |
|---|---|---|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | #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 | } | |
| 158 | 158 | #else |
| 159 | 159 | if (devs) |
| 160 | 160 | { |
| r243232 | r243233 | |
|---|---|---|
| 30 | 30 | #define SDL13_COMBINE_RESIZE (0) |
| 31 | 31 | #endif |
| 32 | 32 | #else |
| 33 | ||
| 33 | #define SDLMAME_INIT_IN_WORKER_THREAD (0) | |
| 34 | 34 | #define SDL13_COMBINE_RESIZE (0) |
| 35 | 35 | #endif |
| 36 | 36 | |
| r243232 | r243233 | |
| 199 | 199 | #ifdef USE_NETWORK |
| 200 | 200 | virtual bool network_init(); |
| 201 | 201 | #endif |
| 202 | ||
| 202 | //virtual bool midi_init(); | |
| 203 | 203 | |
| 204 | 204 | virtual void video_exit(); |
| 205 | 205 | virtual void window_exit(); |
| r243232 | r243233 | |
| 208 | 208 | #ifdef USE_NETWORK |
| 209 | 209 | virtual void network_exit(); |
| 210 | 210 | #endif |
| 211 | ||
| 211 | //virtual void midi_exit(); | |
| 212 | 212 | |
| 213 | ||
| 213 | sdl_options &options() { return m_options; } | |
| 214 | 214 | |
| 215 | 215 | private: |
| 216 | 216 | virtual void osd_exit(); |
| r243232 | r243233 | |
| 220 | 220 | // FIXME: remove machine usage |
| 221 | 221 | void extract_video_config(running_machine &machine); |
| 222 | 222 | |
| 223 | ||
| 223 | sdl_options &m_options; | |
| 224 | 224 | |
| 225 | 225 | watchdog *m_watchdog; |
| 226 | 226 |
| r243232 | r243233 | |
|---|---|---|
| 738 | 738 | $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o |
| 739 | 739 | |
| 740 | 740 | DEFS += -DUSE_QTDEBUG=1 |
| 741 | ||
| 741 | ||
| 742 | 742 | else |
| 743 | 743 | DEFS += -DUSE_QTDEBUG=0 |
| 744 | 744 | endif |
| r243232 | r243233 | |
|---|---|---|
| 152 | 152 | |
| 153 | 153 | if (tmpstr[0] == '$') |
| 154 | 154 | { |
| 155 | ||
| 156 | 155 | envstr = (char *) osd_malloc_array(strlen(tmpstr)+1); |
| 157 | 156 | |
| 158 | 157 | strcpy(envstr, tmpstr); |
| r243232 | r243233 | |
|---|---|---|
| 188 | 188 | |
| 189 | 189 | envstr[i] = '\0'; |
| 190 | 190 | |
| 191 | ||
| 191 | const char *envval = osd_getenv(&envstr[1]); | |
| 192 | 192 | if (envval != NULL) |
| 193 | 193 | { |
| 194 | 194 | j = strlen(envval) + strlen(tmpstr) + 1; |
| r243232 | r243233 | |
| 505 | 505 | |
| 506 | 506 | osd_directory_entry *osd_stat(const char *path) |
| 507 | 507 | { |
| 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 | |
| 515 | 515 | |
| 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 | |
| 521 | 521 | |
| 522 | ||
| 522 | if( err == -1) return NULL; | |
| 523 | 523 | |
| 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; | |
| 531 | 531 | |
| 532 | ||
| 532 | return result; | |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | //============================================================ |
| r243232 | r243233 | |
| 538 | 538 | |
| 539 | 539 | file_error osd_get_full_path(char **dst, const char *path) |
| 540 | 540 | { |
| 541 | file_error err; | |
| 542 | char path_buffer[512]; | |
| 541 | file_error err; | |
| 542 | char path_buffer[512]; | |
| 543 | 543 | |
| 544 | ||
| 544 | err = FILERR_NONE; | |
| 545 | 545 | |
| 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); | |
| 554 | 554 | |
| 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 | } | |
| 565 | 565 | |
| 566 | ||
| 566 | return err; | |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | //============================================================ |
| r243232 | r243233 | |
| 572 | 572 | |
| 573 | 573 | const char *osd_get_volume_name(int idx) |
| 574 | 574 | { |
| 575 | if (idx!=0) return NULL; | |
| 576 | return "/"; | |
| 575 | if (idx!=0) return NULL; | |
| 576 | return "/"; | |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | #endif |
| r243232 | r243233 | |
|---|---|---|
| 319 | 319 | #endif |
| 320 | 320 | |
| 321 | 321 | { |
| 322 | | |
| 322 | sdl_options options; | |
| 323 | 323 | sdl_osd_interface osd(options); |
| 324 | 324 | osd.register_options(); |
| 325 | 325 | cli_frontend frontend(options, osd); |
| r243232 | r243233 | |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | #endif |
| 691 | ||
| 692 |
| r243232 | r243233 | |
|---|---|---|
| 121 | 121 | |
| 122 | 122 | return result; |
| 123 | 123 | } |
| 124 |
| r243232 | r243233 | |
|---|---|---|
| 147 | 147 | return result; |
| 148 | 148 | } |
| 149 | 149 | #endif |
| 150 | ||
| 151 | ||
| 152 |
| r243232 | r243233 | |
|---|---|---|
| 101 | 101 | |
| 102 | 102 | return result; |
| 103 | 103 | } |
| 104 |
| r243232 | r243233 | |
|---|---|---|
| 111 | 111 | |
| 112 | 112 | file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize) |
| 113 | 113 | { |
| 114 | ||
| 114 | return FILERR_ACCESS_DENIED; | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) |
| 118 | 118 | { |
| 119 | ||
| 119 | return FILERR_ACCESS_DENIED; | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) |
| 123 | 123 | { |
| 124 | ||
| 124 | return FILERR_ACCESS_DENIED; | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | file_error sdl_close_ptty(osd_file *file) |
| 128 | 128 | { |
| 129 | ||
| 129 | return FILERR_ACCESS_DENIED; | |
| 130 | 130 | } |
| 131 | 131 | #endif |
| r243232 | r243233 | |
|---|---|---|
| 127 | 127 | |
| 128 | 128 | int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count) |
| 129 | 129 | { |
| 130 | ||
| 130 | wchar_t wch; | |
| 131 | 131 | |
| 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; | |
| 137 | 137 | |
| 138 | ||
| 138 | return count; | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | #endif |
| r243232 | r243233 | |
|---|---|---|
| 154 | 154 | |
| 155 | 155 | #if defined(SDLMAME_WIN32) |
| 156 | 156 | 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 | |
| 160 | 160 | monitor->monitor_width = dmode.w; |
| 161 | 161 | monitor->monitor_height = dmode.h; |
| 162 | 162 | monitor->center_width = dmode.w; |
| r243232 | r243233 | |
|---|---|---|
| 270 | 270 | * The code below will document which hints were set. |
| 271 | 271 | */ |
| 272 | 272 | 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, | |
| 284 | 284 | #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, | |
| 289 | 289 | #endif |
| 290 | 290 | #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, | |
| 294 | 294 | #endif |
| 295 | NULL | |
| 296 | }; | |
| 295 | NULL | |
| 296 | }; | |
| 297 | 297 | |
| 298 | 298 | |
| 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])); | |
| 302 | 302 | #endif |
| 303 | 303 | |
| 304 | 304 | // set up the window list |
| r243232 | r243233 | |
| 1018 | 1018 | |
| 1019 | 1019 | if (osd_event_wait(rendered_event, event_wait_ticks)) |
| 1020 | 1020 | { |
| 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 | } | |
| 1029 | 1029 | |
| 1030 | 1030 | // ensure the target bounds are up-to-date, and then get the primitives |
| 1031 | | |
| 1031 | set_target_bounds(this); | |
| 1032 | 1032 | |
| 1033 | 1033 | render_primitive_list &primlist = target->get_primitives(); |
| 1034 | 1034 |
| r243232 | r243233 | |
|---|---|---|
| 61 | 61 | m_fullscreen = !video_config.windowed; |
| 62 | 62 | prescale = video_config.prescale; |
| 63 | 63 | |
| 64 | windowed_width = config->width; | |
| 65 | windowed_height = config->height; | |
| 64 | windowed_width = config->width; | |
| 65 | windowed_height = config->height; | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | void video_window_update(running_machine &machine); |
| r243232 | r243233 | |
|---|---|---|
| 91 | 91 | // warning C4510: 'xxx' : default constructor could not be generated |
| 92 | 92 | // warning C4512: 'xxx' : assignment operator could not be generated |
| 93 | 93 | // 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' | |
| 95 | 95 | // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught |
| 96 | 96 | // warning C4610: struct 'xxx' can never be instantiated - user defined constructor required |
| 97 | 97 | // warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted |
| r243232 | r243233 | |
|---|---|---|
| 313 | 313 | |
| 314 | 314 | ifeq ($(CROSS_BUILD),1) |
| 315 | 315 | LDFLAGS += -static |
| 316 | endif | |
| 316 | endif | |
| 317 | 317 | |
| 318 | 318 | # TODO: needs to use $(CC) |
| 319 | 319 | TEST_GCC := $(shell gcc --version) |
| r243232 | r243233 | |
|---|---|---|
| 1702 | 1702 | report_error(1, "Invalid size string"); |
| 1703 | 1703 | } |
| 1704 | 1704 | } |
| 1705 | ||
| 1705 | ||
| 1706 | 1706 | // process compression |
| 1707 | 1707 | chd_codec_type compression[4]; |
| 1708 | 1708 | memcpy(compression, s_default_hd_compression, sizeof(compression)); |
| r243232 | r243233 | |
| 1757 | 1757 | if (sscanf(metadata, HARD_DISK_METADATA_FORMAT, &cylinders, &heads, §ors, §or_size) != 4) |
| 1758 | 1758 | report_error(1, "Error parsing hard disk metadata in parent CHD"); |
| 1759 | 1759 | } |
| 1760 | ||
| 1760 | ||
| 1761 | 1761 | // validate the size |
| 1762 | 1762 | if (filesize % sector_size != 0) |
| 1763 | 1763 | report_error(1, "Data size is not divisible by sector size %d", sector_size); |
| r243232 | r243233 | |
|---|---|---|
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | 90 | NETLIST_START(dummy) |
| 91 | ||
| 91 | /* Standard stuff */ | |
| 92 | 92 | |
| 93 | CLOCK(clk, 1000) // 1000 Hz | |
| 94 | SOLVER(Solver, 48000) | |
| 93 | CLOCK(clk, 1000) // 1000 Hz | |
| 94 | SOLVER(Solver, 48000) | |
| 95 | 95 | |
| 96 | 96 | NETLIST_END() |
| 97 | 97 | |
| r243232 | r243233 | |
| 172 | 172 | nl_util::pstring_list ll = nl_util::split(m_logs, ":"); |
| 173 | 173 | for (int i=0; i < ll.count(); i++) |
| 174 | 174 | { |
| 175 | ||
| 175 | pstring name = "log_" + ll[i]; | |
| 176 | 176 | /*netlist_device_t *nc = */ m_setup->register_dev("nld_log", name); |
| 177 | 177 | m_setup->register_link(name + ".I", ll[i]); |
| 178 | 178 | } |
| r243232 | r243233 | |
| 241 | 241 | nt.init(); |
| 242 | 242 | const netlist_factory_t::list_t &list = nt.setup().factory().list(); |
| 243 | 243 | |
| 244 | ||
| 244 | netlist_sources_t sources; | |
| 245 | 245 | |
| 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"); | |
| 248 | 248 | |
| 249 | 249 | nt.setup().start_devices(); |
| 250 | 250 | nt.setup().resolve_inputs(); |
| r243232 | r243233 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| 11 | #define BARE_BUILD_VERSION "0.15 | |
| 11 | #define BARE_BUILD_VERSION "0.158" | |
| 12 | 12 | |
| 13 | 13 | extern const char bare_build_version[]; |
| 14 | 14 | extern const char build_version[]; |
| https://github.com/mamedev/mame/commit/48a36e5241c92dafd03ba32792a1bbe4d82302bd |
| Previous | 199869 Revisions | Next |