trunk/src/mame/machine/pcecommn.c
r18035 | r18036 | |
4 | 4 | #include "video/vdc.h" |
5 | 5 | #include "cpu/h6280/h6280.h" |
6 | 6 | |
7 | | /* system RAM */ |
8 | | struct pce_struct pce; |
| 7 | #define TG_16_JOY_SIG 0x00 |
| 8 | #define PCE_JOY_SIG 0x40 |
| 9 | #define NO_CD_SIG 0x80 |
| 10 | #define CD_SIG 0x00 |
| 11 | /* these might be used to indicate something, but they always seem to return 1 */ |
| 12 | #define CONST_SIG 0x30 |
9 | 13 | |
10 | 14 | /* joystick related data*/ |
11 | | |
12 | 15 | #define JOY_CLOCK 0x01 |
13 | 16 | #define JOY_RESET 0x02 |
14 | 17 | |
15 | | static int joystick_port_select; /* internal index of joystick ports */ |
16 | | static int joystick_data_select; /* which nibble of joystick data we want */ |
17 | 18 | |
18 | | static UINT8 (*pce_joystick_readinputport_callback)(running_machine &) = NULL; |
19 | | |
20 | | void init_pce() { |
21 | | pce.io_port_options = PCE_JOY_SIG | CONST_SIG; |
22 | | } |
23 | | |
24 | | MACHINE_RESET( pce ) { |
25 | | } |
26 | | |
27 | 19 | /* todo: how many input ports does the PCE have? */ |
28 | | WRITE8_HANDLER ( pce_joystick_w ) |
| 20 | WRITE8_MEMBER(pce_common_state::pce_joystick_w) |
29 | 21 | { |
30 | 22 | h6280io_set_buffer(&space.device(), data); |
31 | 23 | /* bump counter on a low-to-high transition of bit 1 */ |
32 | | if((!joystick_data_select) && (data & JOY_CLOCK)) |
| 24 | if((!m_joystick_data_select) && (data & JOY_CLOCK)) |
33 | 25 | { |
34 | | joystick_port_select = (joystick_port_select + 1) & 0x07; |
| 26 | m_joystick_port_select = (m_joystick_port_select + 1) & 0x07; |
35 | 27 | } |
36 | 28 | |
37 | 29 | /* do we want buttons or direction? */ |
38 | | joystick_data_select = data & JOY_CLOCK; |
| 30 | m_joystick_data_select = data & JOY_CLOCK; |
39 | 31 | |
40 | 32 | /* clear counter if bit 2 is set */ |
41 | 33 | if(data & JOY_RESET) |
42 | 34 | { |
43 | | joystick_port_select = 0; |
| 35 | m_joystick_port_select = 0; |
44 | 36 | } |
45 | 37 | } |
46 | 38 | |
47 | | READ8_HANDLER ( pce_joystick_r ) |
| 39 | UINT8 pce_common_state::joy_read() |
48 | 40 | { |
49 | | UINT8 ret; |
50 | | int data; |
| 41 | return machine().root_device().ioport("JOY")->read(); |
| 42 | } |
51 | 43 | |
52 | | if ( pce_joystick_readinputport_callback != NULL ) |
53 | | { |
54 | | data = pce_joystick_readinputport_callback(space.machine()); |
55 | | } |
56 | | else |
57 | | { |
58 | | data = space.machine().root_device().ioport("JOY")->read(); |
59 | | } |
60 | | if(joystick_data_select) data >>= 4; |
61 | | ret = (data & 0x0F) | pce.io_port_options; |
| 44 | READ8_MEMBER(pce_common_state::pce_joystick_r) |
| 45 | { |
| 46 | UINT8 ret; |
| 47 | int data = joy_read(); |
| 48 | if (m_joystick_data_select) data >>= 4; |
| 49 | ret = (data & 0x0F) | m_io_port_options; |
62 | 50 | #ifdef UNIFIED_PCE |
63 | 51 | ret &= ~0x40; |
64 | 52 | #endif |
65 | 53 | return (ret); |
66 | 54 | } |
67 | 55 | |
68 | | void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(running_machine &)) |
| 56 | DRIVER_INIT_MEMBER(pce_common_state,pce_common) |
69 | 57 | { |
70 | | pce_joystick_readinputport_callback = joy_read; |
| 58 | m_io_port_options = PCE_JOY_SIG | CONST_SIG; |
71 | 59 | } |
| 60 | |
trunk/src/mame/drivers/tourvis.c
r18035 | r18036 | |
187 | 187 | #include "machine/i8155.h" |
188 | 188 | |
189 | 189 | |
190 | | class tourvision_state : public driver_device |
| 190 | class tourvision_state : public pce_common_state |
191 | 191 | { |
192 | 192 | public: |
193 | 193 | tourvision_state(const machine_config &mconfig, device_type type, const char *tag) |
194 | | : driver_device(mconfig, type, tag) { } |
| 194 | : pce_common_state(mconfig, type, tag) { } |
195 | 195 | |
196 | 196 | DECLARE_WRITE8_MEMBER(tourvision_8085_d000_w); |
197 | 197 | DECLARE_WRITE8_MEMBER(tourvision_i8155_a_w); |
198 | 198 | DECLARE_WRITE8_MEMBER(tourvision_i8155_b_w); |
199 | 199 | DECLARE_WRITE8_MEMBER(tourvision_i8155_c_w); |
200 | 200 | DECLARE_WRITE_LINE_MEMBER(tourvision_timer_out); |
201 | | DECLARE_DRIVER_INIT(tourvision); |
202 | 201 | }; |
203 | 202 | |
204 | 203 | |
r18035 | r18036 | |
285 | 284 | AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE_LEGACY(vce_r, vce_w ) |
286 | 285 | AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE_LEGACY("c6280", c6280_r, c6280_w ) |
287 | 286 | AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE_LEGACY(h6280_timer_r, h6280_timer_w ) |
288 | | AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE_LEGACY(pce_joystick_r, pce_joystick_w ) |
| 287 | AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(pce_joystick_r, pce_joystick_w ) |
289 | 288 | AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE_LEGACY(h6280_irq_status_r, h6280_irq_status_w ) |
290 | 289 | ADDRESS_MAP_END |
291 | 290 | |
r18035 | r18036 | |
513 | 512 | TOURVISION_BIOS |
514 | 513 | ROM_END |
515 | 514 | |
516 | | |
517 | | DRIVER_INIT_MEMBER(tourvision_state,tourvision) |
518 | | { |
519 | | init_pce(); |
520 | | } |
521 | | |
522 | | GAME( 19??, tourvis, 0, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision)", "Tourvision PCE bootleg", GAME_IS_BIOS_ROOT | GAME_NOT_WORKING ) |
523 | | GAME( 1988, tvlegaxe, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Makyo Densetsu - The Legenary Axe (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
524 | | GAME( 1989, tvusapb, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Aicom", "USA Pro Basketball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
525 | | GAME( 1989, tvdunexp, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Hudson / Atlus", "Dungeon Explorer (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
526 | | GAME( 1990, tvthbld, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Sega / NEC Avenue", "Thunder Blade (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
527 | | GAME( 1990, tvrs2, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Taito", "Rastan Saga II (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
528 | | GAME( 1990, tvsvball, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Video System", "Super Volley ball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
529 | | GAME( 1991, tvpwlg4, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Hudson", "Power League IV (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
530 | | GAME( 1991, tvsci, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Taito", "Special Criminal Investigation (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 515 | GAME( 19??, tourvis, 0, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision)", "Tourvision PCE bootleg", GAME_IS_BIOS_ROOT | GAME_NOT_WORKING ) |
| 516 | GAME( 1988, tvlegaxe, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Makyo Densetsu - The Legenary Axe (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 517 | GAME( 1989, tvusapb, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Aicom", "USA Pro Basketball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 518 | GAME( 1989, tvdunexp, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson / Atlus", "Dungeon Explorer (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 519 | GAME( 1990, tvthbld, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Sega / NEC Avenue", "Thunder Blade (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 520 | GAME( 1990, tvrs2, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito", "Rastan Saga II (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 521 | GAME( 1990, tvsvball, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Video System", "Super Volley ball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 522 | GAME( 1991, tvpwlg4, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson", "Power League IV (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 523 | GAME( 1991, tvsci, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito", "Special Criminal Investigation (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
trunk/src/mame/drivers/paranoia.c
r18035 | r18036 | |
43 | 43 | #include "sound/c6280.h" |
44 | 44 | |
45 | 45 | |
46 | | class paranoia_state : public driver_device |
| 46 | class paranoia_state : public pce_common_state |
47 | 47 | { |
48 | 48 | public: |
49 | 49 | paranoia_state(const machine_config &mconfig, device_type type, const char *tag) |
50 | | : driver_device(mconfig, type, tag) { } |
| 50 | : pce_common_state(mconfig, type, tag) { } |
51 | 51 | |
52 | 52 | DECLARE_WRITE8_MEMBER(paranoia_8085_d000_w); |
53 | 53 | DECLARE_READ8_MEMBER(paranoia_z80_io_01_r); |
r18035 | r18036 | |
58 | 58 | DECLARE_WRITE8_MEMBER(paranoia_i8155_b_w); |
59 | 59 | DECLARE_WRITE8_MEMBER(paranoia_i8155_c_w); |
60 | 60 | DECLARE_WRITE_LINE_MEMBER(paranoia_i8155_timer_out); |
61 | | DECLARE_DRIVER_INIT(paranoia); |
62 | 61 | }; |
63 | 62 | |
64 | 63 | |
r18035 | r18036 | |
81 | 80 | AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE_LEGACY(vce_r, vce_w ) |
82 | 81 | AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE_LEGACY("c6280", c6280_r, c6280_w ) |
83 | 82 | AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE_LEGACY(h6280_timer_r, h6280_timer_w ) |
84 | | AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE_LEGACY(pce_joystick_r, pce_joystick_w ) |
| 83 | AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(pce_joystick_r, pce_joystick_w ) |
85 | 84 | AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE_LEGACY(h6280_irq_status_r, h6280_irq_status_w ) |
86 | 85 | ADDRESS_MAP_END |
87 | 86 | |
r18035 | r18036 | |
228 | 227 | ROM_LOAD( "4.352", 0x18000, 0x8000, CRC(11297fed) SHA1(17a294e65ba1c4806307602dee4c7c627ad1fcfd) ) |
229 | 228 | ROM_END |
230 | 229 | |
231 | | DRIVER_INIT_MEMBER(paranoia_state,paranoia) |
232 | | { |
233 | | init_pce(); |
234 | | } |
235 | | |
236 | | GAME( 1990, paranoia, 0, paranoia, paranoia, paranoia_state, paranoia, ROT0, "Naxat Soft", "Paranoia", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 230 | GAME( 1990, paranoia, 0, paranoia, paranoia, pce_common_state, pce_common, ROT0, "Naxat Soft", "Paranoia", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
trunk/src/mame/drivers/uapce.c
r18035 | r18036 | |
99 | 99 | #include "sound/discrete.h" |
100 | 100 | |
101 | 101 | |
102 | | class uapce_state : public driver_device |
| 102 | class uapce_state : public pce_common_state |
103 | 103 | { |
104 | 104 | public: |
105 | 105 | uapce_state(const machine_config &mconfig, device_type type, const char *tag) |
106 | | : driver_device(mconfig, type, tag) { } |
| 106 | : pce_common_state(mconfig, type, tag) { } |
107 | 107 | |
108 | 108 | UINT8 m_jamma_if_control_latch; |
109 | 109 | DECLARE_WRITE8_MEMBER(jamma_if_control_latch_w); |
110 | 110 | DECLARE_READ8_MEMBER(jamma_if_control_latch_r); |
111 | 111 | DECLARE_READ8_MEMBER(jamma_if_read_dsw); |
112 | | DECLARE_DRIVER_INIT(uapce); |
| 112 | virtual UINT8 joy_read(); |
113 | 113 | virtual void machine_reset(); |
114 | 114 | }; |
115 | 115 | |
r18035 | r18036 | |
213 | 213 | return dsw_val & 1; |
214 | 214 | } |
215 | 215 | |
216 | | static UINT8 jamma_if_read_joystick( running_machine &machine ) |
| 216 | UINT8 uapce_state::joy_read() |
217 | 217 | { |
218 | | uapce_state *state = machine.driver_data<uapce_state>(); |
219 | | if ( state->m_jamma_if_control_latch & 0x10 ) |
| 218 | if ( m_jamma_if_control_latch & 0x10 ) |
220 | 219 | { |
221 | | return state->ioport("JOY" )->read(); |
| 220 | return ioport("JOY" )->read(); |
222 | 221 | } |
223 | 222 | else |
224 | 223 | { |
225 | | return machine.root_device().ioport("JOY" )->read() | 0x08; |
| 224 | return machine().root_device().ioport("JOY" )->read() | 0x08; |
226 | 225 | } |
227 | 226 | } |
228 | 227 | |
229 | 228 | void uapce_state::machine_reset() |
230 | 229 | { |
231 | | pce_set_joystick_readinputport_callback( jamma_if_read_joystick ); |
232 | 230 | m_jamma_if_control_latch = 0; |
233 | 231 | } |
234 | 232 | |
r18035 | r18036 | |
290 | 288 | AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE_LEGACY(vce_r, vce_w ) |
291 | 289 | AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE_LEGACY("c6280", c6280_r, c6280_w ) |
292 | 290 | AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE_LEGACY(h6280_timer_r, h6280_timer_w ) |
293 | | AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE_LEGACY(pce_joystick_r, pce_joystick_w ) |
| 291 | AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(pce_joystick_r, pce_joystick_w ) |
294 | 292 | AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE_LEGACY(h6280_irq_status_r, h6280_irq_status_w ) |
295 | 293 | ADDRESS_MAP_END |
296 | 294 | |
r18035 | r18036 | |
374 | 372 | ROM_LOAD( "u1.bin", 0x0000, 0x800, CRC(f5e538a9) SHA1(19ac9525c9ad6bea1789cc9e63cdb7fe949867d9) ) |
375 | 373 | ROM_END |
376 | 374 | |
377 | | DRIVER_INIT_MEMBER(uapce_state,uapce) |
378 | | { |
379 | | init_pce(); |
380 | | } |
381 | | |
382 | | GAME( 1989, blazlaz, 0, uapce, uapce, uapce_state, uapce, ROT0, "Hudson Soft", "Blazing Lazers", GAME_IMPERFECT_SOUND ) |
383 | | GAME( 1989, keith, 0, uapce, uapce, uapce_state, uapce, ROT0, "Hudson Soft", "Keith Courage In Alpha Zones", GAME_IMPERFECT_SOUND ) |
384 | | GAME( 1989, aliencr, 0, uapce, uapce, uapce_state, uapce, ROT0, "Hudson Soft", "Alien Crush", GAME_IMPERFECT_SOUND ) |
385 | | GAME( 1989, paclandp,0, uapce, uapce, uapce_state, uapce, ROT0, "Namco", "Pac-Land (United Amusements PC Engine)", GAME_IMPERFECT_SOUND ) |
| 375 | GAME( 1989, blazlaz, 0, uapce, uapce, pce_common_state, pce_common, ROT0, "Hudson Soft", "Blazing Lazers", GAME_IMPERFECT_SOUND ) |
| 376 | GAME( 1989, keith, 0, uapce, uapce, pce_common_state, pce_common, ROT0, "Hudson Soft", "Keith Courage In Alpha Zones", GAME_IMPERFECT_SOUND ) |
| 377 | GAME( 1989, aliencr, 0, uapce, uapce, pce_common_state, pce_common, ROT0, "Hudson Soft", "Alien Crush", GAME_IMPERFECT_SOUND ) |
| 378 | GAME( 1989, paclandp,0, uapce, uapce, pce_common_state, pce_common, ROT0, "Namco", "Pac-Land (United Amusements PC Engine)", GAME_IMPERFECT_SOUND ) |