Skip to content

Commit 13d072a

Browse files
committed
-pc/tc_t1t.cpp: Fixed some (but not all) hard-coded assumptions:
* Made character generator ROM tag configurable, use an object finder to access it. * Made PCjr vblank output a configurable callback rather than hardcoding connection to 8259. -pc/tandy1t.cpp: Use a memory bank for BIOS banking rather than an address map bank device. -capcom/cps1.cpp: Use three buttons per player for Final Fight (MT09294). The third button connection is always wired on the CPS-1 mainboard and does work in the game, even if it's an undocumented easter egg. In many cases, the board sets were installed in generic JAMMA cabinets with standard stick plus three buttons control panels, allowing players to use the third button.
1 parent 202ceab commit 13d072a

File tree

5 files changed

+214
-200
lines changed

5 files changed

+214
-200
lines changed

src/mame/capcom/cps1.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,16 +1612,7 @@ INPUT_PORTS_END
16121612
('Ctrl') or "P1 Button 2" ('Alt') during the bootup test. Button 1 will load the Scroll (Background) test,
16131613
and Button 2 will load an Obj (Sprite) viewer. */
16141614
static INPUT_PORTS_START( ffight )
1615-
PORT_INCLUDE( cps1_2b )
1616-
1617-
#if 0
1618-
/* The button below is not officially documented and does not exist on the control panel, probably a leftover.
1619-
Pressing it will allow you to escape from grabs and choke holds instantly. */
1620-
1621-
PORT_MODIFY("IN1")
1622-
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME ("P1 Button 3 (Cheat)")
1623-
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME ("P2 Button 3 (Cheat)")
1624-
#endif
1615+
PORT_INCLUDE( cps1_3b )
16251616

16261617
PORT_START("DSWA")
16271618
CPS1_COINAGE_1( "SW(A)" )

src/mame/pc/ibmpcjr.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// copyright-holders:Wilbert Pol
33
#include "emu.h"
44

5+
#include "pc_t1t.h"
6+
57
#include "cpu/i86/i86.h"
68
#include "imagedev/cassette.h"
79
#include "machine/i8255.h"
@@ -13,7 +15,6 @@
1315
#include "machine/ram.h"
1416
#include "sound/sn76496.h"
1517
#include "sound/spkrdev.h"
16-
#include "pc_t1t.h"
1718

1819
#include "bus/generic/carts.h"
1920
#include "bus/generic/slot.h"
@@ -636,7 +637,10 @@ void pcjr_state::ibmpcjr(machine_config &config)
636637
serport.cts_handler().set("ins8250", FUNC(ins8250_uart_device::cts_w));
637638

638639
/* video hardware */
639-
PCVIDEO_PCJR(config, "pcvideo_pcjr", 0).set_screen("pcvideo_pcjr:screen");
640+
auto &video(PCVIDEO_PCJR(config, "pcvideo_pcjr", 0));
641+
video.set_screen("pcvideo_pcjr:screen");
642+
video.set_chr_gen_tag("gfx1");
643+
video.vsync_callback().set(m_pic8259, FUNC(pic8259_device::ir5_w));
640644

641645
GFXDECODE(config, "gfxdecode", "pcvideo_pcjr:palette", gfx_pcjr);
642646

src/mame/pc/pc_t1t.cpp

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,45 +36,50 @@ DEFINE_DEVICE_TYPE(PCVIDEO_PCJR, pcvideo_pcjr_device, "pcjr_graphics", "
3636
pc_t1t_device::pc_t1t_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
3737
device_t(mconfig, type, tag, owner, clock),
3838
device_video_interface(mconfig, *this),
39-
m_mc6845(*this, T1000_MC6845_NAME),
39+
m_chr_gen(*this, finder_base::DUMMY_TAG),
40+
m_mc6845(*this, "mc6845_t1000"),
41+
m_palette(*this,"palette"),
42+
m_ram(*this, ":" RAM_TAG),
43+
m_vram(*this, "vram"),
4044
m_mode_control(0),
4145
m_color_select(0),
4246
m_status(0),
4347
m_bank(0),
4448
m_pc_framecnt(0),
4549
m_displayram(nullptr),
46-
m_chr_gen(nullptr),
4750
m_chr_size(0),
4851
m_ra_offset(0),
4952
m_address_data_ff(0),
5053
m_update_row_type(-1),
5154
m_display_enable(0),
5255
m_vsync(0),
53-
m_palette_base(0),
54-
m_palette(*this,"palette"),
55-
m_ram(*this, ":" RAM_TAG),
56-
m_vram(*this, "vram")
56+
m_palette_base(0)
5757
{
5858
}
5959

60-
pcvideo_t1000_device::pcvideo_t1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
61-
: pc_t1t_device(mconfig, PCVIDEO_T1000, tag, owner, clock)
60+
pcvideo_t1000_device::pcvideo_t1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
61+
pc_t1t_device(mconfig, PCVIDEO_T1000, tag, owner, clock)
6262
{
6363
}
6464

65-
pcvideo_pcjr_device::pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
66-
: pc_t1t_device(mconfig, PCVIDEO_PCJR, tag, owner, clock),
67-
m_pic8259(*this, ":pic8259"),
65+
pcvideo_pcjr_device::pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
66+
pc_t1t_device(mconfig, PCVIDEO_PCJR, tag, owner, clock),
67+
m_vsync_cb(*this),
6868
m_jxkanji(nullptr)
6969
{
7070
}
7171

7272

73-
void pcvideo_t1000_device::device_start()
73+
void pc_t1t_device::device_start()
7474
{
75-
if(!m_ram->started())
75+
if (!m_ram->started())
7676
throw device_missing_dependencies();
77-
m_chr_gen = machine().root_device().memregion("gfx1")->base();
77+
}
78+
79+
void pcvideo_t1000_device::device_start()
80+
{
81+
pc_t1t_device::device_start();
82+
7883
m_bank = 0;
7984
m_chr_size = 1;
8085
m_ra_offset = 256;
@@ -84,9 +89,8 @@ void pcvideo_t1000_device::device_start()
8489

8590
void pcvideo_pcjr_device::device_start()
8691
{
87-
if(!m_ram->started())
88-
throw device_missing_dependencies();
89-
m_chr_gen = machine().root_device().memregion("gfx1")->base();
92+
pc_t1t_device::device_start();
93+
9094
m_bank = 0;
9195
m_mode_control = 0x08;
9296
m_chr_size = 8;
@@ -120,7 +124,7 @@ void pcvideo_t1000_device::device_add_mconfig(machine_config &config)
120124
{
121125
screen_device &screen(SCREEN(config, T1000_SCREEN_NAME, SCREEN_TYPE_RASTER));
122126
screen.set_raw(XTAL(14'318'181),912,0,640,262,0,200);
123-
screen.set_screen_update(T1000_MC6845_NAME, FUNC(mc6845_device::screen_update));
127+
screen.set_screen_update(m_mc6845, FUNC(mc6845_device::screen_update));
124128

125129
PALETTE(config, m_palette, FUNC(pcvideo_t1000_device::pcjr_palette), 32);
126130

@@ -140,7 +144,7 @@ void pcvideo_pcjr_device::device_add_mconfig(machine_config &config)
140144
{
141145
screen_device &screen(SCREEN(config, T1000_SCREEN_NAME, SCREEN_TYPE_RASTER));
142146
screen.set_raw(XTAL(14'318'181), 912, 0, 640, 262, 0, 200);
143-
screen.set_screen_update(T1000_MC6845_NAME, FUNC(mc6845_device::screen_update));
147+
screen.set_screen_update(m_mc6845, FUNC(mc6845_device::screen_update));
144148

145149
PALETTE(config, m_palette, FUNC(pcvideo_pcjr_device::pcjr_palette), 32);
146150

@@ -194,7 +198,7 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row )
194198
uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff;
195199
uint8_t chr = m_displayram[ offset ];
196200
uint8_t attr = m_displayram[ offset +1 ];
197-
uint8_t data = m_chr_gen[ chr * m_chr_size + ra * m_ra_offset ];
201+
uint8_t data = m_chr_gen[chr * m_chr_size + ra * m_ra_offset];
198202
uint16_t fg = m_palette_base + ( attr & 0x0F );
199203
uint16_t bg = m_palette_base + ( ( attr >> 4 ) & 0x07 );
200204

@@ -225,7 +229,7 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row )
225229
uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff;
226230
uint8_t chr = m_displayram[ offset ];
227231
uint8_t attr = m_displayram[ offset +1 ];
228-
uint8_t data = m_chr_gen[ chr * m_chr_size + ra * m_ra_offset ];
232+
uint8_t data = m_chr_gen[chr * m_chr_size + ra * m_ra_offset];
229233
uint16_t fg = m_palette_base + ( attr & 0x0F );
230234
uint16_t bg = m_palette_base + ( ( attr >> 4 ) & 0x07 );
231235

@@ -929,7 +933,7 @@ void pcvideo_pcjr_device::write(offs_t offset, uint8_t data)
929933
case 12:
930934
break;
931935
case 15:
932-
if(m_jxkanji)
936+
if (m_jxkanji)
933937
pc_pcjx_bank_w(data);
934938
else
935939
pc_pcjr_bank_w(data);
@@ -943,9 +947,9 @@ void pcvideo_pcjr_device::write(offs_t offset, uint8_t data)
943947

944948
uint8_t pc_t1t_device::read(offs_t offset)
945949
{
946-
int data = 0xff;
950+
int data = 0xff;
947951

948-
switch( offset )
952+
switch (offset)
949953
{
950954
case 0: case 2: case 4: case 6:
951955
/* return last written mc6845 address value here? */
@@ -1002,15 +1006,15 @@ void pcvideo_pcjr_device::de_changed(int state)
10021006
void pcvideo_t1000_device::t1000_vsync_changed(int state)
10031007
{
10041008
m_vsync = state ? 8 : 0;
1005-
if ( state )
1009+
if (state)
10061010
{
10071011
m_pc_framecnt++;
10081012
}
10091013
}
10101014

10111015
void pcvideo_t1000_device::disable_w(int state)
10121016
{
1013-
if(state)
1017+
if (state)
10141018
m_vram->set_bank(8);
10151019
else
10161020
bank_w(m_bank);
@@ -1020,9 +1024,9 @@ void pcvideo_t1000_device::disable_w(int state)
10201024
void pcvideo_pcjr_device::pcjr_vsync_changed(int state)
10211025
{
10221026
m_vsync = state ? 8 : 0;
1023-
if ( state )
1027+
if (state)
10241028
{
10251029
m_pc_framecnt++;
10261030
}
1027-
m_pic8259->ir5_w(state);
1031+
m_vsync_cb(state);
10281032
}

src/mame/pc/pc_t1t.h

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55

66
#pragma once
77

8-
#include "video/mc6845.h"
9-
#include "machine/ram.h"
108
#include "machine/bankdev.h"
119
#include "machine/pic8259.h"
10+
#include "machine/ram.h"
11+
#include "video/mc6845.h"
12+
1213
#include "emupal.h"
1314

1415
#define T1000_SCREEN_NAME "screen"
15-
#define T1000_MC6845_NAME "mc6845_t1000"
1616

1717
class pc_t1t_device : public device_t, public device_video_interface
1818
{
1919
public:
20+
// configuration
21+
template <typename T> pc_t1t_device &set_chr_gen_tag(T &&tag) { m_chr_gen.set_tag(std::forward<T>(tag)); return *this; }
22+
2023
void t1000_de_changed(int state);
2124
uint8_t read(offs_t offset);
2225

@@ -55,28 +58,7 @@ class pc_t1t_device : public device_t, public device_video_interface
5558
// construction/destruction
5659
pc_t1t_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
5760

58-
required_device<mc6845_device> m_mc6845;
59-
uint8_t m_mode_control, m_color_select;
60-
uint8_t m_status;
61-
62-
struct reg m_reg;
63-
64-
uint16_t m_bank;
65-
66-
int m_pc_framecnt;
67-
68-
uint8_t *m_displayram;
69-
70-
uint8_t *m_chr_gen;
71-
uint8_t m_chr_size;
72-
uint16_t m_ra_offset;
73-
74-
uint8_t m_address_data_ff;
75-
76-
int m_update_row_type;
77-
uint8_t m_display_enable;
78-
uint8_t m_vsync;
79-
uint8_t m_palette_base;
61+
virtual void device_start() override ATTR_COLD;
8062

8163
void pcjr_palette(palette_device &palette) const;
8264

@@ -89,9 +71,32 @@ class pc_t1t_device : public device_t, public device_video_interface
8971
int vga_data_r();
9072
int bank_r();
9173

74+
required_region_ptr<uint8_t> m_chr_gen;
75+
required_device<mc6845_device> m_mc6845;
9276
required_device<palette_device> m_palette;
9377
required_device<ram_device> m_ram;
9478
required_device<address_map_bank_device> m_vram;
79+
80+
uint8_t m_mode_control, m_color_select;
81+
uint8_t m_status;
82+
83+
struct reg m_reg;
84+
85+
uint16_t m_bank;
86+
87+
int m_pc_framecnt;
88+
89+
uint8_t *m_displayram;
90+
91+
uint8_t m_chr_size;
92+
uint16_t m_ra_offset;
93+
94+
uint8_t m_address_data_ff;
95+
96+
int m_update_row_type;
97+
uint8_t m_display_enable;
98+
uint8_t m_vsync;
99+
uint8_t m_palette_base;
95100
};
96101

97102
class pcvideo_t1000_device : public pc_t1t_device
@@ -125,6 +130,9 @@ class pcvideo_pcjr_device : public pc_t1t_device
125130
// construction/destruction
126131
pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
127132

133+
// configuration
134+
auto vsync_callback() { return m_vsync_cb.bind(); }
135+
128136
void write(offs_t offset, uint8_t data);
129137

130138
void de_changed(int state);
@@ -135,8 +143,8 @@ class pcvideo_pcjr_device : public pc_t1t_device
135143
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
136144
virtual void device_start() override ATTR_COLD;
137145

138-
required_device<pic8259_device> m_pic8259;
139-
uint8_t *m_jxkanji;
146+
devcb_write_line m_vsync_cb;
147+
const uint8_t *m_jxkanji;
140148

141149
private:
142150
void pc_pcjr_mode_switch();

0 commit comments

Comments
 (0)