Previous 15994 Revisions Next

r15304 Thursday 24th May, 2012 at 12:16:29 UTC by Miodrag Milanović
Sync with MAME r16429 (no whatsnew)
[src/emu/machine]8042kbdc.c 8042kbdc.h
[src/emu/sound]pokey.c pokey.h
[src/mame]mame.lst mame.mak
[src/mame/drivers]bzone.c calchase.c crimfght.c darkmist.c flipjack.c* funkball.c gamecstl.c m72.c mediagx.c midqslvr.c namcos10.c photoply.c queen.c savquest.c segaxbd.c seta2.c superwng.c taitowlf.c voyager.c xtom3d.c
[src/mame/machine]midyunit.c
[src/mame/video]m72.c

src/mame/mame.lst
r15303r15304
16651665mrheli         // (c) 1987 (Japan)
16661666nspirit         // (c) 1988
16671667nspiritj      // (c) 1988 (Japan)
1668imgfight      // (c) 1988 (Japan)
1669imgfighto      // (c) 1988 (Japan)
1668imgfight      // (c) 1988 (World)
1669imgfightj      // (c) 1988 (Japan)
16701670loht         // (c) 1989
16711671lohtj         // (c) 1989 (Japan)
16721672lohtb         // (c) 1989 (bootleg)
r15303r15304
35183518            // 2001.02 Taiko no Tatsujin
35193519            // 2001.03 Gahaha Ippatsudou
35203520mrdrilrg      // 2001.03 Mr. Driller G (DRG1 Ver.A)
3521mrdrilrga      // 2001.03 Mr. Driller G ALT (DRG1 Ver.A)
35213522            // 2001.07 Golgo 13 Juusei no Requiem
35223523            // 2001.08 Taiko no Tatsujin 2
35233524            // 2001.09 Gahaha Ippatsudou 2
r15303r15304
43424343            // 1991.01 A.B.Cop (Japan)
43434344            // 1990.10 GP Rider (Japan)
43444345gprider         // 1990.?? GP Rider (World, protected)
4345gprider1      // 1990.12 GP Rider (US, FD1094, decrypted)
4346gprideru      // 1990.12 GP Rider (US, FD1094, decrypted)
43464347
43474348// Y-Board
43484349            // 1988.05 Galaxy Force (Japan)
r15303r15304
1985619857// Extrema Systems International Ltd.
1985719858poker72
1985819859
19860// Peni Soft, actually an hack on modified Time Pilot HW
1985919861chkun
19862bikkuric
1986019863
1986119864// Blitz System Inc.
1986219865megadpkr      // (c) 1990 Blitz System Inc
r15303r15304
2147621479
2147721480manohman      // 199?, Merkur.
2147821481jankenmn      // 1985, Sunwise.
21479bikkuric
21482
21483flipjack
src/mame/machine/midyunit.c
r15303r15304
298298   {
299299      case SOUND_CVSD_SMALL:
300300         machine.device("cvsd:cpu")->memory().space(AS_PROGRAM)->install_write_handler(prot_start, prot_end, write8_delegate(FUNC(midyunit_state::cvsd_protection_w),state));
301         state->m_cvsd_protection_base = machine.root_device().memregion("cvsdcpu")->base() + 0x10000 + (prot_start - 0x8000);
301         state->m_cvsd_protection_base = machine.root_device().memregion("cvsd:cpu")->base() + 0x10000 + (prot_start - 0x8000);
302302         break;
303303
304304      case SOUND_CVSD:
src/mame/mame.mak
r15303r15304
17331733   $(DRIVERS)/esh.o \
17341734   $(DRIVERS)/esripsys.o $(VIDEO)/esripsys.o \
17351735   $(DRIVERS)/ettrivia.o \
1736   $(DRIVERS)/flipjack.o \
17361737   $(DRIVERS)/flower.o $(AUDIO)/flower.o $(VIDEO)/flower.o \
17371738   $(DRIVERS)/fortecar.o \
17381739   $(DRIVERS)/freekick.o $(VIDEO)/freekick.o \
src/mame/video/m72.c
r15303r15304
128128
129129   state->m_bg_tilemap->set_transmask(0,0xffff,0x0000);
130130   state->m_bg_tilemap->set_transmask(1,0x00ff,0xff00);
131
131132   //state->m_bg_tilemap->set_transmask(2,0x0001,0xfffe);
132   state->m_bg_tilemap->set_transmask(2,0x0007,0xfff8);
133   state->m_bg_tilemap->set_transmask(2,0x0007,0xfff8); // needed for lohtj japan warning to look correct
134   //state->m_bg_tilemap->set_transmask(2,0x001f,0xffe0); // needed for nspiritj japan warning to look correct
135   // not sure what is needed to be able to see the imgfghto warning message
133136
134137   memset(state->m_buffered_spriteram,0,state->m_spriteram.bytes());
135138
src/mame/drivers/segaxbd.c
r15303r15304
26712671    Custom Chip 315-5304 (IC 127)
26722672    IC BD Number: 834-7626-01 (roms are "MPR") / 834-7626-04 (roms are "EPR")
26732673*/
2674ROM_START( gprider1 )
2674ROM_START( gprideru )
26752675   ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */
26762676   ROM_LOAD16_BYTE( "epr-13406.ic63", 0x00001, 0x20000, CRC(122c711f) SHA1(2bcc51347e771a7e7f770e68b24d82497d24aa2e) )
26772677   ROM_LOAD16_BYTE( "epr-13407.ic58", 0x00000, 0x20000, CRC(03553ebd) SHA1(041a71a2dce2ad56360f500cb11e29a629020160) )
r15303r15304
28172817GAME( 1989, smgpja,   smgp,     smgp,    smgp,     smgp,           ROT0,   "Sega", "Super Monaco GP (Japan, Rev A, FD1094 317-0124a)", 0 )
28182818GAME( 1990, abcop,    0,        xboard,  abcop,    generic_xboard, ROT0,   "Sega", "A.B. Cop (FD1094 317-0169b)", 0 )
28192819GAME( 1990, gprider,  0,        xboard,  gprider,  gprider,        ROT0,   "Sega", "GP Rider (World, FD1094 317-0163)", 0 )
2820GAME( 1990, gprider1, gprider,  xboard,  gprider,  gprider,        ROT0,   "Sega", "GP Rider (US, FD1094 317-0162)", 0 )
2820GAME( 1990, gprideru, gprider,  xboard,  gprider,  gprider,        ROT0,   "Sega", "GP Rider (US, FD1094 317-0162)", 0 )
src/mame/drivers/mediagx.c
r15303r15304
6666
6767#include "emu.h"
6868#include "cpu/i386/i386.h"
69#include "devconv.h"
7069#include "machine/8237dma.h"
7170#include "machine/pic8259.h"
7271#include "machine/pit8253.h"
r15303r15304
929928   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
930929   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_master", io20_r, io20_w, 0xffffffff)
931930   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
932   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
931   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
933932   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
934933   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,            at_page8_w, 0xffffffff)
935934   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
src/mame/drivers/seta2.c
r15303r15304
9999***************************************************************************/
100100
101101#include "emu.h"
102#include "memconv.h"
103102#include "includes/seta2.h"
104103#include "cpu/m68000/m68000.h"
105104#include "machine/tmp68301.h"
src/mame/drivers/namcos10.c
r15303r15304
706706   ROM_LOAD( "drg1a_2.bin",  0x2100000, 0x1080000, CRC(ccfabf7b) SHA1(0cbd91ce8abd6efca5d427b52279ce265f685aa9) )
707707ROM_END
708708
709ROM_START( mrdrilrga )
710   ROM_REGION32_LE( 0x400000, "user1", 0 ) /* bios */
711   ROM_FILL( 0x0000000, 0x400000, 0x55 )
712
713   ROM_REGION16_LE( 0x3180000, "user2", 0 ) /* main prg */
714   ROM_LOAD( "0.8e",         0x0000000, 0x1080000, CRC(def72bcd) SHA1(e243b7ef23b2b00612c185e01493cd01be51f154) )
715   ROM_LOAD( "1.8d",         0x1080000, 0x1080000, CRC(c87b5e86) SHA1(b034210da30e1f2f7d04f77e00bf7724437e2024) )
716   ROM_LOAD( "2.7e",         0x2100000, 0x1080000, CRC(e0a9339f) SHA1(4284e7233876cfaf8021440d78ccc8c70d00cc00) )
717ROM_END
718
709719ROM_START( knpuzzle )
710720   ROM_REGION32_LE( 0x400000, "user1", 0 ) /* bios */
711721   ROM_FILL( 0x0000000, 0x400000, 0x55 )
r15303r15304
792802GAME( 2000, gunbalina, ptblank3, namcos10_memn, namcos10, gunbalna, ROT0, "Namco", "Gunbalina (GNN1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
793803GAME( 2001, gjspace,   0,        namcos10_memn, namcos10, gjspace,  ROT0, "Namco / Metro", "Gekitoride-Jong Space (10011 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
794804GAME( 2001, mrdrilrg,  0,        namcos10_memn, namcos10, mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks
805GAME( 2001, mrdrilrga, mrdrilrg, namcos10_memn, namcos10, mrdrilrg, ROT0, "Namco", "Mr. Driller G ALT (Japan, DRG1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks
795806GAME( 2001, knpuzzle,  0,        namcos10_memn, namcos10, knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
796807GAME( 2002, chocovdr,  0,        namcos10_memn, namcos10, chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
797808GAME( 2002, startrgn,  0,        namcos10_memn, namcos10, startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/voyager.c
r15303r15304
1414
1515#include "emu.h"
1616#include "cpu/i386/i386.h"
17#include "memconv.h"
18#include "devconv.h"
1917#include "machine/8237dma.h"
2018#include "machine/pic8259.h"
2119#include "machine/pit8253.h"
r15303r15304
7169   i8237_w(device, offset / 2, data);
7270}
7371
74static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
75{
76   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
77}
78
79static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
80{
81   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
82}
83
84
85
8672READ8_MEMBER(voyager_state::at_page8_r)
8773{
8874   UINT8 data = m_at_pages[offset % 0x10];
r15303r15304
417403   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
418404   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
419405   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
420   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
406   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
421407   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
422408   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
423409   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
424   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
410   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
425411   //AM_RANGE(0x00e8, 0x00eb) AM_NOP
426412   AM_RANGE(0x00e8, 0x00ef) AM_NOP //AMI BIOS write to this ports as delays between I/O ports operations sending al value -> NEWIODELAY
427413   AM_RANGE(0x0170, 0x0177) AM_NOP //To debug
src/mame/drivers/queen.c
r15303r15304
3434
3535#include "emu.h"
3636#include "cpu/i386/i386.h"
37#include "memconv.h"
38#include "devconv.h"
3937#include "machine/8237dma.h"
4038#include "machine/pic8259.h"
4139#include "machine/pit8253.h"
r15303r15304
439437   i8237_w(device, offset / 2, data);
440438}
441439
442static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
443{
444   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
445}
446
447static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
448{
449   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
450}
451
452
453
454
455440static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
456441{
457442   cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r15303r15304
529514   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
530515   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
531516   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
532   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
517   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
533518   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
534519   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,   at_page8_w, 0xffffffff)
535520   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
536   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
521   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
537522   AM_RANGE(0x00e8, 0x00ef) AM_NOP
538523
539524   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
src/mame/drivers/m72.c
r15303r15304
597597   0xc6,0x06,0x00,0x0b,0x49^0xff,   // mov [0b00h], byte 049h
598598   0x68,0x00,0xd0,            // push 0d000h
599599   0x1f,                  // pop ds
600   // the following is for nspiritj only, the game checks for
601   // "This game can only be played in Japan..." message in the video text buffer
602   // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu
603   0xc6,0x06,0x70,0x16,0x57,   // mov [1670h], byte 057h
604   0xc6,0x06,0x71,0x16,0x00,   // mov [1671h], byte 000h
605600   0xea,0x00,0x00,0x40,0x00   // jmp  0040:$0000
606601};
607602static const UINT8 nspirit_crc[CRC_LEN] =   {   0xfe,0x94,0x6e,0x4e, 0xc8,0x33,0xa7,0x2d,
608603                                    0xf2,0xa3,0xf9,0xe1, 0xa9,0x6c,0x02,0x95, 0x00,0x00 };
609static const UINT8 nspiritj_crc[CRC_LEN] =  {   0x26,0xa3,0xa5,0xe9, 0xc8,0x33,0xa7,0x2d,
610                                    0xf2,0xa3,0xf9,0xe1, 0xbc,0x6c,0x01,0x95, 0x00,0x00 };
611
612604/* Image Fight */
613605static const UINT8 imgfight_code[CODE_LEN] =
614606{
607
615608   0x68,0x00,0xa0,            // push 0a000h
616609   0x1f,                  // pop ds
617610   0xc6,0x06,0x38,0x38,0x50,   // mov [3838h], byte 050h
r15303r15304
631624   0xc6,0x06,0x23,0x09,0x47^0xff,   // mov [0923h], byte 047h
632625   0x68,0x00,0xd0,            // push 0d000h
633626   0x1f,                  // pop ds
634   // the game checks for
635   // "This game can only be played in Japan..." message in the video text buffer
636   // the message is nowhere to be found in the ROMs, so has to be displayed by the mcu
637   0xc6,0x06,0xb0,0x1c,0x57,   // mov [1cb0h], byte 057h
638627   0xea,0x00,0x00,0x40,0x00   // jmp  0040:$0000
639628};
640static const UINT8 imgfight_crc[CRC_LEN] =  {   0x7e,0xcc,0xec,0x03, 0x04,0x33,0xb6,0xc5,
629
630// these are for the japan set where we have the mcu anyway...
631static const UINT8 imgfightj_crc[CRC_LEN] =  {   0x7e,0xcc,0xec,0x03, 0x04,0x33,0xb6,0xc5,
641632                                    0xbf,0x37,0x92,0x94, 0x00,0x00 };
642633
643634/* Legend of Hero Tonma */
r15303r15304
655646   0xc6,0x06,0x00,0x0a,0x49^0xff,   // mov [0a00h], byte 049h
656647   0xc6,0x06,0x00,0x0b,0x49^0xff,   // mov [0b00h], byte 049h
657648
658   0x68,0x00,0xd0,                // push 0d000h // Japan set only
659   0x1f,                      // pop ds // Japan set only
660   0xc6,0x06,0x70,0x16,0x57,      // mov [1670h], byte 057h // Japan set only - checks this (W) of WARNING
661649
662650   0xea,0x5d,0x01,0x40,0x00   // jmp  0040:$015d
663651
664652};
665653static const UINT8 loht_crc[CRC_LEN] =     {   0x39,0x00,0x82,0xae, 0x2c,0x9d,0x4b,0x73,
666654                                    0xfb,0xac,0xd4,0x6d, 0x6d,0x5b,0x77,0xc0, 0x00,0x00 };
667/* service mode crashes at the moment (119u2), so I can't add the CRCs for lohtj */
668655
669656/* X Multiply */
670657static const UINT8 xmultiplm72_code[CODE_LEN] =
r15303r15304
766753
767754static DRIVER_INIT( imgfight )
768755{
769   install_protection_handler(machine, imgfight_code,imgfight_crc);
756   install_protection_handler(machine, imgfight_code,imgfightj_crc);
770757   m72_state *state = machine.driver_data<m72_state>();
771758   machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::imgfight_sample_trigger_w),state));
772759}
r15303r15304
27372724   ROM_LOAD16_BYTE( "if-c-l3.bin",   0x40000, 0x20000, CRC(c66ae348) SHA1(eca5096ebd5bffc6e68f3fc9969cda9679bd921f) )
27382725   ROM_RELOAD(                       0xc0000, 0x20000 )
27392726
2740   ROM_REGION( 0x10000, "cpu2", 0 )
2741   ROM_LOAD( "imgfight_i8751h.bin",  0x00000, 0x01000, CRC(ef0d5098) SHA1(068b73937588e16a318a094dfe2fb1293b1a1711) )
2727   ROM_REGION( 0x10000, "mcu", 0 )
2728   ROM_LOAD( "imgfight_i8751h.bin",  0x00000, 0x01000, NO_DUMP )
27422729
27432730   ROM_REGION( 0x080000, "gfx1", 0 )
27442731   ROM_LOAD( "if-c-00.bin",  0x00000, 0x20000, CRC(745e6638) SHA1(43fb1f9da4190fea67eee3aee8caf4219becc21b) )   /* sprites */
r15303r15304
27632750   ROM_LOAD( "if-c-v1.bin",  0x10000, 0x10000, CRC(45b68bf5) SHA1(2fb28793019ca85b3b6d7c4c31eedff1d71f2d83) )
27642751ROM_END
27652752
2766ROM_START( imgfighto )
2753ROM_START( imgfightj )
27672754   ROM_REGION( 0x100000, "maincpu", 0 )
27682755   ROM_LOAD16_BYTE( "if-c-h0.bin",  0x00001, 0x10000, CRC(592d2d80) SHA1(d54916a9bfe4b65a972b62202af706135e73518d) )
27692756   ROM_LOAD16_BYTE( "if-c-l0.bin",  0x00000, 0x10000, CRC(61f89056) SHA1(3e0724dbc2b00a30193ea6cfac8b4331055d4fd4) )
r15303r15304
27722759   ROM_LOAD16_BYTE( "if-c-l3.bin",  0x40000, 0x20000, CRC(c66ae348) SHA1(eca5096ebd5bffc6e68f3fc9969cda9679bd921f) )
27732760   ROM_RELOAD(                      0xc0000, 0x20000 )
27742761
2775   ROM_REGION( 0x10000, "cpu2", 0 )
2776   ROM_LOAD( "imgfight_i8751h.bin",  0x00000, 0x01000, CRC(ef0d5098) SHA1(068b73937588e16a318a094dfe2fb1293b1a1711) )
2762   ROM_REGION( 0x10000, "mcu", 0 )
2763   ROM_LOAD( "imgfightj_i8751h.bin",  0x00000, 0x01000, CRC(ef0d5098) SHA1(068b73937588e16a318a094dfe2fb1293b1a1711) )
27772764
27782765   ROM_REGION( 0x080000, "gfx1", 0 )
27792766   ROM_LOAD( "if-c-00.bin",  0x00000, 0x20000, CRC(745e6638) SHA1(43fb1f9da4190fea67eee3aee8caf4219becc21b) )   /* sprites */
r15303r15304
36423629   ROM_LOAD( "ken_m14.rom",  0x00000, 0x20000, CRC(6651e9b7) SHA1(c42009f986c9a9f35732d5cd717d548536469b1c) )
36433630ROM_END
36443631
3632// in the case of the i8751 protected games the World and Japan sets should be using different MCU roms.
3633// the MCU roms provide checksum information needed for the sets, so using the wrong ROM will result in
3634// the program roms failing their tests.  This is why we still have simulation code for many games
3635// despite having Japanese version MCU roms for several of them.  See notes next to the sets
36453636
3646
3647
36483637GAME( 1987, rtype,       0,        rtype,       rtype,    0,           ROT0,   "Irem", "R-Type (World)", GAME_NO_COCKTAIL )
36493638GAME( 1987, rtypej,      rtype,    rtype,       rtype,    0,           ROT0,   "Irem", "R-Type (Japan)", GAME_NO_COCKTAIL )
36503639GAME( 1987, rtypejp,     rtype,    rtype,       rtypep,   0,           ROT0,   "Irem", "R-Type (Japan prototype)", GAME_NO_COCKTAIL )
r15303r15304
36523641GAME( 1987, rtypeb,      rtype,    rtype,       rtype,    0,           ROT0,   "bootleg", "R-Type (World bootleg)", GAME_NO_COCKTAIL )
36533642GAME( 1987, bchopper,    0,        m72,         bchopper, bchopper,    ROT0,   "Irem", "Battle Chopper", GAME_NO_COCKTAIL )
36543643GAME( 1987, mrheli,      bchopper, m72,         bchopper, mrheli,      ROT0,   "Irem", "Mr. HELI no Dai-Bouken", GAME_NO_COCKTAIL )
3655GAME( 1988, nspirit,     0,        m72,         nspirit,  nspirit,     ROT0,   "Irem", "Ninja Spirit", GAME_NO_COCKTAIL )
3656GAME( 1988, nspiritj,    nspirit,  m72_8751,    nspirit,  m72_8751,    ROT0,   "Irem", "Saigo no Nindou (Japan)", GAME_NO_COCKTAIL ) /* some corruption on warning screen (layer enable?) */
3657GAME( 1988, imgfight,    0,        m72,         imgfight, imgfight,    ROT270, "Irem", "Image Fight (Japan, revision A)", 0 )
3658GAME( 1988, imgfighto,   imgfight, m72,         imgfight, imgfight,    ROT270, "Irem", "Image Fight (Japan)", 0 )
3659GAME( 1989, loht,        0,        m72,         loht,     loht,        ROT0,   "Irem", "Legend of Hero Tonma", GAME_NO_COCKTAIL )
3660GAME( 1989, lohtj,       loht,     m72_8751,    loht,     m72_8751,    ROT0,   "Irem", "Legend of Hero Tonma (Japan)", GAME_NO_COCKTAIL )
3661GAME( 1989, lohtb,       loht,     m72,         loht,     0,           ROT0,   "bootleg", "Legend of Hero Tonma (bootleg, set 1)", GAME_NOT_WORKING| GAME_NO_COCKTAIL )
3662GAME( 1989, lohtb2,      loht,     m72_8751,    loht,     m72_8751,    ROT0,   "bootleg", "Legend of Hero Tonma (bootleg, set 2)", GAME_NO_COCKTAIL )
3644GAME( 1988, nspirit,     0,        m72,         nspirit,  nspirit,     ROT0,   "Irem", "Ninja Spirit", GAME_NO_COCKTAIL )                 // doesn't wait / check for japan warning string.. fails rom check if used with japanese mcu rom (World version?)
3645GAME( 1988, nspiritj,    nspirit,  m72_8751,    nspirit,  m72_8751,    ROT0,   "Irem", "Saigo no Nindou (Japan)", GAME_NO_COCKTAIL )      // waits for japan warning screen, works with our mcu dump, corrupt warning screen due to priority / mixing errors (Japan Version)
3646GAME( 1988, imgfight,    0,        m72,         imgfight, imgfight,    ROT270, "Irem", "Image Fight (World, revision A)", 0 )             // doesn't wait / check for japan warning string.. fails rom check if used with japanese mcu rom (World version?)
3647GAME( 1988, imgfightj,   imgfight, m72_8751,    imgfight, m72_8751,    ROT270, "Irem", "Image Fight (Japan)", 0 )                         // waits for japan warning screen, works with our mcu dump, can't actually see warning screen due to priority / mixing errors, check tilemap viewer (Japan Version)
3648GAME( 1989, loht,        0,        m72,         loht,     loht,        ROT0,   "Irem", "Legend of Hero Tonma", GAME_NO_COCKTAIL )         // fails rom check if used with Japan MCU rom (World version?)
3649GAME( 1989, lohtj,       loht,     m72_8751,    loht,     m72_8751,    ROT0,   "Irem", "Legend of Hero Tonma (Japan)", GAME_NO_COCKTAIL ) // waits for japan warning screen, works with our mcu dump (Japan Version)
3650GAME( 1989, lohtb2,      loht,     m72_8751,    loht,     m72_8751,    ROT0,   "bootleg", "Legend of Hero Tonma (Japan, bootleg with i8751)", GAME_NO_COCKTAIL ) // works like above, mcu code is the same as the real code, probably just an alt revision on a bootleg board
3651GAME( 1989, lohtb,       loht,     m72,         loht,     0,           ROT0,   "bootleg", "Legend of Hero Tonma (unprotected bootleg)", GAME_NOT_WORKING| GAME_NO_COCKTAIL )
36633652GAME( 1989, xmultipl,    0,        xmultipl,    xmultipl, 0,           ROT0,   "Irem", "X Multiply (World, M81)", GAME_NO_COCKTAIL )
36643653GAME( 1989, xmultiplm72, xmultipl, xmultiplm72, xmultipl, xmultiplm72, ROT0,   "Irem", "X Multiply (Japan, M72)", GAME_NO_COCKTAIL )
36653654GAME( 1989, dbreed,      0,        dbreed,      dbreed,   0,           ROT0,   "Irem", "Dragon Breed (M81 PCB version)", GAME_NO_COCKTAIL )
src/mame/drivers/superwng.c
r15303r15304
11/****************************************************************************************
2
23Super Wing - (c) 1985 Wing (UPL?)
34
45driver by Tomasz Slanina
56
6Hardware a bit (interrupts, sound) similar to mouser
7probably a prequel/sequel to flipjack
8Hardware a bit (interrupts, sound) similar to mouser as well
79
810TODO:
9
10 - unused rom 6.8s (located on the pcb near the gfx rom 7.8p, but contains
11   data (similar to the one in roms 4.5p and 5.5r).
12   There are two possibilities: its bad dump of gfx rom (two extra bit layers
13   of current gfx) or it's banked at 0x4000 - 0x7fff area.
14  - missing color prom dump (missing on pcb)
11  - unused rom 6.8s (located on the pcb near the gfx rom 7.8p, but contains
12    data (similar to the one in roms 4.5p and 5.5r).
13    There are two possibilities: its bad dump of gfx rom (two extra bit layers
14    of current gfx) or it's banked at 0x4000 - 0x7fff area.
15  - dump color prom
1516  - some unknown DSW and inputs
17  - hopper
1618  - unknown writes
17  - tile and sprite flipping (both h and v controlled by the same bit?)
18  - sprite coords and tile num (is the >>2 correct ?) (name entry, flipped screen)
1919  - measure clocks
2020
21  To enter initials - use tilt. It's probably separate button (?), not a tilt sensor.
2221
2322*****************************************************************************************/
2423
r15303r15304
3231{
3332public:
3433   superwng_state(const machine_config &mconfig, device_type type, const char *tag)
35      : driver_device(mconfig, type, tag) ,
34      : driver_device(mconfig, type, tag),
35      m_maincpu(*this, "maincpu"),
36      m_audiocpu(*this, "audiocpu"),
3637      m_videoram_bg(*this, "videorabg"),
3738      m_videoram_fg(*this, "videorafg"),
3839      m_colorram_bg(*this, "colorrabg"),
39      m_colorram_fg(*this, "colorrafg"){ }
40      m_colorram_fg(*this, "colorrafg")
41   { }
4042
43   required_device<cpu_device> m_maincpu;
44   required_device<cpu_device> m_audiocpu;
4145   required_shared_ptr<UINT8> m_videoram_bg;
4246   required_shared_ptr<UINT8> m_videoram_fg;
4347   required_shared_ptr<UINT8> m_colorram_bg;
4448   required_shared_ptr<UINT8> m_colorram_fg;
4549
46   int         m_tile_bank;
50   UINT8 m_tile_bank;
51   UINT8 m_sound_byte;
52   UINT8 m_nmi_enable;
4753
48   UINT8      m_sound_byte;
49   UINT8      m_nmi_enable;
50
51   device_t *   m_maincpu;
52   device_t *   m_audiocpu;
53
5454   tilemap_t *   m_bg_tilemap;
5555   tilemap_t *   m_fg_tilemap;
5656
r15303r15304
6565   DECLARE_WRITE8_MEMBER(superwng_flip_screen_w);
6666   DECLARE_WRITE8_MEMBER(superwng_cointcnt1_w);
6767   DECLARE_WRITE8_MEMBER(superwng_cointcnt2_w);
68   DECLARE_WRITE8_MEMBER(superwng_flip_screen_x_w);
69   DECLARE_WRITE8_MEMBER(superwng_flip_screen_y_w);
7068};
7169
7270static TILE_GET_INFO( get_bg_tile_info )
r15303r15304
8179   int flipx=(attr&0x80) ? TILE_FLIPX : 0;
8280   int flipy=(attr&0x80) ? TILE_FLIPY : 0;
8381
84   SET_TILE_INFO(   0, code, attr & 0xf, flipx|flipy);
82   SET_TILE_INFO(0, code, attr & 0xf, flipx|flipy);
8583}
8684
8785static TILE_GET_INFO( get_fg_tile_info )
r15303r15304
9795   int flipx=(attr&0x80) ? TILE_FLIPX : 0;
9896   int flipy=(attr&0x80) ? TILE_FLIPY : 0;
9997
100   SET_TILE_INFO( 0, code, attr & 0xf, flipx|flipy);
98   SET_TILE_INFO(0, code, attr & 0xf, flipx|flipy);
10199}
102100
103WRITE8_MEMBER(superwng_state::superwng_flip_screen_x_w)
104{
105   flip_screen_x_set(~data & 1);
106}
107
108WRITE8_MEMBER(superwng_state::superwng_flip_screen_y_w)
109{
110   flip_screen_y_set(~data & 1);
111}
112
113101static VIDEO_START( superwng )
114102{
115103   superwng_state *state = machine.driver_data<superwng_state>();
r15303r15304
122110static SCREEN_UPDATE_IND16( superwng )
123111{
124112   superwng_state *state = screen.machine().driver_data<superwng_state>();
125   int flip=state->flip_screen();
126113
127114   state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
128   rectangle tmp=cliprect;
115   rectangle tmp = cliprect;
129116
130   if(flip)
117   if (state->flip_screen())
131118   {
132      tmp.min_x+=32;
119      tmp.min_x += 32;
133120      state->m_fg_tilemap->draw(bitmap, tmp, 0, 0);
134121   }
135122   else
136123   {
137      tmp.max_x-=32;
124      tmp.max_x -= 32;
138125      state->m_fg_tilemap->draw(bitmap, tmp, 0, 0);
139126   }
140127
128   //sprites
129   for (int i = 0x3e; i >= 0; i -= 2)
141130   {
142      //sprites
131      /*      76543210
132      video0: xxxxxx    code
133                    x   /flip
134                     x  enable?
135      video1: xxxxxxxx  x
136      color0: xxxxxxxx  y
137      color1: xxx       unused?
138                 x      ?
139                  xxxx  color
140      */
141      if (~state->m_videoram_bg[i] & 1)
142         continue;
143143
144      for(int i=0x3e; i>=0; i-=2)
145      {
146         int code=(state->m_videoram_bg[i]>>2)+0x40;
147         int sx=256-state->m_videoram_bg[i+1]-8;
148         int sy = state->m_colorram_bg[i]+8;
149         int attr = state->m_colorram_bg[i+1];
144      int code = (state->m_videoram_bg[i] >> 2) | 0x40;
145      int flip = ~state->m_videoram_bg[i] >> 1 & 1;
146      int sx = 240 - state->m_videoram_bg[i + 1];
147      int sy = state->m_colorram_bg[i];
148      int color = state->m_colorram_bg[i + 1] & 0xf;
150149
151         if (flip)
152         {
153            sy-=8;
154            sx-=8;
155         }
156
157         if(state->m_videoram_bg[i+1] | state->m_colorram_bg[i])
158         {
159
160            drawgfx_transpen(bitmap, cliprect,screen.machine().gfx[1],
161                        code,
162                        attr,
163                        flip, flip,
164                        sx, sy, 0);
165         }
166      }
150      drawgfx_transpen(bitmap, cliprect,screen.machine().gfx[1],
151                  code,
152                  color,
153                  flip, flip,
154                  sx, sy, 0);
167155   }
168156
169157   return 0;
r15303r15304
328316
329317static INPUT_PORTS_START( superwng )
330318   PORT_START("P1")
331   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Launch Ball" )
332   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Right Flipper" )
333   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Left Flipper" )
334   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
319   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Launch Ball")
320   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Right Flipper")
321   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Left Flipper")
322   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
335323   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
336324   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
337   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
325   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL PORT_NAME("P2 Tilt")
338326   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
339327
340328   PORT_START("P2")
341   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Launch Ball" ) PORT_COCKTAIL
342   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Right Flipper" ) PORT_COCKTAIL
343   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Left Flipper" ) PORT_COCKTAIL
344   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
345   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
329   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Launch Ball")
330   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Right Flipper")
331   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Left Flipper")
332   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Tilt")
333   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
334   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
335   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
346336   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
347337
348338   PORT_START("DSW1")
349339   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ))
350   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
351   PORT_DIPSETTING(   0x01,  DEF_STR( On ) )
340   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
341   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
352342   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ))
353   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
354   PORT_DIPSETTING(   0x02,  DEF_STR( On ) )
343   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
344   PORT_DIPSETTING(   0x02, DEF_STR( On ) )
355345   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ))
356   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
357   PORT_DIPSETTING(   0x04,  DEF_STR( On ) )
346   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
347   PORT_DIPSETTING(   0x04, DEF_STR( On ) )
358348   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
359349   PORT_DIPSETTING(    0x00, DEF_STR( Upright ))
360350   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ))
361351   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ))
362   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
363   PORT_DIPSETTING(   0x10,  DEF_STR( On ) )
352   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
353   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
364354   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ))
365   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
366   PORT_DIPSETTING(   0x20,  DEF_STR( On ) )
355   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
356   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
367357   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ))
368   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
369   PORT_DIPSETTING(   0x40,  DEF_STR( On ) )
370   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Lives ) )
371   PORT_DIPSETTING(   0x00, "3" )
372   PORT_DIPSETTING(   0x80, "5" )
358   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
359   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
360   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )
361   PORT_DIPSETTING(   0x80, "3" )
362   PORT_DIPSETTING(   0x00, "5" )
373363
374364   PORT_START("DSW2")
375365   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r15303r15304
382372   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
383373   PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ))
384374   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
385   PORT_DIPNAME( 0x30, 0x00,   DEF_STR( Unknown ) ) //causes writes to 0xa000 every frame
386   PORT_DIPSETTING(    0x00, "0" )
387   PORT_DIPSETTING(    0x10, "1" )
388   PORT_DIPSETTING(    0x20, "2" )
389   PORT_DIPSETTING(    0x30, "3" )
390   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ))
391   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
392   PORT_DIPSETTING(   0x40,  DEF_STR( On ) )
375   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown )) // hopper related
376   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
377   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
378   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown )) // hopper related
379   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
380   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
381   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown )) // hopper related, if 0x10 or 0x20 is set, and this is set, it will lock up with HOPPER EMPTY
382   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
383   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
393384   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ))
394   PORT_DIPSETTING(   0x00,  DEF_STR( Off ) )
395   PORT_DIPSETTING(   0x80,  DEF_STR( On ) )
385   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
386   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
396387INPUT_PORTS_END
397388
398389static const gfx_layout charlayout =
r15303r15304
431422{
432423   superwng_state *state = machine.driver_data<superwng_state>();
433424
434   state->m_maincpu = machine.device("maincpu");
435   state->m_audiocpu = machine.device("audiocpu");
436
425   state->save_item(NAME(state->m_tile_bank));
437426   state->save_item(NAME(state->m_sound_byte));
438427   state->save_item(NAME(state->m_nmi_enable));
439428}
r15303r15304
491480
492481   MCFG_PALETTE_LENGTH(0x40)
493482   MCFG_PALETTE_INIT(superwng)
494   MCFG_VIDEO_START( superwng )
483   MCFG_VIDEO_START(superwng)
495484   MCFG_SCREEN_UPDATE_STATIC(superwng)
496485
497486   MCFG_SPEAKER_STANDARD_MONO("mono")
r15303r15304
525514ROM_END
526515
527516
528GAME( 1985, superwng,   0,      superwng, superwng, 0, ROT90, "Wing", "Super Wing", GAME_WRONG_COLORS )
517GAME( 1985, superwng,   0,      superwng, superwng, 0, ROT90, "Wing", "Super Wing", GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
src/mame/drivers/savquest.c
r15303r15304
2727
2828#include "emu.h"
2929#include "cpu/i386/i386.h"
30#include "memconv.h"
31#include "devconv.h"
3230#include "machine/8237dma.h"
3331#include "machine/pic8259.h"
3432#include "machine/pit8253.h"
r15303r15304
316314   i8237_w(device, offset / 2, data);
317315}
318316
319static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
320{
321   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
322}
323
324static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
325{
326   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
327}
328
329
330
331
332317static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
333318{
334319   cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r15303r15304
404389   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
405390   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
406391   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
407   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
392   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
408393   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
409394   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
410395   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
411   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
396   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
412397   AM_RANGE(0x00e8, 0x00ef) AM_NOP
413398
414399   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
src/mame/drivers/photoply.c
r15303r15304
1111
1212#include "emu.h"
1313#include "cpu/i386/i386.h"
14#include "memconv.h"
15#include "devconv.h"
1614#include "machine/8237dma.h"
1715#include "machine/pic8259.h"
1816#include "machine/pit8253.h"
r15303r15304
246244   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
247245   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
248246   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
249   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
247   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
250248   AM_RANGE(0x0070, 0x007f) AM_RAM//DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
251249   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
252250   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
src/mame/drivers/bzone.c
r15303r15304
309309   AM_RANGE(0x1800, 0x1800) AM_DEVREAD_LEGACY("mathbox", mathbox_status_r)
310310   AM_RANGE(0x1810, 0x1810) AM_DEVREAD_LEGACY("mathbox", mathbox_lo_r)
311311   AM_RANGE(0x1818, 0x1818) AM_DEVREAD_LEGACY("mathbox", mathbox_hi_r)
312//  AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
313312   AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
314313   AM_RANGE(0x1840, 0x1840) AM_DEVWRITE_LEGACY("discrete", bzone_sounds_w)
315314   AM_RANGE(0x1860, 0x187f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w)
r15303r15304
334333   AM_RANGE(0x1808, 0x1808) AM_DEVWRITE_LEGACY("custom", redbaron_joysound_w)   /* and select joystick pot also */
335334   AM_RANGE(0x180a, 0x180a) AM_WRITENOP            /* sound reset, yet todo */
336335   AM_RANGE(0x180c, 0x180c) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w)
337   //AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
338   AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
336   AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
339337   AM_RANGE(0x1820, 0x185f) AM_DEVREADWRITE("earom", atari_vg_earom_device, read, write)
340338   AM_RANGE(0x1860, 0x187f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w)
341339   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000)
src/mame/drivers/midqslvr.c
r15303r15304
2424
2525#include "emu.h"
2626#include "cpu/i386/i386.h"
27#include "memconv.h"
28#include "devconv.h"
2927#include "machine/8237dma.h"
3028#include "machine/pic8259.h"
3129#include "machine/pit8253.h"
r15303r15304
454452   i8237_w(device, offset / 2, data);
455453}
456454
457static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
458{
459   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
460}
461
462static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
463{
464   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
465}
466
467
468
469
470455static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
471456{
472457   cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r15303r15304
545530   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
546531   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
547532   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
548   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
533   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
549534   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
550535   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w,0xffffffff)
551536   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
552   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
537   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
553538   AM_RANGE(0x00e8, 0x00ef) AM_NOP
554539
555540   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
src/mame/drivers/calchase.c
r15303r15304
109109
110110#include "emu.h"
111111#include "cpu/i386/i386.h"
112#include "memconv.h"
113#include "devconv.h"
114112#include "machine/8237dma.h"
115113#include "machine/pic8259.h"
116114#include "machine/pit8253.h"
r15303r15304
175173   i8237_w(device, offset / 2, data);
176174}
177175
178static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
179{
180   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
181}
182
183static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
184{
185   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
186}
187
188
189
190176READ8_MEMBER(calchase_state::at_page8_r)
191177{
192178   UINT8 data = m_at_pages[offset % 0x10];
r15303r15304
562548   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
563549   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
564550   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
565   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
551   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
566552   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
567553   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
568554   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
569   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
555   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
570556   //AM_RANGE(0x00e8, 0x00eb) AM_NOP
571557   AM_RANGE(0x00e8, 0x00ef) AM_NOP //AMI BIOS write to this ports as delays between I/O ports operations sending al value -> NEWIODELAY
572558   AM_RANGE(0x0170, 0x0177) AM_NOP //To debug
src/mame/drivers/xtom3d.c
r15303r15304
4040
4141#include "emu.h"
4242#include "cpu/i386/i386.h"
43#include "memconv.h"
44#include "devconv.h"
4543#include "machine/8237dma.h"
4644#include "machine/pic8259.h"
4745#include "machine/pit8253.h"
r15303r15304
446444   i8237_w(device, offset / 2, data);
447445}
448446
449static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
450{
451   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
452}
453
454static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
455{
456   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
457}
458
459
460
461
462447static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
463448{
464449   cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r15303r15304
536521   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
537522   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
538523   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
539   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
524   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
540525   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
541526   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,   at_page8_w, 0xffffffff)
542527   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
543   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
528   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
544529   AM_RANGE(0x00e8, 0x00ef) AM_NOP
545530
546531   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
src/mame/drivers/flipjack.c
r0r15304
1/***************************************************************************
2
3prelim notes:
4Flipper Jack, by Jackson, 1983
5probably a prequel to superwng, it has a Falcon logo on the pcb
6
7xtal: 16mhz, 6mhz
8cpu: 2*z80
9sound: 2*ay8910
10other: 8255 ppi, hd6845 crtc, 1 dipsw
11ram: 2*8KB, 4*2KB
12rom: see romdefs
13
14TODO:
15- flipscreen
16- remaining gfx/color issues
17- measure clocks
18
19***************************************************************************/
20
21#include "emu.h"
22#include "cpu/z80/z80.h"
23#include "machine/i8255.h"
24#include "sound/ay8910.h"
25#include "video/mc6845.h"
26
27#define MASTER_CLOCK   XTAL_16MHz
28#define VIDEO_CLOCK      XTAL_6MHz
29
30
31class flipjack_state : public driver_device
32{
33public:
34   flipjack_state(const machine_config &mconfig, device_type type, const char *tag)
35      : driver_device(mconfig, type, tag),
36      m_maincpu(*this, "maincpu"),
37      m_audiocpu(*this, "audiocpu"),
38      m_crtc(*this, "crtc"),
39      m_fbram(*this, "fb_ram"),
40      m_vram(*this, "vram"),
41      m_cram(*this, "cram")
42   {
43      m_soundlatch = 0;
44      m_bank = 0;
45      m_layer = 0;
46   }
47
48   required_device<cpu_device> m_maincpu;
49   required_device<cpu_device> m_audiocpu;
50   required_device<hd6845_device> m_crtc;
51
52   required_shared_ptr<UINT8> m_fbram;
53   required_shared_ptr<UINT8> m_vram;
54   required_shared_ptr<UINT8> m_cram;
55
56   UINT8 m_soundlatch;
57   UINT8 m_bank;
58   UINT8 m_layer;
59
60   DECLARE_WRITE8_MEMBER(flipjack_sound_nmi_ack_w);
61   DECLARE_WRITE8_MEMBER(flipjack_soundlatch_w);
62   DECLARE_WRITE8_MEMBER(flipjack_bank_w);
63   DECLARE_WRITE8_MEMBER(flipjack_layer_w);
64   DECLARE_INPUT_CHANGED_MEMBER(flipjack_coin);
65};
66
67
68/***************************************************************************
69
70  Video
71
72***************************************************************************/
73
74PALETTE_INIT( flipjack )
75{
76   // from prom
77   const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
78   for (int i = 0; i < 0x40; i++)
79   {
80      palette_set_color_rgb(machine, 2*i+1, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
81      palette_set_color_rgb(machine, 2*i+0, pal1bit(color_prom[i] >> 1), pal1bit(color_prom[i] >> 2), pal1bit(color_prom[i] >> 0));
82   }
83
84   // standard 1bpp for blitter
85   for (int i = 0; i < 8; i++)
86      palette_set_color_rgb(machine, i+0x80, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
87}
88
89
90static SCREEN_UPDATE_RGB32( flipjack )
91{
92   flipjack_state *state = screen.machine().driver_data<flipjack_state>();
93   int x,y,count;
94
95   bitmap.fill(get_black_pen(screen.machine()), cliprect);
96
97   // draw playfield
98   if (state->m_layer & 2)
99   {
100      const UINT8 *blit_data = state->memregion("gfx2")->base();
101
102      count = 0;
103
104      for(y=0;y<192;y++)
105      {
106         for(x=0;x<256;x+=8)
107         {
108            UINT32 pen_r,pen_g,pen_b,color;
109            int xi;
110
111            pen_r = (blit_data[count] & 0xff)>>0;
112            pen_g = (blit_data[count+0x2000] & 0xff)>>0;
113            pen_b = (blit_data[count+0x4000] & 0xff)>>0;
114
115            for(xi=0;xi<8;xi++)
116            {
117               if(cliprect.contains(x+xi, y))
118               {
119                  color = ((pen_r >> (7-xi)) & 1)<<0;
120                  color|= ((pen_g >> (7-xi)) & 1)<<1;
121                  color|= ((pen_b >> (7-xi)) & 1)<<2;
122                  bitmap.pix32(y, x+xi) = screen.machine().pens[color+0x80];
123               }
124            }
125
126            count++;
127         }
128      }
129   }
130
131   // draw tiles
132   for (y=0;y<32;y++)
133   {
134      for (x=0;x<32;x++)
135      {
136         const gfx_element *gfx = screen.machine().gfx[0];
137         int tile = state->m_bank << 8 | state->m_vram[x+y*0x100];
138         int color = state->m_cram[x+y*0x100] & 0x3f;
139
140         drawgfx_transpen(bitmap, cliprect, gfx, tile, color, 0, 0, x*8, y*8, 0);
141      }
142   }
143
144   // draw framebuffer
145   if (state->m_layer & 4)
146   {
147      count = 0;
148
149      for(y=0;y<192;y++)
150      {
151         for(x=0;x<256;x+=8)
152         {
153            UINT32 pen,color;
154            int xi;
155
156            pen = (state->m_fbram[count] & 0xff)>>0;
157
158            for(xi=0;xi<8;xi++)
159            {
160               if(cliprect.contains(x+xi, y))
161               {
162                  color = ((pen >> (7-xi)) & 1) ? 0x87 : 0;
163                  if(color)
164                     bitmap.pix32(y, x+xi) = screen.machine().pens[color];
165               }
166            }
167
168            count++;
169         }
170      }
171   }
172
173
174   return 0;
175}
176
177
178/***************************************************************************
179
180  I/O
181
182***************************************************************************/
183
184WRITE8_MEMBER(flipjack_state::flipjack_bank_w)
185{
186   // d0-d1: tile bank
187   // d2: prg bank
188   // d4: ?
189   // other bits: unused?
190   m_bank = data;
191   membank("bank1")->set_entry(data >> 2 & 1);
192}
193
194WRITE8_MEMBER(flipjack_state::flipjack_layer_w)
195{
196   // d0: flip screen
197   // d1: enable playfield layer
198   // d2: enable framebuffer layer
199   // d3: ?
200   // other bits: unused?
201   m_layer = data;
202}
203
204static READ8_DEVICE_HANDLER( flipjack_soundlatch_r )
205{
206   flipjack_state *state = device->machine().driver_data<flipjack_state>();
207   device_set_input_line(state->m_audiocpu, 0, CLEAR_LINE);
208   return state->m_soundlatch;
209}
210
211WRITE8_MEMBER(flipjack_state::flipjack_soundlatch_w)
212{
213   m_soundlatch = data;
214   device_set_input_line(m_audiocpu, 0, ASSERT_LINE);
215}
216
217WRITE8_MEMBER(flipjack_state::flipjack_sound_nmi_ack_w)
218{
219   device_set_input_line(m_audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
220}
221
222static WRITE8_DEVICE_HANDLER( flipjack_portc_w )
223{
224   // watchdog?
225}
226
227INPUT_CHANGED_MEMBER(flipjack_state::flipjack_coin)
228{
229   if (newval)
230      device_set_input_line(m_maincpu, INPUT_LINE_NMI, PULSE_LINE);
231}
232
233
234static ADDRESS_MAP_START( flipjack_main_map, AS_PROGRAM, 8, flipjack_state )
235   AM_RANGE(0x0000, 0x1fff) AM_ROM
236   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank1")
237   AM_RANGE(0x4000, 0x5fff) AM_RAM
238   AM_RANGE(0x6000, 0x67ff) AM_RAM
239   AM_RANGE(0x6800, 0x6803) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
240   AM_RANGE(0x7000, 0x7000) AM_WRITE(flipjack_soundlatch_w)
241   AM_RANGE(0x7010, 0x7010) AM_DEVWRITE("crtc", hd6845_device, address_w)
242   AM_RANGE(0x7011, 0x7011) AM_DEVWRITE("crtc", hd6845_device, register_w)
243   AM_RANGE(0x7020, 0x7020) AM_READ_PORT("DSW")
244   AM_RANGE(0x7800, 0x7800) AM_WRITE(flipjack_layer_w)
245   AM_RANGE(0x8000, 0x9fff) AM_ROM
246   AM_RANGE(0xa000, 0xbfff) AM_RAM AM_SHARE("cram")
247   AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("vram")
248   AM_RANGE(0xe000, 0xffff) AM_RAM AM_SHARE("fb_ram")
249ADDRESS_MAP_END
250
251static ADDRESS_MAP_START( flipjack_main_io_map, AS_IO, 8, flipjack_state )
252   ADDRESS_MAP_GLOBAL_MASK(0xff)
253   AM_RANGE(0xff, 0xff) AM_WRITE(flipjack_bank_w)
254ADDRESS_MAP_END
255
256static ADDRESS_MAP_START( flipjack_sound_map, AS_PROGRAM, 8, flipjack_state )
257   AM_RANGE(0x0000, 0x1fff) AM_ROM
258   AM_RANGE(0x2000, 0x27ff) AM_RAM
259   AM_RANGE(0x4000, 0x4000) AM_DEVREADWRITE_LEGACY("ay2", ay8910_r, ay8910_data_w)
260   AM_RANGE(0x6000, 0x6000) AM_DEVWRITE_LEGACY("ay2", ay8910_address_w)
261   AM_RANGE(0x8000, 0x8000) AM_DEVREADWRITE_LEGACY("ay1", ay8910_r, ay8910_data_w)
262   AM_RANGE(0xa000, 0xa000) AM_DEVWRITE_LEGACY("ay1", ay8910_address_w)
263ADDRESS_MAP_END
264
265static ADDRESS_MAP_START( flipjack_sound_io_map, AS_IO, 8, flipjack_state )
266   ADDRESS_MAP_GLOBAL_MASK(0xff)
267   AM_RANGE(0x00, 0x00) AM_WRITE(flipjack_sound_nmi_ack_w)
268ADDRESS_MAP_END
269
270
271/***************************************************************************
272
273  Inputs
274
275***************************************************************************/
276
277static INPUT_PORTS_START( flipjack )
278   PORT_START("COIN")
279   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, flipjack_state, flipjack_coin, 0) // where in P1/P2/P3 is it mapped?
280
281   PORT_START("P1")
282   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Shoot")
283   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Left Flipper")
284   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Tilt")
285   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Right Flipper")
286   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
287   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
288   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
289   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
290
291   PORT_START("P2")
292   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Shoot")
293   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Left Flipper")
294   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL PORT_NAME("P2 Tilt")
295   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Right Flipper")
296   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
297   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
298   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
299   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
300
301   PORT_START("P3")
302   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
303   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
304   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
305   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
306   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) // output
307
308   PORT_START("DSW")
309   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("A0:1")
310   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
311   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
312   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Coinage ) )      PORT_DIPLOCATION("A0:2")
313   PORT_DIPSETTING(    0x02, DEF_STR( 1C_1C ) )
314   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
315   PORT_DIPNAME( 0x04, 0x04, "Drop Target" )         PORT_DIPLOCATION("A0:3")
316   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
317   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
318   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("A0:4")
319   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
320   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
321   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("A0:5,6,7")
322   PORT_DIPSETTING(   0x70, "150K & Every 70K" )
323   PORT_DIPSETTING(   0x60, "150K & Every 100K" )
324   PORT_DIPSETTING(   0x50, "200K & Every 70K" )
325   PORT_DIPSETTING(   0x40, "200K & Every 100K" )
326   PORT_DIPSETTING(   0x00, "None" )
327   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )      PORT_DIPLOCATION("A0:8")
328   PORT_DIPSETTING(    0x80, "3" )
329   PORT_DIPSETTING(    0x00, "5" )
330
331INPUT_PORTS_END
332
333
334/***************************************************************************
335
336  Machine Config
337
338***************************************************************************/
339
340static I8255A_INTERFACE( ppi8255_intf )
341{
342   DEVCB_INPUT_PORT("P1"),            /* Port A read */
343   DEVCB_NULL,                     /* Port A write */
344   DEVCB_INPUT_PORT("P2"),            /* Port B read */
345   DEVCB_NULL,                     /* Port B write */
346   DEVCB_INPUT_PORT("P3"),            /* Port C read */
347   DEVCB_HANDLER(flipjack_portc_w)      /* Port C write */
348};
349
350
351static AY8910_INTERFACE( ay8910_config_1 )
352{
353   AY8910_LEGACY_OUTPUT,               /* Flags */
354   AY8910_DEFAULT_LOADS,               /* Load on channel in ohms */
355   DEVCB_HANDLER(flipjack_soundlatch_r),   /* Port A read */
356   DEVCB_NULL,                        /* Port B read */
357   DEVCB_NULL,                        /* Port A write */
358   DEVCB_NULL                        /* Port B write */
359};
360
361static AY8910_INTERFACE( ay8910_config_2 )
362{
363   AY8910_LEGACY_OUTPUT,               /* Flags */
364   AY8910_DEFAULT_LOADS,               /* Load on channel in ohms */
365   DEVCB_NULL,                        /* Port A read */
366   DEVCB_NULL,                        /* Port B read */
367   DEVCB_NULL,                        /* Port A write */
368   DEVCB_NULL                        /* Port B write */
369};
370
371static MC6845_INTERFACE( mc6845_intf )
372{
373   "screen",   /* screen we are acting on */
374   8,         /* number of pixels per video memory address */
375   NULL,      /* before pixel update callback */
376   NULL,      /* row update callback */
377   NULL,      /* after pixel update callback */
378   DEVCB_NULL,   /* callback for display state changes */
379   DEVCB_NULL,   /* callback for cursor state changes */
380   DEVCB_NULL,   /* HSYNC callback */
381   DEVCB_NULL,   /* VSYNC callback */
382   NULL      /* update address callback */
383};
384
385
386
387static const gfx_layout tilelayout =
388{
389   8, 8,
390   RGN_FRAC(1,1),
391   1,
392   { 0 },
393   { 0, 1, 2, 3, 4, 5, 6, 7 },
394   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
395   8*8
396};
397
398static GFXDECODE_START( flipjack )
399   GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0, 64 )
400GFXDECODE_END
401
402
403
404static MACHINE_START( flipjack )
405{
406   flipjack_state *state = machine.driver_data<flipjack_state>();
407   UINT8 *ROM = machine.root_device().memregion("maincpu")->base();
408   machine.root_device().membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x2000);
409   state->membank("bank1")->set_entry(0);
410
411   state->save_item(NAME(state->m_soundlatch));
412   state->save_item(NAME(state->m_bank));
413   state->save_item(NAME(state->m_layer));
414}
415
416
417static MACHINE_CONFIG_START( flipjack, flipjack_state )
418
419   /* basic machine hardware */
420   MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/4)
421   MCFG_CPU_PROGRAM_MAP(flipjack_main_map)
422   MCFG_CPU_IO_MAP(flipjack_main_io_map)
423   MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
424
425   MCFG_CPU_ADD("audiocpu", Z80, MASTER_CLOCK/4)
426   MCFG_CPU_PROGRAM_MAP(flipjack_sound_map)
427   MCFG_CPU_IO_MAP(flipjack_sound_io_map)
428   MCFG_CPU_VBLANK_INT("screen", nmi_line_assert)
429
430   MCFG_I8255A_ADD( "ppi8255", ppi8255_intf )
431
432   MCFG_MACHINE_START(flipjack)
433
434   /* video hardware */
435   MCFG_SCREEN_ADD("screen", RASTER)
436   MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 0x188, 0, 0x100, 0x100, 0, 0xc0) // from crtc
437   MCFG_SCREEN_UPDATE_STATIC(flipjack)
438
439   MCFG_MC6845_ADD("crtc", HD6845, VIDEO_CLOCK/8, mc6845_intf)
440
441   MCFG_GFXDECODE(flipjack)
442
443   MCFG_PALETTE_LENGTH(128+8)
444   MCFG_PALETTE_INIT(flipjack)
445
446   /* sound hardware */
447   MCFG_SPEAKER_STANDARD_MONO("mono")
448
449   MCFG_SOUND_ADD("ay1", AY8910, MASTER_CLOCK/8)
450   MCFG_SOUND_CONFIG(ay8910_config_1)
451   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
452
453   MCFG_SOUND_ADD("ay2", AY8910, MASTER_CLOCK/8)
454   MCFG_SOUND_CONFIG(ay8910_config_2)
455   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
456MACHINE_CONFIG_END
457
458
459ROM_START( flipjack )
460   ROM_REGION( 0x14000, "maincpu", 0 )
461   ROM_LOAD( "3.d5", 0x00000, 0x2000, CRC(123bd992) SHA1(d845e2b9af5b81d950e5edf35201f1dd1c4af651) )
462   ROM_LOAD( "4.f5", 0x08000, 0x2000, CRC(d27e0184) SHA1(f108993fc3fce9173a4961a76fc60655fdd1cd25) )
463   ROM_LOAD( "1.l5", 0x10000, 0x2000, CRC(4632263b) SHA1(b1fbb851ffd8aff36aff6f36672122fef3dd0af1) )
464   ROM_LOAD( "2.m5", 0x12000, 0x2000, CRC(e2bdce13) SHA1(50d990095a35837570b3117763e990440d8656ae) )
465
466   ROM_REGION( 0x2000, "audiocpu", 0 )
467   ROM_LOAD( "s.s5",  0x0000, 0x2000, CRC(34515a7b) SHA1(affe34198b77bddd314fae2851fd6a29d80f734e) )
468
469   ROM_REGION( 0x2000, "gfx1", 0 )
470   ROM_LOAD( "cg.l6", 0x0000, 0x2000, CRC(8d87f6b9) SHA1(55ca726f190eac9ee7e26b8f4e519f1634bec0dd) )
471
472   ROM_REGION( 0x6000, "gfx2", 0 )
473   ROM_LOAD( "b.h6",  0x0000, 0x2000, CRC(bbc8fdcc) SHA1(93758ca13cc49b87508f01c86c652155945dd484) )
474   ROM_LOAD( "r.f6",  0x2000, 0x2000, CRC(8c02fe71) SHA1(148e7382dc9b7678c447ada5ad19e03a3a051a7f) )
475   ROM_LOAD( "g.d6",  0x4000, 0x2000, CRC(8624d07f) SHA1(fb51c9c785d56854a6530b71868e95ad6be7cbee) )
476
477   ROM_REGION( 0x0100, "proms", 0 )
478   ROM_LOAD( "m3-7611-5.f8", 0x0000, 0x0100, CRC(f0248102) SHA1(22d87935c941e2e8bba5427599f6fd5fa1262ebc) )
479ROM_END
480
481
482GAME( 1983?, flipjack,   0,      flipjack, flipjack, 0, ROT90, "Jackson Co., Ltd.", "Flipper Jack", GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // copyright not shown, datecodes on pcb suggests mid-1983
src/mame/drivers/taitowlf.c
r15303r15304
2727
2828#include "emu.h"
2929#include "cpu/i386/i386.h"
30#include "memconv.h"
31#include "devconv.h"
3230#include "machine/8237dma.h"
3331#include "machine/pic8259.h"
3432#include "machine/pit8253.h"
r15303r15304
111109   i8237_w(device, offset / 2, data);
112110}
113111
114static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
115{
116   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
117}
118
119static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
120{
121   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
122}
123
124
125
126112// Intel 82439TX System Controller (MXTC)
127113
128114static UINT8 mxtc_config_r(device_t *busdevice, device_t *device, int function, int reg)
r15303r15304
466452   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
467453   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
468454   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
469   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
455   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
470456   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
471457   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,            at_page8_w, 0xffffffff)
472458   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
473   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
459   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
474460   AM_RANGE(0x00e8, 0x00eb) AM_NOP
475461   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
476462   AM_RANGE(0x0300, 0x03af) AM_NOP
src/mame/drivers/funkball.c
r15303r15304
6969
7070#include "emu.h"
7171#include "cpu/i386/i386.h"
72#include "memconv.h"
73#include "devconv.h"
7472#include "machine/8237dma.h"
7573#include "machine/pic8259.h"
7674#include "machine/pit8253.h"
r15303r15304
326324   i8237_w(device, offset / 2, data);
327325}
328326
329static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
330{
331   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
332}
333
334static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
335{
336   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
337}
338
339
340
341
342327static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
343328{
344329   cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r15303r15304
585570   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
586571   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", io20_r, io20_w, 0xffffffff)
587572   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
588   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
573   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
589574   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) /* todo: nvram (CMOS Setup Save)*/
590575   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w, 0xffffffff)
591576   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
592   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
577   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
593578   AM_RANGE(0x00e8, 0x00ef) AM_NOP
594579
595580//  AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
src/mame/drivers/gamecstl.c
r15303r15304
6464
6565#include "emu.h"
6666#include "cpu/i386/i386.h"
67#include "memconv.h"
68#include "devconv.h"
6967#include "machine/8237dma.h"
7068#include "machine/pic8259.h"
7169#include "machine/pit8253.h"
r15303r15304
184182   i8237_w(device, offset / 2, data);
185183}
186184
187static READ32_DEVICE_HANDLER(at32_dma8237_2_r)
188{
189   return read32le_with_read8_device_handler(at_dma8237_2_r, device, offset, mem_mask);
190}
191
192static WRITE32_DEVICE_HANDLER(at32_dma8237_2_w)
193{
194   write32le_with_write8_device_handler(at_dma8237_2_w, device, offset, data, mem_mask);
195}
196
197
198
199185// Intel 82439TX System Controller (MXTC)
200186
201187static UINT8 mxtc_config_r(device_t *busdevice, device_t *device, int function, int reg)
r15303r15304
522508   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8_LEGACY("dma8237_1", i8237_r, i8237_w, 0xffffffff)
523509   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8_LEGACY("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
524510   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8_LEGACY("pit8254", pit8253_r, pit8253_w, 0xffffffff)
525   AM_RANGE(0x0060, 0x006f) AM_READWRITE_LEGACY(kbdc8042_32le_r,         kbdc8042_32le_w)
511   AM_RANGE(0x0060, 0x006f) AM_READWRITE8_LEGACY(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
526512   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
527513   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r,at_page8_w, 0xffffffff)
528514   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8_LEGACY("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
529   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE_LEGACY("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
515   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8_LEGACY("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
530516   AM_RANGE(0x00e8, 0x00eb) AM_NOP
531517   AM_RANGE(0x00ec, 0x00ef) AM_NOP
532518   AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE_LEGACY("ide", ide_r, ide_w)
src/mame/drivers/crimfght.c
r15303r15304
356356
357357ROM_START( crimfghtj )
358358   ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */
359   ROM_LOAD( "821p02.bin", 0x10000, 0x18000, CRC(f33fa2e1) SHA1(00fc9e8250fa51386f3af2fca0f137bec9e1c220) )
359   ROM_LOAD( "821p02.f24", 0x10000, 0x18000, CRC(f33fa2e1) SHA1(00fc9e8250fa51386f3af2fca0f137bec9e1c220) )
360360   ROM_CONTINUE(           0x08000, 0x08000 )
361361
362362   ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
r15303r15304
379379
380380ROM_START( crimfght2 )
381381ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */
382   ROM_LOAD( "crimefb.r02", 0x10000, 0x18000, CRC(4ecdd923) SHA1(78e5260c4bb9b18d7818fb6300d7e1d3a577fb63) )
382   ROM_LOAD( "821r02.f24", 0x10000, 0x18000, CRC(4ecdd923) SHA1(78e5260c4bb9b18d7818fb6300d7e1d3a577fb63) )
383383   ROM_CONTINUE(           0x08000, 0x08000 )
384384
385385   ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
src/mame/drivers/darkmist.c
r15303r15304
476476   auto_free(machine, buffer);
477477}
478478
479GAME( 1986, darkmist, 0, darkmist, darkmist, darkmist, ROT270, "Taito", "The Lost Castle In Darkmist", GAME_IMPERFECT_GRAPHICS|GAME_NO_COCKTAIL )
479GAME( 1986, darkmist, 0, darkmist, darkmist, darkmist, ROT270, "Taito Corporation", "The Lost Castle In Darkmist", GAME_IMPERFECT_GRAPHICS|GAME_NO_COCKTAIL )
src/emu/sound/pokey.c
r15303r15304
7171
7272#define POKEY_DEFAULT_GAIN (32767/11/4)
7373
74#define VERBOSE       1
74#define VERBOSE       
7575#define VERBOSE_SOUND   0
76#define VERBOSE_TIMER   1
76#define VERBOSE_TIMER   
7777#define VERBOSE_POLY   0
7878#define VERBOSE_RAND   0
7979
r15303r15304
197197      memcpy(&m_intf, static_config(), sizeof(pokey_interface));
198198   m_clock_period = attotime::from_hz(clock());
199199
200   /* Setup channels */
201   for (i=0; i<POKEY_CHANNELS; i++)
202   {
203      m_channel[i].m_parent = this;
204      m_channel[i].m_INTMask = 0;
205   }
206   m_channel[CHAN1].m_INTMask = IRQ_TIMR1;
207   m_channel[CHAN2].m_INTMask = IRQ_TIMR2;
208   m_channel[CHAN4].m_INTMask = IRQ_TIMR4;
209
200210   /* calculate the A/D times
201211     * In normal, slow mode (SKCTL bit SK_PADDLE is clear) the conversion
202212     * takes N scanlines, where N is the paddle value. A single scanline
r15303r15304
218228   poly_init_9_17(m_poly9,   9);
219229   poly_init_9_17(m_poly17, 17);
220230
221   m_divisor[CHAN1] = 4;
222   m_divisor[CHAN2] = 4;
223   m_divisor[CHAN3] = 4;
224   m_divisor[CHAN4] = 4;
225231   m_clockmult = DIV_64;
226232   m_KBCODE = 0x09;       /* Atari 800 'no key' */
227233   m_SKCTL = SK_RESET;    /* let the RNG run after reset */
228   m_rtimer = timer_alloc(0);
229234
230   m_timer[0] = timer_alloc(1);
231   m_timer[1] = timer_alloc(1);
232   m_timer[2] = timer_alloc(1);
235   m_SKSTAT = 0;
236   m_IRQST = 0;
237   m_IRQEN = 0;
233238
234239   /* reset more internal state */
235240   for (i=0; i<3; i++)
r15303r15304
249254
250255   m_stream = stream_alloc(0, 1, clock());
251256
257#ifdef POKEY_EXEC_INTERFACE
258   m_write_timer = timer_alloc(10);   /* timer for sync operation */
259   timer_alloc(11);
260#endif
261
262
252263   for (i=0; i<POKEY_CHANNELS; i++)
253264   {
254265      save_item(NAME(m_channel[i].m_borrow_cnt), i);
r15303r15304
259270      save_item(NAME(m_channel[i].m_AUDF), i);
260271      save_item(NAME(m_channel[i].m_AUDC), i);
261272   }
273
262274   save_item(NAME(m_divisor));
263275   save_item(NAME(m_clock_cnt));
264276   save_item(NAME(m_p4));
265277   save_item(NAME(m_p5));
266278   save_item(NAME(m_p9));
267279   save_item(NAME(m_p17));
268   save_item(NAME(m_r9));
269   save_item(NAME(m_r17));
270280   save_item(NAME(m_clockmult));
271   save_item(NAME(m_timer_period[0]));
272   save_item(NAME(m_timer_period[1]));
273   save_item(NAME(m_timer_period[2]));
274   save_item(NAME(m_timer_param));
275281   save_item(NAME(m_POTx));
276282   save_item(NAME(m_AUDCTL));
277283   save_item(NAME(m_ALLPOT));
278284   save_item(NAME(m_KBCODE));
279   save_item(NAME(m_RANDOM));
280285   save_item(NAME(m_SERIN));
281286   save_item(NAME(m_SEROUT));
282287   save_item(NAME(m_IRQST));
r15303r15304
327332
328333void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
329334{
330   if (id == 1)
335   if (id == 2)
331336   {
332      int timers = param;
333
334      LOG_TIMER(("POKEY #%p timer %d with IRQEN $%02x\n", this, timers, m_IRQEN));
335
336       /* check if some of the requested timer interrupts are enabled */
337      timers &= m_IRQEN;
338
339       if( timers )
340       {
341         /* set the enabled timer irq status bits */
342         m_IRQST |= timers;
343           /* call back an application supplied function to handle the interrupt */
344         if( m_interrupt_cb )
345            (*m_interrupt_cb)(this, timers);
346       }
347   }
348   else if (id == 2)
349   {
350337      int pot = param;
351338
352339      LOG(("POKEY #%p POT%d triggers after %dus\n", this, pot, (int)(1000000 * m_ptimer[pot]->elapsed().as_double())));
r15303r15304
385372            (m_interrupt_cb)(this, IRQ_SERIN);
386373      }
387374   }
375   else if (id == 10)
376   {
377      offs_t offset = (param >> 8) & 0xff;
378      UINT8 data = param & 0xff;
379      write_internal(offset, data);
380   }
381   else if (id == 11)
382   {
383      /* do nothing, caused by a forced resync */
384   }
388385   else
389386      assert_always(FALSE, "Unknown id in pokey_device::device_timer");
390387}
391388
389#ifdef POKEY_EXEC_INTERFACE
390   void pokeyn_device::execute_run()
391   {
392      //bool check_debugger = ((device_t::machine().debug_flags & DEBUG_FLAG_ENABLED) != 0);
393
394      do
395      {
396         // debugging
397         //m_ppc = m_pc;   // copy PC to previous PC
398         //if (check_debugger)
399            //debugger_instruction_hook(this, m_pc);
400
401         // instruction fetch
402         //UINT16 op = opcode_read();
403
404         UINT32 new_out = step_one_clock();
405         if (m_output != new_out)
406         {
407            m_stream->update();
408            m_output = new_out;
409         }
410
411           m_icount--;
412       } while (m_icount > 0);
413
414   }
415   //{ m_icount = 0; } //printf("execute: %d\n", m_icount); m_icount = 0; }
416#endif
417
418
392419//-------------------------------------------------
393//  stream_generate - handle update requests for
394//  our sound stream
420//  step_one_clock - step the whole chip one
421//  clock cycle.
395422//-------------------------------------------------
396423
397424/*
r15303r15304
402429 *
403430 */
404431
405void pokeyn_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
432UINT32 pokeyn_device::step_one_clock(void)
406433{
407   stream_sample_t *buffer = outputs[0];
434   int ch, clk;
435   UINT32 sum = 0;
436   int clock_triggered[3] = {0,0,0};
408437   int base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
409438
410   while( samples > 0 )
411   {
412      int ch, clk;
413      UINT32 sum = 0;
414      int clock_triggered[3] = {0,0,0};
439    if( (m_SKCTL & SK_RESET) )
440    {
441       /* Clocks only count if we are not in a reset */
442       for (clk = 0; clk < 3; clk++)
443       {
444          m_clock_cnt[clk]++;
445          if (m_clock_cnt[clk] >= clock_divisors[clk])
446          {
447             m_clock_cnt[clk] = 0;
448             clock_triggered[clk] = 1;
449          }
450       }
415451
416      for (clk = 0; clk < 3; clk++)
417      {
418         m_clock_cnt[clk]++;
419         if (m_clock_cnt[clk] >= clock_divisors[clk])
420         {
421            m_clock_cnt[clk] = 0;
422            clock_triggered[clk] = 1;
423         }
424      }
452       m_p4 = (m_p4 + 1) % 0x0000f;
453       m_p5 = (m_p5 + 1) % 0x0001f;
454       m_p9 = (m_p9 + 1) % 0x001ff;
455       m_p17 = (m_p17 + 1 ) % 0x1ffff;
425456
426      m_p4 = (m_p4 + 1) % 0x0000f;
427      m_p5 = (m_p5 + 1) % 0x0001f;
428      m_p9 = (m_p9 + 1) % 0x001ff;
429      m_p17 = (m_p17 + 1 ) % 0x1ffff;
457       clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
458       if (clock_triggered[clk])
459          m_channel[CHAN1].inc_chan();
430460
461       clk = (m_AUDCTL & CH3_HICLK) ? CLK_1 : base_clock;
462       if (clock_triggered[clk])
463          m_channel[CHAN3].inc_chan();
431464
432      clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock;
433      if (clock_triggered[clk])
434         m_channel[CHAN1].inc_chan();
465       if (clock_triggered[base_clock])
466       {
467          if (!(m_AUDCTL & CH12_JOINED))
468             m_channel[CHAN2].inc_chan();
469          if (!(m_AUDCTL & CH34_JOINED))
470             m_channel[CHAN4].inc_chan();
471       }
472    }
435473
436      clk = (m_AUDCTL & CH3_HICLK) ? CLK_1 : base_clock;
437      if (clock_triggered[clk])
438         m_channel[CHAN3].inc_chan();
474   /* do CHAN2 before CHAN1 because CHAN1 may set borrow! */
475   if (m_channel[CHAN2].check_borrow())
476   {
477      int isJoined = (m_AUDCTL & CH12_JOINED);
478      if (isJoined)
479         m_channel[CHAN1].reset_channel();
480      m_channel[CHAN2].reset_channel();
481      process_channel(CHAN2);
439482
440      if (clock_triggered[base_clock])
441      {
442         if (!(m_AUDCTL & CH12_JOINED))
443            m_channel[CHAN2].inc_chan();
444         if (!(m_AUDCTL & CH34_JOINED))
445            m_channel[CHAN4].inc_chan();
446      }
483      /* check if some of the requested timer interrupts are enabled */
484       if ((m_IRQST & IRQ_TIMR2) && m_interrupt_cb )
485         (*m_interrupt_cb)(this, IRQ_TIMR2);
486   }
447487
448      /* do CHAN2 before CHAN1 because CHAN1 may set borrow! */
449      if (m_channel[CHAN2].check_borrow())
450      {
451         int isJoined = (m_AUDCTL & CH12_JOINED);
452         if (isJoined)
453            m_channel[CHAN1].reset_channel();
454         m_channel[CHAN2].reset_channel();
455         process_channel(CHAN2);
456      }
488   if (m_channel[CHAN1].check_borrow())
489   {
490      int isJoined = (m_AUDCTL & CH12_JOINED);
491      if (isJoined)
492         m_channel[CHAN2].inc_chan();
493      else
494         m_channel[CHAN1].reset_channel();
495      process_channel(CHAN1);
496      /* check if some of the requested timer interrupts are enabled */
497       if ((m_IRQST & IRQ_TIMR1) && m_interrupt_cb )
498         (*m_interrupt_cb)(this, IRQ_TIMR1);
499   }
457500
458      if (m_channel[CHAN1].check_borrow())
459      {
460         int isJoined = (m_AUDCTL & CH12_JOINED);
461         if (isJoined)
462            m_channel[CHAN2].inc_chan();
463         else
464            m_channel[CHAN1].reset_channel();
465         process_channel(CHAN1);
466      }
501   /* do CHAN4 before CHAN3 because CHAN3 may set borrow! */
502   if (m_channel[CHAN4].check_borrow())
503   {
504      int isJoined = (m_AUDCTL & CH34_JOINED);
505      if (isJoined)
506         m_channel[CHAN3].reset_channel();
507      m_channel[CHAN4].reset_channel();
508      process_channel(CHAN4);
509      /* is this a filtering channel (3/4) and is the filter active? */
510      if (m_AUDCTL & CH2_FILTER)
511         m_channel[CHAN2].sample();
512      else
513         m_channel[CHAN2].m_filter_sample = 1;
514       if ((m_IRQST & IRQ_TIMR4) && m_interrupt_cb )
515         (*m_interrupt_cb)(this, IRQ_TIMR4);
516   }
467517
468      /* do CHAN4 before CHAN3 because CHAN3 may set borrow! */
469      if (m_channel[CHAN4].check_borrow())
470      {
471         int isJoined = (m_AUDCTL & CH34_JOINED);
472         if (isJoined)
473            m_channel[CHAN3].reset_channel();
474         m_channel[CHAN4].reset_channel();
475         process_channel(CHAN4);
476         /* is this a filtering channel (3/4) and is the filter active? */
477         if (m_AUDCTL & CH2_FILTER)
478            m_channel[CHAN2].sample();
479         else
480            m_channel[CHAN2].m_filter_sample = 1;
481      }
518   if (m_channel[CHAN3].check_borrow())
519   {
520      int isJoined = (m_AUDCTL & CH34_JOINED);
521      if (isJoined)
522         m_channel[CHAN4].inc_chan();
523      else
524         m_channel[CHAN3].reset_channel();
525      process_channel(CHAN3);
526      /* is this a filtering channel (3/4) and is the filter active? */
527      if (m_AUDCTL & CH1_FILTER)
528         m_channel[CHAN1].sample();
529      else
530         m_channel[CHAN1].m_filter_sample = 1;
531   }
482532
483      if (m_channel[CHAN3].check_borrow())
484      {
485         int isJoined = (m_AUDCTL & CH34_JOINED);
486         if (isJoined)
487            m_channel[CHAN4].inc_chan();
488         else
489            m_channel[CHAN3].reset_channel();
490         process_channel(CHAN3);
491         /* is this a filtering channel (3/4) and is the filter active? */
492         if (m_AUDCTL & CH1_FILTER)
493            m_channel[CHAN1].sample();
494         else
495            m_channel[CHAN1].m_filter_sample = 1;
496      }
533   for (ch = 0; ch < 4; ch++)
534   {
535      sum += (((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? m_channel[ch].m_volume : 0 );
536   }
537   return sum;
538}
497539
498      for (ch = 0; ch < 4; ch++)
499      {
500         sum += (((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? m_channel[ch].m_volume : 0 );
501      }
540//-------------------------------------------------
541//  stream_generate - handle update requests for
542//  our sound stream
543//-------------------------------------------------
502544
503       /* store sum of output signals into the buffer */
504545
505       *buffer++ = (sum > 0x7fff) ? 0x7fff : sum;
506       samples--;
546void pokeyn_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
547{
548   stream_sample_t *buffer = outputs[0];
507549
508   }
509   m_rtimer->adjust(attotime::never);
550   while( samples > 0 )
551   {
552#ifndef POKEY_EXEC_INTERFACE
553      m_output = step_one_clock();
554#endif
555          /* store sum of output signals into the buffer */
510556
557          *buffer++ = (m_output > 0x7fff) ? 0x7fff : m_output;
558          samples--;
559
560   }
511561}
512562
513
514
515563//-------------------------------------------------
516564//  read - memory interface for reading the active status
517565//-------------------------------------------------
r15303r15304
524572UINT8 pokeyn_device::read(offs_t offset)
525573{
526574   int data = 0, pot;
527   UINT32 adjust = 0;
528575
576   synchronize(11); /* force resync */
529577   switch (offset & 15)
530578   {
531579   case POT0_C: case POT1_C: case POT2_C: case POT3_C:
r15303r15304
551599      }
552600      else
553601         logerror("%s: warning - read '%s' POT%d\n", machine().describe_context(), tag(), pot);
602      //data = 0; //if (pot == 7) data = 1;
554603      break;
555604
556605    case ALLPOT_C:
r15303r15304
566615      else if( !m_allpot_r.isnull() )
567616      {
568617         data = m_allpot_r(offset);
569         LOG(("POKEY '%s' ALLPOT callback $%02x\n", tag(), data));
618         LOG(("%s: POKEY '%s' ALLPOT callback $%02x\n", machine().describe_context(), tag(), data));
570619      }
571620      else
572621      {
573622         data = m_ALLPOT;
574623         LOG(("POKEY '%s' ALLPOT internal $%02x\n", tag(), data));
575624      }
625      //data = 127;
576626      break;
577627
578628   case KBCODE_C:
r15303r15304
580630      break;
581631
582632   case RANDOM_C:
583      /****************************************************************
584         * If the 2 least significant bits of SKCTL are 0, the random
585         * number generator is disabled (SKRESET). Thanks to Eric Smith
586         * for pointing out this critical bit of info! If the random
587         * number generator is enabled, get a new random number. Take
588         * the time gone since the last read into account and read the
589         * new value from an appropriate offset in the rand17 table.
590         ****************************************************************/
591      if( m_SKCTL & SK_RESET )
592      {
593         adjust = m_rtimer->elapsed().as_double() / m_clock_period.as_double();
594         m_r9 = (m_r9 + adjust) % 0x001ff;
595         m_r17 = (m_r17 + adjust) % 0x1ffff;
596      }
597      else
598      {
599         adjust = 1;
600         m_r9 = 0;
601         m_r17 = 0;
602            LOG_RAND(("POKEY '%s' rand17 frozen (SKCTL): $%02x\n", tag(), m_RANDOM));
603      }
604633      if( m_AUDCTL & POLY9 )
605634      {
606         m_RANDOM = m_poly9[m_r9] & 0xff;
607         LOG_RAND(("POKEY '%s' adjust %u rand9[$%05x]: $%02x\n", tag(), adjust, m_r9, m_RANDOM));
635         data = m_poly9[m_p9] & 0xff;
636         synchronize(11); /* force resync */
637         LOG_RAND(("POKEY '%s' rand9[$%05x]: $%02x\n", tag(), m_p9, data));
608638      }
609639      else
610640      {
611         m_RANDOM = (m_poly17[m_r17] >> 8) & 0xff;
612         LOG_RAND(("POKEY '%s' adjust %u rand17[$%05x]: $%02x\n", tag(), adjust, m_r17, m_RANDOM));
641         data = (m_poly17[m_p17] >> 8) & 0xff;
642         synchronize(11); /* force resync */
643         LOG_RAND(("POKEY '%s' rand17[$%05x]: $%02x\n", tag(), m_p17, data));
613644      }
614      if (adjust > 0)
615         m_rtimer->adjust(attotime::never);
616      data = m_RANDOM ^ 0xff;
617645      break;
618646
619647   case SERIN_C:
r15303r15304
638666
639667   default:
640668      LOG(("POKEY '%s' register $%02x\n", tag(), offset));
669      data = 0x00;
641670        break;
642671    }
643672    return data;
r15303r15304
649678//  write - memory interface for write
650679//-------------------------------------------------
651680
681void pokeyn_device::write(offs_t offset, UINT8 data)
682{
683#ifdef POKEY_EXEC_INTERFACE
684   synchronize(10, (offset<<8) | data);
685#else
686   m_stream->update();
687   write_internal(offset, data);
688#endif
689
690}
691
652692WRITE8_MEMBER( pokeyn_device::write )
653693{
654694   write(offset, data);
655695}
656696
657void pokeyn_device::write(offs_t offset, UINT8 data)
697void pokeyn_device::write_internal(offs_t offset, UINT8 data)
658698{
659   int ch_mask = 0, new_val;
660
661   m_stream->update();
662
663699    /* determine which address was changed */
664700   switch (offset & 15)
665701    {
666702    case AUDF1_C:
667      if( data == m_channel[CHAN1].m_AUDF )
668            return;
669703      LOG_SOUND(("POKEY '%s' AUDF1  $%02x\n", tag(), data));
670704      m_channel[CHAN1].m_AUDF = data;
671        ch_mask = 1 << CHAN1;
672      if( m_AUDCTL & CH12_JOINED )      /* if ch 1&2 tied together */
673            ch_mask |= 1 << CHAN2;    /* then also change on ch2 */
674705        break;
675706
676707    case AUDC1_C:
677      if( data == m_channel[CHAN1].m_AUDC )
678            return;
679708      LOG_SOUND(("POKEY '%s' AUDC1  $%02x (%s)\n", tag(), data, audc2str(data)));
680709      m_channel[CHAN1].m_AUDC = data;
681        ch_mask = 1 << CHAN1;
710      m_channel[CHAN1].m_volume = (data & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
682711        break;
683712
684713    case AUDF2_C:
685      if( data == m_channel[CHAN2].m_AUDF )
686            return;
687714      LOG_SOUND(("POKEY '%s' AUDF2  $%02x\n", tag(), data));
688715      m_channel[CHAN2].m_AUDF = data;
689        ch_mask = 1 << CHAN2;
690716        break;
691717
692718    case AUDC2_C:
693      if( data == m_channel[CHAN2].m_AUDC )
694            return;
695719      LOG_SOUND(("POKEY '%s' AUDC2  $%02x (%s)\n", tag(), data, audc2str(data)));
696720      m_channel[CHAN2].m_AUDC = data;
697        ch_mask = 1 << CHAN2;
721      m_channel[CHAN2].m_volume = (data & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
698722        break;
699723
700724    case AUDF3_C:
701      if( data == m_channel[CHAN3].m_AUDF )
702            return;
703725      LOG_SOUND(("POKEY '%s' AUDF3  $%02x\n", tag(), data));
704726      m_channel[CHAN3].m_AUDF = data;
705        ch_mask = 1 << CHAN3;
706
707      if( m_AUDCTL & CH34_JOINED )   /* if ch 3&4 tied together */
708            ch_mask |= 1 << CHAN4;  /* then also change on ch4 */
709727        break;
710728
711729    case AUDC3_C:
712      if( data == m_channel[CHAN3].m_AUDC )
713            return;
714730      LOG_SOUND(("POKEY '%s' AUDC3  $%02x (%s)\n", tag(), data, audc2str(data)));
715731      m_channel[CHAN3].m_AUDC = data;
716        ch_mask = 1 << CHAN3;
732      m_channel[CHAN3].m_volume = (data & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
717733        break;
718734
719735    case AUDF4_C:
720      if( data == m_channel[CHAN4].m_AUDF )
721            return;
722736      LOG_SOUND(("POKEY '%s' AUDF4  $%02x\n", tag(), data));
723737      m_channel[CHAN4].m_AUDF = data;
724        ch_mask = 1 << CHAN4;
725738        break;
726739
727740    case AUDC4_C:
728      if( data == m_channel[CHAN4].m_AUDC )
729            return;
730741      LOG_SOUND(("POKEY '%s' AUDC4  $%02x (%s)\n", tag(), data, audc2str(data)));
731742      m_channel[CHAN4].m_AUDC = data;
732        ch_mask = 1 << CHAN4;
743      m_channel[CHAN4].m_volume = (data & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
733744        break;
734745
735746    case AUDCTL_C:
r15303r15304
737748            return;
738749      LOG_SOUND(("POKEY '%s' AUDCTL $%02x (%s)\n", tag(), data, audctl2str(data)));
739750      m_AUDCTL = data;
740        ch_mask = 15;       /* all channels */
741751        /* determine the base multiplier for the 'div by n' calculations */
742752      m_clockmult = (m_AUDCTL & CLK_15KHZ) ? DIV_15 : DIV_64;
743753        break;
744754
745755    case STIMER_C:
746        /* first remove any existing timers */
747756      LOG_TIMER(("POKEY '%s' STIMER $%02x\n", tag(), data));
748757
749      m_timer[TIMER1]->adjust(attotime::never, m_timer_param[TIMER1]);
750      m_timer[TIMER2]->adjust(attotime::never, m_timer_param[TIMER2]);
751      m_timer[TIMER4]->adjust(attotime::never, m_timer_param[TIMER4]);
752
753      /* From the pokey documentation */
754        /* reset all counters to zero (side effect) */
758      /* From the pokey documentation:
759         * reset all counters to zero (side effect)
760         * Actually this takes 4 cycles to actually happen.
761         * FIXME: Use timer for delayed reset !
762         */
755763      for (int i = 0; i < POKEY_CHANNELS; i++)
756764      {
757765         m_channel[i].reset_channel();
r15303r15304
759767         m_channel[i].m_filter_sample = (i<2 ? 1 : 0);
760768      }
761769
762      /* joined chan#1 and chan#2 ? */
763      if( m_AUDCTL & CH12_JOINED )
764        {
765         if( m_divisor[CHAN2] > 4 )
766         {
767            LOG_TIMER(("POKEY '%s' timer1+2 after %d clocks\n", tag(), m_divisor[CHAN2]));
768            /* set timer #1 _and_ #2 event after timer_div clocks of joined CHAN1+CHAN2 */
769            m_timer_period[TIMER2] = m_clock_period * m_divisor[CHAN2];
770            m_timer_param[TIMER2] = IRQ_TIMR2|IRQ_TIMR1;
771            m_timer[TIMER2]->adjust(m_timer_period[TIMER2], m_timer_param[TIMER2], m_timer_period[TIMER2]);
772         }
773        }
774        else
775        {
776         if( m_divisor[CHAN1] > 4 )
777         {
778            LOG_TIMER(("POKEY '%s' timer1 after %d clocks\n", tag(), m_divisor[CHAN1]));
779            /* set timer #1 event after timer_div clocks of CHAN1 */
780            m_timer_period[TIMER1] = m_clock_period * m_divisor[CHAN1];
781            m_timer_param[TIMER1] = IRQ_TIMR1;
782            m_timer[TIMER1]->adjust(m_timer_period[TIMER1], m_timer_param[TIMER1], m_timer_period[TIMER1]);
783         }
784
785         if( m_divisor[CHAN2] > 4 )
786         {
787            LOG_TIMER(("POKEY '%s' timer2 after %d clocks\n", tag(), m_divisor[CHAN2]));
788            /* set timer #2 event after timer_div clocks of CHAN2 */
789            m_timer_period[TIMER2] = m_clock_period * m_divisor[CHAN2];
790            m_timer_param[TIMER2] = IRQ_TIMR2;
791            m_timer[TIMER2]->adjust(m_timer_period[TIMER2], m_timer_param[TIMER2], m_timer_period[TIMER2]);
792         }
793        }
794
795      /* Note: p[chip] does not have a timer #3 */
796
797      if( m_AUDCTL & CH34_JOINED )
798        {
799            /* not sure about this: if audc4 == 0000xxxx don't start timer 4 ? */
800         if( m_channel[CHAN4].m_AUDC & 0xf0 )
801            {
802            if( m_divisor[CHAN4] > 4 )
803            {
804               LOG_TIMER(("POKEY '%s' timer4 after %d clocks\n", tag(), m_divisor[CHAN4]));
805               /* set timer #4 event after timer_div clocks of CHAN4 */
806               m_timer_period[TIMER4] = m_clock_period * m_divisor[CHAN4];
807               m_timer_param[TIMER4] = IRQ_TIMR4;
808               m_timer[TIMER4]->adjust(m_timer_period[TIMER4], m_timer_param[TIMER4], m_timer_period[TIMER4]);
809            }
810            }
811        }
812        else
813        {
814         if( m_divisor[CHAN4] > 4 )
815         {
816            LOG_TIMER(("POKEY '%s' timer4 after %d clocks\n", tag(), m_divisor[CHAN4]));
817            /* set timer #4 event after timer_div clocks of CHAN4 */
818            m_timer_period[TIMER4] = m_clock_period * m_divisor[CHAN4];
819            m_timer_param[TIMER4] = IRQ_TIMR4;
820            m_timer[TIMER4]->adjust(m_timer_period[TIMER4], m_timer_param[TIMER4], m_timer_period[TIMER4]);
821         }
822        }
823
824      m_timer[TIMER1]->enable(m_IRQEN & IRQ_TIMR1);
825      m_timer[TIMER2]->enable(m_IRQEN & IRQ_TIMR2);
826      m_timer[TIMER4]->enable(m_IRQEN & IRQ_TIMR4);
827770        break;
828771
829772    case SKREST_C:
r15303r15304
860803            /* reset IRQST bits that are masked now */
861804         m_IRQST &= data;
862805        }
863        else
864        {
865         /* enable/disable timers now to avoid unneeded
866               breaking of the CPU cores for masked timers */
867         if( m_timer[TIMER1] && ((m_IRQEN^data) & IRQ_TIMR1) )
868            m_timer[TIMER1]->enable(data & IRQ_TIMR1);
869         if( m_timer[TIMER2] && ((m_IRQEN^data) & IRQ_TIMR2) )
870            m_timer[TIMER2]->enable(data & IRQ_TIMR2);
871         if( m_timer[TIMER4] && ((m_IRQEN^data) & IRQ_TIMR4) )
872            m_timer[TIMER4]->enable(data & IRQ_TIMR4);
873        }
874806      /* store irq enable */
875807      m_IRQEN = data;
876808        break;
r15303r15304
882814      m_SKCTL = data;
883815        if( !(data & SK_RESET) )
884816        {
885            write(IRQEN_C,  0);
886            write(SKREST_C, 0);
817            write_internal(IRQEN_C,  0);
818            write_internal(SKREST_C, 0);
819          /****************************************************************
820             * If the 2 least significant bits of SKCTL are 0, the random
821             * number generator is disabled (SKRESET). Thanks to Eric Smith
822             * for pointing out this critical bit of info!
823             * Couriersud: Actually, the 17bit poly is reset and kept in a
824             * reset state.
825             ****************************************************************/
826            m_p9 = 0;
827            m_p17 = 0;
828            m_p4 = 0;
829            m_p5 = 0;
830            m_clock_cnt[0] = 0;
831            m_clock_cnt[1] = 0;
832            m_clock_cnt[2] = 0;
833            /* FIXME: Serial port reset ! */
887834        }
888835        break;
889836    }
r15303r15304
896843     *    1.79 MHz, 16-bit - AUDF[CHAN1]+256*AUDF[CHAN2] + 7
897844     ************************************************************/
898845
899    /* only reset the channels that have changed */
900
901    if( ch_mask & (1 << CHAN1) )
902    {
903        /* process channel 1 frequency */
904      if( m_AUDCTL & CH1_HICLK )
905         new_val = m_channel[CHAN1].m_AUDF + DIVADD_HICLK;
906        else
907         new_val = (m_channel[CHAN1].m_AUDF + DIVADD_LOCLK) * m_clockmult;
908
909      LOG_SOUND(("POKEY '%s' chan1 %d\n", tag(), new_val));
910
911      m_channel[CHAN1].m_volume = (m_channel[CHAN1].m_AUDC & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
912        m_divisor[CHAN1] = new_val;
913      if( m_interrupt_cb && m_timer[TIMER1] )
914         m_timer[TIMER1]->adjust(m_clock_period * new_val, m_timer_param[TIMER1], m_timer_period[TIMER1]);
915    }
916
917    if( ch_mask & (1 << CHAN2) )
918    {
919        /* process channel 2 frequency */
920      if( m_AUDCTL & CH12_JOINED )
921        {
922         if( m_AUDCTL & CH1_HICLK )
923            new_val = m_channel[CHAN2].m_AUDF * 256 + m_channel[CHAN1].m_AUDF + DIVADD_HICLK_JOINED;
924            else
925            new_val = (m_channel[CHAN2].m_AUDF * 256 + m_channel[CHAN1].m_AUDF + DIVADD_LOCLK) * m_clockmult;
926         LOG_SOUND(("POKEY '%s' chan1+2 %d\n", tag(), new_val));
927        }
928        else
929      {
930         new_val = (m_channel[CHAN2].m_AUDF + DIVADD_LOCLK) * m_clockmult;
931         LOG_SOUND(("POKEY '%s' chan2 %d\n", tag(), new_val));
932      }
933
934      m_channel[CHAN2].m_volume = (m_channel[CHAN2].m_AUDC & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
935      m_divisor[CHAN2] = new_val;
936      if( m_interrupt_cb && m_timer[TIMER2] )
937         m_timer[TIMER2]->adjust(m_clock_period * new_val, m_timer_param[TIMER2], m_timer_period[TIMER2]);
938    }
939
940    if( ch_mask & (1 << CHAN3) )
941    {
942        /* process channel 3 frequency */
943      if( m_AUDCTL & CH3_HICLK )
944         new_val = m_channel[CHAN3].m_AUDF + DIVADD_HICLK;
945        else
946         new_val = (m_channel[CHAN3].m_AUDF + DIVADD_LOCLK) * m_clockmult;
947
948      LOG_SOUND(("POKEY '%s' chan3 %d\n", tag(), new_val));
949
950      m_channel[CHAN3].m_volume = (m_channel[CHAN3].m_AUDC & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
951      m_divisor[CHAN3] = new_val;
952      /* channel 3 does not have a timer associated */
953    }
954
955    if( ch_mask & (1 << CHAN4) )
956    {
957        /* process channel 4 frequency */
958      if( m_AUDCTL & CH34_JOINED )
959        {
960         if( m_AUDCTL & CH3_HICLK )
961            new_val = m_channel[CHAN4].m_AUDF * 256 + m_channel[CHAN3].m_AUDF + DIVADD_HICLK_JOINED;
962            else
963            new_val = (m_channel[CHAN4].m_AUDF * 256 + m_channel[CHAN3].m_AUDF + DIVADD_LOCLK) * m_clockmult;
964         LOG_SOUND(("POKEY '%s' chan3+4 %d\n", tag(), new_val));
965        }
966        else
967      {
968         new_val = (m_channel[CHAN4].m_AUDF + DIVADD_LOCLK) * m_clockmult;
969         LOG_SOUND(("POKEY '%s' chan4 %d\n", tag(), new_val));
970      }
971
972      m_channel[CHAN4].m_volume = (m_channel[CHAN4].m_AUDC & VOLUME_MASK) * POKEY_DEFAULT_GAIN;
973      m_divisor[CHAN4] = new_val;
974      if( m_interrupt_cb && m_timer[TIMER4] )
975         m_timer[TIMER4]->adjust(m_clock_period * new_val, m_timer_param[TIMER4], m_timer_period[TIMER4]);
976    }
977846}
978847
979848void pokeyn_device::serin_ready(int after)
r15303r15304
1103972       lfsr = lfsr >> 1;
1104973       lfsr = (in << (size-1)) | lfsr;
1105974      *poly = lfsr ^ invert;
1106        LOG_POLY(("%05x: %02x\n", lfsr, *poly));
1107        poly++;
975        LOG_POLY(("%05x: %02x\n", i, *poly));
1108976   }
1109977}
1110978
r15303r15304
1112980{
1113981    int mask = (1 << size) - 1;
1114982    int i;
1115    UINT32 lfsr = 0;
983    UINT32 lfsr =mask;
1116984
1117985   LOG_RAND(("rand %d\n", size));
1118986
r15303r15304
1121989       for( i = 0; i < mask; i++ )
1122990      {
1123991           /* calculate next bit @ 7 */
1124          int in8 = !((lfsr >> 8) & 1) ^ ((lfsr >> 13) & 1);
992          int in8 = ((lfsr >> 8) & 1) ^ ((lfsr >> 13) & 1);
1125993          int in = (lfsr & 1);
1126994          lfsr = lfsr >> 1;
1127995          lfsr = (lfsr & 0xff7f) | (in8 << 7);
1128996          lfsr = (in << 16) | lfsr;
1129997         *poly = lfsr;
1130           LOG_RAND(("%05x: %02x\n", lfsr, *poly));
998           LOG_RAND(("%05x: %02x\n", i, *poly));
1131999           poly++;
11321000      }
11331001   }
r15303r15304
11361004       for( i = 0; i < mask; i++ )
11371005      {
11381006           /* calculate next bit */
1139          int in = !((lfsr >> 0) & 1) ^ ((lfsr >> 5) & 1);
1007          int in = ((lfsr >> 0) & 1) ^ ((lfsr >> 5) & 1);
11401008          lfsr = lfsr >> 1;
11411009          lfsr = (in << 8) | lfsr;
11421010         *poly = lfsr;
1143           LOG_RAND(("%05x: %02x\n", lfsr, *poly));
1011           LOG_RAND(("%05x: %02x\n", i, *poly));
11441012           poly++;
11451013      }
11461014   }
r15303r15304
11991067
12001068pokeyn_device::pokey_channel::pokey_channel()
12011069   :   m_AUDF(0),
1202      m_AUDC(0),
1070       m_AUDC(0),
12031071      m_borrow_cnt(0),
1204      m_counter(0),
1205      m_volume(0),
1206      m_output(0),
1207      m_filter_sample(0)
1072       m_counter(0),
1073       m_volume(0),
1074       m_output(0),
1075       m_filter_sample(0)
12081076{
12091077}
12101078
src/emu/sound/pokey.h
r15303r15304
2121
2222#include "devlegcy.h"
2323
24/* uncomment the line below for MESS to avoid breaking compile
25 * please migrate as soon as possible to new device so that we can get rid of the legacy */
24#define POKEY_EXEC_INTERFACE
2625
27//#define OLDDEVICE_FOR_MESS 1
28
29//#define POKEY_EXEC_INTERFACE
30
3126/* CONSTANT DEFINITIONS */
3227
33
3428/* exact 1.79 MHz clock freq (of the Atari 800 that is) */
3529#define FREQ_17_EXACT   1789790
3630
r15303r15304
6559class pokeyn_device : public device_t,
6660                 public device_sound_interface
6761#ifdef POKEY_EXEC_INTERFACE
68                 public ,device_execute_interface
62                 ,public device_execute_interface
6963#endif
7064{
7165public:
r15303r15304
134128   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
135129
136130#ifdef POKEY_EXEC_INTERFACE
137   virtual void execute_run() { m_icount = 0; } //printf("execute: %d\n", m_icount); m_icount = 0; }
131   virtual void execute_run();
138132#endif
139133
140134   // configuration state
r15303r15304
150144    {
151145    public:
152146       pokey_channel();
147       pokeyn_device *m_parent;
148       UINT8 m_INTMask;
153149       UINT8 m_AUDF;           /* AUDFx (D200, D202, D204, D206) */
154150       UINT8 m_AUDC;         /* AUDCx (D201, D203, D205, D207) */
155151       INT32 m_borrow_cnt;      /* borrow counter */
r15303r15304
160156
161157       inline void sample(void)         { m_filter_sample = m_output; }
162158       inline void reset_channel(void)      { m_counter = m_AUDF ^ 0xff; }
163       inline void inc_chan(void)
159
160       inline void inc_chan()
164161       {
165162          m_counter = (m_counter + 1) & 0xff;
166163          if (m_counter == 0 && m_borrow_cnt == 0)
164          {
167165             m_borrow_cnt = 3;
166             if (m_parent->m_IRQEN & m_INTMask)
167             {
168                m_parent->m_IRQST |= m_INTMask;
169             }
170          }
168171       }
172
169173       inline int check_borrow()
170174       {
171175          if (m_borrow_cnt > 0)
r15303r15304
179183
180184   static const int POKEY_CHANNELS = 4;
181185
186   UINT32 step_one_clock();
187
182188   void poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert);
183189   void poly_init_9_17(UINT32 *poly, int size);
184190   inline void process_channel(int ch);
r15303r15304
186192   char *audc2str(int val);
187193   char *audctl2str(int val);
188194
195   void write_internal(offs_t offset, UINT8 data);
196
189197   // internal state
190198   sound_stream* m_stream;
191199
192200   pokey_channel m_channel[POKEY_CHANNELS];
193201
194   INT32 m_divisor[4];      /* channel divisor (modulo value) */
202   UINT32 m_output;
203
195204   INT32 m_clock_cnt[3];      /* clock counters */
196205   UINT32 m_p4;              /* poly4 index */
197206   UINT32 m_p5;              /* poly5 index */
198207   UINT32 m_p9;              /* poly9 index */
199208   UINT32 m_p17;             /* poly17 index */
200   UINT32 m_r9;            /* rand9 index */
201   UINT32 m_r17;             /* rand17 index */
202209   UINT32 m_clockmult;      /* clock multiplier */
203   emu_timer *m_timer[3];   /* timers for channel 1,2 and 4 events */
204   attotime m_timer_period[3];   /* computed periods for these timers */
205   int m_timer_param[3];      /* computed parameters for these timers */
206   emu_timer *m_rtimer;     /* timer for calculating the random offset */
210
207211   emu_timer *m_ptimer[8];   /* pot timers */
212
213#ifdef POKEY_EXEC_INTERFACE
214   emu_timer *m_write_timer;   /* timer for sync operation */
215#endif
216
208217   devcb_resolved_read8 m_pot_r[8];
209218   devcb_resolved_read8 m_allpot_r;
210219   devcb_resolved_read8 m_serin_r;
211220   devcb_resolved_write8 m_serout_w;
212221   void (*m_interrupt_cb)(pokeyn_device *device, int mask);
213   UINT8 m_POTx[8];         /* POTx   (R/D200-D207) */
222
223   UINT8 m_POTx[8];      /* POTx   (R/D200-D207) */
214224   UINT8 m_AUDCTL;         /* AUDCTL (W/D208) */
215225   UINT8 m_ALLPOT;         /* ALLPOT (R/D208) */
216226   UINT8 m_KBCODE;         /* KBCODE (R/D209) */
217   UINT8 m_RANDOM;         /* RANDOM (R/D20A) */
218227   UINT8 m_SERIN;         /* SERIN  (R/D20D) */
219228   UINT8 m_SEROUT;         /* SEROUT (W/D20D) */
220229   UINT8 m_IRQST;         /* IRQST  (R/D20E) */
221230   UINT8 m_IRQEN;         /* IRQEN  (W/D20E) */
222231   UINT8 m_SKSTAT;         /* SKSTAT (R/D20F) */
223232   UINT8 m_SKCTL;         /* SKCTL  (W/D20F) */
233
224234   attotime m_clock_period;
225235   attotime m_ad_time_fast;
226236   attotime m_ad_time_slow;
src/emu/machine/8042kbdc.c
r15303r15304
607607}
608608
609609
610
611READ32_HANDLER( kbdc8042_32le_r )
612{
613   return read32le_with_read8_handler(kbdc8042_8_r, space, offset, mem_mask);
614}
615
616
617
618WRITE32_HANDLER( kbdc8042_32le_w )
619{
620   write32le_with_write8_handler(kbdc8042_8_w, space, offset, data, mem_mask);
621}
622
623
624
625610READ64_HANDLER( kbdc8042_64be_r )
626611{
627612   return read64be_with_read8_handler(kbdc8042_8_r, space, offset, mem_mask);
src/emu/machine/8042kbdc.h
r15303r15304
3636
3737READ8_HANDLER(kbdc8042_8_r);
3838WRITE8_HANDLER(kbdc8042_8_w);
39READ32_HANDLER(kbdc8042_32le_r);
40WRITE32_HANDLER(kbdc8042_32le_w);
4139READ64_HANDLER(kbdc8042_64be_r);
4240WRITE64_HANDLER(kbdc8042_64be_w);
4341

Previous 15994 Revisions Next


© 1998-2018 The MESS Team