1
/**********************************************************************************
9
--- Technical Notes ---
12
Company: IGT - International Gaming Technology
17
CPU = INTEL 8039 ; I8039 compatible
18
VIDEO = SYS 6545 ; CRTC6845 compatible
19
SND = AY-3-8912 ; AY8910 compatible
23
This is one of the first video machines produced by IGT. Originally, the
24
company was called SIRCOMA and was founded in 1979. It became a public
25
company in 1981 and changed its name to IGT.
27
***********************************************************************************/
29
#include "machine/nvram.h"
30
#include "sound/ay8910.h"
31
#include "cpu/mcs48/mcs48.h"
34
class drw80pkr_state : public driver_device
37
drw80pkr_state(const machine_config &mconfig, device_type type, const char *tag)
38
: driver_device(mconfig, type, tag) { }
40
tilemap_t *m_bg_tilemap;
50
UINT8 m_pkr_io_ram[0x100];
51
UINT16 m_video_ram[0x0400];
52
UINT8 m_color_ram[0x0400];
56
#define CPU_CLOCK XTAL_8MHz
57
#define DATA_NVRAM_SIZE 0x100
60
static MACHINE_START( drw80pkr )
62
drw80pkr_state *state = machine.driver_data<drw80pkr_state>();
63
machine.device<nvram_device>("nvram")->set_base(state->m_pkr_io_ram, sizeof(state->m_pkr_io_ram));
70
static WRITE8_HANDLER( t0_w )
72
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
76
static WRITE8_HANDLER( t1_w )
78
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
82
static WRITE8_HANDLER( p0_w )
84
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
88
static WRITE8_HANDLER( p1_w )
90
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
94
static WRITE8_HANDLER( p2_w )
96
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
100
static WRITE8_HANDLER( prog_w )
102
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
103
state->m_prog = data;
105
// Bankswitch Program Memory
106
if (state->m_prog == 0x01)
108
state->m_active_bank = state->m_active_bank ^ 0x01;
110
memory_set_bank(space->machine(), "bank1", state->m_active_bank);
114
static WRITE8_HANDLER( bus_w )
116
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
120
static WRITE8_HANDLER( drw80pkr_io_w )
122
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
125
if (state->m_p2 == 0x3f || state->m_p2 == 0x7f)
127
n_offs = ((state->m_p1 & 0xc0) << 2 ) + offset;
129
if (state->m_p2 == 0x3f)
131
state->m_video_ram[n_offs] = data; // low address
133
state->m_color_ram[n_offs] = data & 0x0f; // color palette
134
state->m_video_ram[n_offs] += ((data & 0xf0) << 4 ); // high address
137
tilemap_mark_tile_dirty(state->m_bg_tilemap, n_offs);
140
if (state->m_p2 == 0xc7)
143
// R0 = 0x1f(31) Horizontal Total
144
// R1 = 0x18(24) Horizontal Displayed
145
// R2 = 0x1a(26) Horizontal Sync Position
146
// R3 = 0x34(52) HSYNC/VSYNC Widths
147
// R4 = 0x1f(31) Vertical Total
148
// R5 = 0x01(01) Vertical Total Adjust
149
// R6 = 0x1b(27) Vertical Displayed
150
// R7 = 0x1c(28) Vertical Sync Position
151
// R8 = 0x10 Mode Control
153
// Straight Binary - Ram Addressing
154
// Shared Memory - Ram Access
155
// Delay Display Enable one character time
156
// No Delay Cursor Skew
157
// R9 = 0x07(07) Scan Line
158
// R10 = 0x00 Cursor Start
159
// R11 = 0x00 Cursor End
160
// R12 = 0x00 Display Start Address (High)
161
// R13 = 0x00 Display Start Address (Low)
164
if (state->m_p2 == 0xd7)
169
if (state->m_p2 == 0xfb) {
170
state->m_pkr_io_ram[offset] = data;
173
if (state->m_p2 == 0xff)
175
if (state->m_p1 == 0xdf)
177
state->m_attract_mode = data; // Latch this for use in input reads (0x01 = attract mode, 0x00 = game in progress)
180
if (state->m_p1 == 0xdb || state->m_p1 == 0xef || state->m_p1 == 0xf7 || state->m_p1 == 0xfb)
182
// unknown, most likely lamps, meters, hopper etc.
185
// ay8910 control port
186
if (state->m_p1 == 0xfc)
187
ay8910_address_w(space->machine().device("aysnd"), 0, data);
189
// ay8910_write_port_0_w
190
if (state->m_p1 == 0xfe)
191
ay8910_data_w(space->machine().device("aysnd"), 0, data);
199
static READ8_HANDLER( t0_r )
201
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
205
static READ8_HANDLER( t1_r )
207
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
211
static READ8_HANDLER( p0_r )
213
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
217
static READ8_HANDLER( p1_r )
219
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
223
static READ8_HANDLER( p2_r )
225
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
229
static READ8_HANDLER( bus_r )
231
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
235
static READ8_HANDLER( drw80pkr_io_r )
237
drw80pkr_state *state = space->machine().driver_data<drw80pkr_state>();
243
if (state->m_p2 == 0x3b)
248
if (state->m_p2 == 0x7b)
250
ret = state->m_pkr_io_ram[offset];
253
if (state->m_p2 == 0xf7)
258
if (state->m_p2 == 0xfb)
260
ret = state->m_pkr_io_ram[offset];
263
if (state->m_p2 == 0xff)
265
if (state->m_p1 == 0x5f || state->m_p1 == 0x9f || state->m_p1 == 0xdb)
270
if (state->m_p1 == 0xfe)
272
// Dip switches tied to sound chip
274
// TODO: Unknown switch positions, but found the following flipping bits:
275
// SW.? = Double Up Option
276
// SW.? = Coin Denomination
277
// SW.4 = Payout Type (0=cash, 1=credit)
278
// SW.? = Use Joker in Deck
280
ret = 0x77; // double-up with credit payout
283
if ((state->m_attract_mode == 0x01 && state->m_p1 == 0xef) || state->m_p1 == 0xf7)
286
// TODO: Get Input Port Values
287
kbdin = ((input_port_read(space->machine(), "IN1") & 0xaf ) << 8) + input_port_read(space->machine(), "IN0");
291
// The following is very incorrect, but does allow you to
292
// play slightly with very messed up hold buttons etc.
294
// Open/Close the door with 'O'
295
// Press '5' (twice) with door open to play credit
296
// Press '1' to draw/deal
298
case 0x0000: ret = 0x00; break;
299
case 0x0001: ret = 0x01; break; /* Door */
300
case 0x4000: ret = 0x00; break;
301
case 0x8000: ret = 0x00; break; /* Hand Pay */
302
case 0x0002: ret = 0x00; break; /* Books */
303
case 0x0004: ret = 0x0e; break; /* Coin In */
304
case 0x0008: ret = 0x0d; break; /* Start */
305
case 0x0010: ret = 0x00; break; /* Discard */
306
case 0x0020: ret = 0x00; break; /* Cancel */
307
case 0x0040: ret = 0x01; break; /* Hold 1 */
308
case 0x0080: ret = 0x02; break; /* Hold 2 */
309
case 0x0100: ret = 0x03; break; /* Hold 3 */
310
case 0x0200: ret = 0x04; break; /* Hold 4 */
311
case 0x0400: ret = 0x05; break; /* Hold 5 */
312
case 0x0800: ret = 0x00; break; /* Bet */
321
/****************************
322
* Video/Character functions *
323
****************************/
325
static TILE_GET_INFO( get_bg_tile_info )
327
drw80pkr_state *state = machine.driver_data<drw80pkr_state>();
328
int color = state->m_color_ram[tile_index];
329
int code = state->m_video_ram[tile_index];
331
SET_TILE_INFO(0, code, color, 0);
334
static VIDEO_START( drw80pkr )
336
drw80pkr_state *state = machine.driver_data<drw80pkr_state>();
337
state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 24, 27);
340
static SCREEN_UPDATE( drw80pkr )
342
drw80pkr_state *state = screen->machine().driver_data<drw80pkr_state>();
343
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
348
static PALETTE_INIT( drw80pkr )
352
for (j = 0; j < machine.total_colors(); j++)
354
int r, g, b, tr, tg, tb, i;
356
i = (color_prom[j] >> 3) & 0x01;
360
tr = 0xf0 - (0xf0 * ((color_prom[j] >> 0) & 0x01));
361
r = tr - (i * (tr / 5));
363
/* green component */
364
tg = 0xf0 - (0xf0 * ((color_prom[j] >> 1) & 0x01));
365
g = tg - (i * (tg / 5));
368
tb = 0xf0 - (0xf0 * ((color_prom[j] >> 2) & 0x01));
369
b = tb - (i * (tb / 5));
371
palette_set_color(machine, j, MAKE_RGB(r, g, b));
376
/*************************
378
*************************/
380
static const gfx_layout charlayout =
382
8,8, /* 8x8 characters */
383
RGN_FRAC(1,2), /* 512 characters */
385
{ 0, RGN_FRAC(1,2) },
392
/******************************
393
* Graphics Decode Information *
394
******************************/
396
static GFXDECODE_START( drw80pkr )
397
GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 0, 16 )
405
static DRIVER_INIT( drw80pkr )
407
memory_configure_bank(machine, "bank1", 0, 2, machine.region("maincpu")->base(), 0x1000);
411
/*************************
412
* Memory map information *
413
*************************/
415
static ADDRESS_MAP_START( drw80pkr_map, AS_PROGRAM, 8 )
416
AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1")
419
static ADDRESS_MAP_START( drw80pkr_io_map, AS_IO, 8 )
420
AM_RANGE(0x00, 0xff) AM_READWRITE(drw80pkr_io_r, drw80pkr_io_w)
421
AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READWRITE(t0_r, t0_w)
422
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READWRITE(t1_r, t1_w)
423
AM_RANGE(MCS48_PORT_P0, MCS48_PORT_P0) AM_READWRITE(p0_r, p0_w)
424
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w)
425
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w)
426
AM_RANGE(MCS48_PORT_PROG, MCS48_PORT_PROG) AM_RAM_WRITE(prog_w)
427
AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_READWRITE(bus_r, bus_w)
430
/*************************
432
*************************/
434
static INPUT_PORTS_START( drw80pkr )
435
// Unknown at this time
436
// These are temporary buttons for testing only
438
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR ) PORT_TOGGLE
439
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
440
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
441
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start")
442
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Discard") PORT_CODE(KEYCODE_2)
443
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_POKER_CANCEL )
444
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_POKER_HOLD1 )
445
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_POKER_HOLD2 )
448
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POKER_HOLD3 )
449
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_POKER_HOLD4 )
450
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
451
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
452
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
453
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT)
454
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
455
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
458
/*************************
460
*************************/
462
static MACHINE_CONFIG_START( drw80pkr, drw80pkr_state )
463
// basic machine hardware
464
MCFG_CPU_ADD("maincpu", I8039, CPU_CLOCK)
465
MCFG_CPU_PROGRAM_MAP(drw80pkr_map)
466
MCFG_CPU_IO_MAP(drw80pkr_io_map)
467
MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
469
MCFG_MACHINE_START(drw80pkr)
473
MCFG_SCREEN_ADD("screen", RASTER)
474
MCFG_SCREEN_REFRESH_RATE(60)
475
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
476
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
477
MCFG_SCREEN_SIZE((31+1)*8, (31+1)*8)
478
MCFG_SCREEN_VISIBLE_AREA(0*8, 24*8-1, 0*8, 27*8-1)
479
MCFG_SCREEN_UPDATE(drw80pkr)
481
MCFG_GFXDECODE(drw80pkr)
482
MCFG_PALETTE_LENGTH(16*16)
484
MCFG_PALETTE_INIT(drw80pkr)
485
MCFG_VIDEO_START(drw80pkr)
487
MCFG_NVRAM_ADD_0FILL("nvram")
490
MCFG_SPEAKER_STANDARD_MONO("mono")
492
MCFG_SOUND_ADD("aysnd", AY8912, 20000000/12)
493
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
496
/*************************
498
*************************/
500
ROM_START( drw80pkr )
501
ROM_REGION( 0x2000, "maincpu", 0 )
502
ROM_LOAD( "pm0.u81", 0x0000, 0x1000, CRC(73223555) SHA1(229999ec00a1353f0d4928c65c8975079060c5af) )
503
ROM_LOAD( "pm1.u82", 0x1000, 0x1000, CRC(f8158f2b) SHA1(da3b30cfd49cd0e8a48d78fd3f82b2b4ab33670c) )
505
ROM_REGION( 0x002000, "gfx1", 0 )
506
ROM_LOAD( "cg0-a.u74", 0x0000, 0x1000, CRC(0eefe598) SHA1(ed10aac345b10e35fb15babdd3ac30ebe2b8fc0f) )
507
ROM_LOAD( "cg1-a.u76", 0x1000, 0x1000, CRC(522a96d0) SHA1(48f855a132413493353fbf6a44a1feb34ae6726d) )
509
ROM_REGION( 0x100, "proms", 0 )
510
ROM_LOAD( "cap13.u92", 0x0000, 0x0100, CRC(be67a8d9) SHA1(24b8cd19a5ec09779a737f6fc8c07b44f1226c8f) )
513
ROM_START( drw80pk2 )
514
ROM_REGION( 0x2000, "maincpu", 0 )
515
ROM_LOAD( "pm0.u81", 0x0000, 0x1000, CRC(0f3e97d2) SHA1(aa9e4015246284f32435d7320de667e075412e5b) )
516
ROM_LOAD( "pm1.u82", 0x1000, 0x1000, CRC(5a6ad467) SHA1(0128bd70b65244a0f68031d5f451bf115eeb7609) )
518
ROM_REGION( 0x002000, "gfx1", 0 )
519
ROM_LOAD( "cg0-a.u74", 0x0000, 0x1000, CRC(97f5eb92) SHA1(f6c7bb42ccef8a78e8d56104ad942ae5b8e5b0df) )
520
ROM_LOAD( "cg1-a.u76", 0x1000, 0x1000, CRC(2a3a750d) SHA1(db6183d11b2865b011c3748dc472cf5858dde78f) )
522
ROM_REGION( 0x100, "proms", 0 )
523
ROM_LOAD( "cap13.u92", 0x0000, 0x0100, CRC(be67a8d9) SHA1(24b8cd19a5ec09779a737f6fc8c07b44f1226c8f) )
526
/*************************
528
*************************/
530
/* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */
531
GAME( 1982, drw80pkr, 0, drw80pkr, drw80pkr, drw80pkr, ROT0, "IGT - International Gaming Technology", "Draw 80 Poker", GAME_NOT_WORKING )
532
GAME( 1983, drw80pk2, 0, drw80pkr, drw80pkr, drw80pkr, ROT0, "IGT - International Gaming Technology", "Draw 80 Poker - Minn", GAME_NOT_WORKING )