trunk/src/mame/drivers/tryout.c
r244731 | r244732 | |
25 | 25 | #include "sound/2203intf.h" |
26 | 26 | #include "includes/tryout.h" |
27 | 27 | |
28 | | WRITE8_MEMBER(tryout_state::tryout_nmi_ack_w) |
| 28 | WRITE8_MEMBER(tryout_state::nmi_ack_w) |
29 | 29 | { |
30 | 30 | m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE ); |
31 | 31 | } |
32 | 32 | |
33 | | WRITE8_MEMBER(tryout_state::tryout_sound_w) |
| 33 | WRITE8_MEMBER(tryout_state::sound_w) |
34 | 34 | { |
35 | 35 | soundlatch_byte_w(space, 0, data); |
36 | 36 | m_audiocpu->set_input_line(0, HOLD_LINE); |
r244731 | r244732 | |
38 | 38 | |
39 | 39 | /*this is actually irq/nmi mask, polls only four values at start up (81->01->81->01) and then |
40 | 40 | stays on this state.*/ |
41 | | WRITE8_MEMBER(tryout_state::tryout_sound_irq_ack_w) |
| 41 | WRITE8_MEMBER(tryout_state::sound_irq_ack_w) |
42 | 42 | { |
43 | 43 | // m_audiocpu->set_input_line(0, CLEAR_LINE); |
44 | 44 | } |
r244731 | r244732 | |
48 | 48 | membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x2000); |
49 | 49 | } |
50 | 50 | |
51 | | WRITE8_MEMBER(tryout_state::tryout_bankswitch_w) |
| 51 | WRITE8_MEMBER(tryout_state::bankswitch_w) |
52 | 52 | { |
53 | 53 | membank("bank1")->set_entry(data & 0x01); |
54 | 54 | } |
55 | 55 | |
56 | 56 | static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, tryout_state ) |
57 | 57 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
58 | | AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(tryout_videoram_w) AM_SHARE("videoram") |
| 58 | AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") |
59 | 59 | AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank1") |
60 | 60 | AM_RANGE(0x4000, 0xbfff) AM_ROM |
61 | 61 | AM_RANGE(0xc800, 0xc87f) AM_RAM AM_SHARE("spriteram") |
62 | 62 | AM_RANGE(0xcc00, 0xcc7f) AM_RAM AM_SHARE("spriteram2") |
63 | | AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tryout_vram_r, tryout_vram_w) |
| 63 | AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(vram_w) AM_SHARE("vram") |
64 | 64 | AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSW") |
65 | 65 | AM_RANGE(0xe001, 0xe001) AM_READ_PORT("P1") |
66 | 66 | AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2") |
67 | 67 | AM_RANGE(0xe003, 0xe003) AM_READ_PORT("SYSTEM") |
68 | | AM_RANGE(0xe301, 0xe301) AM_WRITE(tryout_flipscreen_w) |
69 | | AM_RANGE(0xe302, 0xe302) AM_WRITE(tryout_bankswitch_w) |
70 | | AM_RANGE(0xe401, 0xe401) AM_WRITE(tryout_vram_bankswitch_w) |
| 68 | AM_RANGE(0xe301, 0xe301) AM_WRITE(flipscreen_w) |
| 69 | AM_RANGE(0xe302, 0xe302) AM_WRITE(bankswitch_w) |
| 70 | AM_RANGE(0xe401, 0xe401) AM_WRITE(vram_bankswitch_w) |
71 | 71 | AM_RANGE(0xe402, 0xe404) AM_WRITEONLY AM_SHARE("gfx_control") |
72 | | AM_RANGE(0xe414, 0xe414) AM_WRITE(tryout_sound_w) |
73 | | AM_RANGE(0xe417, 0xe417) AM_WRITE(tryout_nmi_ack_w) |
| 72 | AM_RANGE(0xe414, 0xe414) AM_WRITE(sound_w) |
| 73 | AM_RANGE(0xe417, 0xe417) AM_WRITE(nmi_ack_w) |
74 | 74 | AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("maincpu", 0xbff0) /* reset vectors */ |
75 | 75 | ADDRESS_MAP_END |
76 | 76 | |
r244731 | r244732 | |
78 | 78 | AM_RANGE(0x0000, 0x07ff) AM_RAM |
79 | 79 | AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) |
80 | 80 | AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r) |
81 | | AM_RANGE(0xd000, 0xd000) AM_WRITE(tryout_sound_irq_ack_w) |
| 81 | AM_RANGE(0xd000, 0xd000) AM_WRITE(sound_irq_ack_w) |
82 | 82 | AM_RANGE(0xc000, 0xffff) AM_ROM |
83 | 83 | ADDRESS_MAP_END |
84 | 84 | |
r244731 | r244732 | |
137 | 137 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
138 | 138 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) |
139 | 139 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2) |
140 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state,coin_inserted, 0) |
141 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state,coin_inserted, 0) |
| 140 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state, coin_inserted, 0) |
| 141 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state, coin_inserted, 0) |
142 | 142 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
143 | 143 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
144 | 144 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") |
r244731 | r244732 | |
201 | 201 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
202 | 202 | MCFG_SCREEN_SIZE(256, 256) |
203 | 203 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) |
204 | | MCFG_SCREEN_UPDATE_DRIVER(tryout_state, screen_update_tryout) |
| 204 | MCFG_SCREEN_UPDATE_DRIVER(tryout_state, screen_update) |
205 | 205 | MCFG_SCREEN_PALETTE("palette") |
206 | 206 | |
207 | 207 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", tryout) |
r244731 | r244732 | |
242 | 242 | ROM_LOAD( "ch14.bpr", 0x00000, 0x0020, CRC(8ce19925) SHA1(12f8f6022f1148b6ba1d019a34247452637063a7) ) |
243 | 243 | ROM_END |
244 | 244 | |
245 | | GAME( 1985, tryout, 0, tryout, tryout, driver_device, 0, ROT90, "Data East Corporation", "Pro Baseball Skill Tryout (Japan)", GAME_NO_COCKTAIL ) |
| 245 | GAME( 1985, tryout, 0, tryout, tryout, driver_device, 0, ROT90, "Data East Corporation", "Pro Baseball Skill Tryout (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/tryout.h
r244731 | r244732 | |
3 | 3 | public: |
4 | 4 | tryout_state(const machine_config &mconfig, device_type type, const char *tag) |
5 | 5 | : driver_device(mconfig, type, tag), |
| 6 | m_maincpu(*this, "maincpu"), |
| 7 | m_audiocpu(*this, "audiocpu"), |
| 8 | m_gfxdecode(*this, "gfxdecode"), |
| 9 | m_palette(*this, "palette"), |
6 | 10 | m_videoram(*this, "videoram"), |
7 | 11 | m_spriteram(*this, "spriteram"), |
8 | 12 | m_spriteram2(*this, "spriteram2"), |
9 | 13 | m_gfx_control(*this, "gfx_control"), |
10 | | m_maincpu(*this, "maincpu"), |
11 | | m_audiocpu(*this, "audiocpu"), |
12 | | m_gfxdecode(*this, "gfxdecode"), |
13 | | m_palette(*this, "palette") { } |
| 14 | m_vram(*this, "vram") { } |
14 | 15 | |
| 16 | required_device<cpu_device> m_maincpu; |
| 17 | required_device<cpu_device> m_audiocpu; |
| 18 | required_device<gfxdecode_device> m_gfxdecode; |
| 19 | required_device<palette_device> m_palette; |
| 20 | |
15 | 21 | required_shared_ptr<UINT8> m_videoram; |
16 | 22 | required_shared_ptr<UINT8> m_spriteram; |
17 | 23 | required_shared_ptr<UINT8> m_spriteram2; |
18 | 24 | required_shared_ptr<UINT8> m_gfx_control; |
| 25 | required_shared_ptr<UINT8> m_vram; |
19 | 26 | |
20 | 27 | tilemap_t *m_fg_tilemap; |
21 | 28 | tilemap_t *m_bg_tilemap; |
22 | 29 | UINT8 m_vram_bank; |
23 | | UINT8 *m_vram; |
24 | 30 | UINT8 *m_vram_gfx; |
25 | | DECLARE_WRITE8_MEMBER(tryout_nmi_ack_w); |
26 | | DECLARE_WRITE8_MEMBER(tryout_sound_w); |
27 | | DECLARE_WRITE8_MEMBER(tryout_sound_irq_ack_w); |
28 | | DECLARE_WRITE8_MEMBER(tryout_bankswitch_w); |
29 | | DECLARE_READ8_MEMBER(tryout_vram_r); |
30 | | DECLARE_WRITE8_MEMBER(tryout_videoram_w); |
31 | | DECLARE_WRITE8_MEMBER(tryout_vram_w); |
32 | | DECLARE_WRITE8_MEMBER(tryout_vram_bankswitch_w); |
33 | | DECLARE_WRITE8_MEMBER(tryout_flipscreen_w); |
| 31 | |
| 32 | DECLARE_WRITE8_MEMBER(nmi_ack_w); |
| 33 | DECLARE_WRITE8_MEMBER(sound_w); |
| 34 | DECLARE_WRITE8_MEMBER(sound_irq_ack_w); |
| 35 | DECLARE_WRITE8_MEMBER(bankswitch_w); |
| 36 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 37 | DECLARE_WRITE8_MEMBER(vram_w); |
| 38 | DECLARE_WRITE8_MEMBER(vram_bankswitch_w); |
| 39 | DECLARE_WRITE8_MEMBER(flipscreen_w); |
| 40 | |
34 | 41 | DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); |
| 42 | |
35 | 43 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
36 | 44 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
37 | 45 | TILEMAP_MAPPER_MEMBER(get_fg_memory_offset); |
38 | 46 | TILEMAP_MAPPER_MEMBER(get_bg_memory_offset); |
| 47 | |
39 | 48 | virtual void machine_start(); |
40 | 49 | virtual void video_start(); |
41 | 50 | DECLARE_PALETTE_INIT(tryout); |
42 | | UINT32 screen_update_tryout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 51 | |
| 52 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
43 | 53 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); |
44 | | required_device<cpu_device> m_maincpu; |
45 | | required_device<cpu_device> m_audiocpu; |
46 | | required_device<gfxdecode_device> m_gfxdecode; |
47 | | required_device<palette_device> m_palette; |
48 | 54 | }; |
trunk/src/mame/video/tryout.c
r244731 | r244732 | |
12 | 12 | PALETTE_INIT_MEMBER(tryout_state, tryout) |
13 | 13 | { |
14 | 14 | const UINT8 *color_prom = memregion("proms")->base(); |
15 | | int i; |
16 | | |
17 | | for (i = 0;i < palette.entries();i++) |
| 15 | |
| 16 | for (int i = 0;i < palette.entries();i++) |
18 | 17 | { |
19 | 18 | int bit0,bit1,bit2,r,g,b; |
20 | 19 | |
r244731 | r244732 | |
40 | 39 | |
41 | 40 | TILE_GET_INFO_MEMBER(tryout_state::get_fg_tile_info) |
42 | 41 | { |
43 | | UINT8 *videoram = m_videoram; |
44 | | int code, attr, color; |
45 | | |
46 | | code = videoram[tile_index]; |
47 | | attr = videoram[tile_index + 0x400]; |
| 42 | int code = m_videoram[tile_index]; |
| 43 | int attr = m_videoram[tile_index + 0x400]; |
48 | 44 | code |= ((attr & 0x03) << 8); |
49 | | color = ((attr & 0x4)>>2)+6; |
| 45 | int color = ((attr & 0x4)>>2)+6; |
50 | 46 | |
51 | 47 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
52 | 48 | } |
r244731 | r244732 | |
56 | 52 | SET_TILE_INFO_MEMBER(2, m_vram[tile_index] & 0x7f, 2, 0); |
57 | 53 | } |
58 | 54 | |
59 | | READ8_MEMBER(tryout_state::tryout_vram_r) |
| 55 | WRITE8_MEMBER(tryout_state::videoram_w) |
60 | 56 | { |
61 | | return m_vram[offset]; // debug only |
62 | | } |
63 | | |
64 | | WRITE8_MEMBER(tryout_state::tryout_videoram_w) |
65 | | { |
66 | | UINT8 *videoram = m_videoram; |
67 | | videoram[offset] = data; |
| 57 | m_videoram[offset] = data; |
68 | 58 | m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); |
69 | 59 | } |
70 | 60 | |
71 | | WRITE8_MEMBER(tryout_state::tryout_vram_w) |
| 61 | WRITE8_MEMBER(tryout_state::vram_w) |
72 | 62 | { |
73 | 63 | /* There are eight banks of vram - in bank 0 the first 0x400 bytes |
74 | 64 | is reserved for the tilemap. In banks 2, 4 and 6 the game never |
r244731 | r244732 | |
136 | 126 | m_gfxdecode->gfx(2)->mark_dirty((offset-0x400/64)&0x7f); |
137 | 127 | } |
138 | 128 | |
139 | | WRITE8_MEMBER(tryout_state::tryout_vram_bankswitch_w) |
| 129 | WRITE8_MEMBER(tryout_state::vram_bankswitch_w) |
140 | 130 | { |
141 | 131 | m_vram_bank = data; |
142 | 132 | } |
143 | 133 | |
144 | | WRITE8_MEMBER(tryout_state::tryout_flipscreen_w) |
| 134 | WRITE8_MEMBER(tryout_state::flipscreen_w) |
145 | 135 | { |
146 | 136 | flip_screen_set(data & 1); |
147 | 137 | } |
r244731 | r244732 | |
168 | 158 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tryout_state::get_fg_tile_info),this),tilemap_mapper_delegate(FUNC(tryout_state::get_fg_memory_offset),this),8,8,32,32); |
169 | 159 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tryout_state::get_bg_tile_info),this),tilemap_mapper_delegate(FUNC(tryout_state::get_bg_memory_offset),this),16,16,64,16); |
170 | 160 | |
171 | | m_vram=auto_alloc_array(machine(), UINT8, 8 * 0x800); |
172 | 161 | m_vram_gfx=auto_alloc_array(machine(), UINT8, 0x6000); |
173 | 162 | |
174 | 163 | m_gfxdecode->gfx(2)->set_source(m_vram_gfx); |
175 | 164 | |
176 | 165 | m_fg_tilemap->set_transparent_pen(0); |
| 166 | |
| 167 | save_item(NAME(m_vram_bank)); |
| 168 | save_pointer(NAME(m_vram_gfx), 0x6000); |
177 | 169 | } |
178 | 170 | |
179 | 171 | void tryout_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) |
180 | 172 | { |
181 | | UINT8 *spriteram = m_spriteram; |
182 | | UINT8 *spriteram_2 = m_spriteram2; |
183 | 173 | int offs,fx,fy,x,y,color,sprite,inc; |
184 | 174 | |
185 | 175 | for (offs = 0;offs < 0x7f;offs += 4) |
186 | 176 | { |
187 | | if (!(spriteram[offs]&1)) |
| 177 | if (!(m_spriteram[offs]&1)) |
188 | 178 | continue; |
189 | 179 | |
190 | | sprite = spriteram[offs+1] + ((spriteram_2[offs]&7)<<8); |
191 | | x = spriteram[offs+3]-3; |
192 | | y = spriteram[offs+2]; |
193 | | color = 0;//(spriteram[offs] & 8)>>3; |
194 | | fx = (spriteram[offs] & 8)>>3; |
| 180 | sprite = m_spriteram[offs+1] + ((m_spriteram2[offs]&7)<<8); |
| 181 | x = m_spriteram[offs+3]-3; |
| 182 | y = m_spriteram[offs+2]; |
| 183 | color = 0;//(m_spriteram[offs] & 8)>>3; |
| 184 | fx = (m_spriteram[offs] & 8)>>3; |
195 | 185 | fy = 0; |
196 | 186 | inc = 16; |
197 | 187 | |
r244731 | r244732 | |
207 | 197 | } |
208 | 198 | |
209 | 199 | /* Double Height */ |
210 | | if(spriteram[offs] & 0x10) |
| 200 | if(m_spriteram[offs] & 0x10) |
211 | 201 | { |
212 | 202 | m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, |
213 | 203 | sprite, |
r244731 | r244732 | |
226 | 216 | } |
227 | 217 | } |
228 | 218 | |
229 | | UINT32 tryout_state::screen_update_tryout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 219 | UINT32 tryout_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
230 | 220 | { |
231 | 221 | int scrollx = 0; |
232 | 222 | |